A311D ethernet `cannot attach to PHY` error since 6.18.9 update

Hi there!

Since Kernel 6.18.9 (and now 6.18.10) kernel, I can’t use ethernet to connect to network.

So I try to restart reform-hw-setup manually with:

doas systemctl restart reform-hw-setup.service

And check kernel messages:

[ 3868.156925] meson8b-dwmac ff3f0000.ethernet: IRQ eth_wake_irq not found
[ 3868.157901] meson8b-dwmac ff3f0000.ethernet: IRQ eth_lpi not found
[ 3868.164093] meson8b-dwmac ff3f0000.ethernet: IRQ sfty not found
[ 3868.173313] meson8b-dwmac ff3f0000.ethernet: PTP uses main clock
[ 3868.177302] meson8b-dwmac ff3f0000.ethernet: User ID: 0x11, Synopsys ID: 0x37
[ 3868.183475] meson8b-dwmac ff3f0000.ethernet: 	DWMAC1000
[ 3868.188275] meson8b-dwmac ff3f0000.ethernet: DMA HW capability register supported
[ 3868.195839] meson8b-dwmac ff3f0000.ethernet: RX Checksum Offload Engine supported
[ 3868.203352] meson8b-dwmac ff3f0000.ethernet: COE Type 2
[ 3868.208367] meson8b-dwmac ff3f0000.ethernet: TX Checksum insertion supported
[ 3868.215449] meson8b-dwmac ff3f0000.ethernet: Wake-Up On Lan supported
[ 3868.221844] meson8b-dwmac ff3f0000.ethernet: Normal descriptors
[ 3868.227677] meson8b-dwmac ff3f0000.ethernet: Ring mode enabled
[ 3868.233488] meson8b-dwmac ff3f0000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[ 3871.435604] meson8b-dwmac ff3f0000.ethernet end0: renamed from eth0

All seems to work there but network adapter is marke as DOWN with ip a. So I try to set it up then I have this error on dmesg:

[ 4029.204842] meson8b-dwmac ff3f0000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 4029.211867] meson8b-dwmac ff3f0000.ethernet end0: cannot attach to PHY (error: -ENODEV)

From there I don’t know how to deep dive into debugging.

Regards,

1 Like

Thank you, I can confirm this issue. It looks like this when it’s working (on 6.17):

meson8b-dwmac ff3f0000.ethernet: IRQ eth_wake_irq not found
meson8b-dwmac ff3f0000.ethernet: IRQ eth_lpi not found
meson8b-dwmac ff3f0000.ethernet: IRQ sfty not found
meson8b-dwmac ff3f0000.ethernet: PTP uses main clock
meson8b-dwmac ff3f0000.ethernet: User ID: 0x11, Synopsys ID: 0x37
meson8b-dwmac ff3f0000.ethernet: 	DWMAC1000
meson8b-dwmac ff3f0000.ethernet: DMA HW capability register supported
meson8b-dwmac ff3f0000.ethernet: RX Checksum Offload Engine supported
meson8b-dwmac ff3f0000.ethernet: COE Type 2
meson8b-dwmac ff3f0000.ethernet: TX Checksum insertion supported
meson8b-dwmac ff3f0000.ethernet: Wake-Up On Lan supported
meson8b-dwmac ff3f0000.ethernet: Normal descriptors
meson8b-dwmac ff3f0000.ethernet: Ring mode enabled
meson8b-dwmac ff3f0000.ethernet: Enable RX Mitigation via HW Watchdog Timer
meson8b-dwmac ff3f0000.ethernet end0: renamed from eth0
meson8b-dwmac ff3f0000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0
meson8b-dwmac ff3f0000.ethernet end0: PHY [mdio_mux-0.0:00] driver [RTL8211F Gigabit Ethernet] (irq=52)
meson8b-dwmac ff3f0000.ethernet end0: No Safety Features support found
meson8b-dwmac ff3f0000.ethernet end0: PTP not supported by HW
meson8b-dwmac ff3f0000.ethernet end0: configuring for phy/rgmii-txid link mode

When it’s not working we get a dmesg which differs from the above like this:

 meson8b-dwmac ff3f0000.ethernet: Enable RX Mitigation via HW Watchdog Timer
 meson8b-dwmac ff3f0000.ethernet end0: renamed from eth0
 meson8b-dwmac ff3f0000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0
-meson8b-dwmac ff3f0000.ethernet end0: PHY [mdio_mux-0.0:00] driver [RTL8211F Gigabit Ethernet] (irq=52)
-meson8b-dwmac ff3f0000.ethernet end0: No Safety Features support found
-meson8b-dwmac ff3f0000.ethernet end0: PTP not supported by HW
-meson8b-dwmac ff3f0000.ethernet end0: configuring for phy/rgmii-txid link mode
+meson8b-dwmac ff3f0000.ethernet end0: cannot attach to PHY (error: -ENODEV)

Hi @josch thanks for replying so quickly! So waiting for a fix :slight_smile: .

Hey @josch has there been any update to this situation?

Yes. The problem is fixed in 6.19.

EDIT: correction, it is not fixed. I still have to bisect.

1 Like

Found the culprit. In reform-hw-setup the module mdio_mux_meson_g12a is removed and then loaded again but that workaround stopped working when somewhere between 6.17 and 6.18 that module started to be built as a built-in. I don’t know if I have time to investigate what exactly triggered this difference in behaviour. But CONFIG_MDIO_BUS_MUX_MESON_G12A=y was a setting since July 2023 and despite the “y” was built as a module. Now this changed and as it is a built-in now, the phy reset hack is no longer working. This was hard to notice because it turns out that the modprobe utility does not exit non-zero and prints nothing when trying to modprobe a built-in.

I have now set CONFIG_MDIO_BUS_MUX_MESON_G12A=m which means that mdio_mux_meson_g12a gets built as a module again. I also added code to the gitlab CI scripts which make sure that kernel/drivers/net/mdio/mdio-mux-meson-g12a.ko is part of the resulting package and fails otherwise. In the next reform-tools release, reform-hw-setup will have a change which first calls modinfo -n mdio_mux_meson_g12a and that fails if mdio_mux_meson_g12a is not a module. I will also add a similar check to reform-check. That way, this problem should not re-appear in the future and even if it does, should be easier to diagnose.

Those who want to try out 6.19 with working ethernet on a311d can put this into their apt sources.list:

deb [trusted=yes arch=arm64] https://source.mnt.re/reform/reform-debian-packages/-/jobs/19313/artifacts/raw/repo reform main
1 Like

I just got this build installed on a BananaPi in a Reform the testing motherboard and its all working at the HQ! and I tested that wifi is working internally too.