[bug report] sunxi: H6: no ethernet on Orange Pi One Plus

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

Hi Anne,
On Tue, 2023-07-04 at 23:22 +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
Can you attempt to change the TF-A target from sun50i_h6 to sun50i_h6_no_pmic?
This at least seems to have been the fix accepted into the Debian packaging for the Orange Pi One Plus.
I have one around somewhere, I could hook it up and do some more investigation if that doesn't help you.
(PS: We should probably update the U-Boot documentation if that suggestion does work.)
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
Cheers!
Chris

Hi Anne,
On Tue, Jul 4, 2023 at 8:52 PM Anne Macedo retpolanne@posteo.net 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
Does it help if you revert 4f0278dac56a658ef1e0967fec0bb95372a875bd ?
I added on CC the folks involved in the previous report.

On Wed, Jul 05, 2023 at 10:46:25AM -0300, Fabio Estevam wrote:
Hi Anne,
On Tue, Jul 4, 2023 at 8:52 PM Anne Macedo retpolanne@posteo.net 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
Does it help if you revert 4f0278dac56a658ef1e0967fec0bb95372a875bd ?
Hey! After reverting the commit, but with PMIC disabled:
=> dhcp mdio_register: non unique device name 'ethernet@5020000' Could not get PHY for ethernet@5020000: addr 1
I added on CC the folks involved in the previous report.
Regards, Anne

On Wed, Jul 05, 2023 at 03:24:23PM +0000, Anne Macedo wrote:
On Wed, Jul 05, 2023 at 10:46:25AM -0300, Fabio Estevam wrote:
Hi Anne,
On Tue, Jul 4, 2023 at 8:52 PM Anne Macedo retpolanne@posteo.net 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
Does it help if you revert 4f0278dac56a658ef1e0967fec0bb95372a875bd ?
Hey! After reverting the commit, but with PMIC disabled:
=> dhcp mdio_register: non unique device name 'ethernet@5020000' Could not get PHY for ethernet@5020000: addr 1
I added on CC the folks involved in the previous report.
Regards, Anne
I think I'm on the right path :)
1. Included SUNXI_SETUP_REGULATORS=0 to the bl31 make 2. Changed the phy mode on arch/arm/dts/sun50i-h6-orangepi-one-plus.dts From rgmii-id to rgmii More info on [1][2][3] 3. Added this configs to configs/orangepi_one_plus_defconfig: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y CONFIG_SUN8I_EMAC=y
Result:
U-Boot 2023.04-gfd4ed6b (Apr 03 2023 - 20:38:50 +0000) Allwinner Technology
CPU: Allwinner H6 (SUN50I) Model: OrangePi One Plus DRAM: 1 GiB Core: 55 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@7020400 MMC: mmc@4020000: 0 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Net: eth0: ethernet@5020000
=> dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
Still no interface on Linux, but at least eth0 is detected on u-boot?
[1] https://forum.armbian.com/topic/7108-orangepi-zero-plus-ethernet-in-u-boot/ [2] https://forum.openwrt.org/t/sunxi-target-broken-in-master/110643/12 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/driv...
Regards, Anne

