[LEDE-DEV] MT7620: wan eth port doesn't work

2017-08-03 Thread Giuseppe Lippolis
Hi,
Here an update.

I collected the switch configuration from the oem and lede systems (base
registers:  0x1011).

Here are the differences.

In case you find something suspect please ask me to double check the
registers because I get the data using some manual processing (error prone).

oem_switch_cfg_dump.txt
lede_switch_cfg_dump.txt

090: 0f 00 00 00 01 00 00 40 00 00 00 00 00 00 00 00090: 0f
10 00 00 00 00 00 00 00 00 00 00 00 00 00 00

100: 02 10 00 00 03 40 00 00 05 60 00 00 07 80 00 00100: 00
10 00 00 02 30 00 00 04 50 00 00 06 70 00 00
110: 09 a0 00 00 0b c0 00 00 0d e0 00 00 0f 00 01 00110: 08
90 00 00 0a b0 00 00 0c d0 00 00 0e f0 00 00

490: 0f 00 00 00 01 00 00 40 00 00 00 00 00 00 00 00490: 0f
10 00 00 00 00 00 00 00 00 00 00 00 00 00 00

500: 02 10 00 00 03 40 00 00 05 60 00 00 07 80 00 00500: 00
10 00 00 02 30 00 00 04 50 00 00 06 70 00 00
510: 09 a0 00 00 0b c0 00 00 0d e0 00 00 0f 00 01 00510: 08
90 00 00 0a b0 00 00 0c d0 00 00 0e f0 00 00

890: 0f 00 00 00 01 00 00 40 00 00 00 00 00 00 00 00890: 0f
10 00 00 00 00 00 00 00 00 00 00 00 00 00 00

900: 02 10 00 00 03 40 00 00 05 60 00 00 07 80 00 00900: 00
10 00 00 02 30 00 00 04 50 00 00 06 70 00 00
910: 09 a0 00 00 0b c0 00 00 0d e0 00 00 0f 00 01 00910: 08
90 00 00 0a b0 00 00 0c d0 00 00 0e f0 00 00

c90: 0f 00 00 00 01 00 00 40 00 00 00 00 00 00 00 00c90: 0f
10 00 00 00 00 00 00 00 00 00 00 00 00 00 00

d00: 02 10 00 00 03 40 00 00 05 60 00 00 07 80 00 00d00: 00
10 00 00 02 30 00 00 04 50 00 00 06 70 00 00
d10: 09 a0 00 00 0b c0 00 00 0d e0 00 00 0f 00 01 00d10: 08
90 00 00 0a b0 00 00 0c d0 00 00 0e f0 00 00

0001680: 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 000001680: 00
00 00 00 04 00 00 00 00 00 00 00 00 00 00 00

0001fc0: e8 01 c9 01 00 00 00 00 00 00 00 00 00 00 00 000001fc0: e7
01 dc 01 00 00 00 00 00 00 00 00 00 00 00 00

0002510: c0 00 00 81 01 00 01 00 01 00 01 00 00 00 00 000002510: 00
00 00 81 00 00 01 00 01 00 01 00 00 00 00 00

0002600: ff ff 00 00 03 00 ff 20 00 80 00 00 00 ff 0f 000002600: ff
ff 00 00 03 00 ff 00 00 80 00 00 00 ff 0f 00
0002610: 00 00 00 81 01 00 01 00 01 00 01 00 00 00 00 000002610: 00
00 00 81 00 00 01 00 01 00 01 00 00 00 00 00

0002700: ff ff 00 00 03 00 ff 20 00 80 00 00 00 ff 0f 000002700: ff
ff 00 00 03 00 ff 00 00 80 00 00 00 ff 0f 00
0002710: 00 00 00 81 01 00 01 00 01 00 01 00 00 00 00 000002710: 00
00 00 81 00 00 01 00 01 00 01 00 00 00 00 00

0003300: 30 63 05 00 e0 01 1e 11 37 00 00 00 00 00 00 000003300: 30
63 05 00 e0 01 1e 11 00 00 00 00 00 00 00 00
0003310: 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 000003310: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0003400: 30 63 05 00 e0 01 1e 11 77 00 00 00 00 00 00 000003400: 30
63 05 00 e0 01 1e 11 06 00 00 00 00 00 00 00
0003410: 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 000003410: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0003500: 00 80 00 00 e0 01 1e 11 00 00 00 00 00 00 00 000003500: 30
63 05 00 e0 01 1e 11 00 00 00 00 00 00 00 00

0003610: 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 000003610: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0003fe0: 25 3f 00 00 64 80 28 43 0c 00 00 00 00 00 00 000003fe0: 25
3f 00 00 51 d5 26 13 6f e4 00 00 00 00 00 00

0004000: 00 00 00 00 03 00 00 00 ff ff ff ff 00 00 00 000004000: 00
00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00

0004300: 1c 00 06 00 06 00 00 00 ff ff ff ff 00 00 00 000004300: 00
00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00
0004310: d9 08 00 00 00 00 00 00 4a 65 14 00 00 00 00 000004310: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0004320: b4 07 00 00 00 00 00 00 54 cc 05 00 00 00 00 000004320: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0004330: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000004330: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0004400: 1c 00 06 00 05 00 00 00 ff ff ff ff 00 00 00 000004400: 00
00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00
0004410: f2 01 00 00 00 00 00 00 43 2d 01 00 00 00 00 000004410: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0004420: d1 04 00 00 00 00 00 00 4d fa 10 00 00 00 00 000004420: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0004500: 00 00 00 00 02 00 00 00 ff ff ff ff 00 00 00 000004500: 00
00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00

0004610: 84 0c 00 00 00 00 00 00 51 f6 16 00 00 00 00 000004610: 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0004620: d5 0a 00 00 00 00 00 00 4b b0 15 00 00 00 00 000004620: e2
03 00 00 00 00 00 00 64 1f 05 00 00 00 00 00
0004630: 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000004630: e2
03 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0004700: 00 00 00 00 02 00 01 

[LEDE-DEV] MT7620: wan eth port doesn't work

2017-08-02 Thread Giuseppe Lippolis
Hi all,
I'm working to port owrt/lede on the dwr-921 (mt7620n based).

Currently I'm able to complete the boot but the wan port (port 4) doesn't
work.
All the other lan port (port 0-3) are working properly.

Yesterday with blogic we though the problem was related to the assignment of
the port-4 to the embedded switch using the 
mediatek,port4 = "ephy";
property in the dts, but also this doesn't work.
I check in the datasheet and I see that this feature is valid only in the
mt7620a.
According to the DS the mt7620n have only one switch configuration with 5 FE
port:

MT7620N MT7620A
Switch 5p FE SW 5p FE SW + RGMII(1) 
4p FE SW + RGMII(2)

When I try, using the oem system, to switch from the 3g wan to the eth wan I
get the following messages on the console:

ramtd_write: to:ff len:10

ramtd_write: to:ff0010 len:f56

ramtd_write: to:ff len:1

ramtd_erase: addr:ff len:0

ramtd_write: to:ff len:10

ramtd_write: to:ff0010 len:f58

ramtd_write: to:ff len:1

device eth2.1 left promiscuous mode

br0: port 1(eth2.1) entering forwarding state

device eth2 left promiscuous mode

device eth2 entered promiscuous mode

device eth2.1 entered promiscuous mode

br0: port 1(eth2.1) entering forwarding state

br0: port 1(eth2.1) entering forwarding state

phy 0, reg 0, val 0x800

phy 1, reg 0, val 0x800

phy 2, reg 0, val 0x800

phy 3, reg 0, val 0x800

ESW: Link Status Changed - Port3 Link Down

phy 4, reg 0, val 0x800

ESW: Link Status Changed - Port4 Link Down

phy 5, reg 0, val 0x800

Ralink HW NAT Module Enabled

ramtd_erase: addr:ff len:0

phy 0, reg 0, val 0x3300

ramtd_write: to:ff len:10

ramtd_write: to:ff0010 len:f58

ramtd_write: to:ff len:1

addrconf_dad_completed 7

phy 1, reg 0, val 0x3300

addrconf_dad_completed 7

phy 2, reg 0, val 0x3300

phy 3, reg 0, val 0x3300

phy 4, reg 0, val 0x3300

phy 5, reg 0, val 0x3300

ESW: Link Status Changed - Port3 Link UP

ESW: Link Status Changed - Port4 Link UP

Ralink HW NAT Module Disabled

And the wan port work as expected.
Therefore, in some way, some sort of configuration is required.

Any ideas?

Following some additional detail:

Device page: https://wiki.openwrt.org/inbox/d-link/d-link_dwr-921_c1

Preliminary Dts:
/dts-v1/;

#include "mt7620n.dtsi"

#include 
#include 

/ {
compatible = "d-link,dwr-921", "ralink,mt7620n-soc";
model = "D-Link DWR-921 C1";

};

 {
status = "okay";
};

 {
status = "okay";
};

 {
status = "okay";
};

 {
status = "okay";

m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <1000>;

bootloader: partition@0 {
label = "bootloader";
reg = <0x0 0x1>;
read-only;
};

kernel: partition@1 {
label = "kernel";
reg = <0x1 0x17>;
};

rootfs: partition@18 {
label = "rootfs";
reg = <0x18 0xe6>;
};

config: partition@ff {
label = "config";
reg = <0xff 0x1>;
read-only;
};

};
};

 {
status = "okay";
};

 {
status = "okay";
};

 {
mtd-mac-address = < 0xe2ac>;
mediatek,portmap = "w";
};

 {
ralink,mtd-eeprom = < 0xe08e>;
};

 {
state_default: pinctrl0 {
default {
ralink,group = "uartf", "i2c", "wdt", "jtag";
ralink,function = "gpio";
};
};
};


etc/board.d/02_network:

...
dir-615-h1|\
dwr-921-c1|\
firewrt|\
...
zbt-wr8305rt)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"


Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] boot error on dwr-921 (mt7620n)

2017-07-31 Thread Giuseppe Lippolis
> Look for the word 0x7620 at an even offset, that's the start of the
EEPROM.
> 
> > Here the complete bootlog:
> > ...
> 
> You are on the right spot, the log confirms that the eeprom partition or
offset
> is certainly wrong.

Daniel, thanks for your help.
Now I'm able to complete the boot.

