Hello
I own an Edimax NS 2502, which is a NAS based on StormLinix 3516.
I successfully upgraded it with a recent Linux.
The DTB I use is the following:
/dts-v1/;
#include "gemini.dtsi"
#include <dt-bindings/input/input.h>
/ {
model = "Edimax NS-2502";
compatible = "edimax,ns-2502", "cortina,gemini";
#address-cells = <1>;
#size-cells = <1>;
memory@0 {
/* 128 MB */
device_type = "memory";
reg = <0x00000000 0x8000000>;
};
chosen {
bootargs = "console=ttyS0,19200n8";
stdout-path = &uart0;
};
mdio0: ethernet-phy {
compatible = "virtual,mdio-gpio";
gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */
<&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */
#address-cells = <1>;
#size-cells = <0>;
phy0: ethernet-phy@1 {
reg = <1>;
device_type = "ethernet-phy";
};
};
soc {
flash@30000000 {
status = "okay";
/* 8MB of flash */
reg = <0x30000000 0x00800000>;
partition@0 {
label = "RedBoot";
reg = <0x00000000 0x00020000>;
read-only;
};
partition@20000 {
label = "kernel";
reg = <0x00020000 0x00700000>;
};
partition@720000 {
label = "VCTL";
reg = <0x00720000 0x00020000>;
read-only;
};
partition@740000 {
label = "CurConf";
reg = <0x00740000 0x000a0000>;
read-only;
};
partition@7e0000 {
label = "FIS";
reg = <0x007e0000 0x00010000>;
read-only;
};
};
syscon: syscon@40000000 {
pinctrl {
/*
* gpio0agrp cover line 0-4
* gpio0bgrp cover line 5
*/
gpio0_default_pins: pinctrl-gpio0 {
mux {
function = "gpio0";
groups = "gpio0agrp",
"gpio0bgrp";
};
};
};
};
gpio0: gpio@4d000000 {
pinctrl-names = "default";
pinctrl-0 = <&gpio0_default_pins>;
};
ethernet@60000000 {
status = "okay";
ethernet-port@0 {
phy-mode = "rgmii";
phy-handle = <&phy0>;
};
ethernet-port@1 {
/* Not used in this platform */
};
};
usb@68000000 {
status = "okay";
};
usb@69000000 {
status = "okay";
};
};
};
This is a bit of copy paste of other DTB.
With it I boot successfully to a shell.
BUT neither ethernet nor USB works.
This is the bootlog:
Flash Block Size = 65536
Storlink SL351x Boot Loader [Linux], version 1.0.9
Built by linux, 10:50:46, Aug 6 2008
Processor: SL3516c2
CPU Rate: 300000000
AHB Bus Clock:150MHz Ratio:2/1
MAC 1 Address: 00:00:25:02:00:00
MAC 2 Address: 00:01:25:02:00:00
inet addr: 192.168.1.237/255.255.255.0
==> enter ^C to abort booting within 2 seconds ......
Load Kern image from 0x30020000 to 0x800000 size 7340032
Booting Linux on physical CPU 0x0
Linux version 5.12.0-rc5-next-20210401+ (compile@Red) (armv7a-unknown-linux-gnueabihf-gcc (Gentoo 9.3.0-r2 p4) 9.3.0, GNU ld (Gentoo 2.34 p6) 2.34.0) #47 PREEMPT Mon Apr 5 20:20:27 CEST 2021
CPU: FA526 [66015261] revision 1 (ARMv4), cr=0000397f
CPU: VIVT data cache, VIVT instruction cache
OF: fdt: Machine model: Edimax NS-2502
Memory policy: Data cache writeback
Zone ranges:
Normal [mem 0x0000000000000000-0x0000000007ffffff]
HighMem empty
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x0000000000000000-0x0000000007ffffff]
Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
Built 1 zonelists, mobility grouping on. Total pages: 32512
Kernel command line: console=ttyS0,19200n8
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
mem auto-init: stack:off, heap alloc:off, heap free:off
Memory: 119300K/131072K available (4922K kernel code, 577K rwdata, 1344K rodata, 3340K init, 212K bss, 11772K reserved, 0K cma-reserved, 0K highmem)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
rcu: Preemptible hierarchical RCU implementation.
Trampoline variant of Tasks RCU enabled.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
random: get_random_bytes called from start_kernel+0x2fc/0x4f0 with crng_init=0
clocksource: FTTMR010-TIMER2: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 76450417870 ns
sched_clock: 32 bits at 25MHz, resolution 40ns, wraps every 85899345900ns
Switching to timer-based delay loop, resolution 40ns
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 50.00 BogoMIPS (lpj=250000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x81e0 - 0x8228
rcu: Hierarchical SRCU implementation.
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: -1, 3072 bytes, linear)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
thermal_sys: Registered thermal governor 'step_wise'
No ATAGs?
pinctrl-gemini 40000000.syscon:pinctrl: detected 3516 chip variant
pinctrl-gemini 40000000.syscon:pinctrl: GLOBAL MISC CTRL at boot: 0x83c22037
pinctrl-gemini 40000000.syscon:pinctrl: flash pin is not set
pinctrl-gemini 40000000.syscon:pinctrl: initialized Gemini pin control driver
random: fast init done
pl08xdmac 67000000.dma-controller: FTDMAC020 1.16 rel 1
pl08xdmac 67000000.dma-controller: FTDMAC020 4 channels, has built-in bridge, AHB0 and AHB1, supports linked lists
pl08xdmac 67000000.dma-controller: initialized 4 virtual memcpy channels
pl08xdmac 67000000.dma-controller: DMA: PL080 rev0 at 0x67000000 irq 27
Gemini SoC 3516 revision c2, set arbitration 00200030
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
clocksource: Switched to clocksource FTTMR010-TIMER2
NET: Registered protocol family 2
IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
NET: Registered protocol family 1
Initialise system trusted keyrings
workingset: timestamp_bits=30 max_order=15 bucket_order=0
romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
NET: Registered protocol family 38
Key type asymmetric registered
Asymmetric key parser 'x509' registered
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
io scheduler mq-deadline registered
io scheduler kyber registered
ftgpio010-gpio 4d000000.gpio: FTGPIO010 @(ptrval) registered
ftgpio010-gpio 4e000000.gpio: FTGPIO010 @(ptrval) registered
ftgpio010-gpio 4f000000.gpio: FTGPIO010 @(ptrval) registered
Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
printk: console [ttyS0] disabled
42000000.serial: ttyS0 at MMIO 0x42000000 (irq = 18, base_baud = 3000000) is a 16550A
printk: console [ttyS0] enabled
brd: module loaded
physmap-flash 30000000.flash: no enabled pin control state
physmap-flash 30000000.flash: no disabled pin control state
physmap-flash 30000000.flash: initialized Gemini-specific physmap control
physmap-flash 30000000.flash: physmap platform flash device: [mem 0x30000000-0x307fffff]
30000000.flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x0000c2 Chip ID 0x0022cb
Support for command set 0002 not present
gen_probe: No supported Vendor Command Set found
physmap-flash 30000000.flash: map_probe failed
libphy: Fixed MDIO Bus: probed
mdio-gpio ethernet-phy: failed to get alias id
libphy: GPIO Bitbanged MDIO: probed
tun: Universal TUN/TAP device driver, 1.6
gmac-gemini 60000000.ethernet: Ethernet device ID: 0x000, revision 0x1
gemini-ethernet-port 60008000.ethernet-port: probe 60008000.ethernet-port ID 0
gemini-ethernet-port 60008000.ethernet-port: using a random ethernet address
RTL8211B Gigabit Ethernet gpio-0:01: attached PHY driver (mii_bus:phy_addr=gpio-0:01, irq=POLL)
gemini-ethernet-port 60008000.ethernet-port eth0: irq 30, DMA @ 0x0x60008000, GMAC @ 0x0x6000a000
gemini-ethernet-port 6000c000.ethernet-port: probe 6000c000.ethernet-port ID 1
gemini-ethernet-port 6000c000.ethernet-port: using a random ethernet address
gemini-ethernet-port 6000c000.ethernet-port (unnamed net_device) (uninitialized): PHY init failed
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
fotg210_hcd: FOTG210 Host Controller (EHCI) Driver
fotg210-hcd 68000000.usb: Faraday USB2.0 Host Controller
fotg210-hcd 68000000.usb: new USB bus registered, assigned bus number 1
fotg210-hcd 68000000.usb: irq 28, io mem 0x68000000
fotg210-hcd 68000000.usb: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
fotg210-hcd 69000000.usb: Faraday USB2.0 Host Controller
fotg210-hcd 69000000.usb: new USB bus registered, assigned bus number 2
fotg210-hcd 69000000.usb: irq 29, io mem 0x69000000
fotg210-hcd 69000000.usb: USB 2.0 started, EHCI 1.00
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
usbcore: registered new interface driver usb-storage
rtc-ftrtc010 45000000.rtc: registered as rtc0
rtc-ftrtc010 45000000.rtc: setting system clock to 1970-01-01T00:00:00 UTC (0)
gemini-poweroff 4b000000.power-controller: other power management IRQ
gemini-poweroff 4b000000.power-controller: Gemini poweroff driver registered
ftwdt010-wdt 41000000.watchdog: FTWDT010 watchdog driver enabled
device-mapper: ioctl: 4.45.0-ioctl (2021-03-22) initialised: [email protected]
NET: Registered protocol family 10
Segment Routing with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
8021q: 802.1Q VLAN Support v1.8
Loading compiled-in X.509 certificates
Freeing unused kernel memory: 3340K
Kernel memory protection not selected by kernel config.
Run /init as init process
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: random: dd: uninitialized urandom read (512 bytes read)
OK
Starting network: OK
random: crng init done
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
Starting sshd: OK
Welcome to Buildroot
ns2502 login: root
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether b6:95:3c:18:98:62 brd ff:ff:ff:ff:ff:ff
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
# udhcpc -i eth0
udhcpc: started, v1.33.0
gmac-gemini 60000000.ethernet: allocate 512 pages for queue
gemini-ethernet-port 60008000.ethernet-port eth0: Unsupported PHY speed (-1) on gpio-0:01
gemini-ethernet-port 60008000.ethernet-port eth0: Link is Down
gemini-ethernet-port 60008000.ethernet-port eth0: link flow control: none
udhcpc: socket: Address family not supported by protocol
# gemini-ethernet-port 60008000.ethernet-port eth0: Link is Up - 1Gbps/Full - flow control rx/tx
gemini-ethernet-port 60008000.ethernet-port eth0: link flow control: tx
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
# udhcpc -i eth0
udhcpc: started, v1.33.0
udhcpc: socket: Address family not supported by protocol
Inserting an USB dongle give nothing.
As shown, udhcp cannot get an IP.
Setting one at hand does not fix anything, ping fail.
Can someone help me bring up at least ethernet ?
Thanks
On Mon, Apr 05, 2021 at 08:39:54PM +0200, Corentin Labbe wrote:
> mdio0: ethernet-phy {
Not relevant to the brokennes, but this should not be called
ethernet-phy. The example given in
Documentation/devicetree/bindings/net/mdio-gpio.txt is
mdio0: mdio
> compatible = "virtual,mdio-gpio";
> gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */
> <&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */
> #address-cells = <1>;
> #size-cells = <0>;
> phy0: ethernet-phy@1 {
> reg = <1>;
> device_type = "ethernet-phy";
> };
> };
So you are using a bit-banging MDIO bus.
> gpio0: gpio@4d000000 {
> pinctrl-names = "default";
> pinctrl-0 = <&gpio0_default_pins>;
> };
and here is the gpio controller.
> ethernet@60000000 {
> status = "okay";
> ethernet-port@0 {
> phy-mode = "rgmii";
> phy-handle = <&phy0>;
> };
> ethernet-port@1 {
> /* Not used in this platform */
> };
> };
and this look O.K.
> libphy: Fixed MDIO Bus: probed
> mdio-gpio ethernet-phy: failed to get alias id
That does not look too good. But it is just a warning.
if (pdev->dev.of_node) {
bus_id = of_alias_get_id(pdev->dev.of_node, "mdio-gpio");
if (bus_id < 0) {
dev_warn(&pdev->dev, "failed to get alias id\n");
bus_id = 0;
}
If you look at the example in the documentation, it has
aliases {
mdio-gpio0 = &mdio0;
};
If you add that, i guess this will go away.
> libphy: GPIO Bitbanged MDIO: probed
> tun: Universal TUN/TAP device driver, 1.6
> gmac-gemini 60000000.ethernet: Ethernet device ID: 0x000, revision 0x1
> gemini-ethernet-port 60008000.ethernet-port: probe 60008000.ethernet-port ID 0
> gemini-ethernet-port 60008000.ethernet-port: using a random ethernet address
> RTL8211B Gigabit Ethernet gpio-0:01: attached PHY driver (mii_bus:phy_addr=gpio-0:01, irq=POLL)
So a realtek PHY has been found on the MDIO bus. Good.
> gemini-ethernet-port 60008000.ethernet-port eth0: irq 30, DMA @ 0x0x60008000, GMAC @ 0x0x6000a000
and everything looks good.
> gemini-ethernet-port 6000c000.ethernet-port: probe 6000c000.ethernet-port ID 1
> gemini-ethernet-port 6000c000.ethernet-port: using a random ethernet address
> gemini-ethernet-port 6000c000.ethernet-port (unnamed net_device) (uninitialized): PHY init failed
And now it seems to of all gone horribly wrong :-(
This is the second Ethernet interface, the one you have commented as
/* Not used in this platform */
I _think_ you just need to delete the entry, otherwise it tried to
probe it. And then that probe fails, it looks like it also fails the
working interface :-(
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> inet 127.0.0.1/8 scope host lo
> valid_lft forever preferred_lft forever
> inet6 ::1/128 scope host
> valid_lft forever preferred_lft forever
> 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
> link/ether b6:95:3c:18:98:62 brd ff:ff:ff:ff:ff:ff
> 3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
> link/sit 0.0.0.0 brd 0.0.0.0
> # udhcpc -i eth0
> udhcpc: started, v1.33.0
> gmac-gemini 60000000.ethernet: allocate 512 pages for queue
> gemini-ethernet-port 60008000.ethernet-port eth0: Unsupported PHY speed (-1) on gpio-0:01
> gemini-ethernet-port 60008000.ethernet-port eth0: Link is Down
> gemini-ethernet-port 60008000.ethernet-port eth0: link flow control: none
> udhcpc: socket: Address family not supported by protocol
> # gemini-ethernet-port 60008000.ethernet-port eth0: Link is Up - 1Gbps/Full - flow control rx/tx
> gemini-ethernet-port 60008000.ethernet-port eth0: link flow control: tx
> IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
>
> # udhcpc -i eth0
> udhcpc: started, v1.33.0
> udhcpc: socket: Address family not supported by protocol
That suggests the kernel you have build does not have PF_PACKET.
Enable CONFIG_PACKET_DIAG.
Andrew
On Mon, Apr 5, 2021 at 8:39 PM Corentin Labbe <[email protected]> wrote:
> I own an Edimax NS 2502, which is a NAS based on StormLinix 3516.
> I successfully upgraded it with a recent Linux.
Pretty cool!
> mdio0: ethernet-phy {
> compatible = "virtual,mdio-gpio";
> gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */
> <&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */
> #address-cells = <1>;
> #size-cells = <0>;
> phy0: ethernet-phy@1 {
> reg = <1>;
> device_type = "ethernet-phy";
> };
> };
This looks like the most typical way to attach an MDIO phy.
I always try to identify the exact component used on the board. Do you have
a high res board photo?
Realtek RTL82111 is the most common configuration.
Compare to the D-Linux DNS-313 DTS:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/gemini-dlink-dns-313.dts
Try just copying the whole pinctrl-gmii section!
> syscon: syscon@40000000 {
> pinctrl {
> /*
> * gpio0agrp cover line 0-4
> * gpio0bgrp cover line 5
> */
> gpio0_default_pins: pinctrl-gpio0 {
> mux {
> function = "gpio0";
> groups = "gpio0agrp",
> "gpio0bgrp";
> };
> };
Change groups to
groups = "gpio0agrp", "gpio0bgrp", "gpio0hgrp";
So you mux in group h which is where the GPIO 21, 22 go out
to the MDIO on 3516 IIUC. The right mux out is pretty important,
if you have vendor source code, please share so I can check how
they set it up.
> BUT neither ethernet nor USB works.
For USB try this patch:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/commit/?h=gemini-usb&id=cbaf6cdf770b90de5f10bfa5112c679f1dffe948
Pls report progress! I hope we can mainline this device.
Yours,
Linus Walleij
Le Mon, Apr 05, 2021 at 10:36:32PM +0200, Andrew Lunn a ?crit :
> On Mon, Apr 05, 2021 at 08:39:54PM +0200, Corentin Labbe wrote:
[ ... ]
> > libphy: Fixed MDIO Bus: probed
> > mdio-gpio ethernet-phy: failed to get alias id
>
> That does not look too good. But it is just a warning.
>
> if (pdev->dev.of_node) {
> bus_id = of_alias_get_id(pdev->dev.of_node, "mdio-gpio");
> if (bus_id < 0) {
> dev_warn(&pdev->dev, "failed to get alias id\n");
> bus_id = 0;
> }
>
> If you look at the example in the documentation, it has
>
> aliases {
> mdio-gpio0 = &mdio0;
> };
>
> If you add that, i guess this will go away.
>
Hello
Yes it go away with this
> > gemini-ethernet-port 6000c000.ethernet-port: probe 6000c000.ethernet-port ID 1
> > gemini-ethernet-port 6000c000.ethernet-port: using a random ethernet address
> > gemini-ethernet-port 6000c000.ethernet-port (unnamed net_device) (uninitialized): PHY init failed
>
> And now it seems to of all gone horribly wrong :-(
>
> This is the second Ethernet interface, the one you have commented as
>
> /* Not used in this platform */
>
> I _think_ you just need to delete the entry, otherwise it tried to
> probe it. And then that probe fails, it looks like it also fails the
> working interface :-(
Deleting the entry did no change. It still try to probe it.
I will try to delete second interface in gemini.dtsi just in case...
> > # udhcpc -i eth0
> > udhcpc: started, v1.33.0
> > udhcpc: socket: Address family not supported by protocol
>
> That suggests the kernel you have build does not have PF_PACKET.
> Enable CONFIG_PACKET_DIAG.
Yes adding it fixed this error message.
Thanks
Le Tue, Apr 06, 2021 at 10:15:51AM +0200, Linus Walleij a ?crit :
> On Mon, Apr 5, 2021 at 8:39 PM Corentin Labbe <[email protected]> wrote:
>
> > I own an Edimax NS 2502, which is a NAS based on StormLinix 3516.
> > I successfully upgraded it with a recent Linux.
>
> Pretty cool!
>
> > mdio0: ethernet-phy {
> > compatible = "virtual,mdio-gpio";
> > gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */
> > <&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */
> > #address-cells = <1>;
> > #size-cells = <0>;
> > phy0: ethernet-phy@1 {
> > reg = <1>;
> > device_type = "ethernet-phy";
> > };
> > };
>
> This looks like the most typical way to attach an MDIO phy.
>
> I always try to identify the exact component used on the board. Do you have
> a high res board photo?
>
Hello
You could find photos at http://kernel.montjoie.ovh/gemini/
There are also photos of another SL3516 SoC based device (a SSI 1328 NAS), but I fail to setup a serial on it, so I keep it for later.
> Realtek RTL82111 is the most common configuration.
>
> Compare to the D-Linux DNS-313 DTS:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/gemini-dlink-dns-313.dts
>
> Try just copying the whole pinctrl-gmii section!
>
>
> > syscon: syscon@40000000 {
> > pinctrl {
> > /*
> > * gpio0agrp cover line 0-4
> > * gpio0bgrp cover line 5
> > */
> > gpio0_default_pins: pinctrl-gpio0 {
> > mux {
> > function = "gpio0";
> > groups = "gpio0agrp",
> > "gpio0bgrp";
> > };
> > };
>
> Change groups to
>
> groups = "gpio0agrp", "gpio0bgrp", "gpio0hgrp";
>
> So you mux in group h which is where the GPIO 21, 22 go out
> to the MDIO on 3516 IIUC. The right mux out is pretty important,
> if you have vendor source code, please share so I can check how
> they set it up.
>
No change, probably due to all pinctrl-gemini 40000000.syscon:pinctrl: could not map pin config for "R8 GMAC0 RXDV"
Please see http://kernel.montjoie.ovh/gemini/bootlog6.txt , I have added some pr_info in gmac.
I have put in the directory, the final dtb which I use.
The vendor source could be found at https://www.edimax.com/edimax/mw/cufiles/files/download/OpenSourceCode/transfer/Wireless/NAS/NAS-GPL-source.zip
> > BUT neither ethernet nor USB works.
>
> For USB try this patch:
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/commit/?h=gemini-usb&id=cbaf6cdf770b90de5f10bfa5112c679f1dffe948
>
One of the USB port is now working.
> Pls report progress! I hope we can mainline this device.
>
I hope too.
Note that I have also started to work on the gemini crypto driver.
Thanks for your help
On Tue, Apr 6, 2021 at 2:05 PM Corentin Labbe <[email protected]> wrote:
> You could find photos at http://kernel.montjoie.ovh/gemini/
> There are also photos of another SL3516 SoC based device (a SSI 1328 NAS), but I fail to setup a serial on it, so I keep it for later.
Yeah it is clearly an RTL82111 at least, so this should be possible
to get going.
> > > syscon: syscon@40000000 {
> > > pinctrl {
> > > /*
> > > * gpio0agrp cover line 0-4
> > > * gpio0bgrp cover line 5
> > > */
> > > gpio0_default_pins: pinctrl-gpio0 {
> > > mux {
> > > function = "gpio0";
> > > groups = "gpio0agrp",
> > > "gpio0bgrp";
> > > };
> > > };
> >
> > Change groups to
> >
> > groups = "gpio0agrp", "gpio0bgrp", "gpio0hgrp";
> >
> > So you mux in group h which is where the GPIO 21, 22 go out
> > to the MDIO on 3516 IIUC. The right mux out is pretty important,
> > if you have vendor source code, please share so I can check how
> > they set it up.
>
> No change, probably due to all pinctrl-gemini 40000000.syscon:pinctrl: could not map pin config for "R8 GMAC0 RXDV"
> Please see http://kernel.montjoie.ovh/gemini/bootlog6.txt , I have added some pr_info in gmac.
> I have put in the directory, the final dtb which I use.
All this is wrong too:
pinctrl-gemini 40000000.syscon:pinctrl: could not map pin config for
"R8 GMAC0 RXDV"
pinctrl-gemini 40000000.syscon:pinctrl: could not map pin config for
"U11 GMAC1 RXDV"
(...)
This is because we copied the DT config from a 3512 device rather than
3516 ... totally different pins. :/ R8 is the pin on 3512 so they all need
to change to e.g. from "R8 GMAC0 RXDV" to "V8 GMAC0 RXDV".
We need to come up with something unique for this device.
The code for mux is in drivers/pinctrl/pinctrl-gemini.c but can be a bit
terse. This file contains both 3512 and 3516 drivers so check closely
that you are looking at the right variant. The right pin names are in
the array gemini_3516_pins[].
The tricky thing is that I have never seen a SL3516 connected directly to
a simple phy like 82111. They all connect to some kind of switch chip...
So we need to figure out the muxing and pin config for this set-up.
This is what the DIR-685 is using for GMAC0:
pinctrl-gmii {
mux {
function = "gmii";
groups = "gmii_gmac0_grp";
};
conf0 {
pins = "V8 GMAC0
RXDV", "T10 GMAC1 RXDV",
"Y7 GMAC0 RXC",
"Y11 GMAC1 RXC",
"T8 GMAC0 TXEN",
"W11 GMAC1 TXEN",
"U8 GMAC0 TXC",
"V11 GMAC1 TXC",
"W8 GMAC0 RXD0",
"V9 GMAC0 RXD1",
"Y8 GMAC0 RXD2",
"U9 GMAC0 RXD3",
"T7 GMAC0 TXD0",
"U6 GMAC0 TXD1",
"V7 GMAC0 TXD2",
"U7 GMAC0 TXD3",
"Y12 GMAC1 RXD0",
"V12 GMAC1 RXD1",
"T11 GMAC1 RXD2",
"W12 GMAC1 RXD3",
"U10 GMAC1 TXD0",
"Y10 GMAC1 TXD1",
"W10 GMAC1 TXD2",
"T9 GMAC1 TXD3";
skew-delay = <7>;
};
/* Set up drive strength on
GMAC0 to 16 mA */
conf1 {
groups = "gmii_gmac0_grp";
drive-strength = <16>;
};
};
But maybe your device is using GMAC1? I would try GMAC0 first anyway.
> The vendor source could be found at https://www.edimax.com/edimax/mw/cufiles/files/download/OpenSourceCode/transfer/Wireless/NAS/NAS-GPL-source.zip
Normally the kernel should be setting up device resources and
config under arch/arm/mach-sl2312 (never mind the ASIC number...)
but Storlink have hacked the kernel all over the place so the
relevant parts can be hard to find.
The interesting stuff relating to pin control appears when
you grep for SL2312_GLOBAL_BASE.
When the kernel boots some essentials are set up
already in init/main.c (hacky!). But it seems to be the same
as in all Storlink devices.
This part in drivers/net/sl2312_emac.c looks quite interesting:
#ifdef CONFIG_SL3516_ASIC
{
unsigned int val;
/* set GMAC global register */
val = readl(GMAC_GLOBAL_BASE_ADDR+0x10);
val = val | 0x005a0000;
writel(val,GMAC_GLOBAL_BASE_ADDR+0x10);
writel(0x07f007f0,GMAC_GLOBAL_BASE_ADDR+0x1c);
writel(0x77770000,GMAC_GLOBAL_BASE_ADDR+0x20);
writel(0x77770000,GMAC_GLOBAL_BASE_ADDR+0x24);
val = readl(GMAC_GLOBAL_BASE_ADDR+0x04);
if((val&(1<<20))==0){ // GMAC1 enable
val = readl(GMAC_GLOBAL_BASE_ADDR+0x30);
val = (val & 0xe7ffffff) | 0x08000000;
writel(val,GMAC_GLOBAL_BASE_ADDR+0x30);
}
}
#endif
So we need to verify that this corresponds to what you set
up in your device tree (I do it by reading the data sheets and
coparing to the pinctrl-gemini.c code and defines...)
Then we have this:
/* define GPIO pin for MDC/MDIO */
// for gemini ASIC
#ifdef CONFIG_SL3516_ASIC
#define H_MDC_PIN 22
#define H_MDIO_PIN 21
#define G_MDC_PIN 22
#define G_MDIO_PIN 21
#else
(...)
This seems to correspond to your device tree so OK...
But it's annoying that we can't communicate with it.
This is usually because some other device is
"shading" the GPIO lines, i.e. hiding it.
drivers/net/sl_switch.c is not used on your platform (Vitesse switch)
and is a leftover from the Storlink reference design.
> > > BUT neither ethernet nor USB works.
> >
> > For USB try this patch:
> > https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/commit/?h=gemini-usb&id=cbaf6cdf770b90de5f10bfa5112c679f1dffe948
> >
>
> One of the USB port is now working.
Hey nice! :D
The USB patch is not very widely tested, so it may need some shaping
up.
> Note that I have also started to work on the gemini crypto driver.
I saw some nice debug prints! :D
I always wanted to get that to work, nice that you're working on
it!
Yours,
Linus Walleij
Le Wed, Apr 07, 2021 at 11:34:29AM +0200, Linus Walleij a ?crit :
> On Tue, Apr 6, 2021 at 2:05 PM Corentin Labbe <[email protected]> wrote:
>
> > You could find photos at http://kernel.montjoie.ovh/gemini/
> > There are also photos of another SL3516 SoC based device (a SSI 1328 NAS), but I fail to setup a serial on it, so I keep it for later.
>
> > > For USB try this patch:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/commit/?h=gemini-usb&id=cbaf6cdf770b90de5f10bfa5112c679f1dffe948
> > >
> >
> > One of the USB port is now working.
>
> Hey nice! :D
>
> The USB patch is not very widely tested, so it may need some shaping
> up.
>
Hello
It seems that USB is still a bit buggy, device are detected only if plugged before boot.
I hit a problem on the NS2502, sata drives does not work well:
gemini_sata_bridge 46000000.sata: SATA ID 00000e00, PHY ID: 01000100
gemini_sata_bridge 46000000.sata: set up the Gemini IDE/SATA nexus
pata_ftide010 63000000.ide: set up Gemini PATA0
pata_ftide010 63000000.ide: device ID 00000500, irq 27, reg [mem 0x63000000-0x63000fff]
pata_ftide010 63000000.ide: SATA0 (master) start
gemini_sata_bridge 46000000.sata: SATA0 PHY ready
pata_ftide010 63000000.ide: brought 1 bridges online
scsi host0: pata_ftide010
ata1: SATA max UDMA/133 irq 27
libphy: Fixed MDIO Bus: probed
libphy: GPIO Bitbanged MDIO: probed
ata1.00: qc timeout (cmd 0x27)
ata1.00: failed to read native max address (err_mask=0x4)
ata1.00: HPA support seems broken, skipping HPA handling
ata1.00: ATA-8: WDC WD10EAVS-00D7B1, 01.01A01, max UDMA/133
ata1.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 0/32)
scsi 0:0:0:0: Direct-Access ATA WDC WD10EAVS-00D 1A01 PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1
sd 0:0:0:0: [sda] Attached SCSI disk
tun: Universal TUN/TAP device driver, 1.6
gmac-gemini 60000000.ethernet: Ethernet device ID: 0x000, revision 0x1
gemini-ethernet-port 60008000.ethernet-port: probe 60008000.ethernet-port ID 0
gemini-ethernet-port 60008000.ethernet-port: Old MAC from hw 0x000000000000000000000000
gemini-ethernet-port 60008000.ethernet-port: HW ADDR FROM OF 00:1f:1f:8e:65:e2
gemini-ethernet-port 60008000.ethernet-port (unnamed net_device) (uninitialized): RGMII: set GMAC0 and GMAC1 to MII/RGMII mode
RTL8211B Gigabit Ethernet gpio-0:01: attached PHY driver (mii_bus:phy_addr=gpio-0:01, irq=POLL)
gemini-ethernet-port 60008000.ethernet-port eth0: irq 31, DMA @ 0x0x60008000, GMAC @ 0x0x6000a000
gemini-ethernet-port 6000c000.ethernet-port: probe 6000c000.ethernet-port ID 1
gemini-ethernet-port 6000c000.ethernet-port: ethernet address 0x000000000000000000000000 invalid
gemini-ethernet-port 6000c000.ethernet-port: using a random ethernet address
gemini-ethernet-port 6000c000.ethernet-port (unnamed net_device) (uninitialized): PHY init failed
rtc-ftrtc010 45000000.rtc: registered as rtc0
rtc-ftrtc010 45000000.rtc: setting system clock to 2021-05-05T18:49:18 UTC (1620240558)
gemini-poweroff 4b000000.power-controller: other power management IRQ
gemini-poweroff 4b000000.power-controller: Gemini poweroff driver registered
ata1: lost interrupt (Status 0x58)
ata1: lost interrupt (Status 0x58)
ftwdt010-wdt 41000000.watchdog: FTWDT010 watchdog driver enabled
device-mapper: ioctl: 4.45.0-ioctl (2021-03-22) initialised: [email protected]
sl3516-crypto 62000000.crypto: will run requests pump with realtime priority
sl3516-crypto 62000000.crypto: DEBUG: Register ecb(aes)
sl3516-crypto 62000000.crypto: Fallback for ecb-aes-sl3516 is ecb(aes-generic)
sl3516-crypto 62000000.crypto: SL3516 dev a00 rev 0
random: crng init done
sl3516-crypto 62000000.crypto: SL3516 DMA dev 0 rev 1
NET: Registered protocol family 17
Freeing unused kernel memory: 5320K
Kernel memory protection not selected by kernel config.
Run /init as init process
[...]
# crypsetup stuff
[...]
# mount /dev/mapper/backup /mnt/
ata1: lost interrupt (Status 0x50)
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.00: failed command: WRITE DMA
ata1.00: cmd ca/00:08:00:18:00/00:00:00:00:00/e0 tag 0 dma 4096 out
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }
ata1: soft resetting link
ata1.00: configured for UDMA/133
ata1.00: device reported invalid CHS sector 0
ata1: EH complete
ata1: lost interrupt (Status 0x50)
ata1.00: limiting speed to UDMA/100:PIO4
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.00: failed command: WRITE DMA
ata1.00: cmd ca/00:08:00:18:00/00:00:00:00:00/e0 tag 0 dma 4096 out
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }
ata1: soft resetting link
ata1.00: configured for UDMA/100
ata1.00: device reported invalid CHS sector 0
ata1: EH complete
ata1: lost interrupt (Status 0x50)
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.00: failed command: WRITE DMA
ata1.00: cmd ca/00:08:00:18:00/00:00:00:00:00/e0 tag 0 dma 4096 out
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }
ata1: soft resetting link
ata1.00: configured for UDMA/100
ata1.00: device reported invalid CHS sector 0
ata1: EH complete
ata1: lost interrupt (Status 0x50)
ata1.00: limiting speed to UDMA/33:PIO4
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.00: failed command: WRITE DMA
ata1.00: cmd ca/00:08:00:18:00/00:00:00:00:00/e0 tag 0 dma 4096 out
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }
ata1: soft resetting link
ata1.00: configured for UDMA/33
ata1.00: device reported invalid CHS sector 0
ata1: EH complete
ata1: lost interrupt (Status 0x50)
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.00: failed command: WRITE DMA
ata1.00: cmd ca/00:08:00:18:00/00:00:00:00:00/e0 tag 0 dma 4096 out
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }
ata1: soft resetting link
ata1.00: configured for UDMA/33
ata1.00: device reported invalid CHS sector 0
ata1: EH complete
ata1: lost interrupt (Status 0x50)
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.00: failed command: WRITE DMA
ata1.00: cmd ca/00:08:00:18:00/00:00:00:00:00/e0 tag 0 dma 4096 out
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }
ata1: soft resetting link
ata1.00: configured for UDMA/33
ata1.00: device reported invalid CHS sector 0
sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08 cmd_age=188s
sd 0:0:0:0: [sda] tag#0 Sense Key : 0x5 [current]
sd 0:0:0:0: [sda] tag#0 ASC=0x21 ASCQ=0x4
sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 18 00 00 00 08 00
blk_update_request: I/O error, dev sda, sector 6144 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0
blk_update_request: I/O error, dev sda, sector 6144 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0
Buffer I/O error on dev dm-0, logical block 0, lost sync page write
EXT4-fs (dm-0): I/O error while writing superblock
ata1: EH complete
EXT4-fs (dm-0): mount failed
It seems a problem soon after driver probe (qc timeout and HPA error).
Any idea ?
The SATA works well on my other board (SSI1328)
having one or two disk does not change the behavour.
Hi Corentin,
I will check the patches you posted too, sorry for being a bit busy
with some merge window and stuff.
On Wed, May 5, 2021 at 9:26 PM Corentin Labbe <[email protected]> wrote:
> It seems that USB is still a bit buggy, device are detected only if plugged before boot.
Yeah :/ I don't know that driver very well, only that others use it too
so there might be some people who can help. I haven't mainlined
that patch because there is something that seems wrong about it
but I'm not a USB guy.
> I hit a problem on the NS2502, sata drives does not work well:
(...)
> It seems a problem soon after driver probe (qc timeout and HPA error).
> Any idea ?
>
> The SATA works well on my other board (SSI1328)
> having one or two disk does not change the behavour.
Could be the SATA muxing, this thing in your device tree:
sata: sata@46000000 {
cortina,gemini-ata-muxmode = <0>;
cortina,gemini-enable-sata-bridge;
status = "okay";
};
cortina,gemini-ata-muxmode should be 3 for two harddisks
I think.
If that is correct then check if DMA is broken like on SQ201,
see drivers/ata/pata_ftide010.c and here:
/* This device has broken DMA, only PIO works */
if (of_machine_is_compatible("itian,sq201")) {
pi->mwdma_mask = 0;
pi->udma_mask = 0;
}
This had to be explicitly disabled for SQ201 to work and
I guess it must be broken electronics design (too long
leads, interference...) so try to put the compatible for your
board in there and see if the drive starts working. You should
be able to check the source code of the vendor tree to
see if they also turned off DMA, if they did then that is
a certain sign it has the same bug so you should make a
patch for it. Maybe it should rather be some "disable-dma"
flag in the DT node, the above is a bit ugly but works.
Yours,
Linus Walleij
Hi Linus, Coretin
On Thu, 6 May 2021 at 08:56, Linus Walleij <[email protected]> wrote:
> On Wed, May 5, 2021 at 9:26 PM Corentin Labbe <[email protected]> wrote:
>
> > It seems that USB is still a bit buggy, device are detected only if plugged before boot.
>
> Yeah :/ I don't know that driver very well, only that others use it too
> so there might be some people who can help. I haven't mainlined
> that patch because there is something that seems wrong about it
> but I'm not a USB guy.
Assuming I didn't read the wrong dts this machine is using the Faraday FOTG210.
FWIW the MStar/Sigmastar ARMv7 (and earlier I think) chips use
basically the same IP for USB host (FUSBH200).
There used to be a distinct driver for the host-only version but it
got removed at some point so I added support for it to the otg driver
in my tree and it sort of works.
It seems very picky about devices being hot plugged and doesn't seem
able to enumerate low speed/full speed devices at all.
Maybe we are seeing the same issues? I have a USB bus analyzer and I
intend to debug this at some point.
Adding support for USB on the MStar stuff is pretty far off but maybe
if I find something Coretin can test to see if it helps out there too.
Thanks,
Daniel
Le Thu, May 06, 2021 at 01:56:28AM +0200, Linus Walleij a ?crit :
> Hi Corentin,
>
> I will check the patches you posted too, sorry for being a bit busy
> with some merge window and stuff.
>
> On Wed, May 5, 2021 at 9:26 PM Corentin Labbe <[email protected]> wrote:
>
> > It seems that USB is still a bit buggy, device are detected only if plugged before boot.
>
> Yeah :/ I don't know that driver very well, only that others use it too
> so there might be some people who can help. I haven't mainlined
> that patch because there is something that seems wrong about it
> but I'm not a USB guy.
>
> > I hit a problem on the NS2502, sata drives does not work well:
> (...)
> > It seems a problem soon after driver probe (qc timeout and HPA error).
> > Any idea ?
> >
> > The SATA works well on my other board (SSI1328)
> > having one or two disk does not change the behavour.
>
> Could be the SATA muxing, this thing in your device tree:
>
> sata: sata@46000000 {
> cortina,gemini-ata-muxmode = <0>;
> cortina,gemini-enable-sata-bridge;
> status = "okay";
> };
>
> cortina,gemini-ata-muxmode should be 3 for two harddisks
> I think.
>
I used 0, and only the second slot was working.
Using 3 fixed both slots.
Thanks