Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cannot attach to PHY after upgrade to 2023.8.1

Featured Replies

Hello, I have  Orange Pi One Plus with the kernel 5.15.80 of Armbian 22.11.1 and work well.

, but after upgrading to 23.8.1 kernel 6.1.47 the network interfaces stop working at all.

 

Even I try the 23.05.1, 23.05.6 all have same error which because the kernel is 6.1.x.

Currenly I limited the internet access without the the network.

May I know how to fix it in the console or someone can help to generate the 23.11.1 image for fixed this error.

 Thanks

 

The error message like as below in the console terminal.

[  9.899195] dwmac-sun8i 5020000.ethernet eth0: __stmmac_open: Cannot attach to PHY (error: -19)

 

The spec of the system:

dmesg | grep eth0
[   36.352751] dwmac-sun8i 5020000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   36.353587] dwmac-sun8i 5020000.ethernet eth0: __stmmac_open: Cannot attach to PHY (error: -19)

 

uname -a
Linux orangepioneplus 6.1.47-current-sunxi64 #3 SMP Wed Aug 23 15:52:42 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

 

ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 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 state DOWN group default qlen 1000
    link/ether 02:01:e7:xx:xx:xx brd ff:ff:ff:ff:ff:ff

 

 

Edited by Jack07

  • Author

2024/02/11 update the status.

I use addition USB3 ethernet device to work with the network and run apt upgrade to the kernel 6.1.63.

But still has a error with inside network device eth0.

The below is spec:

image file:

Armbian_23.8.1_Orangepioneplus_jammy_current_6.1.47.img.xz

 

uname -a

Linux orangepioneplus 6.1.63-current-sunxi64 #1 SMP Mon Nov 20 10:52:19 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

 

ip address

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 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 state DOWN group default qlen 1000
    link/ether 02:01:e7:xx:xx:xx brd ff:ff:ff:ff:ff:ff
4: enx000ec6b1d59e: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0e:c6:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.xx.xx/24 brd 192.168.xx.xx scope global dynamic noprefixroute enx000ec6b1d59e
       valid_lft 85927sec preferred_lft 85927sec
    inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

 

dmesg | grep eth0
[   20.495445] dwmac-sun8i 5020000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   20.496087] dwmac-sun8i 5020000.ethernet eth0: __stmmac_open: Cannot attach to PHY (error: -19)

Edited by Jack07

I have the same problem on OrangePi 3

 

uname -a

Linux orangepi3 6.1.63-current-sunxi64 #1 SMP Mon Nov 20 10:52:19 UTC 2023 aarch64 GNU/Linux

image file

Armbian_23.11.1_Orangepi3_bookworm_current_6.1.63.img.xz

ifup end0

ifup: failed to bring up end0
 

dmesg | grep -i end
[    5.133926] dwmac-sun8i 5020000.ethernet end0: renamed from eth0
[   11.205978] dwmac-sun8i 5020000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   11.214610] dwmac-sun8i 5020000.ethernet end0: __stmmac_open: Cannot attach to PHY (error: -19)
[   88.248982] ---[ end trace 0000000000000000 ]---

 

This is a problem of interaction between the phy driver and MAC in the Linux kernel.

 

./stmicro/stmmac/stmmac_main.c:928: pr_err("%s: Cannot attach to PHY (error: %d)\n", __func__, ret);

./stmicro/stmmac/stmmac_main.c-894-static int stmmac_open(struct net_device *dev)

./stmicro/stmmac/stmmac_main.c:299:static int stmmac_init_phy(struct net_device *dev)

../phy/phy_device.c:371:struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,

./phy_device.c:336:int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,

./phy_device.c:441:static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,

./phy_device.c:413:int phy_init_hw(struct phy_device *phydev)

 

It is known that an error will be reported during phy initialization, but I am still looking for the kernel source code for Sunxi Linux 6.1.xx and 5.15.xx.

 