But I need to find a proper way to generate the factory/sysupgrade image
without changing the bootloader. 
For this I will open a new post.

This is the (partial) bootlog:

Starting kernel @8000...

[0.00] Linux version 4.4.50 (lippo@nice) (gcc version 5.4.0 (LEDE
GCC 5.4.0 r4650+5-5d7e23f) ) #0 Mon Mar 13 19:23:08 2017
[0.00] Board has DDR1
[0.00] Analog PMU set to hw control
[0.00] Digital PMU set to hw control
[0.00] SoC Type: MediaTek MT7620N ver:2 eco:6
[0.00] bootconsole [early0] enabled
[0.00] CPU0 revision is: 00019650 (MIPS 24KEc)
[0.00] MIPS: machine is D-Link DWR-921

 [ ... ]

[   10.114956] NET: Registered protocol family 24
[   10.142926] rt2800_wmac 1018.wmac: loaded eeprom from mtd device
"config"
[   10.157203] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev
0500 detected
[   10.172650] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620
detected
[   10.268205] usbcore: registered new interface driver option
[   10.279484] usbserial: USB Serial support registered for GSM modem
(1-port)

 [ ... ]

[   22.430495] br-lan: port 1(eth0.1) entered forwarding state
[   24.422712] br-lan: port 1(eth0.1) entered forwarding state



BusyBox v1.26.2 () built-in shell (ash)

 _
//\  ____ ___  ___
   /  LE/  \| |  | __|   \| __|
  /DE  /\   | |__| _|| |) | _|
 //  LE  \  ||___|___/|___|
lede-project.org
 \\   DE /
  \LE  \/
---
   \  DE\  /Reboot (SNAPSHOT, r3584-19eba67)
\\/
---

=== WARNING! =
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--
root@LEDE:/#


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] boot error on dwr-921 (mt7620n)

2017-07-30 Thread Giuseppe Lippolis
Dear community,
I'm trying to port openwrt/lede on the dlink dwr921 (mt7620n arch).

Currently I get a kernel panic after the OS fail to find the wmac eeprom
location.
At the moment I use in the dts something clearly wrong:
 {
mtd-mac-address = < 0xe2ac>;
mediatek,portmap = "w";
};

 {
ralink,mtd-eeprom = < 0xe000>;
};

I'm quite sure the wmac eeprom is located in the "config" flash partition.
What shall I search to find the proper address of the required section?


Here the complete bootlog:

Starting kernel @8000...

[0.00] Linux version 4.4.50 (lippo@nice) (gcc version 5.4.0 (LEDE
GCC 5.4.0 r4650+5-5d7e23f) ) #0 Mon Mar 13 19:23:08 2017
[0.00] Board has DDR1
[0.00] Analog PMU set to hw control
[0.00] Digital PMU set to hw control
[0.00] SoC Type: MediaTek MT7620N ver:2 eco:6
[0.00] bootconsole [early0] enabled
[0.00] CPU0 revision is: 00019650 (MIPS 24KEc)
[0.00] MIPS: machine is D-Link DWR-921
[0.00] Determined physical RAM map:
[0.00]  memory: 0400 @  (usable)
[0.00] Initrd not found or empty - disabling initrd
[0.00] Zone ranges:
[0.00]   Normal   [mem 0x-0x03ff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x03ff]
[0.00] Initmem setup node 0 [mem
0x-0x03ff]
[0.00] Primary instruction cache 64kB, VIPT, 4-way, linesize 32
bytes.
[0.00] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32
bytes
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total
pages: 16256
[0.00] Kernel command line: console=ttyS0,57600
rootfstype=squashfs,jffs2
[0.00] PID hash table entries: 256 (order: -2, 1024 bytes)
[0.00] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[0.00] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[0.00] Writing ErrCtl register=0007fff0
[0.00] Readback ErrCtl register=0007fff0
[0.00] Memory: 60648K/65536K available (2967K kernel code, 145K
rwdata, 708K rodata, 204K init, 203K bss, 4888K reserved, 0K cma-reserved)
[0.00] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[0.00] NR_IRQS:256
[0.00] CPU Clock: 580MHz
[0.00] clocksource: systick: mask: 0x max_cycles: 0x,
max_idle_ns: 583261500 ns
[0.00] systick: enable autosleep mode
[0.00] systick: running - mult: 214748, shift: 32
[0.00] clocksource: MIPS: mask: 0x max_cycles: 0x,
max_idle_ns: 6590553264 ns
[0.09] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every
7405115902ns
[0.015448] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[0.080593] pid_max: default: 32768 minimum: 301
[0.089883] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[0.102930] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
bytes)
[0.121737] clocksource: jiffies: mask: 0x max_cycles:
0x, max_idle_ns: 1911260446275 ns
[0.141363] pinctrl core: initialized pinctrl subsystem
[0.152285] NET: Registered protocol family 16
[0.164117] rt2880-pinmux pinctrl: invalid group "wdt rst" for function
"gpio"
[0.178386] rt2880-pinmux pinctrl: invalid group "jtag" for function
"gpio"
[0.206269] rt2880_gpio 1600.gpio: registering 24 gpios
[0.217281] rt2880_gpio 1600.gpio: registering 24 irq handlers
[0.229671] rt2880_gpio 1660.gpio: registering 32 gpios
[0.240636] rt2880_gpio 1660.gpio: registering 32 irq handlers
[0.253065] rt2880_gpio 1688.gpio: registering 1 gpios
[0.263864] rt2880_gpio 1688.gpio: registering 1 irq handlers
[0.277380] clocksource: Switched to clocksource systick
[0.289139] NET: Registered protocol family 2
[0.298636] TCP established hash table entries: 1024 (order: 0, 4096
bytes)
[0.312408] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[0.324998] TCP: Hash tables configured (established 1024 bind 1024)
[0.337721] UDP hash table entries: 256 (order: 0, 4096 bytes)
[0.349254] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[0.361968] NET: Registered protocol family 1
[0.374516] rt-timer 1100.timer: maximum frequency is 1220Hz
[0.387244] futex hash table entries: 256 (order: -1, 3072 bytes)
[0.399382] Crashlog allocated RAM at address 0x3f0
[0.425250] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[0.436765] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME)
(CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[0.458846] io scheduler noop registered
[0.466495] io scheduler deadline registered (default)
[0.476978] ralink-usb-phy usbphy: invalid resource
[0.488106] gpio-export gpio-export: 10 gpio(s) exported
[

[LEDE-DEV] ddns problem

2017-06-06 Thread Giuseppe Lippolis
> 100.64.0.0/10 is shared address space under RFC6598. IETF seems to point
> to significant restrictions on its use. Customer connectivity issues are
> clear in the RFC. Chasing mobile load and avoiding rerouting global IP
> space is likely fair. Enumerating users fixed wire line end points is
> likely not fair. CGN should free IP from internal routing equipment for
> customer assignment. Depending on the consumer protections in your
> jurisdiction, you may wish to give your ISP a call.


Thanks for the clarification.
Currently I'm connecting through a 3G connection.
It seems that I do not have a valid ipv6 as well (Is it correct?).

usb0  Link encap:Ethernet  HWaddr 02:00:FF:AA:AA:AA
  inet addr:100.70.226.65  Bcast:100.70.226.67  Mask:255.255.255.252
  inet6 addr: fe80:::feaa:/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:764 errors:0 dropped:0 overruns:0 frame:0
  TX packets:677 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:522905 (510.6 KiB)  TX bytes:80102 (78.2 KiB)



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] ddns problem

2017-06-05 Thread Giuseppe Lippolis
Dear All,
I have a problem with the pkg ddns-scripts_2.7.6-14_all.
I'm using the option service_name 'dyndns.org'.

After running the script I get in logread:

Mon Jun  5 15:27:27 2017 user.err ddns-scripts[2591]: myddns_ipv4: No or
private or invalid IP '100.67.31.70' given! Please check your configuration

If I modify the /etc/config/ddns:
option upd_privateip '1'   (instead of '0')

The ddns is updated as expected.

Any Ideas?

Bye.




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] Remerge logo ideas

2017-06-01 Thread Giuseppe Lippolis
I like the idea and I like the proposed logo.
And I really want a sticker applied on my openwrt router.

Therefore I supported the request on the https://www.unixstickers.com/
roadmap:
https://trello.com/c/QHSfmIQ2/560-openwrt%2Flede-hexagon-sticker

If there are enough vote they will produce the stickers for public sell.
If you like the idea please support the request as well.

Bye.



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] openwrt and lede - remerge proposal

2017-05-14 Thread Giuseppe Lippolis
> *) branding
> - the owrt side sees no option of using the lede brand
> 
> - a (minor) majority voted for openwrt as a name over lede whilst most
> people said they did not care
> 
> - as the last vote had a 100% ACK for a remerge using the owrt brand is
the
> only feasible option

Passionate: I start to develop with lede, therefore I'm fond to this brand.
More rational: Lede differ from OWRT because it should be more open to
generic embedded architecture. IMHO this is a big advantage compared to OWRT
that shall be kept.

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] Drumming up more interest in LEDE

2017-03-03 Thread Giuseppe Lippolis
> > On 3 March 2017 at 16:55, Mauro Mozzarelli  wrote:
> >> I have been trying to make a very simple contribution to LEDE, but it
> >> has been a frustrating process because my contribution got stuck due
> >> to form rather than substance.

I'm also thinking that the process should be in some way improved. 
I explain my example.
I proposed a PR and as expected I received some comments. 
I do not make any differences between formal and substance because I think 
that in a big project the form is important as well.
I modified the patch according the remarks or provided justification.
But since 2 month I do not get any other feedback.
How this silence shall be considered?
IMHO a justified negative feedback is much better than the silence.
A negative feedback can help the beginner (like me) to learn, and this is my
main motivation. The silence will kill my motivation.

By the way here is the PR ( https://github.com/lede-project/source/pull/641
).

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] Release Candidate Test Plan - first draft

2017-02-06 Thread Giuseppe Lippolis
My proposal for the anonymous datacollection is to send 
1) an UDP telegram with sysupgraded.$boardname at the end of the sysupgrade
2) an UDP telegram with firstboot.$boardname at the end of the firstboot

Clearly only for the release to avoid flooding data from the developer.
Bye.



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] Release Candidate Test Plan - first draft

