Skip to contentSkip to conversation

dt-bindings: net: Document support for Airoha AN7583 MDIO Controller

PATCH Applied Christian Marangi 3 participants 4 messages Jun 17, 2025 – Jun 27, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 dt-bindings: net: Document support for Airoha AN7583 MDIO Controller

Airoha AN7583 SoC have 3 different MDIO Controller. One comes from the intergated Switch based on MT7530. The other 2 live under the SCU register and expose 2 dedicated MDIO controller.

Document the schema for the 2 dedicated MDIO controller. Each MDIO controller can be independently reset with the SoC reset line. Each MDIO controller have a dedicated clock configured to 2.5MHz by default to follow MDIO bus IEEE 802.3 standard.

---
Changes v2:
- Out of RFC
- Rework the schema to MDIO child nodes with dedicated reg
- Add clock property (required for clock-frequency)
- Make reset property mandatory

 .../bindings/net/airoha,an7583-mdio.yaml      | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml
Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml new file +59 -0
new file mode 100644
index 000000000000..3e7e68ec1560
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/airoha,an7583-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Airoha AN7583 Dedicated MDIO Controller
+
+maintainers:
+  - Christian Marangi <[email protected]>
+
+description:
+  Airoha AN7583 SoC have 3 different MDIO Controller.
+
+  One comes from the intergated Switch based on MT7530.
+
+  The other 2 (that this schema describe) live under the SCU
+  register supporting both C22 and C45 PHYs.
+
+$ref: mdio.yaml#
+
+properties:
+  compatible:
+    const: airoha,an7583-mdio
+
+  reg:
+    enum: [0xc8, 0xcc]
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  clock-frequency:
+    default: 2500000
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    system-controller {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mdio-bus@c8 {
+            compatible = "airoha,an7583-mdio";
+            reg = <0xc8>;
+
+            clocks = <&scu>;
+            resets = <&scu>;
+        };
+    };
Signature · 1 line
2.48.1
#1 lore raw

PATCH v2 2/2 net: mdio: Add MDIO bus controller for Airoha AN7583

Airoha AN7583 SoC have 2 dedicated MDIO bus controller in the SCU register map. To driver register an MDIO controller based on the DT reg property and access the register by accessing the parent syscon.

The MDIO bus logic is similar to the MT7530 internal MDIO bus but deviates of some setting and some HW bug.

On Airoha AN7583 the MDIO clock is set to 25MHz by default and needs to be correctly setup to 2.5MHz to correctly work (by setting the divisor to 10x).

There seems to be Hardware bug where AN7583_MII_RWDATA is not wiped in the context of unconnected PHY and the previous read value is returned.

Example: (only one PHY on the BUS at 0x1f)
- read at 0x1f report at 0x2 0x7500
- read at 0x0 report 0x7500 on every address

To workaround this, we reset the Mdio BUS at every read to have consistent values on read operation.

---
Changes v2:
- Out of RFC
- Drop fast mode register (it was reported that they are used for debug purpose)
- Connect actual clock to support clock-frequency tuning
- Adapt to DT schema changes
- Add and document found HW bug with spurious read on unconnected PHY

 drivers/net/mdio/Kconfig       |   7 +
 drivers/net/mdio/Makefile      |   1 +
 drivers/net/mdio/mdio-airoha.c | 276 +++++++++++++++++++++++++++++++++
 3 files changed, 284 insertions(+)
 create mode 100644 drivers/net/mdio/mdio-airoha.c
drivers/net/mdio/Kconfig +7 -0
index 7db40aaa079d..e1e32b687068 100644
@@ -27,6 +27,13 @@ config ACPI_MDIO
 	help
 	  ACPI MDIO bus (Ethernet PHY) accessors
 
+config MDIO_AIROHA
+	tristate "Airoha AN7583 MDIO bus controller"
+	depends on ARCH_AIROHA || COMPILE_TEST
+	help
+	  This module provides a driver for the MDIO busses found in the
+	  Airoha AN7583 SoC's.
+
 config MDIO_SUN4I
 	tristate "Allwinner sun4i MDIO interface support"
 	depends on ARCH_SUNXI || COMPILE_TEST
drivers/net/mdio/Makefile +1 -0
index c23778e73890..fbec636700e7 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_ACPI_MDIO)		+= acpi_mdio.o
 obj-$(CONFIG_FWNODE_MDIO)	+= fwnode_mdio.o
 obj-$(CONFIG_OF_MDIO)		+= of_mdio.o
 
+obj-$(CONFIG_MDIO_AIROHA)		+= mdio-airoha.o
 obj-$(CONFIG_MDIO_ASPEED)		+= mdio-aspeed.o
 obj-$(CONFIG_MDIO_BCM_IPROC)		+= mdio-bcm-iproc.o
 obj-$(CONFIG_MDIO_BCM_UNIMAC)		+= mdio-bcm-unimac.o
drivers/net/mdio/mdio-airoha.c new file +276 -0

276 lines not on this page · raw message

Signature · 1 line
2.48.1
maintainer Reviewed-by on v2 2/2
#2 lore raw

Re: [net-next PATCH v2 2/2] net: mdio: Add MDIO bus controller for Airoha AN7583

Quoted 15 lines · Christian Marangi

Airoha AN7583 SoC have 2 dedicated MDIO bus controller in the SCU register map. To driver register an MDIO controller based on the DT reg property and access the register by accessing the parent syscon.

The MDIO bus logic is similar to the MT7530 internal MDIO bus but deviates of some setting and some HW bug.

On Airoha AN7583 the MDIO clock is set to 25MHz by default and needs to be correctly setup to 2.5MHz to correctly work (by setting the divisor to 10x).

There seems to be Hardware bug where AN7583_MII_RWDATA is not wiped in the context of unconnected PHY and the previous read value is returned.

Quoted 8 lines

Example: (only one PHY on the BUS at 0x1f)
- read at 0x1f report at 0x2 0x7500
- read at 0x0 report 0x7500 on every address

To workaround this, we reset the Mdio BUS at every read to have consistent values on read operation.

Andrew

#3 lore raw
In reply to Christian Marangi
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 10 lines · On Tue, 17 Jun 2025 11:16:52 +0200 you wrote:

Airoha AN7583 SoC have 3 different MDIO Controller. One comes from the intergated Switch based on MT7530. The other 2 live under the SCU register and expose 2 dedicated MDIO controller.

Document the schema for the 2 dedicated MDIO controller. Each MDIO controller can be independently reset with the SoC reset line. Each MDIO controller have a dedicated clock configured to 2.5MHz by default to follow MDIO bus IEEE 802.3 standard.

[...]

Here is the summary with links:
- [net-next,v2,1/2] dt-bindings: net: Document support for Airoha AN7583 MDIO Controller

    https://git.kernel.org/netdev/net-next/c/a6ee35bd1fe0
  - [net-next,v2,2/2] net: mdio: Add MDIO bus controller for Airoha AN7583
    https://git.kernel.org/netdev/net-next/c/67e3ba978361

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html