On Wed, Jul 05, 2023 at 01:31:28PM -0300, Anne Macedo wrote:
On Wed, Jul 05, 2023 at 03:24:23PM +0000, Anne Macedo wrote:
On Wed, Jul 05, 2023 at 10:46:25AM -0300, Fabio Estevam wrote:
Hi Anne,
On Tue, Jul 4, 2023 at 8:52 PM Anne Macedo retpolanne@posteo.net 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
Does it help if you revert 4f0278dac56a658ef1e0967fec0bb95372a875bd ?
Hey! After reverting the commit, but with PMIC disabled:
=> dhcp mdio_register: non unique device name 'ethernet@5020000' Could not get PHY for ethernet@5020000: addr 1
I added on CC the folks involved in the previous report.
Regards, Anne
I think I'm on the right path :)
- Included SUNXI_SETUP_REGULATORS=0 to the bl31 make
- Changed the phy mode on arch/arm/dts/sun50i-h6-orangepi-one-plus.dts From rgmii-id to rgmii More info on [1][2][3]
- Added this configs to configs/orangepi_one_plus_defconfig: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y CONFIG_SUN8I_EMAC=y
Result:
U-Boot 2023.04-gfd4ed6b (Apr 03 2023 - 20:38:50 +0000) Allwinner Technology
CPU: Allwinner H6 (SUN50I) Model: OrangePi One Plus DRAM: 1 GiB Core: 55 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@7020400 MMC: mmc@4020000: 0 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Net: eth0: ethernet@5020000
=> dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
Still no interface on Linux, but at least eth0 is detected on u-boot?
[1] https://forum.armbian.com/topic/7108-orangepi-zero-plus-ethernet-in-u-boot/ [2] https://forum.openwrt.org/t/sunxi-target-broken-in-master/110643/12 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/driv...
Actually had commented out SUNXI_SETUP_REGULATORS=0, with it I see:
Net: PHY reset timed out eth0: ethernet@5020000
Regards, Anne

On Wed, Jul 5, 2023 at 1:31 PM Anne Macedo retpolanne@posteo.net wrote:
I think I'm on the right path :)
- Included SUNXI_SETUP_REGULATORS=0 to the bl31 make
- Changed the phy mode on arch/arm/dts/sun50i-h6-orangepi-one-plus.dts From rgmii-id to rgmii
This does not look like the correct fix. Please see this commit from Linux: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v...
More info on [1][2][3] 3. Added this configs to configs/orangepi_one_plus_defconfig: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y CONFIG_SUN8I_EMAC=y
Result:
U-Boot 2023.04-gfd4ed6b (Apr 03 2023 - 20:38:50 +0000) Allwinner Technology
CPU: Allwinner H6 (SUN50I) Model: OrangePi One Plus DRAM: 1 GiB Core: 55 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@7020400 MMC: mmc@4020000: 0 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Net: eth0: ethernet@5020000
=> dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
What about using the Realtek PHY driver instead of the Generic one?
--- a/configs/orangepi_one_plus_defconfig +++ b/configs/orangepi_one_plus_defconfig @@ -8,3 +8,6 @@ CONFIG_SUNXI_DRAM_H6_LPDDR3=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_PHY_REALTEK=y +CONFIG_RGMII=y +CONFIG_MII=y
Does this help?

On Wed, Jul 05, 2023 at 02:15:43PM -0300, Fabio Estevam wrote:
On Wed, Jul 5, 2023 at 1:31 PM Anne Macedo retpolanne@posteo.net wrote:
I think I'm on the right path :)
- Included SUNXI_SETUP_REGULATORS=0 to the bl31 make
- Changed the phy mode on arch/arm/dts/sun50i-h6-orangepi-one-plus.dts From rgmii-id to rgmii
This does not look like the correct fix. Please see this commit from Linux: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v...
More info on [1][2][3] 3. Added this configs to configs/orangepi_one_plus_defconfig: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y
e> CONFIG_SUN8I_EMAC=y
Result:
U-Boot 2023.04-gfd4ed6b (Apr 03 2023 - 20:38:50 +0000) Allwinner Technology
CPU: Allwinner H6 (SUN50I) Model: OrangePi One Plus DRAM: 1 GiB Core: 55 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@7020400 MMC: mmc@4020000: 0 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Net: eth0: ethernet@5020000
=> dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
What about using the Realtek PHY driver instead of the Generic one?
--- a/configs/orangepi_one_plus_defconfig +++ b/configs/orangepi_one_plus_defconfig @@ -8,3 +8,6 @@ CONFIG_SUNXI_DRAM_H6_LPDDR3=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_PHY_REALTEK=y +CONFIG_RGMII=y +CONFIG_MII=y
Does this help?
Sorry for the delay, life came in the way.
u-boot config: CONFIG_PHY_REALTEK=y CONFIG_RGMII=y CONFIG_MII=y
tfa config: SUNXI_SETUP_REGULATORS=0
result: => dhcp No ethernet found.
u-boot config: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y CONFIG_SUN8I_EMAC=y CONFIG_PHY_REALTEK=y CONFIG_RGMII=y CONFIG_MII=y
tfa config: SUNXI_SETUP_REGULATORS=0
result: Net: PHY reset timed out eth0: ethernet@5020000 => dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
It's interesting that it keeps using Generic PHY.
Regards, Anne