2017-02-06 Thread Giuseppe Lippolis
> there was an idea, to do sort of anonymous datacollection by executing
> e.g. 'nslookup sysupgraded.$boardname.lede-project.org'
> after each hotplug.wan - so we can get a feeling for problems...

I like the idea. We can also have a feeling of the most popular board in
LEDE.

Bye.




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] devicetree question

2017-02-06 Thread Giuseppe Lippolis
I replace the layout without TABs


+---+
|si3210 |
|   |
|---+---|
| Audio |CTRL   |   
+---+
|  PCM  | SPI   |---+
+---+   |
^   ^   |
|   |   |PIN1
+---+   +--+
|   |<--| GPIO |
|   uP  |   IRQ +--+
+---+


Bye.



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] devicetree question

2017-02-06 Thread Giuseppe Lippolis
Hi all,
I need to describe the following hw layout in the DT for the DWR-512:


+---+
|si3210 |
|   |
|---+---|
| Audio |CTRL   |   
+---+
|  PCM  | SPI   |---+
+---+   |
^   ^   |
|   |   |PIN1
+---+   +--+
|   |<--| GPIO |
|   uP  |   IRQ +--+
+---+

Is the following dt update correct?

#include "rt5350.dtsi"

 {
status = "enabled";
si3210@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "siliconlabs,si3210";
}
}

 {
status = "okay";

si3210@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "siliconlabs,si3210";

interrupt-parent = <>;
interrupts = <1 2>;
irq-gpio = < 1 2>;

reg = <0>;
spi-max-frequency = <100>;
};
};

What means the last number in the interrupts and irq-gpio field?

Thanks,
Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] telephony: adding telephony functionality

2017-02-04 Thread Giuseppe Lippolis
>Dear All,
>after some investigation on my DWR-512 board I discovered the hw
architecture of the telephone voice channel embedded in the router.
>The board embeds one 3g modem plugged on the mini pcie slot and one proslic
device (si3210 - subscriber line interface circuit).
>The hw architecture is shown below.
>
>T   V
>|   |
>  +---+   +---+
>IRQ   |   |  PCM bus  |   | events
>  +---|  si   |<=>|   3g  |-+
>  |   | 3210  |   | modem | |
>  |   +---+   +---+ |
>  | ^ ^ |
>  | | | |
>  | | spidev1.0   | |
>  | | | ttyUSB0/1   |
>  |   +---+   | |
>  |   |   |---+ |
>  +-->|  uP   | |
>gpio1 |   |<+
>  +---+ ttyUSB1
> 

>My next plan is to develop a driver for the si3210 and then one userspace
daemon to enable the telephone voice (and sms) channel functions.

>Have someone some comments about this plan?

I found an interesting tentative to add a telephony class in linux, it was
the phonedev.c class by Alan Cox.
Nevertheless this piece of code has been removed since kernel 3.6
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7
326446c728f633a0d6b3318cf491f71f044dce0
Make sense revert it back?

Bye.




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] rt5350: second gpio bank

2017-01-29 Thread Giuseppe Lippolis
Hi,
I would like to verify if something is connected on the second gpio bank of
my rt5350.
Therefore I enabled the bank in the dts and now I'm able to see it in /sys:

root@lede:~# ls /sys/class/gpio/
export  gpio7   gpiochip0   gpiochip22
modem3g_enable  unexport
root@lede:~# cat /sys/class/gpio/gpiochip*/base
0
22

But if I try to export one of the pin I get an error:

root@lede:~# echo 23 > /sys/class/gpio/export
-ash: write error: Invalid argument
root@lede:~# echo 22 > /sys/class/gpio/export
-ash: write error: Invalid argument

Can someone help me?
Thanks.
Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] RT5350 spi half duplex?

2017-01-18 Thread Giuseppe Lippolis
Hi,
I’m experimenting the spi interface on a RT5350 target.
Its spi driver set the interface as half duplex

    master->dev.of_node = pdev->dev.of_node;
    master->mode_bits = RT2880_SPI_MODE_BITS;
    master->bits_per_word_mask = SPI_BPW_MASK(8);
    master->min_speed_hz = clk_get_rate(clk) / 128;
    master->max_speed_hz = clk_get_rate(clk) / 2;
    master->flags = SPI_MASTER_HALF_DUPLEX;
    master->setup = rt2880_spi_setup;
    master->prepare_message = rt2880_spi_prepare_message;
    master->set_cs = rt2880_spi_set_cs;
    master->transfer_one = rt2880_spi_transfer_one,

but from the datasheet it seems that the device is full duplex capable.
There are some reason to set the driver in this way?

Thanks, bye. 



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] 3g led netdev setup

2017-01-09 Thread Giuseppe Lippolis
Hi All,
I would like to switch on the 3g LED on the front panel of the dwr-512 when
the 3g modem connection is established.

One way (successfully tested) is to add the following section in the
/etc/conf/system:
config 'led'
option 'name'  '3G'
option 'sysfs' 'dwr-512-b:green:3g'
option 'trigger'   'netdev'
option 'dev'   'usb0'
option 'mode'  'link'

Therefore one way is to add the uci commands in the
target/linux/ramips/base-files/etc/uci-defaults/  dir.

Another way seems to be add a line in the /etc/board.d/01_leds file:

dwr-512-b)
ucidef_set_led_netdev "wan3g" "wan3g" "$board:green:3g" "usb0"
   ;;

Unfortunately this second way doesn't work and I'm unable to find any
documentation about the /etc/board.d/01_leds file.

Can someone help me?
Thanks,
Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] spi-tools failure

2017-01-08 Thread Giuseppe Lippolis
Same error using the spidev_test tool:

root@lede:/tmp# spidev_test -D /dev/spidev1.0 -s 100
spi mode: 0x3
bits per word: 8
max speed: 100 Hz (1000 KHz)
can't send spi message: Invalid argument
Aborted


The error occurs on this system call:
ret = ioctl(fd, SPI_IOC_MESSAGE(1), );
if (ret < 1)
pabort("can't send spi message");



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] spi-tools failure

2017-01-07 Thread Giuseppe Lippolis
Here the report using a different command:

root@lede:/tmp# spi-pipe -d /dev/spidev1.0 -b 4 -n 40 < /dev/zero
SPI_IOC_MESSAGE: Invalid argument

