net: phy: Add the Airoha EN8811H PHY driver
Subsystems (2)
PATCH 1/1 net: phy: Add the Airoha EN8811H PHY driver
Add the driver for the Airoha EN8811H 2.5 Gigabit PHY. The PHY supports 100/1000/2500 Mbps with auto negotiation only.
The driver uses two firmware files, for which updated versions are added to linux-firmware already.
Based on the Linux upstream 8811 driver code(air_en8811h.c),
I have modified the relevant process to align with the U-Boot boot sequence. and have validated this on Banana Pi BPI-R3 Mini.
The MD32 FW is currently stored in eMMC partition 1 on Banana Pi BPI-R3 Mini, and it is loaded from there.
--- drivers/net/phy/Kconfig | 34 ++ drivers/net/phy/Makefile | 1 + drivers/net/phy/air_en8811h.c | 783 ++++++++++++++++++++++++++++++++++ 3 files changed, 818 insertions(+) create mode 100644 drivers/net/phy/air_en8811h.c
drivers/net/phy/Kconfig +34 -0
@@ -79,6 +79,40 @@ config PHY_ADIN help Add support for configuring RGMII on Analog Devices ADIN PHYs. +menuconfig PHY_AIROHA + bool "Airoha Ethernet PHYs support" + +config PHY_AIROHA_EN8811H + bool "Airoha Ethernet EN8811H support" + depends on PHY_AIROHA + help + AIROHA EN8811H supported. + +choice + prompt "Location of the Airoha PHY firmware" + default PHY_AIROHA_FW_IN_MMC + depends on PHY_AIROHA_EN8811H + +config PHY_AIROHA_FW_IN_MMC + bool "Airoha firmware in MMC boot1 partition" + +endchoice + +config AIROHA_FW_ADDR + hex "Airoha Firmware Address" + depends on PHY_AIROHA_EN8811H + default 0x0 + +config AIROHA_MD32_DM_SIZE + hex "Airoha Firmware MD32 DM Size" + depends on PHY_AIROHA_EN8811H + default 0x4000 + +config AIROHA_MD32_DSP_SIZE + hex "Airoha Firmware MD32 DSP Size" + depends on PHY_AIROHA_EN8811H + default 0x20000 + menuconfig PHY_AQUANTIA bool "Aquantia Ethernet PHYs support" select PHY_GIGE
drivers/net/phy/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_MV88E6352_SWITCH) += mv88e6352.o obj-$(CONFIG_PHYLIB) += phy.o obj-$(CONFIG_PHYLIB_10G) += generic_10g.o obj-$(CONFIG_PHY_ADIN) += adin.o +obj-$(CONFIG_PHY_AIROHA_EN8811H) += air_en8811h.o obj-$(CONFIG_PHY_AQUANTIA) += aquantia.o obj-$(CONFIG_PHY_ATHEROS) += atheros.o obj-$(CONFIG_PHY_BROADCOM) += broadcom.o
drivers/net/phy/air_en8811h.c new file +783 -0
783 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 6 lines · Lucien.Jheng
Add the driver for the Airoha EN8811H 2.5 Gigabit PHY. The PHY supports 100/1000/2500 Mbps with auto negotiation only.
The driver uses two firmware files, for which updated versions are added to linux-firmware already.
Quoted 6 lines
Based on the Linux upstream 8811 driver
code(air_en8811h.c),
I have modified the relevant process to align with the U-Boot boot sequence. and have validated this on Banana Pi BPI-R3 Mini.The MD32 FW is currently stored in eMMC partition 1 on Banana Pi BPI-R3 Mini, and it is loaded from there.
If this is ported from Linux, please include Linux commit SHA from which this is ported.
Quoted 9 lines
drivers/net/phy/Kconfig +1
-0@@ -79,6 +79,40 @@ config PHY_ADIN help Add support for configuring RGMII on Analog Devices ADIN PHYs. +menuconfig PHY_AIROHA
drivers/net/phy/Kconfig config PHY_ADIN · line 92
Quoted 10 lines
drivers/net/phy/Kconfig +10
-0+ bool "Airoha Ethernet PHYs support" + +config PHY_AIROHA_EN8811H + bool "Airoha Ethernet EN8811H support" + depends on PHY_AIROHA + help + AIROHA EN8811H supported. + +choice + prompt "Location of the Airoha PHY firmware"
Can this do the same thing as Aquatia PHY and load the PHY firmware from filesystem on block device instead , using the blk* or fs* commands ? Then the hard-coded filesize and co. won't be necessary.
If you need board specific loading override, implement __weak default loading from file on filesystem by default (see what Aquatia does) and then override the loading function on board or architecture level.
U-Boot really needs a proper generic firmware loader, because this firmware stuff keeps showing up more and more, but I cannot ask you to write one only because of this PHY ... but if you are up for a challenge ...
[...]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Lucien,
Hi Marek,
Quoted 6 lines · Lucien.Jheng
Hi Marek Vasut
Thanks for the review.
The next commit will change the loading of the PHY firmware to the filesystem on a block device.
Please keep in mind that most systems using this PHY are (like the OpenWrt One, for example) simple embedded devices with only a small amount of NAND or NOR flash. Loading the firmware from a filesystem means overhead and complexity, while loading it from a simple MTD partition, raw UBI volume or one of the EMMC boot hw partitions is a better match to the reality of the devices it is being used on, making the process less complex and more deterministic, and hence more robust.
Quoted 7 lines
[...]
Marek Vasut 於 2025/4/6 下午 09:30 寫道:Quoted 5 lines
[...]
Can this do the same thing as Aquatia PHY and load the PHY firmware from filesystem on block device instead , using the blk* or fs* commands ? Then the hard-coded filesize and co. won't be necessary.
Note that the size is afaik given by the hardware in this case, it won't every change. Hence any handling of a more dynamic approach of loading the firmware will also have to come with a size-check against the (again) hard-coded size anyway.
Quoted 4 lines
Quoted 4 lines
If you need board specific loading override, implement
__weakdefault loading from file on filesystem by default (see what Aquatia does) and then override the loading function on board or architecture level.
That can work, but in practice it will lead to code duplication, as all platforms using those PHYs are kinda similar (ie. MT7981, MT7986 and probably Airoha/EcoNet router SoCs as well)
Quoted 7 lines
Quoted 7 lines
U-Boot really needs a proper generic firmware loader, because this firmware stuff keeps showing up more and more, but I cannot ask you to write one only because of this PHY ... but if you are up for a challenge
...[...]
Quoted 2 lines · Daniel Golle
Hi Lucien,
Hi Marek,
Hi,
Quoted 8 lines · Lucien.Jheng
Quoted 6 lines
Hi Marek Vasut
Thanks for the review.
The next commit will change the loading of the PHY firmware to the filesystem on a block device.
Quoted 8 lines
Please keep in mind that most systems using this PHY are (like the OpenWrt One, for example) simple embedded devices with only a small amount of NAND or NOR flash. Loading the firmware from a filesystem means overhead and complexity, while loading it from a simple MTD partition, raw UBI volume or one of the EMMC boot hw partitions is a better match to the reality of the devices it is being used on, making the process less complex and more deterministic, and hence more robust.
That works until someone else needs to load the firmware from somewhere else. U-Boot is not a one-board-special-hack but a generic bootloader, which is why special board-specific Kconfig options and other such ad-hoc board-specific hacks in drivers are frowned upon. Having a PHY driver depend on loading firmware in a non-generic manner is not helpful.
Whatever board specific firmware loading should not be in the driver, it should be either in board code, or in some generic firmware loader (if that is something someone wants to write, but that is more involved).
I am not buying the "reality of devices" argument, sorry, this is a generic ethernet PHY, users can use it on whatever device they populate it on, and they can very well chose to place the firmware into /lib/firmware to share it with Linux expectations or in some EEPROM .
Quoted 4 lines
Quoted 4 lines
[...]
Marek Vasut 於 2025/4/6 下午 09:30 寫道:Quoted 2 lines
[...]
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Can this do the same thing as Aquatia PHY and load the PHY firmware from filesystem on block device instead , using the blk* or fs* commands ? Then the hard-coded filesize and co. won't be necessary.
Note that the size is afaik given by the hardware in this case, it won't every change. Hence any handling of a more dynamic approach of loading the firmware will also have to come with a size-check against the (again) hard-coded size anyway.
If the firmware size is fixed, it shouldn't be exposed via Kconfig in the first place. Linux doesn't do that either, why is it done here ?
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
If you need board specific loading override, implement
__weakdefault loading from file on filesystem by default (see what Aquatia does) and then override the loading function on board or architecture level.That can work, but in practice it will lead to code duplication, as all platforms using those PHYs are kinda similar (ie. MT7981, MT7986 and probably Airoha/EcoNet router SoCs as well)
Surely there is a way to factor common loader code parts into dedicated loader-implementation.c to avoid duplication.
Hi Marek
Marek Vasut 於 2025/4/21 上午 01:55 寫道:
Quoted 1 line
If the firmware size is fixed, it shouldn't be exposed via
Kconfigin the first place. Linux doesn't do that either, why is it done here ?
I misunderstood this part when I was porting the driver. I'll modify it in the next commit,
thank you.
Quoted 11 lines · Lucien.Jheng
Add the driver for the Airoha EN8811H 2.5 Gigabit PHY. The PHY supports 100/1000/2500 Mbps with auto negotiation only.
The driver uses two firmware files, for which updated versions are added to linux-firmware already.
Based on the Linux upstream 8811 driver
code(air_en8811h.c),
I have modified the relevant process to align with the U-Boot boot sequence. and have validated this on Banana Pi BPI-R3 Mini.[...]
Applied to u-boot/master, thanks!
[1/1] net: phy: Add the Airoha EN8811H PHY driver
commit: c9c8df2c377e512553f2e9ad5d19c4b85efbf07d
Signature · 1 line
Tom