On Thu, Jul 06, 2023 at 11:51:54PM +0000, Anne Macedo wrote:
On Wed, Jul 05, 2023 at 02:15:43PM -0300, Fabio Estevam wrote:
On Wed, Jul 5, 2023 at 1:31 PM Anne Macedo retpolanne@posteo.net wrote:
I think I'm on the right path :)
- Included SUNXI_SETUP_REGULATORS=0 to the bl31 make
- Changed the phy mode on arch/arm/dts/sun50i-h6-orangepi-one-plus.dts From rgmii-id to rgmii
This does not look like the correct fix. Please see this commit from Linux: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v...
More info on [1][2][3] 3. Added this configs to configs/orangepi_one_plus_defconfig: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y
e> CONFIG_SUN8I_EMAC=y
Result:
U-Boot 2023.04-gfd4ed6b (Apr 03 2023 - 20:38:50 +0000) Allwinner Technology
CPU: Allwinner H6 (SUN50I) Model: OrangePi One Plus DRAM: 1 GiB Core: 55 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@7020400 MMC: mmc@4020000: 0 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Net: eth0: ethernet@5020000
=> dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
What about using the Realtek PHY driver instead of the Generic one?
--- a/configs/orangepi_one_plus_defconfig +++ b/configs/orangepi_one_plus_defconfig @@ -8,3 +8,6 @@ CONFIG_SUNXI_DRAM_H6_LPDDR3=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_PHY_REALTEK=y +CONFIG_RGMII=y +CONFIG_MII=y
Does this help?
Sorry for the delay, life came in the way.
u-boot config: CONFIG_PHY_REALTEK=y CONFIG_RGMII=y CONFIG_MII=y
tfa config: SUNXI_SETUP_REGULATORS=0
result: => dhcp No ethernet found.
u-boot config: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y CONFIG_SUN8I_EMAC=y CONFIG_PHY_REALTEK=y CONFIG_RGMII=y CONFIG_MII=y
tfa config: SUNXI_SETUP_REGULATORS=0
result: Net: PHY reset timed out eth0: ethernet@5020000 => dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
It's interesting that it keeps using Generic PHY.
Regards, Anne
OH! I believe I discovered something I overlooked:
On arch/arm/dts/sun50i-h6-orangepi-one-plus.dts:
reg_gmac_3v3: gmac-3v3 { compatible = "regulator-fixed"; regulator-name = "vcc-gmac-3v3"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; startup-delay-us = <100000>; enable-active-high; gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */ vin-supply = <®_aldo2>; };
After I connected GPIO 3 to GPIO 6, the Ethernet LED turned on!
I still see:
=> dhcp sun8i_emac_eth_start: Timeout
And
Net: PHY reset timed out eth0: ethernet@5020000
Regards, Anne