root@lede:/tmp# strace spi-pipe -d /dev/spidev1.0 -b 4 -n 40 < /dev/zero
execve("/usr/bin/spi-pipe", ["spi-pipe", "-d", "/dev/spidev1.0", "-b", "4",
"-n", "40"], [/* 14 vars */]) = 0
set_thread_area(0x778a2e50) = 0
set_tid_address(0x7789bd90) = 1152
open("/etc/ld-musl-mipsel-sf.path", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1
ENOENT (No such file or directory)
open("/lib/libgcc_s.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=76975, ...}) = 0
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\20(\0\0004\0\0\0"..., 936)
= 936
mmap2(NULL, 143360, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x777d5000
mmap2(0x777f7000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x12000) = 0x777f7000
close(3)= 0
mprotect(0x411000, 4096, PROT_READ) = 0
open("/dev/spidev1.0", O_RDONLY|O_LARGEFILE) = 3
read(0, "\0\0\0\0", 4)  = 4
ioctl(3, SPI_IOC_MESSAGE(32), 0x7fef0aa8) = -1 EINVAL (Invalid argument)
writev(2, [{iov_base="", iov_len=0}, {iov_base="SPI_IOC_MESSAGE",
iov_len=15}], 2SPI_IOC_MESSAGE) = 15
writev(2, [{iov_base="", iov_len=0}, {iov_base=":", iov_len=1}], 2:) = 1
writev(2, [{iov_base="", iov_len=0}, {iov_base=" ", iov_len=1}], 2 ) = 1
writev(2, [{iov_base="", iov_len=0}, {iov_base="Invalid argument",
iov_len=16}], 2Invalid argument) = 16
writev(2, [{iov_base="", iov_len=0}, {iov_base="\n", iov_len=1}], 2
) = 1
exit_group(1)   = ?
+++ exited with 1 +++

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] spi-tools failure

2017-01-07 Thread Giuseppe Lippolis
I'm trying to use spi-tools on the current LEDE snapshot, but it fails at
runtime:

root@lede:~# echo -n -e '\x80' | spi-pipe -d /dev/spidev1.0 | hexdump
SPI_IOC_MESSAGE: Invalid argument

root@lede:/tmp# strace echo -n -e '\x80' | spi-pipe -d /dev/spidev1.0 |
hexdump
execve("/bin/echo", ["echo", "-n", "-e", "\\x80"], [/* 14 vars */]) = 0
set_thread_area(0x77615e50) = 0
set_tid_address(0x7760ed90) = 1139
open("/etc/ld-musl-mipsel-sf.path", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1
ENOENT (No such file or directory)
open("/lib/libgcc_s.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=76975, ...}) = 0
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\20(\0\0004\0\0\0"..., 936)
= 936
mmap2(NULL, 143360, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x77548000
mmap2(0x7756a000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x12000) = 0x7756a000
close(3)= 0
getuid()= 0
write(1, "\200", 1SPI_IOC_MESSAGE: Invalid argument
) = 1
exit_group(0)   = ?
+++ exited with 0 +++

root@lede:/tmp# spi-pipe -v
spi-pipe - cc6a41fdcec60610703ba6db488c621c64952898

root@lede:~# uname -a
Linux lede 4.4.39 #0 Thu Dec 22 16:02:42 2016 mips GNU/Linux

Can someone confirm the problem and/or suggest a solution?
Thanks, Bye.



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [OpenWrt-Devel] Talks between OpenWrt and LEDE

2016-12-22 Thread Giuseppe Lippolis
> >> we did propose this as an idea, keep lede as the bleeding edge tree
> >> and
> > use
> >> openwrt as the stable release tree with long term support. the
> >> openwrt
> > folks
> >> made it a condition for the merger that this may not be the case. i
> >> think
> > the
> >> sentence used by the owrt folks was "merge to one project/tree or
> >> dont merge"
> >
> > This sentence doesn't sound very constructive. Anyhow:
> 
> sorry if you feel that way, i am trying to be constructive and inclusive
to the
> best of my ability. just because i am nosy, why do you think this is not
> constructive ?

John, my criticism was for the people saying: "merge to one project/tree or
don't merge".
Not for you!

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [OpenWrt-Devel] Talks between OpenWrt and LEDE

2016-12-22 Thread Giuseppe Lippolis
> > When I decided where to port my contribution I considered the "focus 
> > on stability and functionality" more interesting than the "bleeding 
> > edge functionality", therefore I selected LEDE.
> > Now I understand that a merge is ongoing.
> > Can I ask to the people taking care about the merge how the 
> > trade-off between stability and bleeding edge is solved?
> 
> we did propose this as an idea, keep lede as the bleeding edge tree 
> and
use
> openwrt as the stable release tree with long term support. the openwrt
folks
> made it a condition for the merger that this may not be the case. i 
> think
the
> sentence used by the owrt folks was "merge to one project/tree or dont 
> merge"

This sentence doesn't sound very constructive. Anyhow:
I'm sure that the owrt folks have good reason to merge, It is a question of
transparencies, can they share with us these reasons?
And most important, what are they proposing to trade-off between stability
and bleeding edge?

In my opinion a conflict unsolved is simple an unsolved conflict. 
If the merge means restore the status before the split, the probability to
have a new split is high.
 
Therefore in absence of valid proposal  to trade-off, my advice is to
identify the perimeter where really make sense to merge and on the top of
this common base built two different project, one focused on the "stability"
and the second on the "bleeding edge".

> > At the end the market share will answer if a single product make 
> > sense or not.

Anyhow on this point I hope that the discussion can be transparent and
extended to the community.

Bye,
Giuseppe.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [OpenWrt-Devel] Talks between OpenWrt and LEDE

2016-12-21 Thread Giuseppe Lippolis
Dear All,
I started to contribute to LEDE recently and after the spin-off.
When I decided where to port my contribution I considered the "focus on
stability and functionality" more interesting than the "bleeding edge
functionality", therefore I selected LEDE.
Now I understand that a merge is ongoing.
Can I ask to the people taking care about the merge how the trade-off
between stability and bleeding edge is solved?

In my opinion a coordination/collaboration between the two project is for
sure a benefit for both, but having a single product will generate an
ambiguous and ineffective trade-off.
Why don't keep two product line with different focus on stability and
bleeding edge and merge what really make sense for both?

At the end the market share will answer if a single product make sense or
not.

By the way where can I find the minute of the meetings?

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] rt5350-spi rt2880-spi question

2016-12-10 Thread Giuseppe Lippolis
In the driver code is written the follow comment:

/*
 * spidev should never be referenced in DT without a specific
 * compatible string, it is a Linux implementation thing
 * rather than a description of the hardware.
 */

What shall I use in the .dts to bind a generic spi driver?


> -Ursprüngliche Nachricht-
> Von: Giuseppe Lippolis [mailto:giu.lippo...@gmail.com]
> Gesendet: Samstag, 10. Dezember 2016 23:21
> An: lede-dev@lists.infradead.org
> Betreff: rt5350-spi rt2880-spi question
> 
> I have an update.
> Using the following add to the DWR-512-B.dts
> 
>  {
> status = "okay";
> 
> spidev@1 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "spidev";
> reg = <0>;
> spi-max-frequency = <3000>;
> };
> };
> 
> I'm able to see the device:
> root@lede:/tmp# ls /dev/spi*
> /dev/spidev1.0
> 
> But in the bootlog I get:
> 
> [   56.306119] procd: - init -
> [   56.902341] ip6_tables: (C) 2000-2006 Netfilter Core Team
> [   56.944417] i2c /dev entries driver
> [   56.965816] Loading modules backported from Linux version
> wt-2016-10-03-1-g6fcb1a6
> [   56.981067] Backport generated by backports.git
> backports-20160324-9-g0e38f5c
> [   57.003743] ip_tables: (C) 2000-2006 Netfilter Core Team
> [   57.034967] nf_conntrack version 0.5.0 (447 buckets, 1788 max)
> [   57.084989] spidev spi1.0: buggy DT: spidev listed directly in DT
> [   57.097291] [ cut here ]
> [   57.106611] WARNING: CPU: 0 PID: 415 at drivers/spi/spidev.c:719
> init_module+0x333c/0x3dec [spidev]()
> [   57.125042] Modules linked in: spidev(+) slhc nf_reject_ipv4
> nf_nat_redirect nf_nat_masquerade_ipv4 nf_nat nf_log_ipv4
> nf_defrag_ipv6
> nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack iptable_raw
> iptable_mangle iptable_filter ip_tables crc_itu_t crc_ccitt compat
i2c_ralink
> i2c_dev i2c_core ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common
> ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables
> eeprom_93cx6 leds_gpio ehci_platform ehci_hcd gpio_button_hotplug
> usbcore nls_base usb_common
> [   57.213233] CPU: 0 PID: 415 Comm: kmodloader Not tainted 4.4.36 #0
> [   57.225597] Stack : 80325d94  0001 8036 819aaa80
> 80362d23
> 803076cc 019f
> [   57.225597]  803a3430 0007 001a 024000c0 80065a9c
8004a6c8
> 8030cbe4 8036
> [   57.225597]  0003 0007 8030afe8 81bf3b4c 80065a9c
80048634
>  
> [   57.225597]  0001    

>  
> [   57.225597]      

>  
> [   57.225597]  ...
> [   57.296770] Call Trace:
> [   57.301757] [<80065a9c>] module_sect_show+0x0/0x18
> [   57.311382] [<8004a6c8>] vprintk_default+0x24/0x30
> [   57.321003] [<80065a9c>] module_sect_show+0x0/0x18
> [   57.330619] [<80048634>] printk+0x2c/0x38
> [   57.338626] [<80024f44>] warn_slowpath_common+0xa0/0xd0
> [   57.349107] [<80148d38>] dump_stack+0x14/0x28
> [   57.357871] [<8001442c>] show_stack+0x50/0x84
> [   57.366623] [<80024f44>] warn_slowpath_common+0xa0/0xd0
> [   57.377117] [<80d8633c>] init_module+0x333c/0x3dec [spidev]
> [   57.388288] [<80d8>] 0x80d8
> [   57.395318] [<80024ffc>] warn_slowpath_null+0x18/0x24
> [   57.405459] [<801bebd0>] of_match_node+0x20/0x44
> [   57.414739] [<80d8>] 0x80d8
> [   57.421771] [<80d8633c>] init_module+0x333c/0x3dec [spidev]
> [   57.432971] [<801964a8>] devm_kfree+0x20/0x44
> [   57.441752] [<801ad3f4>] spi_drv_probe+0x3c/0x84
> [   57.451019] [<80192e7c>] driver_probe_device+0x120/0x288
> [   57.461695] [<80089984>] kstrdup+0x44/0x8c
> [   57.469923] [<801ad2f4>] spi_match_device+0x38/0xa8
> [   57.479733] [<80193060>] __driver_attach+0x7c/0xb4
> [   57.489291] [<80191284>] next_device+0x10/0x30
> [   57.498221] [<80192fe4>] __driver_attach+0x0/0xb4
> [   57.507665] [<80191340>] bus_for_each_dev+0x9c/0xac
> [   57.517469] [<802b3ca8>] klist_add_tail+0x24/0x50
> [   57.526910] [<80d8>] 0x80d8
> [   57.533925] [<80191114>] bus_get+0x2c/0x50
> [   57.542171] [<80192574>] bus_add_driver+0xec/0x20c
> [   57.551796] [<800ac068>] exact_match+0x0/0x8
> [   57.560352] [<800ac570>] exact_lock+0x0/0x24
> [   57.568869] [<80d8>] 0x80d8
> [   57.575875] [<80d8>] 0x80d8
> 

[LEDE-DEV] rt5350-spi rt2880-spi question

2016-12-10 Thread Giuseppe Lippolis
Dear All,
I'd like to enable all the function available to my DWR-512.
Currently on the board is mounted the SLIC device Si3210.
This device is controlled by the spi interface.
I checked that its spi interface is connected to the spi master of the
rt5350 on the cs1.

Running the following cmd in the uboot:
RT5350 # nm 1060

1b54: 00400080 ? 0080

RT5350 # md 1b00

1b00:    

1b10: 0152 0001  R...

1b20: 00f7   

1b30:    

1b40:    

1b50: 0152 0001  R...

1b60: 00ff   

1b70:    

1b80:    

1b90:    

1ba0:    

1bb0:    

1bc0:    

1bd0:    

1be0:    

1bf0: 8003   

RT5350 # nm 1b54

1b54: 0001 ? 3

1b54: 0001 ? 2 

I'm able to see the clock burst and the cs1 moving on the proper Si3210
pins.

Therefore I'd like to enable the second spi channel in my dts.
But here I found something strange.

Currently the included rt5350.dtsi have the following structure:
palmbus: palmbus@1000 {
compatible = "palmbus";
reg = <0x1000 0x20>;
ranges = <0x0 0x1000 0x1F>;

#address-cells = <1>;
#size-cells = <1>;

[ ... ]

spi0: spi@b00 {
compatible = "ralink,rt5350-spi",
"ralink,rt2880-spi";
reg = <0xb00 0x40>;

resets = < 18>;
reset-names = "spi";

#address-cells = <1>;
#size-cells = <0>;

pinctrl-names = "default";
pinctrl-0 = <_pins>;

status = "disabled";
};

spi1: spi@b40 {
compatible = "ralink,rt5350-spi",
"ralink,rt2880-spi";
reg = <0xb40 0x60>;

resets = < 18>;
reset-names = "spi";

#address-cells = <1>;
#size-cells = <0>;

pinctrl-names = "default";
pinctrl-0 = <_cs1>;

status = "disabled";
};

[ ... ]

};

and in my DWR-512-B.dts:

#include "rt5350.dtsi"

 {
status = "okay";

mx25l6405d@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <3000>;
m25p,fast-read;

partition@0 {
label = "u-boot";
reg = <0x0 0x3>;
read-only;
};

[ ... ]

config: partition@7f {
label = "config";
reg = <0x7f 0x1>;
};
};
};

>From what I understood sufing online, to enable the second chipselect
channel I need to add the following section into the  section of my
DWR-512-B.dts file.

spidev@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spidev";
reg = <1>;
spi-max-frequency = <3000>;
};

Is this correct? Or shall I use the spi1 section of the rt5350.dtsi?
Is the spi1 section in the rt5350.dtsi correct?
(from the rt5350 datasheet, it is clear that the device have only one master
with two cs channel).

Thanks,
Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] comgt-ncm: Add support for specifying profile index

2016-12-09 Thread Giuseppe Lippolis
> Ah, that's the echo from the command messing up things. I was using the
> cdc-wdm0 node, which doesn't echo, so I didn't notice this. Will send a
fix
> later today. However, it still wouldn't work with your modem as the
> manufacturer would be "+cgmi:". This is a bug in the modem firmware, since
> according to GSM spec AT+CGMI should only return the manufacturer name
> and "OK". This from a Huawei:
> 
> AT+CGMI
> huawei
> 
> OK

Ok I will wait for your update and then I will propose an alternative
parsing strategy to be used when the standard one doesn't work, to make also
some non-compliant modem working in lede.

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] comgt-ncm: Add support for specifying profile index

2016-12-07 Thread Giuseppe Lippolis
> --- a/package/network/utils/comgt/files/getcardinfo.gcom
> +++ b/package/network/utils/comgt/files/getcardinfo.gcom
> @@ -6,7 +6,7 @@ opengt
>   flash 0.1
> 
>  :start
> - send "ATI^m"
> + send "AT+CGMI^m"

> diff --git a/package/network/utils/comgt/files/ncm.json


> diff --git a/package/network/utils/comgt/files/ncm.sh
> b/package/network/utils/comgt/files/ncm.sh
> index 14b6347..df60fe8 100644


> - manufacturer=`gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk
'/Manufacturer/ { print tolower($2) }'`
> + manufacturer=`gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk
+'NF { print tolower($1); exit; }'`

Unfortunately this currently doesn't work for me, but can be easily fixed.
Adding this line:
+   echo "Manufacturer: $manufacturer"
this is what I get in the logread:
Tue Dec  6 18:49:52 2016 daemon.notice netifd: Interface 'wan3g' is setting
up now
Tue Dec  6 18:49:52 2016 daemon.notice netifd: wan3g (1082): wwan[1082]
Using proto:wwan device:/dev/ttyUSB0 iface:usb0 desc:
Tue Dec  6 18:49:54 2016 daemon.notice netifd: wan3g (1082): Manufacturer:
at+cgmi
Tue Dec  6 18:49:54 2016 daemon.notice netifd: wan3g (1082): WARNING:
Variable 'at+cgmi' does not exist or is not an array/object
Tue Dec  6 18:49:54 2016 daemon.notice netifd: wan3g (1082): Unsupported
modem
Tue Dec  6 18:49:54 2016 daemon.notice netifd: wan3g (1122): Stopping
network device:
Tue Dec  6 18:49:54 2016 daemon.notice netifd: wan3g (1122): Can't open
device .
Tue Dec  6 18:49:54 2016 daemon.notice netifd: wan3g (1122): Failed to
disconnect
Tue Dec  6 18:49:54 2016 daemon.notice netifd: Interface 'wan3g' is now down

Running the getcardinfo script manually:
root@lede:~# gcom -d /dev/ttyUSB0 -s /etc/gcom/getcardinfo.gcom
AT+CGMI
+CGMI: MTK1

OK

A general comment:
Currently the wwan is dividing only for manufacturer and not per device
model.
I don't know if this is a good strategy. Probably the same manufacturer can
produce different modem models requiring some more specific configuration.
My suggestion is to keep the manufactured identification (as it is now) to
address the generic configuration, but identify also the model in order to
allow a more specific configuration if needed.

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] enhanced 3G support