Error code flow:
stmmac_open > stmmac_init_phy > phy_connect > phy_connect_direct > phy_attach_direct > phy_init_hw

I am trying to downgrade to kernel 5.15.93-sunxi64 and found the eth0 is worked.

 

pi@orangepi3:~$ dmesg | grep eth0
[   18.467932] dwmac-sun8i 5020000.ethernet eth0: PHY [stmmac-0:01] driver [RTL8211E Gigabit Ethernet] (irq=POLL)
[   18.468969] dwmac-sun8i 5020000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   18.469701] dwmac-sun8i 5020000.ethernet eth0: No Safety Features support found
[   18.469727] dwmac-sun8i 5020000.ethernet eth0: No MAC Management Counters available
[   18.469734] dwmac-sun8i 5020000.ethernet eth0: PTP not supported by HW
[   18.475463] dwmac-sun8i 5020000.ethernet eth0: configuring for phy/rgmii-id link mode
[   20.510690] dwmac-sun8i 5020000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[   20.510735] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

 

I found the dts setting about "ethernet@5020000" was different between kernel 5.15.93 and kernel 6.1.47.

 

We need to make sure the following things are correct:

1. Ethernet driver uses the correct clock/reset

2. GPIO reset can be pulled up

3. MDIO can correctly go to PHY

4. Pinmux correctly sets Ethernet pins

 

#Kernnel 5.15.93-sunxi64
ethernet@5020000 {
			compatible = "allwinner,sun50i-h6-emac\0allwinner,sun50i-a64-emac";
			syscon = <0x31>;
			reg = <0x5020000 0x10000>;
			interrupts = <0x00 0x0c 0x04>;
			interrupt-names = "macirq";
			resets = <0x04 0x21>;
			reset-names = "stmmaceth";
			clocks = <0x04 0x54>;
			clock-names = "stmmaceth";
			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <0x32>;
			phy-mode = "rgmii-id";
			phy-handle = <0x33>;
			phy-supply = <0x34>;
			phy-io-supply = <0x35>;
			allwinner,rx-delay-ps = <0xc8>;
			allwinner,tx-delay-ps = <0xc8>;
			phandle = <0x78>;

			mdio {
				compatible = "snps,dwmac-mdio";
				#address-cells = <0x01>;
				#size-cells = <0x00>;
				phandle = <0x79>;

				ethernet-phy@1 {
					compatible = "ethernet-phy-ieee802.3-c22";
					reg = <0x01>;
					reset-gpios = <0x1f 0x03 0x0e 0x01>;
					reset-assert-us = <0x3a98>;
					reset-deassert-us = <0x9c40>;
					phandle = <0x33>;
				};
			};
		};

 

#Kernel 6.1.47-current-sunxi64
		ethernet@5020000 {
			compatible = "allwinner,sun50i-h6-emac\0allwinner,sun50i-a64-emac";
			syscon = <0x32>;
			reg = <0x5020000 0x10000>;
			interrupts = <0x00 0x0c 0x04>;
			interrupt-names = "macirq";
			resets = <0x06 0x21>;
			reset-names = "stmmaceth";
			clocks = <0x06 0x54>;
			clock-names = "stmmaceth";
			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <0x33>;
			phy-mode = "rgmii-id";
			phy-handle = <0x34>;
			phy-supply = <0x2e>;
			phy-io-supply = <0x35>;
			allwinner,rx-delay-ps = <0xc8>;
			allwinner,tx-delay-ps = <0xc8>;
			phandle = <0x79>;

			mdio {
				compatible = "snps,dwmac-mdio";
				#address-cells = <0x01>;
				#size-cells = <0x00>;
				phandle = <0x7a>;

				ethernet-phy@1 {
					compatible = "ethernet-phy-ieee802.3-c22";
					reg = <0x01>;
					reset-gpios = <0x1e 0x03 0x0e 0x01>;
					reset-assert-us = <0x3a98>;
					reset-deassert-us = <0x9c40>;
					phandle = <0x34>;
				};
			};
		};

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.