Skip to contentSkip to conversation

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

RFC PATCH Superseded Christian Marangi 3 participants 6 messages May 27, 2025 – Jun 5, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 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 that expose the 2 dedicated MDIO controller. Each MDIO controller can be independently reset with the SoC reset line.

---
 .../bindings/net/airoha,an7583-mdio.yaml      | 78 +++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml
Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml new file +78 -0
new file mode 100644
index 000000000000..2375f1bf85a2
@@ -0,0 +1,78 @@
+# 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.
+
+properties:
+  compatible:
+    const: airoha,an7583-mdio
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  '^mdio(-(bus|external))@[0-1]$':
+    type: object
+
+    $ref: mdio.yaml#
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 1
+
+      resets:
+        maxItems: 1
+
+    required:
+      - reg
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    mdio-controller {
+        compatible = "airoha,an7583-mdio";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mdio-bus@0 {
+            reg = <0>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            ethernet-phy@1f {
+                reg = <31>;
+            };
+        };
+
+        mdio-bus@1 {
+            reg = <1>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
Signature · 1 line
2.48.1
#1 lore raw

RFC PATCH 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 expose the 2 MDIO controller based on the DT node 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 to enable MDIO fast mode and some difference for CL45 handling.

---
 drivers/net/mdio/Kconfig       |   7 +
 drivers/net/mdio/Makefile      |   1 +
 drivers/net/mdio/mdio-airoha.c | 275 +++++++++++++++++++++++++++++++++
 3 files changed, 283 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 +275 -0

275 lines not on this page · raw message

Signature · 1 line
2.48.1
maintainer
#2 lore raw

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

drivers/net/mdio/mdio-airoha.c line 41

Quoted 3 lines
drivers/net/mdio/mdio-airoha.c new file +3 -0
+#define AN7583_MDIO_PHY				0xd4
+#define   AN7583_MDIO1_SPEED_MODE		BIT(11)
+#define   AN7583_MDIO0_SPEED_MODE		BIT(10)

Is there any documentation about what these bits do? The bus should default to 2.5Mhz.

Andrew

#3 lore raw

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

Quoted 7 lines · Andrew Lunn

drivers/net/mdio/mdio-airoha.c line 41

Quoted 3 lines
drivers/net/mdio/mdio-airoha.c new file +3 -0
+#define AN7583_MDIO_PHY				0xd4
+#define   AN7583_MDIO1_SPEED_MODE		BIT(11)
+#define   AN7583_MDIO0_SPEED_MODE		BIT(10)

Is there any documentation about what these bits do? The bus should default to 2.5Mhz.

No but I can ask. In theory tho these MDIO controller are used for 10g or 2.5g PHY that all require a firmware to load so 2.5MHz makes the boot time of 2+ minute.

The documentation say...

1: fast mode
0: normal mode

Very useful I guess :D

Signature · 1 line
	Ansuel
maintainer
#4 lore raw

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

Quoted 13 lines · Christian Marangi
Quoted 7 lines · Andrew Lunn

drivers/net/mdio/mdio-airoha.c line 41

Quoted 3 lines
drivers/net/mdio/mdio-airoha.c new file +3 -0
+#define AN7583_MDIO_PHY				0xd4
+#define   AN7583_MDIO1_SPEED_MODE		BIT(11)
+#define   AN7583_MDIO0_SPEED_MODE		BIT(10)

Is there any documentation about what these bits do? The bus should default to 2.5Mhz.

No but I can ask. In theory tho these MDIO controller are used for 10g or 2.5g PHY that all require a firmware to load so 2.5MHz makes the boot time of 2+ minute.

Quoted 6 lines

The documentation say...

1: fast mode
0: normal mode

Very useful I guess :D

Can you put an oscilloscope on the clock line and measure it?

We have the DT property:

clock-frequency:
description:
Desired MDIO bus clock frequency in Hz. Values greater than IEEE 802.3 defined 2.5MHz should only be used when all devices on the bus support the given clock speed.

It would be good to default to normal mode, but allow fast to be selected, once we know what it actually is.

Andrew

maintainer
#5 lore raw
In reply to Christian Marangi
Quoted 32 lines · Christian Marangi

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 that expose the 2 dedicated MDIO controller. Each MDIO controller can be independently reset with the SoC reset line.

---
 .../bindings/net/airoha,an7583-mdio.yaml      | 78 +++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml
Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml new file +13 -0
new file mode 100644
index 000000000000..2375f1bf85a2
@@ -0,0 +1,78 @@
+# 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.

Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml line 23

Quoted 10 lines
Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml new file +10 -0
+
+  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.
+
+properties:
+  compatible:
+    const: airoha,an7583-mdio
+

No registers? Looks to me like this middle node should go and the SCU node should have 2 mdio child nodes at 0xc8 and 0xcc.

It looks like you'll need to define the speed mode bit location somehow as well.

Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml line 31

Quoted 8 lines
Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml new file +8 -0
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  '^mdio(-(bus|external))@[0-1]$':

Just '^mdio@[0-1]$'

If you need to distinguish external or something, use compatible or something.

Quoted 50 lines
Documentation/devicetree/bindings/net/airoha,an7583-mdio.yaml new file +47 -0
+    type: object
+
+    $ref: mdio.yaml#
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 1
+
+      resets:
+        maxItems: 1
+
+    required:
+      - reg
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    mdio-controller {
+        compatible = "airoha,an7583-mdio";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mdio-bus@0 {
+            reg = <0>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            ethernet-phy@1f {
+                reg = <31>;
+            };
+        };
+
+        mdio-bus@1 {
+            reg = <1>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
Signature · 1 line
2.48.1