2016-12-02 Thread Giuseppe Lippolis
Dear Bjørn,
please join the discussion directly on the github code:

https://github.com/lede-project/source/pull/585

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] enhanced 3G support

2016-12-01 Thread Giuseppe Lippolis
Dear Bjørn, Matti,

> I don't think it is relevant for you, though.  You should continue your 
> initial
> idea, creating a "proto" supporting the AT managed cdc_ether based
> modem.

I add a pull request here:

https://github.com/lede-project/source/pull/585

Please help me to fix some issue and review it.

Thanks,
Bye.
 


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] enhanced 3G support

2016-11-27 Thread Giuseppe Lippolis
Hi Bjørn,

> No, no, the cdc_ether driver is definitely the correct one.  NCM or MBIM
> won't work unless you can make the device morph into another mode. But
> since you know how to manage it in cdc_ether mode, and that is the native
> mode, I see no reason to mess with it.

You are right. The only working driver (at least in the default status) for the 
2 data interface is the cdc_ether.

> I don't think it is relevant for you, though.  You should continue your 
> initial
> idea, creating a "proto" supporting the AT managed cdc_ether based
> modem.

The actual wwan script with the simple modification of the 2001-7d04 data file 
from the (2001-7d03) call the 3g.sh script.
But this script establish the connection using the ppp over the ttyUSB and do 
not use the cdc_ether.
So I'm going to update the wwan script to support the cdc_ether.

As soon as (I'm a LEDE hobbyist, I cannot work full time) I have some results I 
will ask you for some advice.

Thanks,
Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] enhanced 3G support

2016-11-27 Thread Giuseppe Lippolis
Dear All,
I currently add supprt for the dwr-512 device on LEDE.
This device have a 3G modem embedded.
The current available configuration uses the usb-option to establish the 3G
connection over ppp.
Nevertheless the modem offer one cdc-ether interface with better
performance.

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=2001 ProdID=7d04 Rev= 3.00
S:  Manufacturer=D-Link,Inc
S:  Product=D-Link DWM-158
C:* #Ifs= 7 Cfg#= 1 Atr=a0 MxPwr=500mA
A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=125us
I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=02 Prot=01 Driver=option
E:  Ad=87(I) Atr=03(Int.) MxPS=  64 Ivl=125us
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 6 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

It seems to me that currently this kind of "protocol" is not supported in
LEDE.
In particular I'm unable to found an interface type in the
/etc/config/network to setup this kind of connection.

Currently I'm able to establish a connection setting the interface in
"manual" mode.

To do this I setup an usb interface

config interface 'wan3g'
option ifname 'usb0'
option proto 'dhcp'

then I need to send manually the following command to the /dev/ttyUSB0 to
establish the 3G connection:

AT+CFUN=1
AT+CPIN=""
AT+CREG?
> +CREG: 2,1,"1CE3","0BCA3360",6 (6=UTRAN w/HSDPA and HSUPA)
AT+CGDCONT=1,"IP","",0,0
AT+CGACT=1,1
AT+CGACT?
AT+CGPADDR=1
>> +CGPADDR: 1, "109.42.15.170"
AT+CGPRCO?
>> +CGPRCO: 1, "139.7.30.126", "139.7.30.125", "", ""
AT+CGDATA="M-MBIM",1,1

at this point the IF is UP and working:
usb0  Link encap:Ethernet  HWaddr 02:00:FF:AA:AA:AA
  inet addr:109.42.15.170  Bcast:109.42.15.171  Mask:255.255.255.252
  inet6 addr: fe80:::feaa:/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:314 errors:0 dropped:0 overruns:0 frame:0
  TX packets:360 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:29855 (29.1 KiB)  TX bytes:33129 (32.3 KiB)

  
Can someoune help me in introduce the handling of this "protocol" in LEDE?

Thanks,
Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] enabling 3G interface in DLink DWR-512

2016-11-23 Thread Giuseppe Lippolis
Dear All,
my preliminary board porting for the dwr-512 has been accepted in the
mainstream.
The dwr-512 have an embedded pcie 3G modem (see
https://wiki.openwrt.org/inbox/d-link/d-link_dwr-512_b )

Currently all the kernel module and package needed to enable the connection
are embedded in the image.

But in order to start-up the 3G interface the following modification need to
be manually added:

in config/network:
config interface 'wan3g'
option proto3g  
option service  'umts'  
option 'device' '/dev/ttyUSB0'  
option apn  'web.vodafone.de'
option pincode  ''

in config/firewall:
config zone
option name wan
list   network  'wan'
+   list   network  'wan3g'
list   network  'wan6'
option inputREJECT
option output   ACCEPT
option forward  REJECT
option masq 1
option mtu_fix  1

in /etc/gcom/setpin.gcom adding (before to set the pin) :
send "AT+CFUN=1^m"
 waitfor 20 "OK","ERR"

and manually send the following command:
echo '2001 7d04 ff' > /sys/bus/usb-serial/drivers/option1/new_id

and finally if-up wan3g

Is clear that at the end is responsibility of the user set the  apn and the
pincode in config/network, but how I would like to "prepare" the 3G setup,
keeping disabled the wan3g interface (option enabled 0), but adding all the
described step in the image.

Therefore, currently, my question is how shall I modify (as described) the
config/network and config/firewall file?
And where to put the "echo '2001 7d04 ff' >
/sys/bus/usb-serial/drivers/option1/new_id" command to attach the driver to
the modem?

Thanks.




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] kernel: update to v4.4.23

2016-11-13 Thread Giuseppe Lippolis
From: Álvaro Fernández Rojas 

Refresh patches for all targets that support kernel 4.4.
compile/run-tested on brcm2708/bcm2710 only.

Signed-off-by: Álvaro Fernández Rojas 
---
 include/kernel-version.mk  |  4 +--
 .../ar71xx/patches-4.4/500-MIPS-fw-myloader.patch  |  2 +-
 .../patches-4.4/201-extra_optimization.patch   | 16 +++
 .../patches-4.4/202-reduce_module_size.patch   |  2 +-
 .../generic/patches-4.4/280-rfkill-stubs.patch | 32 --
 .../generic/patches-4.4/304-mips_disable_fpu.patch |  2 +-
 .../645-bridge_multicast_to_unicast.patch  |  2 +-
 ...80-NET-skip-GRO-for-foreign-MAC-addresses.patch | 10 +++
 .../generic/patches-4.4/902-debloat_proc.patch |  4 +--
 .../patches-4.4/0026-NET-multi-phy-support.patch   |  6 ++--
 .../patches-4.4/0001-NET-multi-phy-support.patch   |  6 ++--
 ...ovide-a-hook-for-link-up-link-down-events.patch | 18 ++--
 .../patches-4.4/0034-NET-multi-phy-support.patch   |  6 ++--
 13 files changed, 53 insertions(+), 57 deletions(-)

diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 0db1b35..64b25e8 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -4,11 +4,11 @@ LINUX_RELEASE?=1
 
 LINUX_VERSION-3.18 = .29
 LINUX_VERSION-4.1 = .20