On Fri, Jul 07, 2023 at 08:42:33AM -0300, Anne Macedo wrote:
On Thu, Jul 06, 2023 at 11:51:54PM +0000, Anne Macedo wrote:
On Wed, Jul 05, 2023 at 02:15:43PM -0300, Fabio Estevam wrote:
On Wed, Jul 5, 2023 at 1:31 PM Anne Macedo retpolanne@posteo.net wrote:
I think I'm on the right path :)
- Included SUNXI_SETUP_REGULATORS=0 to the bl31 make
- Changed the phy mode on arch/arm/dts/sun50i-h6-orangepi-one-plus.dts From rgmii-id to rgmii
This does not look like the correct fix. Please see this commit from Linux: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v...
More info on [1][2][3] 3. Added this configs to configs/orangepi_one_plus_defconfig: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y
e> CONFIG_SUN8I_EMAC=y
Result:
U-Boot 2023.04-gfd4ed6b (Apr 03 2023 - 20:38:50 +0000) Allwinner Technology
CPU: Allwinner H6 (SUN50I) Model: OrangePi One Plus DRAM: 1 GiB Core: 55 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@7020400 MMC: mmc@4020000: 0 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Net: eth0: ethernet@5020000
=> dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
What about using the Realtek PHY driver instead of the Generic one?
--- a/configs/orangepi_one_plus_defconfig +++ b/configs/orangepi_one_plus_defconfig @@ -8,3 +8,6 @@ CONFIG_SUNXI_DRAM_H6_LPDDR3=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_PHY_REALTEK=y +CONFIG_RGMII=y +CONFIG_MII=y
Does this help?
Sorry for the delay, life came in the way.
u-boot config: CONFIG_PHY_REALTEK=y CONFIG_RGMII=y CONFIG_MII=y
tfa config: SUNXI_SETUP_REGULATORS=0
result: => dhcp No ethernet found.
u-boot config: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUNXI_NO_PMIC=y CONFIG_SUN8I_EMAC=y CONFIG_PHY_REALTEK=y CONFIG_RGMII=y CONFIG_MII=y
tfa config: SUNXI_SETUP_REGULATORS=0
result: Net: PHY reset timed out eth0: ethernet@5020000 => dhcp sun8i_emac_eth_start: Timeout => mdio list ethernet@5020000: 1 - Generic PHY <--> ethernet@5020000
It's interesting that it keeps using Generic PHY.
Regards, Anne
OH! I believe I discovered something I overlooked:
On arch/arm/dts/sun50i-h6-orangepi-one-plus.dts:
reg_gmac_3v3: gmac-3v3 { compatible = "regulator-fixed"; regulator-name = "vcc-gmac-3v3"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; startup-delay-us = <100000>; enable-active-high; gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */ vin-supply = <®_aldo2>; };
After I connected GPIO 3 to GPIO 6, the Ethernet LED turned on!
Okay, I completely misunderstood this... and I lost the combination that turned the LED on :(
It seems that PD6 is not exposed on the GPIO header [1]. It is defined on the FBGA on the pin map session of the datasheet [2]. So, I don't believe I need to short the pins to get it working, but somehow it at least powered on the Ethernet port. I wish I remember the combination.
[1] https://forum.armbian.com/uploads/monthly_2020_04/873961756_Opioneplusgpio.j...
[2] https://linux-sunxi.org/images/5/5c/Allwinner_H6_V200_Datasheet_V1.1.pdf
UPDATE: I did it!
On u-boot shell:
gpio set pd6
then dhcp command works :). However, it doesn't get an IP and with static IP pinging doesn't work.
It seems to be able to send BOOTP broadcasts but it doesn't get an IP...
Combination was:
u-boot config: CONFIG_SPL_SPI_SUNXI=y CONFIG_SUN8I_EMAC=y
tfa config:
SUNXI_SETUP_REGULATORS=1 (or just unset this)
I still see:
=> dhcp sun8i_emac_eth_start: Timeout
And
Net: PHY reset timed out eth0: ethernet@5020000
Regards, Anne
Regards, Anne

On Fri, Jul 7, 2023 at 10:46 AM Anne Macedo retpolanne@posteo.net wrote:
On u-boot shell:
gpio set pd6
Good point. You should pass the following options:
CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y
so that the GPIO3_6 turns on by default and then you would not need to run the "gpio set pd6" command.
then dhcp command works :). However, it doesn't get an IP and with static IP pinging doesn't work.

