On 6/15/25 3:12 PM, Lucien.Jheng wrote:
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.

Signed-off-by: Lucien.Jheng <[email protected]>
---
Change in PATCH v2:
air_en8811h.c:
  * Fix: Indentation and coding style
  * Fix: Invert conditionals in some APIs to reduce indent.
  * Correct en8811h_read_fw(): Integrate malloc to allow other users to
    fully override the loading process and return a buffer containing the 
firmware from its source.

  drivers/net/phy/Kconfig       |  43 ++
  drivers/net/phy/Makefile      |   1 +
  drivers/net/phy/air_en8811h.c | 857 ++++++++++++++++++++++++++++++++++
  3 files changed, 901 insertions(+)
  create mode 100644 drivers/net/phy/air_en8811h.c

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 3132718e4f8..f053f8196c2 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -79,6 +79,49 @@ 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 PHY_AIROHA_FW_PART,
+         PHY_AIROHA_FW_DM_FILEPATH and PHY_AIROHA_FW_DSP_FILEPATH options.
I ran into the same firmware loading problem recently. I took a different approach, have a look at [1] and specifically function rcar_gen4_pcie_load_firmware() . This invokes U-Boot shell script , which has to be defined by the user, and which loads the firmware by whatever means necessary, from whatever storage or location . I think that might be the generic approach to U-Boot firmware loading . If the user needs to change the firmware loading location, they do not need to rebuild the U-Boot itself, they simply update their environment and the matching script. What do you think ?

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Reply via email to