-LINUX_VERSION-4.4 = .22
+LINUX_VERSION-4.4 = .23
 
 LINUX_KERNEL_MD5SUM-3.18.29 = b25737a0bc98e80d12200de93f239c28
 LINUX_KERNEL_MD5SUM-4.1.20 = 075c38a3a23ca5bc80437b13606df00a
-LINUX_KERNEL_MD5SUM-4.4.22 = 404802389c7f0bbe94dda95f9d058d9e
+LINUX_KERNEL_MD5SUM-4.4.23 = 39c3e2090931e83b7dd3438e7fb276d4
 
 ifdef KERNEL_PATCHVER
   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
diff --git a/target/linux/ar71xx/patches-4.4/500-MIPS-fw-myloader.patch 
b/target/linux/ar71xx/patches-4.4/500-MIPS-fw-myloader.patch
index f823b59..e877b0c 100644
--- a/target/linux/ar71xx/patches-4.4/500-MIPS-fw-myloader.patch
+++ b/target/linux/ar71xx/patches-4.4/500-MIPS-fw-myloader.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/Makefile
 +++ b/arch/mips/Makefile
-@@ -222,6 +222,7 @@ cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_AL
+@@ -218,6 +218,7 @@ endif
  #
  libs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/
  libs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/
diff --git a/target/linux/generic/patches-4.4/201-extra_optimization.patch 
b/target/linux/generic/patches-4.4/201-extra_optimization.patch
index bcb6a00..508627a 100644
--- a/target/linux/generic/patches-4.4/201-extra_optimization.patch
+++ b/target/linux/generic/patches-4.4/201-extra_optimization.patch
@@ -1,14 +1,18 @@
 --- a/Makefile
 +++ b/Makefile
-@@ -608,9 +608,9 @@ include arch/$(SRCARCH)/Makefile
- KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
+@@ -619,12 +619,12 @@ KBUILD_CFLAGS+= $(call cc-option,-fno-d
+ KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
  
  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
--KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
-+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION) $(call 
cc-disable-warning,maybe-uninitialized,)
+-KBUILD_CFLAGS += -Os
++KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION)
  else
+ ifdef CONFIG_PROFILE_ALL_BRANCHES
 -KBUILD_CFLAGS += -O2
-+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
++KBUILD_CFLAGS += -O2 $(EXTRA_OPTIMIZATION)
+ else
+-KBUILD_CFLAGS   += -O2
++KBUILD_CFLAGS   += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
+ endif
  endif
  
- # Tell gcc to never replace conditional load with a non-conditional one
diff --git a/target/linux/generic/patches-4.4/202-reduce_module_size.patch 
b/target/linux/generic/patches-4.4/202-reduce_module_size.patch
index cef04d1..283d48d 100644
--- a/target/linux/generic/patches-4.4/202-reduce_module_size.patch
+++ b/target/linux/generic/patches-4.4/202-reduce_module_size.patch
@@ -1,6 +1,6 @@
 --- a/Makefile
 +++ b/Makefile
-@@ -398,7 +398,7 @@ KBUILD_CFLAGS_KERNEL :=
+@@ -402,7 +402,7 @@ KBUILD_CFLAGS_KERNEL :=
  KBUILD_AFLAGS   := -D__ASSEMBLY__
  KBUILD_AFLAGS_MODULE  := -DMODULE
  KBUILD_CFLAGS_MODULE  := -DMODULE
diff --git a/target/linux/generic/patches-4.4/280-rfkill-stubs.patch 
b/target/linux/generic/patches-4.4/280-rfkill-stubs.patch
index 8864902..96a98e2 100644
--- a/target/linux/generic/patches-4.4/280-rfkill-stubs.patch
+++ b/target/linux/generic/patches-4.4/280-rfkill-stubs.patch
@@ -1,7 +1,5 @@
-Index: linux-4.4.21/net/rfkill/Kconfig
-===
 linux-4.4.21.orig/net/rfkill/Kconfig   2016-09-15 08:29:29.0 
+0200
-+++ linux-4.4.21/net/rfkill/Kconfig2016-09-27 18:23:27.210404930 +0200
+--- a/net/rfkill/Kconfig
 b/net/rfkill/Kconfig
 @@ -1,7 +1,11 @@
  #
  # RF switch subsystem configuration
@@ -15,7 +13,7 @@ Index: linux-4.4.21/net/rfkill/Kconfig
tristate "RF switch subsystem support"
help
  Say Y here if you want to have 

[LEDE-DEV] adding LEDE support for board DLINK DWR-512-B

2016-11-13 Thread Giuseppe Lippolis
This patch add LEDE support for the board DLINK DWR-512-B 

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] patch for dwr-512 support

2016-11-13 Thread Giuseppe Lippolis
Dear all,
I’m sending to the community the following patch to support the dlink
dwr-512.

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network
b/target/linux/ramips/base-files/etc/board.d/02_network
index c8b57ca..719078c 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -71,6 +71,7 @@ ramips_setup_interfaces()
   dir-320-b1|\
   dir-610-a1|\
   dir-615-h1|\
+ dwr-512-b|\
   firewrt|\
   hlk-rm04|\
   mac1200rv2|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh
b/target/linux/ramips/base-files/lib/ramips.sh
index bb379f7..a0f041e 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -154,6 +154,9 @@ ramips_board_detect() {
   *"DIR-860L B1")
  name="dir-860l-b1"
  ;;
