On Sun, Jul 09, 2023 at 04:32:22PM +0000, Anne Macedo wrote: > On Tue, Jul 04, 2023 at 11:22:29PM +0000, Anne Macedo wrote: > > Hey! > > > > I'm trying to bake Linux images for the Orange Pi One Plus using Yocto. > > Everything works fine, except for Ethernet. > > > > On the u-boot prompt: > > > > => dhcp > > No ethernet found. > > > > After adding: > > > > CONFIG_SPL_SPI_SUNXI=y > > CONFIG_SUN8I_EMAC=y > > > > to configs/orangepi_one_plus_defconfig, I started seeing this error: > > > > => dhcp > > sun8i_emac_eth_start: Timeout > > > > I saw this other bug report but I couldn't really understand what has > > been made to fix this issue [1]. > > > > More context here [2]. > > > > [1] https://lists.denx.de/pipermail/u-boot/2021-June/451357.html > > [2] https://github.com/linux-sunxi/meta-sunxi/issues/387 > > > > Regards, > > Anne Quick update > > Just wanted to share a summary of my findings about the ethernet on the > Orange Pi One Plus (Allwinner H6). > > 1. PMIC should not be disabled. I tested and if I disable PMIC, MAC > never turns on, even if I force the gpio PD6 pin to be on. When building > tfa, use SUNXI_SETUP_REGULATORS=1 or just don't pass it. > > 2. These configs are needed on configs/orangepi_one_plus_defconfig > > CONFIG_SPL_SPI_SUNXI=y CONFIG_SPL_SPI_SUNXI may not be needed in this context, I don't know why I mentioned it in the first place. > CONFIG_SUN8I_EMAC=y > > 3. With this config, there's this strange behavior where ethernet is > only detected after a crash: > > # Fresh boot > Net: Could not get PHY for ethernet@5020000: addr 1 > No ethernet found. > > # Forcing the board to crash > => mii dump > "Synchronous Abort" handler, esr 0x96000044 > > Code: 32000021 d5033fbf 91408013 f9481a60 (b9004801) > Resetting CPU ... > > resetting ... > > # Reboot > Net: eth0: ethernet@5020000 > > 4. I'm testing CONFIG_MACPWR="PD6" and that successfully enabled MAC on > u-boot (I see the LEDs turning on). However, I see the behaviour from #3 > but crash-rebooting doesn't seem to enable ethernet...
According to this patch [1], we should use DM driver, so I believe CONFIG_MACPWR is deprecated. I then added these configs: # Required by regulator CONFIG_DM=y # Required by regulator fixed CONFIG_DM_REGULATOR=y # Required by the ethernet's definition on the dts CONFIG_DM_REGULATOR_FIXED=y # This adds a handy regulator cmd on u-boot CONFIG_CMD_REGULATOR=y With the regulator command, I turned it on and saw the LEDs turning on and dhcp "trying" to work (it doesn't get an IP though). => regulator list | Device | regulator-name | Parent | vcc5v | vcc-5v | root_driver | gmac-3v3 | vcc-gmac-3v3 | root_driver => regulator dev vcc-gmac-3v3 dev: vcc-gmac-3v3 @ gmac-3v3 => regulator enable => dhcp BOOTP broadcast 1 BOOTP broadcast 2 For some reason, vcc-gmac-3v3 is disabled by default, and it only seems to start manually for me. It sometimes start when I try a mii dump or a dhcp, but there's a lot of phy errors that make it unusable. [1] https://lists.denx.de/pipermail/u-boot/2022-December/501397.html > > Regards, > Anne