On Fri, Jul 07, 2023 at 10:54:00AM -0300, Fabio Estevam wrote:
On Fri, Jul 7, 2023 at 10:46 AM Anne Macedo retpolanne@posteo.net wrote:
On u-boot shell:
gpio set pd6
Good point. You should pass the following options:
CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y
so that the GPIO3_6 turns on by default and then you would not need to run the "gpio set pd6" command.
That didn't work. I still had to enable with "gpio set pd6". Also, when it gets to the kernel, ethernet shuts down. I also don't see the device in my router, so I believe even though eth0 is up, something may not be working yet.
then dhcp command works :). However, it doesn't get an IP and with static IP pinging doesn't work.

On Fri, Jul 07, 2023 at 02:20:48PM +0000, Anne Macedo wrote:
On Fri, Jul 07, 2023 at 10:54:00AM -0300, Fabio Estevam wrote:
On Fri, Jul 7, 2023 at 10:46 AM Anne Macedo retpolanne@posteo.net wrote:
On u-boot shell:
gpio set pd6
Good point. You should pass the following options:
CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y
One thing I realized is that on the defconfig and on Yocto, SPL is expected, so if I disable CONFIG_SPL, things break. I'm thinking about using it because CONFIG_DM_REGULATOR didn't seem to work?
I also decided to use CONFIG_SPL_DM_REGULATOR, but it doesn't compile :(
These are the configs I added
# This one I believe is needed for EMAC CONFIG_SPL_SPI_SUNXI=y # This one is needed by the DM and SPL_DM configs CONFIG_DM=y # These two seem to allow me to build with SPL CONFIG_SPL_BUILD=y CONFIG_SPL_POWER=y # This one breaks the build CONFIG_SPL_DM=y # Keeping these two commented until I fix SPL_DM #CONFIG_SPL_DM_REGULATOR=y #CONFIG_SPL_DM_REGULATOR_FIXED=y
I also had to patch drivers/mmc/sunxi_mmc.c to add an if macro on the only gpio_request_by_name it has, inspired by [1]. Will send a patch once I figure out why SPL is breaking.
Maybe it has to do with SPL memory? These are the errors I see when I enable CONFIG_SPL_DM:
aarch64-poky-linux-ld.bfd: address 0x28e60 of u-boot-spl section `.text' is not within region `.sram' aarch64-poky-linux-ld.bfd: u-boot-spl section `.rodata' will not fit in region `.sram'
aarch64-poky-linux-ld.bfd: address 0x28e60 of u-boot-spl section `.text' is not within region `.sram' aarch64-poky-linux-ld.bfd: u-boot-spl section `.rodata' will not fit in region `.sram' aarch64-poky-linux-ld.bfd: address 0x28e60 of u-boot-spl section `.text' is not within region `.sram' aarch64-poky-linux-ld.bfd: address 0x28e60 of u-boot-spl section `.text' is not within region `.sram'
aarch64-poky-linux-ld.bfd: address 0x28e60 of u-boot-spl section `.text' is not within region `.sram' aarch64-poky-linux-ld.bfd: address 0x28e60 of u-boot-spl section `.text' is not within region `.sram' aarch64-poky-linux-ld.bfd: region `.sram' overflowed by 8864 bytes
aarch64-poky-linux-ld.bfd: region `.sram' overflowed by 8864 bytes
I don't see them without CONFIG_SPL_DM.
This person [2] mentions in another similar issue that SPL is very tight in memory btw.
[1] https://patchwork.ozlabs.org/project/uboot/patch/20190117170601.20676-2-fpar... [2] https://lists.denx.de/pipermail/u-boot/2020-May/412530.html
so that the GPIO3_6 turns on by default and then you would not need to run the "gpio set pd6" command.
That didn't work. I still had to enable with "gpio set pd6". Also, when it gets to the kernel, ethernet shuts down. I also don't see the device in my router, so I believe even though eth0 is up, something may not be working yet.
then dhcp command works :). However, it doesn't get an IP and with static IP pinging doesn't work.

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
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_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...
Regards, Anne

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).
- 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.
- 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
- 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
- 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
participants (3)
-
Anne Macedo
-
Christopher Obbard
-
Fabio Estevam