+ *"DWR-512 B")
+ name="dwr-512-b"
+ ;;
   *"Dovado Tiny AC")
  name="tiny-ac"
  ;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 0ef2308..36ea469 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -50,6 +50,7 @@ platform_check_image() {
   dir-620-a1|\
   dir-620-d1|\
   dir-810l|\
+ dwr-512-b|\
   duzun-dm06|\
   e1700|\
   esr-9753|\
diff --git a/target/linux/ramips/dts/DWR-512-B.dts
b/target/linux/ramips/dts/DWR-512-B.dts
index e69de29..c5a8d9c 100644
--- a/target/linux/ramips/dts/DWR-512-B.dts
+++ b/target/linux/ramips/dts/DWR-512-B.dts
@@ -0,0 +1,115 @@
+/dts-v1/;
+
+/include/ "rt5350.dtsi"
+
+/ {
+ compatible = "ralink,rt5350-soc";
+ model = "D-Link DWR-512 B";
+
+ gpio-keys-polled {
+ compatible = "gpio-keys-polled";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ poll-interval = <20>;
+
+ wps {
+    label = "wps";
+    gpios = < 0 1>;
+     linux,code = <0x211>;
+ };
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ sms {
+    label = "dwr-512-b:green:sms";
+    gpios = < 8 1>;
+ };
+ status {
+    label =
"dwr-512-b:green:status";
+    gpios = < 9 1>;
+ };
+ 2g {
+    label = "dwr-512-b:green:2g";
+    gpios = < 17 1>;
+ };
+ 3g {
+    label = "dwr-512-b:green:3g";
+    gpios = < 19 1>;
+ };
+ sstrengthr {
+    label =
"dwr-512-b:red:sigstrength";
+    gpios = < 20 1>;
+ };
+ sstrengthg {
+    label =
"dwr-512-b:green:sigstrength";
+    gpios = < 21 1>;
+ };
+ };
+
+ gpio-export {
+ compatible = "gpio-export";
+ #size-cells = <0>;
+ 
+ modem3g_enable {
+    gpio-export,name =
"modem3g_enable";
+    gpio-export,output = <1>;
+    gpios = < 18 1>;
+ };
+ };
+};
+
+ {
+ status = "okay";
+
+ mx25l6405d@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "macronix,mx25l6405d",
"jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <3000>;
+ fast-read;
+
+    partition@0 {
+    label = "u-boot";
+    reg = <0x0 0x3>;
+    read-only;
+  

Re: [LEDE-DEV] jtag on rt5350

2016-11-06 Thread Giuseppe Lippolis
Thanks to a resistance I had the jtag working properly.
Thanks to the jtag I have now the uboot from the ralink-sdk working properly
in ram (after skipping the init phase).
Now I would like to flash it. I see that the flash image add an header on
the top of the uboot image where are stored also the RAM load address:

: 27051956 3eeb1bce 581ee93c 0001a130  '..V>...X..<...0
0010: 8020 8020 36e07ec3 05050100  . ... ..6.~.
0020: 53504920 466c6173 6820496d 61676500  SPI Flash Image.
0030: 0650     .P..

This sound like if the RT5350 doesn't execute the code from flash, but the
internal ROM code copy it in RAM and then execute.
My question then is:
How the ROM code can copy the image in ram if the ram is still not
initialized?

Have someone some tips?
Thanks,
Bye.

> -Ursprüngliche Nachricht-
> Von: Giuseppe Lippolis [mailto:giu.lippo...@gmail.com]
> Gesendet: Samstag, 5. November 2016 11:30
> An: lede-dev@lists.infradead.org
> Betreff: jtag on rt5350
> 
> Hi All,
> In ordert o be able to flash properly lede on the DWR-512 most likly I
need to
> change the bootloader with u-boot (see
> http://lists.infradead.org/pipermail/lede-dev/2016-October/003435.html).
> 
> Before to proceed I wold be sure that I'm able to control the target using
the
> jtag.
> On internet I found some tips to create a .cfg file for openocd:
> 
> # FTDI C232HM - USB 2.0 Hi-Speed to MPSSE Cable interface ftdi
ftdi_vid_pid
> 0x0403 0x6014 # 0x000f -> TMS, TCK, TDI, TDO # 0x4000 -> ^LED # 0x0010 ->
> GPIOL0 (grey) # 0x0020 -> GPIOL1 (purpe) # 0x0040 -> GPIOL2 (white) #
> 0x0080 -> GPIOL3 (blue) ftdi_layout_init 0x0008 0x400b ftdi_layout_signal
> nTRST -data 0x0020 -oe 0x0020 jtag_ntrst_delay 100 adapter_khz 100
> reset_config trst_only
> 
> set  _CHIPNAME rt5350
> set  _ENDIAN little
> set _CPUTAPID 0x1535024f
> 
> #daemon configuration
> telnet_port 
> 
> #jtag scan chain
> # format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
> jtag newtap $_CHIPNAME cpu -irlen 5  -ircapture 0x1 -irmask 0x3 -expected-
> id $_CPUTAPID
> 
> set _TARGETNAME [format "%s.cpu" $_CHIPNAME] target create
> $_TARGETNAME mips_m4k -endian $_ENDIAN -chain-position
> $_TARGETNAME
> 
> 
> When I run openocd I get:
> Open On-Chip Debugger 0.9.0 (2015-09-02-10:43) Licensed under GNU GPL
> v2 For bug reports, read
> http://openocd.org/doc/doxygen/bugs.html
> Info : auto-selecting first available session transport "jtag". To
override use
> 'transport select '.
> jtag_ntrst_delay: 100
> adapter speed: 100 kHz
> trst_only separate trst_push_pull
> Info : clock speed 100 kHz
> Info : JTAG tap: rt5350.cpu tap/device found: 0x1535024f (mfg: 0x127,
part:
> 0x5350, ver: 0x1)
> 
> And using the telnet connection:
> 
> Open On-Chip Debugger
> > targets
> TargetName Type   Endian TapNameState
> --  -- -- -- -- 
>  0* rt5350.cpu mips_m4k   little rt5350.cpu running
> > init
> > halt
> Failed to enter Debug Mode!
> Halt timed out, wake up GDB.
> timed out while waiting for target halted
> 
> because the target is not halted I cannot send read/write command and thus
> I cannot control the target.
> 
> Have someone some tips?
> 
> Thanks,
> Bye.
> 



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] jtag on rt5350

2016-11-05 Thread Giuseppe Lippolis
Hi All,
In ordert o be able to flash properly lede on the DWR-512 most likly I need
to change the bootloader with u-boot (see
http://lists.infradead.org/pipermail/lede-dev/2016-October/003435.html).

Before to proceed I wold be sure that I'm able to control the target using
the jtag.
On internet I found some tips to create a .cfg file for openocd:

# FTDI C232HM - USB 2.0 Hi-Speed to MPSSE Cable
interface ftdi
ftdi_vid_pid 0x0403 0x6014
# 0x000f -> TMS, TCK, TDI, TDO
# 0x4000 -> ^LED
# 0x0010 -> GPIOL0 (grey)
# 0x0020 -> GPIOL1 (purpe)
# 0x0040 -> GPIOL2 (white)
# 0x0080 -> GPIOL3 (blue)
ftdi_layout_init 0x0008 0x400b
ftdi_layout_signal nTRST -data 0x0020 -oe 0x0020
jtag_ntrst_delay 100
adapter_khz 100
reset_config trst_only

set  _CHIPNAME rt5350
set  _ENDIAN little
set _CPUTAPID 0x1535024f

#daemon configuration
telnet_port 

#jtag scan chain
# format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag newtap $_CHIPNAME cpu -irlen 5  -ircapture 0x1 -irmask 0x3 -expected-id
$_CPUTAPID

set _TARGETNAME [format "%s.cpu" $_CHIPNAME]
target create $_TARGETNAME mips_m4k -endian $_ENDIAN -chain-position
$_TARGETNAME


When I run openocd I get:
Open On-Chip Debugger 0.9.0 (2015-09-02-10:43)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override
use 'transport select '.
jtag_ntrst_delay: 100
adapter speed: 100 kHz
trst_only separate trst_push_pull
Info : clock speed 100 kHz
Info : JTAG tap: rt5350.cpu tap/device found: 0x1535024f (mfg: 0x127, part:
0x5350, ver: 0x1)

And using the telnet connection:

Open On-Chip Debugger
> targets
TargetName Type   Endian TapNameState
--  -- -- -- -- 
 0* rt5350.cpu mips_m4k   little rt5350.cpu running
> init
> halt
Failed to enter Debug Mode!
Halt timed out, wake up GDB.
timed out while waiting for target halted

because the target is not halted I cannot send read/write command and thus I
cannot control the target.

Have someone some tips?

Thanks,
Bye.



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [RFC] dwr-512: Image Cracking

2016-10-18 Thread Giuseppe Lippolis
If someone is interested in testing the binboy, it can be found here:
http://tsd.dlink.com.tw/downloads2008detail.asp

download the file: DWR-512_GPL_V2.00b01_20131231_v1.tar.bz2 

The "binboy" is stored in the following directory
DWR-512_GPL_V2.00b01_20131231_v1\CIG531AM_U11_GPL_03QS0.1006_20131231\GPL\to
ols\priv\bin.

Bye.


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [RFC] dwr-512: Image Cracking

2016-10-18 Thread Giuseppe Lippolis
Dear All,
I'm working to port the Dlink DWR-512 in openwrt.
Currently I'm able to complete the boot and control properly a big part of
the system.
Nevertheless there is an issue with the oem bootloader.
The oem bootloader need to get the firmware in a propietary format.
If the format is not recognized by the bootloader, it prevent to boot.
Here the example:

Jboot B394
JRecovery Version R1.2 2011/05/26 09:53
=== 0xB014 =  
SPI FLASH: MX25l6405d 8M
CSID 6E20->6E24
...Rootfs CRC Error! BCD84A9E 992C3587
IP=192.168.123.254 NA=78:54:2E:A0:78:6D
#

Dlink provides the tool (called "binboy") to generate this format and this
is the procedure I'm currently using.
According to the LEDE philosophy no binary tool, only source code, are
allowed.
Is this true in generale or some exception are allowed?

In case we cannot introduce binary tool we need encode an emulator of the
binboy.
I start to analyze the tool but without complete success.
Therefore I want to present you the test perfomed and my result in order to
get some help.

The binboy tool compose the final firmware in three steps:
1) generation of the kernel image
2) generation of the rootfs image
3) generation of the firmware image

The last step should be a simple concatenation, on the first two add an
header to the image.
I'm currently focused on the first step.
To test the first step I generated a fake kernel image:
: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00  
0010: 00   .

and I passed it to the tool.
After some analysis I noticed that the header is in some way hased with the
current host time.
This is the reason why I present you the memory dump result and the current
host time.

Do 25. Dez 12:00:00 CET 2014
: 44 4c 4b 36 81 00 6b 80 f0 ff de 6f e0 bb 79 b6  DLK6..ko..y.
0010: 4c fb e8 86 25 3f 24 ae a0 f4 51 f9 69 07 ee e2  L...%?$...Q.i...
0020: 21 20 0a c4 ce 1b 28 f5 6e 18 94 88 e8 e6 cc 9f  ! (.n...
0030: ed f9 2b 9f c0 c4 3a f4 c7 ff 68 ca 53 36 20 b9  ..+...:...h.S6 .
0040: 0e 07 e3 b4 87 61 cb d0 82 ad 8e ab 4d f4 b0 98  .a..M...
0050: ff 04 24 2b cc 9f e6 07 39 00 00 00 ae d4 3d 54  ..$+9.=T
0060: 24 21 03 02 00 00 00 80 11 00 00 00 7d 2e 61 08  $!..}.a.
0070: 00 00 00 80 00 00 15 bf 00 10 00 00 e9 93 98 90  
0080: 4b 4f 8a 38 28 00 00 00 00 00 00 00 00 00 01 00  KO.8(...
0090: 00 00 00 00 00 00 00 00 00   .
Do 25. Dez 12:17:04 CET 2014
: 44 4c 4b 36 81 00 6b 7f 76 73 b4 73 45 4f b2 8d  DLK6..k.vs.sEO..
0010: f7 87 f3 f0 c1 e3 f2 c7 c2 2f 83 fa b0 a4 7e d8  ./~.
0020: b1 06 e6 e2 e6 65 fc 98 f8 bb b2 95 d4 9f 2f 99  .e/.
0030: b5 fa 65 b4 59 47 5f f9 9f e7 18 b9 d7 52 ba b9  ..e.YG_..R..
0040: 40 1d a4 c7 b8 0a 73 9b fa 13 6b b9 ec 53 1e fd  @.s...k..S..
0050: ff 04 24 2b cc a0 e6 07 39 00 00 00 ae d4 3d 53  ..$+9.=S
0060: 24 21 03 02 00 00 00 80 11 00 00 00 7d 2e 61 08  $!..}.a.
0070: 00 00 00 80 00 00 15 bf 00 10 00 00 e9 93 98 90  
0080: 4b 4f 8a 38 28 00 00 00 00 00 00 00 00 00 01 00  KO.8(...
0090: 00 00 00 00 00 00 00 00 00   .
So 28. Dez 12:49:00 CET 2014
: 44 4c 4b 36 81 00 6b 80 f0 ff de 6f e0 bb 79 b6  DLK6..ko..y.
0010: 4c fb e8 86 25 3f 24 ae a0 f4 51 f9 6e 07 ef e2  L...%?$...Q.n...
0020: 26 20 0b c4 c9 1b 29 f5 69 18 95 88 ef e6 cd 9f  & ).i...
0030: ea f9 2a 9f c7 c4 3b f4 c0 ff 69 ca 54 36 21 b9  ..*...;...i.T6!.
0040: 09 07 e2 b4 80 61 ca d0 85 ad 8f ab 4a f4 b1 98  .a..J...
0050: ff 04 24 2b cb 9f e7 07 39 00 00 00 ae d4 3d 54  ..$+9.=T
0060: 24 21 03 02 00 00 00 80 11 00 00 00 7d 2e 61 08  $!..}.a.
0070: 00 00 00 80 00 00 15 bf 00 10 00 00 e9 93 98 90  
0080: 4b 4f 8a 38 28 00 00 00 00 00 00 00 00 00 01 00  KO.8(...
0090: 00 00 00 00 00 00 00 00 00   .
Do 9. Feb 05:04:00 CET 2017
: 44 4c 4b 36 81 00 6b 80 f0 ff de 6f e0 bb 79 b6  DLK6..ko..y.
0010: 4c fb e8 86 25 3f 24 ae a0 f4 51 f9 69 06 ee ed  L...%?$...Q.i...
0020: 21 21 0a cb ce 1a 28 fa 6e 19 94 87 e8 e7 cc 90  !!(.n...
0030: ed f8 2b 90 c0 c5 3a fb c7 fe 68 c5 53 37 20 b6  ..+...:...h.S7 .
0040: 0e 06 e3 bb 87 60 cb df 82 ac 8e a4 4d f5 b0 97  .`..M...
0050: ff 04 24 2b cc 9e e6 08 39 00 00 00 ae d4 3d 54  ..$+9.=T
0060: 24 21 03 02 00 00 00 80 11 00 00 00 7d 2e 61 08  $!..}.a.
0070: 00 00 00 80 00 00 15 bf 00 10 00 00 e9 93 98 90  
0080: 4b 4f 8a 38 28 00 00 00 00 00 00 00 00 00 01 00  KO.8(...
0090: 00 00 00 00 00 00 00 00 00   .

Here the Fact I realized by analysis:

1) The first 6 8-bit are fixed : 44 4c 4b 36 81 00
2) Starting from the location 

Re: [LEDE-DEV] Adding support for dlink dwr-512

2016-10-16 Thread Giuseppe Lippolis
Mathias,
Thanks for the tips.
I'm going to work on it.

Bye.

> -Ursprüngliche Nachricht-
> Von: Mathias Kresin [mailto:d...@kresin.me]
> Gesendet: Sonntag, 16. Oktober 2016 09:54
> An: Giuseppe Lippolis <giu.lippo...@gmail.com>; lede-
> d...@lists.infradead.org
> Betreff: Re: [LEDE-DEV] Adding support for dlink dwr-512
> 
> Hi Giuseppe,
> 
> find a few remarks inline.
> 
> 16.10.2016 00:03, Giuseppe Lippolis:
> > Hi all,
> > I'm proceeding to finalize the support:
> > Now the wifi is enabled, the LEDs and the buttons are supported.
> >
> > To complete the device support I need to:
> > 1. enable the 3G modem
> > 2. crack the header file to generate the factory image
> 
> Run the strings command on the binboy binary. The binary includes some
> text which looks to me like the description of different headers.
> 
> It might be possible that there is already a tool for writing the binboy
header
> in tools/firmware-utils.
> 
> >
> > Will take some time.
> >
> > In the meantime, here the patch:
> >
> > diff --git a/target/linux/ramips/base-files/etc/board.d/02_network
> > b/target/linux/ramips/base-files/etc/board.d/02_network
> > index c8b57ca..719078c 100755
> > --- a/target/linux/ramips/base-files/etc/board.d/02_network
> > +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> > @@ -71,6 +71,7 @@ ramips_setup_interfaces()
> > dir-320-b1|\
> > dir-610-a1|\
> > dir-615-h1|\
> > +   dwr-512-b|\
> > firewrt|\
> > hlk-rm04|\
> > mac1200rv2|\
> > diff --git a/target/linux/ramips/base-files/lib/ramips.sh
> > b/target/linux/ramips/base-files/lib/ramips.sh
> > index bb379f7..a0f041e 100755
> > --- a/target/linux/ramips/base-files/lib/ramips.sh
> > +++ b/target/linux/ramips/base-files/lib/ramips.sh
> > @@ -154,6 +154,9 @@ ramips_board_detect() {
> > *"DIR-860L B1")
> > name="dir-860l-b1"
> > ;;
> > +   *"DWR-512 B")
> > +   name="dwr-512-b"
> > +   ;;
> > *"Dovado Tiny AC")
> > name="tiny-ac"
> > ;;
> > diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> > b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> > index 0ef2308..36ea469 100755
> > --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> > +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> > @@ -50,6 +50,7 @@ platform_check_image() {
> > dir-620-a1|\
> > dir-620-d1|\
> > dir-810l|\
> > +   dwr-512-b|\
> > duzun-dm06|\
> > e1700|\
> > esr-9753|\
> > diff --git a/target/linux/ramips/dts/DWR-512-B.dts
> > b/target/linux/ramips/dts/DWR-512-B.dts
> > index e69de29..2a69ce7 100644
> > --- a/target/linux/ramips/dts/DWR-512-B.dts
> > +++ b/target/linux/ramips/dts/DWR-512-B.dts
> > @@ -0,0 +1,109 @@
> > +/dts-v1/;
> > +
> > +/include/ "rt5350.dtsi"
> > +
> > +/ {
> > +   compatible = "ralink,rt5350-soc";
> > +   model = "D-Link DWR-512 B";
> > +
> > +   gpio-keys-polled {
> > +   compatible = "gpio-keys-polled";
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +   poll-interval = <20>;
> > +
> > +   wps {
> > +   label = "wps";
> > +   gpios = < 0 1>;
> > +   linux,code = <0x211>;
> > +   };
> > +   };
> > +
> > +   gpio-leds {
> > +   compatible = "gpio-leds";
> > +
> > +   sms {
> > +   label = "dwr-512-b:green:sms";
> > +   gpios = < 8 1>;
> > +   };
> > +   status {
> > +   label = "dwr-512-b:green:status";
> > +   gpios = < 9 1>;
> > +   };
> > +   2g {
> > +   label = "dwr-512-b:green:2g";
> > +   gpios = < 17 1>;
> > +   };
> > +   3g {
> > +   label = "dwr-512-b:green:3g";
> > +   gpios = < 19 1>;
> > +   };
> > +   sstrengthr {
> > +   label = "dwr-512-b:red:sigstrength";
> > +   gpios = < 20 1>;
> > +   };
> > +

Re: [LEDE-DEV] Adding support for dlink dwr-512

2016-10-03 Thread Giuseppe Lippolis
Hi Mathias,

> > use the "KERNEL := kernel-bin | patch-dtb | lzma" config  instead?
> 
> Well, that is exactly the KERNEL line I've send in my last mail. Not 
> sure
if I get
> what you are asking here. But such a kernel works for most of the 
> rt305x devices.

In your previous email your advice was: 
   KERNEL := kernel-bin | append-dtb | lzma

The difference is patch-dtb against append-dtb.

> > 1) From my understanding the append-dtb seems to append the dtb 
> > after the kernel. But in this way in my opinion the kernel cannot 
> > point to the dbt (remember that currently It seems that the oem 
> > bootloader cannot pass kernel parameter).
> > In the
> > build_dir/target-mipsel_24kc_musl-1.1.15/linux-ramips_rt305x/linux-4
> > .4 .23/ar ch/mips/ralink/of.c the __dt_setup_arch(&__image_dtb); 
> > point to the __image_dtb area embedded in the kernel. This area 
> > should be populated after the compilation process by the patch-dtb 
> > tool. Shall I use the "KERNEL := kernel-bin | patch-dtb | lzma" 
> > config  instead?

Can you please confirm my understanding



> > what shall I do to propagate the change effect in the 
> > target/linux/ramips/image/rt305x.mk
> b/target/linux/ramips/image/rt305x.mk?
> 
> The contents of the lede-ramips-rt305x-dwr-512-b* files should be 
> different. Please ignore the remaining files in the directory. These 
> are generic files which are generated due to the fact that some rt305x 
> boards are still using the old build code. These files are _not_ 
> specific for your board.
> 
> As written in my last mail. You will find the kernel generated for 
> your board in
build_dir/target-mipsel_24kc_musl-1.1.15/linux-ramips_rt305x/.
> 
> But at this point I would try to tftpboot the initramfs-kernel.bin 
> from uboot to check if everything works. Most bootloader do not 
> enforce a vendor specific header for images loaded via tftp.
> 
> > Currently the only way I found to apply a change in the target/linux/...
is:
> > Make distclean
> > Make menuconfig
> > Make

With the current change in the target/linux/ramips/image/rt305x.mk :
+  KERNEL := kernel-bin | patch-dtb | lzma  IMAGES := factory.bin  
+ IMAGE/factory.bin := \
+   append-kernel

I'm able (after make distclean, make menuconfig, make) to find in
bin/targets/ramips/rt305x/ the image
lede-ramips-rt305x-dwr-512-b-squashfs-factory.bin

This seems to be exactly what I'm looking for (vmlinux lzma compressed with
device tree embedded).

> make target/linux/{clean,install} should work.
This cmd works as expected.

Thanks,
I'm going to test the new fw.



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] Adding support for dlink dwr-512

2016-10-02 Thread Giuseppe Lippolis
Dear Mathias,
thanks for your info.

Just a couple of question before to proceed.

1) From my understanding the append-dtb seems to append the dtb after the
kernel. But in this way in my opinion the kernel cannot point to the dbt
(remember that currently It seems that the oem bootloader cannot pass kernel
parameter). 
In the
build_dir/target-mipsel_24kc_musl-1.1.15/linux-ramips_rt305x/linux-4.4.23/ar
ch/mips/ralink/of.c the __dt_setup_arch(&__image_dtb); point to the
__image_dtb area embedded in the kernel. This area should be populated after
the compilation process by the patch-dtb tool. Shall I use the "KERNEL :=
kernel-bin | patch-dtb | lzma" config  instead?

2) Currently I make this patch

diff --git a/target/linux/ramips/image/rt305x.mk
b/target/linux/ramips/image/rt305x.mk
index be21ac4..f768785 100644
--- a/target/linux/ramips/image/rt305x.mk
+++ b/target/linux/ramips/image/rt305x.mk
@@ -168,6 +168,17 @@ endef
 TARGET_DEVICES += dir-620-d1


+define Device/dwr-512-b
+  DTS := DWR-512-B
+  KERNEL := kernel-bin | patch-dtb | lzma
+  IMAGES := factory.bin
+  IMAGE/factory.bin := \
+   append-kernel
+  DEVICE_TITLE := D-Link DWR-512 B
+endef
+TARGET_DEVICES += dwr-512-b

But If run the make script I get the same files I had before in the
bin/targets/ramips/rt305x/
lede-ramips-rt305x-dwr-512-b-initramfs-kernel.bin  
lede-ramips-rt305x-dwr-512-b-squashfs-factory.bin
lede-ramips-rt305x-dwr-512-b-squashfs-sysupgrade.bin  
lede-ramips-rt305x-root.squashfs   
lede-ramips-rt305x-uImage-initramfs.bin
lede-ramips-rt305x-uImage.bin 
lede-ramips-rt305x-vmlinux-initramfs.bin   
lede-ramips-rt305x-vmlinux-initramfs.elf
lede-ramips-rt305x-vmlinux.bin
lede-ramips-rt305x-vmlinux.elf


what shall I do to propagate the change effect in the
target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk?
Currently the only way I found to apply a change in the target/linux/... is:
Make distclean
Make menuconfig
Make

But this is annoying (every time recompile all). Do you have some advice
about?

Thanks.



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev