[PATCH net-next v4 0/6] Introduce Airoha AN8801R series Gigabit Ethernet PHY driver
From: Louis-Alexis Eyraud <hidden>
Date: 2026-05-21 08:22:40
Also in:
linux-arm-kernel, linux-devicetree, linux-mediatek, lkml
This series introduces the Airoha AN8801R Gigabit Ethernet PHY initial support. The Airoha AN8801R is a low power single-port Ethernet PHY Transceiver with Single-port serdes interface for 1000Base-X/RGMII. This chip is compliant with 10Base-T, 100Base-TX and 1000Base-T IEEE 802.3(u,ab) and supports: - Energy Efficient Ethernet (802.3az) - Full Duplex Control Flow (802.3x) - auto-negotiation - crossover detect and autocorrection, - Wake-on-LAN with Magic Packet - Jumbo Frame up to 9 Kilobytes. This PHY also supports up to three user-configurable LEDs, which are usually used for LAN Activity, 100M, 1000M indication. The series provides the devicetree binding and the driver that have been written by AngeloGioacchino Del Regno, based on downstream implementation ([1]). The driver allows setting up PHY LEDs, 10/100M, 1000M speeds, and Wake on LAN and PHY interrupts. Since v2, the series also adds the air_phy_lib library, which goal is to share common code between air_en8811h and air_an8801 drivers, and its use in them. The first shared functions are the existing BuckPbus register accessors and air_phy_read/write_page functions coming from air_en8811h driver. The series is based on net-next kernel tree (sha1: 830d8771ae3c) and I have tested it on Mediatek Genio 720-EVK board (that integrates an Airoha AN8801RIN/A Ethernet PHY) with early board hardware enablement patches. [1]: https://gitlab.com/mediatek/aiot/bsp/linux/-/blob/mtk-v6.6/drivers/net/phy/an8801.c Signed-off-by: Louis-Alexis Eyraud <redacted> --- Changes in v4: - Rebased on net-next (830d8771ae3c) - Added in patch 1 the missing function-enumator property description, that should already have been present in v3 - Modified patch 1 and patch 5 subjects to use AN8801R and not AN8801/R (detected by sashiko-nipa) - Modified patch 3 to add missing wordpath.h include (detected by sashiko.dev) - Modified patch 5 to use NSEC_PER_MSEC definition instead of hardcoded value in an8801r_led_blink_ms_to_hw - Removed unnecessary RGMII_DELAY_STEP_MASK mask operation in an8801r_rgmii_rxdelay and an8801r_rgmii_txdelay - Removed extra empty line in an8801r_led_hw_control_set - Improved AN8801_RGMII_TX/RXDELAY_DEFAULT definition comments - Fixed inverted GENMASK arguments in AN8801_WAKE_OUT_WIDTH definition (detected by sashiko-nipa) - Fixed possible overflow when writing LED_BLINK_DUR register value in an8801r_led_blink_set (detected by sashiko-nipa and sashiko.dev) - Modified the an8801r_handle_interrupt to allow the WAKE_MAGICPKT and WAKE_LNKCHG interrupts handling in the same call (detected by sashiko-nipa and sashiko.dev) - Add extra check in an8801r_set_wol to reject unsupported modes (detected by sashiko-nipa) - Fixed supported led trigger detection in an8801r_led_trig_to_hw (detected by sashiko.dev) - Fixed possible uninitialized return value in an8801r_of_init_leds (detected by sashiko-nipa and sashiko.dev) - Modified patch 6 to fix possible cases where the link mode register value might not be updated (detected by sashiko-nipa) - Added new reviewed-by trailers - Link to v3: https://lore.kernel.org/r/20260512-add-airoha-an8801-support-v3-0-1edb34e363ae@collabora.com (local) Changes in v3: - Rebased on net-next (7e0cccae6b45) - Updated patch 1 to describe the function-enumator property for the LEDs and its possible values - Modified patch 2 to add missing includes in air_phy_lib source and header files - Split patch 3 in two so that the api call renames in air_en8811h driver is done in a separate patch - Simplified return code handling in several functions - Fixed return code handling in several functions detected by AI peer-reviews (netdev-ai or sashiko) - Added additional interrupt enabled check before enabling/disabling link changed interrupt in an8801r_suspend/resume callbacks - Fixed register mask for GPIO LED selection register in an8801r_led_init function - Fixed potential uninitialized variable in an8801r_led_polarity_set function - Fixed LED blink register settings in an8801r_led_blink_set function - Split an8801r_read_status function implementation in a separate patch as requested and add comment to describe why the link mode register needed to be modified after reading the link speed. - Link to v2: https://lore.kernel.org/r/20260326-add-airoha-an8801-support-v2-0-1a42d6b6050f@collabora.com (local) Changes in v2: - Rebased on net-next (d1e59a4697371) - Fixed dt-bindings to remove the leds property from the required ones and add wakeup-source as valid property - Added new reviewed-by trailer for dt_bindings - Added new patches (2 and 3) to create air_phy_lib, to share common code between air_en8811h and air_an8801 drivers and use it in air_en8811h. - Remove custom BuckPBus register accessor functions and definitions from air_an8801 and use the ones from air_phy_lib. It also fixes a build issue on v1 due to an uninitialized variable used in __air_buckpbus_reg_read, that is now removed from driver code - Added air_an8801_probe function to allocate the newly added private data structure and detect if the PHY is wakeup capable and the interrupt can be registered as a wakeup IRQ, and perform the needed actions - Added an8801r_suspend and an8801r_resume functions to perform specific actions when WoL is enabled (reset its status, enable/disable the Link Changed interrupt) and call the genphy_suspend/resume functions if needed - Modified an8801r_get_wol to return WoL is not supported if the PHY device is not wakeup capable - Modified an8801r_set_wol to return EOPNOTSUPP error code if the PHY device is not wakeup capable, and to update the wakeup flag according to WoL mode - Modified an8801r_config_init to remove EEE disabling and replace __phy_write use by phy_write_paged - Reworked an8801r_rgmii_delay_config and its subfunctions to fix a double return use in PHY_INTERFACE_MODE_RGMII_ID case, replace the magic value use for default TX and RX delay and handle better the enable/disable the inserted delays for all RGMII modes - Merged an8801r_did_interrupt function in an8801r_handle_interrupt - Modified the an8801r_handle_interrupt processing to process differently the Magic Packet (to notify system wakeup) and the Link Changed interrupt (to notify PHY state machine) - Splitted the reset WoL status part from an8801r_ack_interrupt and fix an issue that in some random cases made WAKEUP_CTL1 register lose the Magic Packet WoL settings - Modified an8801r_of_init_leds function so it does not return an error if the leds configuration is not present in devicetree - Removed feature field and add PHY_ALWAYS_CALL_SUSPEND flag in airoha_driver data structure - Link to v1: https://lore.kernel.org/r/20260304-add-airoha-an8801-support-v1-0-0ae4ee5a2f9d@collabora.com (local) --- AngeloGioacchino Del Regno (2): dt-bindings: net: Add support for Airoha AN8801R GbE PHY net: phy: Introduce Airoha AN8801R Gigabit Ethernet PHY driver Louis-Alexis Eyraud (4): net: phy: Add Airoha phy library for shared code net: phy: air_phy_lib: Factorize BuckPBus register accessors net: phy: Rename Airoha common BuckPBus register accessors net: phy: air_an8801: ensure maximum available speed link use .../devicetree/bindings/net/airoha,an8801.yaml | 116 ++ drivers/net/phy/Kconfig | 12 + drivers/net/phy/Makefile | 2 + drivers/net/phy/air_an8801.c | 1144 ++++++++++++++++++++ drivers/net/phy/air_en8811h.c | 316 +----- drivers/net/phy/air_phy_lib.c | 213 ++++ drivers/net/phy/air_phy_lib.h | 39 + 7 files changed, 1584 insertions(+), 258 deletions(-) --- base-commit: 830d8771ae3c7bc90a62dde76a6556e612529fbc change-id: 20260303-add-airoha-an8801-support-57d544a4afed Best regards, -- Louis-Alexis Eyraud [off-list ref]