net: phy: Add the Airoha EN8811H PHY driver
Subsystems (2)
PATCH v3 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.
Locating the AIROHA FW within the filesystem at the designated partition and path will trigger its automatic loading and writing to the PHY via MDIO. If need board specific loading override,
please override the en8811h_read_fw function on board or architecture level.
Linux upstream AIROHA EN8811H driver commit:71e79430117d56c409c5ea485a263bc0d8083390
Based on the Linux upstream AIROHA EN8811H 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.
---
Change in PATCH v3:air_en8811h.c:
* Add U-Boot environment variable(en8811h_fw_part, en8811h_fw_dm_dir, en8811h_fw_dsp_dir) support for firmware loading.
drivers/net/phy/Kconfig | 25 + drivers/net/phy/Makefile | 1 + drivers/net/phy/air_en8811h.c | 880 ++++++++++++++++++++++++++++++++++ 3 files changed, 906 insertions(+) create mode 100644 drivers/net/phy/air_en8811h.c
drivers/net/phy/Kconfig +25 -0
@@ -79,6 +79,31 @@ 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 partition" + help + Airoha PHYs use firmware which can be loaded automatically + from storage directly attached to the PHY, and then loaded + via MDIO commands by the boot loader. The firmware is loaded + from a file specified by the U-Boot environment variables + en8811h_fw_part, en8811h_fw_dm_dir, and en8811h_fw_dsp_dir. + +endchoice + 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 +880 -0
880 lines not on this page · raw message
--
2.34.1
Hi
Quoted 22 lines
Gesendet: Sonntag, 20. Juli 2025 um 14:28
Von: "Lucien.Jheng" <[email protected]>
Betreff: [U-Boot, v3, 1/1]net: phy: Add the Airoha EN8811H PHY driverAdd 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.
Locating the AIROHA FW within the filesystem at the designated partition and path will trigger its automatic loading and writing to the PHY via MDIO. If need board specific loading override,
please override theen8811h_read_fwfunction on board or architecture level.Linux upstream AIROHA EN8811H driver commit:
71e79430117d56c409c5ea485a263bc0d8083390Based on the Linux upstream AIROHA EN8811H 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.
Quoted 6 lines
Signed-off-by Lucien.Jheng <[email protected]>---
Change in PATCH v3:air_en8811h.c:
* Add U-Boot environmentvariable(en8811h_fw_part, en8811h_fw_dm_dir, en8811h_fw_dsp_dir)support for firmware loading.
Thank you lucien for taking care of this driver...
Quoted 26 lines
drivers/net/phy/Kconfig | 25 + drivers/net/phy/Makefile | 1 + drivers/net/phy/air_en8811h.c | 880 ++++++++++++++++++++++++++++++++++ 3 files changed, 906 insertions(+) create mode 100644 drivers/net/phy/air_en8811h.cdrivers/net/phy/Kconfig +12
-0@@ -79,6 +79,31 @@ 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
drivers/net/phy/Kconfig config PHY_ADIN · line 103
Quoted 10 lines
drivers/net/phy/Kconfig +10
-0+ depends on PHY_AIROHA_EN8811H + +config PHY_AIROHA_FW_IN_MMC + bool "Airoha firmware in MMC partition" + help + Airoha PHYs use firmware which can be loaded automatically + from storage directly attached to the PHY, and then loaded + via MDIO commands by the boot loader. The firmware is loaded + from a file specified by the U-Boot environment variables + en8811h_fw_part, en8811h_fw_dm_dir, and en8811h_fw_dsp_dir.
maybe something like PHY_AIROHA_FW_IN_SUBSYSTEM = (MMC/USB/NVME/...) as choice? or better PHY_AIROHA_FW_BY_ENV and then check env-var with default "mmc" for maximum on flexibility without recompile.
Quoted 10 lines
drivers/net/phy/Kconfig +2
-0+endchoice + menuconfig PHY_AQUANTIA bool "Aquantia Ethernet PHYs support" select PHY_GIGEdrivers/net/phy/air_en8811h.c new file +0
-0
...
Quoted 14 lines
drivers/net/phy/air_en8811h.c new file +14
-0+__weak int en8811h_read_fw (void **addr) +{ +const char *fw_dm, *fw_dsp, *fw_part; +u32 ca_crc32; +void *buffer; +loff_t read; +int ret; + +if (!IS_ENABLED (CONFIG_PHY_AIROHA_FW_IN_MMC )) +return -EOPNOTSUPP ; + +/* Allocate memory to store both DM and DSP firmware */ + buffer =malloc (EN8811H_MD32_DM_SIZE +EN8811H_MD32_DSP_SIZE ); +if (!buffer) {
drivers/net/phy/air_en8811h.c line 483
Quoted 10 lines
drivers/net/phy/air_en8811h.c new file +10
-0+printf ("Failed to allocate memory for firmware\n" ); +return -ENOMEM ; + } + +/* Get the partition name where the firmware is stored */ + fw_part =env_get ("en8811h_fw_part" ); +if (!fw_part) { +printf ("Error: env var en8811h_fw_part not set.\n" ); +return -EINVAL ; + }
this could include non mmc partitions, e.g. usb,nvme to be more generic (maybe separate var). CONFIG-option of course needs to have different name.
drivers/net/phy/air_en8811h.c line 490
Quoted 6 lines
drivers/net/phy/air_en8811h.c new file +6
-0+/* Get the DM firmware file path */ + fw_dm =env_get ("en8811h_fw_dm_dir" ); +if (!fw_dm) { +printf ("Error: env var en8811h_fw_dm_dir not set.\n" ); +return -EINVAL ; + }
imho path could be separated from filename. Filename and Directory (which is mostly same for both files) could be hardcoded, maybe as fallback if vars are not set, to same value as on linux. So users have only point to device and partition.
so default for dir: /lib/firmware/airoha
filenames: EthMD32.dm.bin and EthMD32.DSP.bin
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/airoha
linux driver only defines subpath, but imho on most systems this is below /lib/firmware in rootfs
https://elixir.bootlin.com/linux/v6.16-rc3/source/drivers/net/phy/air_en8811h.c#L23
if i define as dir only /lib/firmware and the airoha-path with filename gets expanded by driver, it will be ok for me, but imho it makes it harder to verify path is set or not and if airoha needs to be added or not. So i would use full path, but default to linux default.
drivers/net/phy/air_en8811h.c line 500
Quoted 9 lines
drivers/net/phy/air_en8811h.c new file +9
-0+/* Get the DSP firmware file path */ + fw_dsp =env_get ("en8811h_fw_dsp_dir" ); +if (!fw_dsp) { +printf ("Error: env var en8811h_fw_dsp_dir not set.\n" ); +return -EINVAL ; + } + +/* Load DM firmware */ + ret =fs_set_blk_dev ("mmc" , fw_part,FS_TYPE_ANY );
this could use a subsystem env-var (with default mmc maybe) to support usb/nvme too.
Quoted 8 lines
drivers/net/phy/air_en8811h.c new file +8
-0+if (ret <0 ) +return ret; + +/* Read DM firmware file into the start of buffer */ + ret =fs_read (fw_dm, (ulong )buffer,0 ,EN8811H_MD32_DM_SIZE , &read); +if (ret <0 ) { +printf ("Failed to read DM firmware: %s\n" , fw_dm); +return ret;
drivers/net/phy/air_en8811h.c line 518
Quoted 10 lines
drivers/net/phy/air_en8811h.c new file +10
-0+ } + +/* Calculate CRC32 of DM firmware for verification */ + ca_crc32 =crc32 (0 , (unsigned char *)buffer,EN8811H_MD32_DM_SIZE ); +debug ("DM crc32: 0x%x\n" , ca_crc32); + +/* Load DSP firmware */ + ret =fs_set_blk_dev ("mmc" , fw_part,FS_TYPE_ANY ); +if (ret <0 ) +return ret;
same here for subsystem and part
Quoted 19 lines
drivers/net/phy/air_en8811h.c new file +19
-0+/* Read DSP firmware file into buffer after DM section */ + ret =fs_read (fw_dsp, (ulong )buffer +EN8811H_MD32_DM_SIZE ,0 , +EN8811H_MD32_DSP_SIZE , &read); +if (ret <0 ) { +printf ("Failed to read DSP firmware: %s\n" , fw_dsp); +return ret; + } + +/* Calculate CRC32 of DSP firmware for verification */ + ca_crc32 =crc32 (0 , (unsigned char *)buffer +EN8811H_MD32_DM_SIZE , +EN8811H_MD32_DSP_SIZE ); +debug ("DSP crc32: 0x%x\n" , ca_crc32); + + *addr = buffer; +debug ("Found Airoha Firmware.\n" ); + +return 0 ; +} +
drivers/net/phy/air_en8811h.c line 548
Quoted 10 lines
drivers/net/phy/air_en8811h.c new file +10
-0+static int en8811h_load_firmware (struct phy_device *phydev) +{ +struct en8811h_priv *priv = phydev->priv; +void *buffer; +int ret; + +if (!IS_ENABLED (CONFIG_PHY_AIROHA_FW_IN_MMC )) { +printf ("Airoha EN8811H firmware loading not implemented\n" ); +return -EOPNOTSUPP ; + }
this check is redundant in en8811h_read_fw which call follows, so imho this could be dropped here, maybe put printf in en8811h_read_fw.
drivers/net/phy/air_en8811h.c line 558
Quoted 9 lines
drivers/net/phy/air_en8811h.c new file +9
-0+ ret =en8811h_read_fw (&buffer); +if (ret <0 ) + goto en8811h_load_firmware_out; + + ret =air_buckpbus_reg_write (phydev,EN8811H_FW_CTRL_1 , +EN8811H_FW_CTRL_1_START ); +if (ret <0 ) + goto en8811h_load_firmware_out; +
regards Frank
Quoted 24 lines · On 7/21/25 5:26 PM, [email protected] wrote:
Hi
Quoted 22 lines
Gesendet: Sonntag, 20. Juli 2025 um 14:28
Von: "Lucien.Jheng" <[email protected]>
Betreff: [U-Boot, v3, 1/1]net: phy: Add the Airoha EN8811H PHY driverAdd 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.
Locating the AIROHA FW within the filesystem at the designated partition and path will trigger its automatic loading and writing to the PHY via MDIO. If need board specific loading override,
please override theen8811h_read_fwfunction on board or architecture level.Linux upstream AIROHA EN8811H driver commit:
71e79430117d56c409c5ea485a263bc0d8083390Based on the Linux upstream AIROHA EN8811H 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.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Lucien.Jheng <[email protected]>---
Change in PATCH v3:air_en8811h.c:
* Add U-Boot environmentvariable(en8811h_fw_part, en8811h_fw_dm_dir, en8811h_fw_dsp_dir)support for firmware loading.Thank you lucien for taking care of this driver...
Indeed, and thank you for the patience.
Quoted 30 lines
Quoted 30 lines
drivers/net/phy/Kconfig | 25 + drivers/net/phy/Makefile | 1 + drivers/net/phy/air_en8811h.c | 880 ++++++++++++++++++++++++++++++++++ 3 files changed, 906 insertions(+)create mode 100644
drivers/net/phy/air_en8811h.cdrivers/net/phy/Kconfig +16
-0@@ -79,6 +79,31 @@ 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 partition"
Quoted 8 lines
drivers/net/phy/Kconfig config PHY_ADIN · line 103
Quoted 6 lines
drivers/net/phy/Kconfig +6
-0+ help + Airoha PHYs use firmware which can be loaded automatically + from storage directly attached to the PHY, and then loaded + via MDIO commands by the boot loader. The firmware is loaded + from a file specified by the U-Boot environment variables + en8811h_fw_part, en8811h_fw_dm_dir, and en8811h_fw_dsp_dir.maybe something like
PHY_AIROHA_FW_IN_SUBSYSTEM= (MMC/USB/NVME/...) as choice? or betterPHY_AIROHA_FW_BY_ENVand then check env-var with default "mmc" for maximum on flexibility without recompile.
If we could use the generic loader interface, than these Kconfig symbols go away altogether , right ?
Am 21. Juli 2025 18:19:54 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 74 lines · On 7/21/25 5:26 PM, [email protected] wrote:
Quoted 24 lines
Hi
Quoted 22 lines
Gesendet: Sonntag, 20. Juli 2025 um 14:28
Von: "Lucien.Jheng" <[email protected]>
Betreff: [U-Boot, v3, 1/1]net: phy: Add the Airoha EN8811H PHY driverAdd 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.
Locating the AIROHA FW within the filesystem at the designated partition and path will trigger its automatic loading and writing to the PHY via MDIO. If need board specific loading override,
please override theen8811h_read_fwfunction on board or architecture level.Linux upstream AIROHA EN8811H driver commit:
71e79430117d56c409c5ea485a263bc0d8083390Based on the Linux upstream AIROHA EN8811H 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.Quoted 8 lines
Quoted 6 lines
Signed-off-by Lucien.Jheng <[email protected]>---
Change in PATCH v3:air_en8811h.c:
* Add U-Boot environmentvariable(en8811h_fw_part, en8811h_fw_dm_dir, en8811h_fw_dsp_dir)support for firmware loading.Thank you lucien for taking care of this driver...
Indeed, and thank you for the patience.
Quoted 30 lines
Quoted 30 lines
drivers/net/phy/Kconfig | 25 + drivers/net/phy/Makefile | 1 + drivers/net/phy/air_en8811h.c | 880 ++++++++++++++++++++++++++++++++++ 3 files changed, 906 insertions(+)create mode 100644
drivers/net/phy/air_en8811h.cdrivers/net/phy/Kconfig +16
-0@@ -79,6 +79,31 @@ 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 partition"Quoted 8 lines
drivers/net/phy/Kconfig config PHY_ADIN · line 103
Quoted 6 lines
drivers/net/phy/Kconfig +6
-0+ help + Airoha PHYs use firmware which can be loaded automatically + from storage directly attached to the PHY, and then loaded + via MDIO commands by the boot loader. The firmware is loaded + from a file specified by the U-Boot environment variables + en8811h_fw_part, en8811h_fw_dm_dir, and en8811h_fw_dsp_dir.maybe something like
PHY_AIROHA_FW_IN_SUBSYSTEM= (MMC/USB/NVME/...) as choice? or betterPHY_AIROHA_FW_BY_ENVand then check env-var with default "mmc" for maximum on flexibility without recompile.
Quoted 1 line
If we could use the generic loader interface, than these
Kconfigsymbols go away altogether , right ?
It depends on how generic loader interface works,but yes for the fw one if subsystem, partition, basepath
should be defined globally and vendorpath and filename is set by driver these could be dropped and also code below has only 2 calls to fsloader passing vendorpath and filename.
regards Frank