Lamobo R1 broken networking on 21.02

Hello Guys,
After installing 21.02 latest snapshot into a lamobo bananapi R1 , I noticed that networking is not working . In the dmesg I can see errors referring to swconfig:

[    2.848451] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    2.858514] init: - preinit -
[    3.265901] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1
[    3.272070] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
ip: SIOCSIFFLAGS: No such device
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.
[    4.533023] random: jshn: uninitialized urandom read (4 bytes read)
[    4.561518] random: jshn: uninitialized urandom read (4 bytes read)
[    4.639144] random: jshn: uninitialized urandom read (4 bytes read)
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.
[    4.769626] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1
[    4.775743] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
ip: SIOCSIFFLAGS: No such device
ip: SIOCSIFFLAGS: Network is down
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
sendto(): Network unreachable
sendto(): Network unreachable
[    9.255115] F2FS-fs (loop0): Mounted with checkpoint version = 6147d0c3
[    9.262943] mount_root: overlay filesystem has not been fully initialized yet
[    9.270534] mount_root: switching to f2fs overlay
[    9.318865] urandom-seed: Seed file not found (/etc/urandom.seed)
[    9.387068] procd: - early -
[    9.390053] procd: - watchdog -
[    9.983054] procd: - watchdog -
[    9.986772] procd: - ubus -
[   10.009199] urandom_read: 3 callbacks suppressed
[   10.009210] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.040720] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.049200] random: ubusd: uninitialized urandom read (4 bytes read)
[   10.058803] procd: - init -
Please press Enter to activate this console.
[   10.486997] urngd: v1.0.2 started.
[   10.513670] kmodloader: loading kernel modules from /etc/modules.d/*
[   10.545585] random: crng init done
[   10.549005] random: 1 urandom warning(s) missed due to ratelimiting
[   10.595517] Loading modules backported from Linux version v5.10.42-0-g65859eca4dff
[   10.603177] Backport generated by backports.git v5.10.42-1-0-gbee5c545
[   10.631071] xt_time: kernel timezone is -0000
[   10.729500] PPP generic driver version 2.4.2
[   10.735301] NET: Registered protocol family 24
[   10.765448] rtl8192cu: Chip version 0x11
[   10.851949] rtl8192cu: Board Type 0
[   10.855670] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
[   10.861528] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[   10.870242] usbcore: registered new interface driver rtl8192cu
[   10.941840] kmodloader: done loading kernel modules from /etc/modules.d/*
[   18.751839] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1
[   18.757890] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
[   18.777546] br-lan: port 1(eth0.1) entered blocking state
[   18.783084] br-lan: port 1(eth0.1) entered disabled state
[   18.788957] device eth0.1 entered promiscuous mode
[   31.851272] vcc3v0: disabling
[   31.854263] vcc5v0: disabling
[   31.857247] usb0-vbus: disabling

From the look of it swconfig seems to be broken:

# swconfig dev eth0
swconfig list
swconfig dev <dev> [port <port>|vlan <vlan>] (help|set <key> <value>|get <key>|load <config>|show)
root@OpenWrt:/# 
root@OpenWrt:/# swconfig list
root@OpenWrt:/# swconfig dev eth0 help
Failed to connect to the switch. Use the "list" command to see which switches are available.
root@OpenWrt:/# swconfig dev eth0 show
Failed to connect to the switch. Use the "list" command to see which switches are available.
root@OpenWrt:/# 

I initially thought that R1 may have been moved over to dsa however , everything points to this device using swconfig approach instead .
for one the auto-generated config for the network:

root@OpenWrt:/# cat /etc/config/network 

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdaf:84b6:fc01::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0.1'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option device 'eth0.2'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth0.2'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '4 0 1 2 8t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '3 8t'

root@OpenWrt:/# 

Also there does not seem to be any trace of dsa in here:

root@OpenWrt:/# 
root@OpenWrt:/# find / -name "dsa*"
root@OpenWrt:/# 

And I can not define any dsa type ports:

root@OpenWrt:/# 
root@OpenWrt:/# ip addr add 192.0.2.1/30 dev lan1
ip: can't find device 'lan1'
root@OpenWrt:/# 

root@OpenWrt:/# 
root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr 02:C7:06:C2:F2:EB  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fdaf:84b6:fc01::1/60 Scope:Global
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:512 errors:0 dropped:0 overruns:0 frame:0
          TX packets:512 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:39936 (39.0 KiB)  TX bytes:39936 (39.0 KiB)

root@OpenWrt:/# 


So I am suspecting that this device is not meant to be on dsa just yet . And that the issue we have is a broken swconfig .

Falling back to 19.07 , the networking comes up nicely , and all works ok especially swconfig
. I have not tried the older 21.02 RC images , only rc3 and today's snapshot . Which theoretically would be the most uptodate , and have latest bugfixes .

I would be grateful if you could assist in getting R1 working on 21.02 . Much appreciate any help .
Mil

1 Like

you'll probably need too reset your device to get networking back again, in 21.02.

Much thanks for the suggestion . Now I have loaded 21.02 RC3 , and set the ports up , as per above .
With the networking as it is on 21.02 I can not connect to luci , since none of the ports work , and that is the only way in and out . SO I am working through cli serial port .
Here is my config , i just need one port up to see if i can get to luci:

root@OpenWrt:/# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd3b:21e9:8eea::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0.1'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'
        list ports 'wan'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.6.1'
        option netmask '255.255.255.0'

This is not working either . I suspect now something is wrong with the driver .
In 17.09 we used the B53 drivers , and we can see that in the dmesg:

root@OpenWrt:/# dmesg | grep -i b53
[    1.529659] b53_common: found switch: BCM53125, rev 4
[    1.552673] b53_common: found switch: BCM53125, rev 4
[    1.561470] Broadcom B53 (2) stmmac-0:00: attached PHY driver [Broadcom B53 (2)] (mii_bus:phy_addr=stmmac-0:00, irq=POLL)
[    1.572431] mdio_bus stmmac-0:01: attached PHY driver [Broadcom B53 (2)] (mii_bus:phy_addr=stmmac-0:01, irq=POLL)
[    1.582693] mdio_bus stmmac-0:02: attached PHY driver [Broadcom B53 (2)] (mii_bus:phy_addr=stmmac-0:02, irq=POLL)
[    1.592955] mdio_bus stmmac-0:03: attached PHY driver [Broadcom B53 (2)] (mii_bus:phy_addr=stmmac-0:03, irq=POLL)
[    1.603214] mdio_bus stmmac-0:04: attached PHY driver [Broadcom B53 (2)] (mii_bus:phy_addr=stmmac-0:04, irq=POLL)
[    1.613475] Broadcom B53 (2) stmmac-0:1e: attached PHY driver [Broadcom B53 (2)] (mii_bus:phy_addr=stmmac-0:1e, irq=POLL)
[    3.471001] Broadcom B53 (2) stmmac-0:00: attached PHY driver [Broadcom B53 (2)] (mii_bus:phy_addr=stmmac-0:00, irq=POLL)
[   13.721157] Broadcom B53 (2) stmmac-0:00: attached PHY driver [Broadcom B53 (2)] (mii_bus:phy_addr=stmmac-0:00, irq=POLL)
root@OpenWrt:/# 

Now in 21.02 , I see errors here:

root@OpenWrt:/# dmesg | grep -i eth
[    0.000000] psci: probing for conduit method from DT.
[    0.836608] sun7i-dwmac 1c50000.ethernet: IRQ eth_wake_irq not found
[    0.842996] sun7i-dwmac 1c50000.ethernet: IRQ eth_lpi not found
[    0.849041] sun7i-dwmac 1c50000.ethernet: PTP uses main clock
[    0.854813] sun7i-dwmac 1c50000.ethernet: no reset control found
[    1.161971] sun7i-dwmac 1c50000.ethernet: IRQ eth_wake_irq not found
[    1.168329] sun7i-dwmac 1c50000.ethernet: IRQ eth_lpi not found
[    1.174408] sun7i-dwmac 1c50000.ethernet: PTP uses main clock
[    1.180158] sun7i-dwmac 1c50000.ethernet: no reset control found
[    1.301303] sun7i-dwmac 1c50000.ethernet: Version ID not available
[    1.307501] sun7i-dwmac 1c50000.ethernet:    DWMAC1000
[    1.312504] sun7i-dwmac 1c50000.ethernet: DMA HW capability register supported
[    1.319726] sun7i-dwmac 1c50000.ethernet: Normal descriptors
[    1.325392] sun7i-dwmac 1c50000.ethernet: Ring mode enabled
[    2.591935] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1
[    2.597957] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
[   11.500560] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1
[   11.506746] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
[   11.520328] br-lan: port 1(eth0.1) entered blocking state
[   11.525877] br-lan: port 1(eth0.1) entered disabled state
[   11.531733] device eth0.1 entered promiscuous mode
[   62.569376] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1
[   62.575560] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
root@OpenWrt:/# 

same when I try to up the interface:

root@OpenWrt:/# ip link set eth0 up
[  693.529448] sun7i-dwmac 1c50000.ethernet eth0: no phy at addr -1
[  693.535646] sun7i-dwmac 1c50000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
ip: SIOCSIFFLAGS: No such device
root@OpenWrt:/# 

There is more to it , than config it seems .
Regards
Mil

1 Like

Hello Guys,

Update:

I am pretty much sure now that the R1 is not supposed to be on DSA , it is meant to remain on swconfig . However we have a broken connectivity to PHY . I have been looking at the .dts file that comes with imagebuid , and we can see it has old config in there for gmac:

&gmac {
	pinctrl-names = "default";
	pinctrl-0 = <&gmac_rgmii_pins>;
	phy-handle = <&phy1>;
	phy-mode = "rgmii";
	phy-supply = <&reg_gmac_3v3>;
	status = "okay";

	phy1: ethernet-phy@1 {
		reg = <1>;
	};
};

Also looks like in 2018 , there was some work done on the code . The .dts file went from swconfig to dsa , and back again . There are patches for reverting changes , then patches for reverting the reverts . A bit confusing to know what the result is once all these patches are applied .

The DSA version of the gmac config would look something like this:

&gmac {
 	pinctrl-names = "default";
 	pinctrl-0 = <&gmac_rgmii_pins>;
 	phy-mode = "rgmii";
 	phy-supply = <&reg_gmac_3v3>;
 	status = "okay";
 
	fixed-link {
		speed = <1000>;
		full-duplex;
	};

 	mdio {
 		compatible = "snps,dwmac-mdio";
 		#address-cells = <1>;
 		#size-cells = <0>;
 
		switch: ethernet-switch@1e {
			compatible = "brcm,bcm53125";
			reg = <30>;

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

				port0: port@0 {
					reg = <0>;
					label = "lan2";
				};

				port1: port@1 {
					reg = <1>;
					label = "lan3";
				};

				port2: port@2 {
					reg = <2>;
					label = "lan4";
				};

				port3: port@3 {
					reg = <3>;
 	               			label = "wan";
				};

				port4: port@4 {
					reg = <4>;
					label = "lan1";
				};

				port8: port@8 {
					reg = <8>;
					label = "cpu";
					ethernet = <&gmac>;
					phy-mode = "rgmii-txid";
					fixed-link {
						speed = <1000>;
						full-duplex;
					};
				};
			};
		};
 	};
 };
 

And it is clear that we do not have that .

I wander if the b53 drivers used on the R1 are broken with respect to kernel 5.4 ?
Some files in there have not been touched for years .

Update:
The old b53 drivers , seem to be a no hope exercise . I have not been able to compile them to work with swconfig .
So I have moved over to DSA drivers . And have had success here .
I was able to get a fresh git pull of the openwrt snapshot source , and selectively apply Hauke's patches from his git tree , and compile a working driver set up .

My dmesg is now looking good:

[    1.123220] sun4i-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pa not found, using dummy regulator
[    1.133136] sun7i-dwmac 1c50000.ethernet: IRQ eth_wake_irq not found
[    1.139496] sun7i-dwmac 1c50000.ethernet: IRQ eth_lpi not found
[    1.145562] sun7i-dwmac 1c50000.ethernet: PTP uses main clock
[    1.151311] sun7i-dwmac 1c50000.ethernet: no reset control found
[    1.187566] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.198222] mmc0: new high speed SDHC card at address aaaa
[    1.204758] mmcblk0: mmc0:aaaa SE32G 29.7 GiB 
[    1.210756]  mmcblk0: p1 p2
[    1.272089] sun7i-dwmac 1c50000.ethernet: Version ID not available
[    1.278286] sun7i-dwmac 1c50000.ethernet:    DWMAC1000
[    1.283291] sun7i-dwmac 1c50000.ethernet: DMA HW capability register supported
[    1.290509] sun7i-dwmac 1c50000.ethernet: Normal descriptors
[    1.296177] sun7i-dwmac 1c50000.ethernet: Ring mode enabled
[    1.302029] libphy: stmmac: probed
[    1.307158] b53_common: found switch: BCM53125, rev 4
[    1.312293] bcm53xx stmmac-0:1e: failed to register switch: -517
[    1.319872] ehci-platform 1c14000.usb: EHCI Host Controller
[    1.325522] ehci-platform 1c14000.usb: new USB bus registered, assigned bus number 1
[    1.333451] ehci-platform 1c14000.usb: irq 33, io mem 0x01c14000
[    1.361770] ehci-platform 1c14000.usb: USB 2.0 started, EHCI 1.00
[    1.368101] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[    1.376396] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.383627] usb usb1: Product: EHCI Host Controller
[    1.388501] usb usb1: Manufacturer: Linux 5.4.128 ehci_hcd
[    1.393991] usb usb1: SerialNumber: 1c14000.usb
[    1.399064] hub 1-0:1.0: USB hub found
[    1.402917] hub 1-0:1.0: 1 port detected
[    1.407843] ehci-platform 1c1c000.usb: EHCI Host Controller
[    1.413500] ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 2
[    1.421424] ehci-platform 1c1c000.usb: irq 38, io mem 0x01c1c000
[    1.451784] ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00
[    1.458104] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[    1.466390] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.473619] usb usb2: Product: EHCI Host Controller
[    1.478493] usb usb2: Manufacturer: Linux 5.4.128 ehci_hcd
[    1.483981] usb usb2: SerialNumber: 1c1c000.usb
[    1.489061] hub 2-0:1.0: USB hub found
[    1.492903] hub 2-0:1.0: 1 port detected
[    1.497798] ohci-platform 1c14400.usb: Generic Platform OHCI controller
[    1.504478] ohci-platform 1c14400.usb: new USB bus registered, assigned bus number 3
[    1.512437] ohci-platform 1c14400.usb: irq 34, io mem 0x01c14400
[    1.585974] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.04
[    1.594261] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.601477] usb usb3: Product: Generic Platform OHCI controller
[    1.607403] usb usb3: Manufacturer: Linux 5.4.128 ohci_hcd
[    1.612893] usb usb3: SerialNumber: 1c14400.usb
[    1.617972] hub 3-0:1.0: USB hub found
[    1.621834] hub 3-0:1.0: 1 port detected
[    1.627859] b53_common: found switch: BCM53125, rev 4
[    1.717166] libphy: dsa slave smi: probed
[    1.721818] bcm53xx stmmac-0:1e lan2 (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY]
[    1.731680] bcm53xx stmmac-0:1e lan3 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[    1.741496] bcm53xx stmmac-0:1e lan4 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[    1.751339] bcm53xx stmmac-0:1e wan (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[    1.761090] bcm53xx stmmac-0:1e lan1 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY]
[    1.774427] bcm53xx stmmac-0:1e: Using legacy PHYLIB callbacks. Please migrate to PHYLINK!
[    1.781810] usb 2-1: new high-speed USB device number 2 using ehci-platform
[    1.792321] bcm53xx stmmac-0:1e: Configured port 8 for rgmii-txid

I can get the R1 to work a a dumb switch , and access the system , run luci as well as install packages .

However I am struggling to understand how to create the network config file in dsa syntax, to do what the old one did using swconfig .

I would be very grateful for any assistance in converting this network config file:

root@OpenWrt:/# cat /etc/config/network 

config interface 'loopback'
       option device 'lo'
       option proto 'static'
       option ipaddr '127.0.0.1'
       option netmask '255.0.0.0'

config globals 'globals'
       option ula_prefix 'fdaf:84b6:fc01::/48'

config device
       option name 'br-lan'
       option type 'bridge'
       list ports 'eth0.1'

config interface 'lan'
       option device 'br-lan'
       option proto 'static'
       option ipaddr '192.168.1.1'
       option netmask '255.255.255.0'
       option ip6assign '60'

config interface 'wan'
       option device 'eth0.2'
       option proto 'dhcp'

config interface 'wan6'
       option device 'eth0.2'
       option proto 'dhcpv6'

config switch
       option name 'switch0'
       option reset '1'
       option enable_vlan '1'

config switch_vlan
       option device 'switch0'
       option vlan '1'
       option ports '4 0 1 2 8t'

config switch_vlan
       option device 'switch0'
       option vlan '2'
       option ports '3 8t'

root@OpenWrt:/# 

I just do not get how to do it .

I have tried some armbian guides , as well as openwrt forum posts on the subject , however it is all still clear as mud .

Much appreciate your help .
Mil

Hello Guys,

Looks like I can not get the vlan stuff to happen on kernel 5.4 . It may be that there is some dev work needed on the sw to make it fully dsa ready . There is a quote from Florian in May 2018, not sure if the status is the same today , but here it is:

Yes, remember, b53 does not currently turn on Broadcom tags, so the only
way to segregate traffic is to have VLANs for that.

That would work once Broadcom tags are turned on which requires turning
on managed mode, which requires work that I have not been able to get
done :slight_smile:

I am not able to use the nice and easy dsa method of config . Also when i tried the manual method by creating the eth0.1 and .2 interfaces then creating bridge and assigning vlans to ports , that did not work either .

What I can do is make a dumb switch out of it by adding eth0 to the bridge along with the lan ports .

To reproduce the behaviour with kernel 5.4 and dsa , what was easily done with openwrt 19.07 and swconfig I have not been able to manage .

SO I have decided to give up .

Best Regards
Mil

Can you please try latest master (development snapshot) and report back in https://github.com/openwrt/openwrt/issues/7817 ?

I just tried the latest snapshot. It is working flawlessly. Installing packages, wifi, installing luci https, openvpn and others...

Model:

Lamobo Lamobo R1 / Bananapi BPi-R1

Platform:

sunxi/cortexa7

Version:

SNAPSHOT (r19700-90e4c8c6e6)

Date:

2022-05-23 20:39:36

Please mark this thread as solved.
Solved in the snapshot images.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.