Le Potato: Networking unavilable when booting in UEFI mode

Until recently, I’ve been booting my Le Potato from an SD card in the standard extlinux-compatible mode (this is just how my distro – NixOS – builds sd cards out of the box). Now I’ve purchased an eMMC, transferred the OS root to it, everything is fine, however I am still using that same SD card for booting as it has the firmware and the bootloader.

As the next step, I am trying to transfer the bootloader to eMMC and switch to UEFI mode. I have created an EFI partition, installed Grub in EFI mode, and flashed the official Libre Computer firmware for this board (from https://boot.libre.computer/ci/).

When I reboot in this configuration, everything is fine, except… there is no networking. I am not sure what is happening, as I am booting the exact same operating system – the only difference is in the early boot sequence (before stage1).

I have compared the two kernel logs, and everything looks fine until it begins to initialise the phy:

This is when booting from the SD card using extlinux config:

meson8b-dwmac c9410000.ethernet end0: renamed from eth0
meson8b-dwmac c9410000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0
meson8b-dwmac c9410000.ethernet end0: PHY [mdio_mux-0.e40908ff:08] driver [Meson GXL Internal PHY] (irq=46)
meson8b-dwmac c9410000.ethernet end0: No Safety Features support found
meson8b-dwmac c9410000.ethernet end0: PTP not supported by HW
meson8b-dwmac c9410000.ethernet end0: configuring for phy/rmii link mode

This is when booting from the eMMC in UEFI mode:

meson8b-dwmac c9410000.ethernet end0: renamed from eth0  
meson8b-dwmac c9410000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0  
meson8b-dwmac c9410000.ethernet end0: __stmmac_open: Cannot attach to PHY (error: -19)  

I found people complaining about this exact issue with this exact NIC, however the proposed solution is extremely unimpressive.

I am starting to suspect the devicetree: in extlinux mode, NixOS tells U-Boot to load its devicetree (which is just the one from the upstream Kernel), while in UEFI mode, I believe, the devicetree is bundled in the firmware, right?

So, my questions are:

  1. What could be causing this issue?
  2. Are the official distributions doing something special to get ethernet working? I am looking at the Debian image, but I don’t see anything unusual…
  3. Is there a way to force U-boot from the official firmware to load my devicetree to see if it makes any difference?

Make sure you are using Linux 6.4 or newer as the Ethernet MDIO bindings have changed. If you are using an older Linux, you need to compile and copy the device tree from the older release to the override device tree path. The firmware will use the override device tree for the older kernel.

If you are using Linux 6.4 or newer, make sure that your kernel has the proper configs enabled for the new Amlogic GXL MDIO driver so that it binds to the device tree compatible from our firmware.

The wiring tool places a customized dtb in the efi partition at

dtb/amlogic/meson-gxl-s905x-libretech-cc-v2.dtb

The directory dtb, in the root of the ESP, and amlogic within it, should be the same on your Potato, but the file name will presumably be meson-gxl-s905x-libretech-cc.dtb - my example is from the SweetP I’ve been playing with. This is undocumented unless there’s more than the howto examples I’ve found for the wiring tool. Note that this is a merged DT, there’s no overlay support in Libre’s ecosystem aside from the wiring tool itself (so far as I can see).

1 Like

Just to clarify, this path is for Sweet Potato, not Le Potato.

You can provide any device tree you want to Linux as long as it’s in this path. The wiring tool is an userspace utility and has no bearing on the normal upstream u-boot DT override facilities. This is proper OSI design.

Until you posted the link to the source (above), I had never seen anything but handwaving mention of the overlay device tree path, aside from observing the results of ldto. So this is a step forwards. Thanks.

Thanks for the help, that was it! I’ve switched to the dtb that came with my kernel (6.1.82) and everything works now.

For posterity, the full path is /boot/dtb/amlogic/meson-gxl-s905x-libretech-cc.dtb (where /boot is the mount point of the EFI system partition). I suppose the generic approach would be to just copy the dtbs directory with the dtbs compiled from the kernel source to /boot/dtb when building the system image and let the firmware pick the correct tree.

It would be super useful to have these override paths documented somewhere actually (e.g. where the UEFI boot process is described).

This is documented in u-boot. In an ideal world, device trees should be stable, but this is not the case sadly.