Skip to contentSkip to conversation

Add support for PIC64-HPSC/HX MDIO controller

PATCH Superseded Charles Perry 3 participants 9 messages Mar 23 – Apr 7

Subsystems (5)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH v2 1/2 dt-bindings: net: document Microchip PIC64-HPSC/HX MDIO controller

In reply to Charles Perry

This MDIO hardware is based on a Microsemi design supported in Linux by mdio-mscc-miim.c. However, The register interface is completely different with pic64hpsc, hence the need for separate documentation.

The hardware supports C22 and C45.

The documentation recommends an input clock of 156.25MHz and a prescaler of 39, which yields an MDIO clock of 1.95MHz.

The hardware supports an interrupt pin to signal transaction completion which is not strictly needed as the software can also poll a "TRIGGER" bit for this.

---

Notes:
Changes in v2:
- Make "clocks" and "interrupts" required (Andrew)
- Add a default value to "clock-frequency" (Andrew)

 .../net/microchip,pic64hpsc-mdio.yaml         | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +68 -0
new file mode 100644
index 000000000000..d690afe3d3cf
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/microchip,pic64hpsc-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip PIC64-HPSC/HX MDIO controller
+
+maintainers:
+  - Charles Perry <[email protected]>
+
+description: |
+  Microchip PIC64-HPSC/HX SoCs have two MDIO bus controller. This MDIO bus
+  controller supports C22 and C45 register access. It is named "MDIO Initiator"
+  in the documentation.
+
+allOf:
+  - $ref: mdio.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - const: microchip,pic64hpsc-mdio
+      - items:
+          - const: microchip,pic64hx-mdio
+          - const: microchip,pic64hpsc-mdio
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-frequency:
+    default: 2500000
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        mdio@4000C21E000 {
+            compatible = "microchip,pic64hpsc-mdio";
+            reg = <0x400 0x0C21E000 0x0 0x1000>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            clocks = <&svc_clk>;
+            interrupt-parent = <&saplic0>;
+            interrupts = <168 IRQ_TYPE_LEVEL_HIGH>;
+
+            phy0: ethernet-phy@0 {
+                reg = <0>;
+            };
+        };
+    };
Signature · 1 line
2.47.3
author maintainer
#4 lore raw

PATCH v2 2/2 net: mdio: add a driver for PIC64-HPSC/HX MDIO controller

In reply to Charles Perry

This adds an MDIO driver for PIC64-HPSC/HX. The hardware supports C22 and C45 but only C22 is implemented in this commit.

This MDIO hardware is based on a Microsemi design supported in Linux by mdio-mscc-miim.c. However, The register interface is completely different with pic64hpsc, hence the need for a separate driver.

The documentation recommends an input clock of 156.25MHz and a prescaler of 39, which yields an MDIO clock of 1.95MHz.

The hardware supports an interrupt pin or a "TRIGGER" bit that can be polled to signal transaction completion. This commit uses polling.

This was tested on Microchip HB1301 evalkit with a VSC8574 and a VSC8541.

---

Notes:
Changes in v2:
- Remove #define for unused registers (Maxime)
- Add "c22" to clause 22 read/write ops (Maxime)
- Remove the call to platform_set_drvdata() (Andrew)
- Make the clock mandatory (Andrew)
- Use 2.5MHz if no clock-frequency was specified (Andrew)
- Change the error message for bad clock-frequency (Andrew)
- Fix a use without initialization on bus_freq (Andrew)

 drivers/net/mdio/Kconfig          |   7 ++
 drivers/net/mdio/Makefile         |   1 +
 drivers/net/mdio/mdio-pic64hpsc.c | 192 ++++++++++++++++++++++++++++++
 3 files changed, 200 insertions(+)
 create mode 100644 drivers/net/mdio/mdio-pic64hpsc.c
drivers/net/mdio/Kconfig +7 -0
index 44380378911b..7bdba8c3ddef 100644
@@ -146,6 +146,13 @@ config MDIO_OCTEON
 	  buses. It is required by the Octeon and ThunderX ethernet device
 	  drivers on some systems.
 
+config MDIO_PIC64HPSC
+	tristate "PIC64-HPSC/HX MDIO interface support"
+	depends on HAS_IOMEM && OF_MDIO
+	help
+	  This driver supports the MDIO interface found on the PIC64-HPSC/HX
+	  SoCs.
+
 config MDIO_IPQ4019
 	tristate "Qualcomm IPQ4019 MDIO interface support"
 	depends on HAS_IOMEM && OF_MDIO
drivers/net/mdio/Makefile +1 -0
index fbec636700e7..048586746026 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_MDIO_MOXART)		+= mdio-moxart.o
 obj-$(CONFIG_MDIO_MSCC_MIIM)		+= mdio-mscc-miim.o
 obj-$(CONFIG_MDIO_MVUSB)		+= mdio-mvusb.o
 obj-$(CONFIG_MDIO_OCTEON)		+= mdio-octeon.o
+obj-$(CONFIG_MDIO_PIC64HPSC)		+= mdio-pic64hpsc.o
 obj-$(CONFIG_MDIO_REALTEK_RTL9300)	+= mdio-realtek-rtl9300.o
 obj-$(CONFIG_MDIO_REGMAP)		+= mdio-regmap.o
 obj-$(CONFIG_MDIO_SUN4I)		+= mdio-sun4i.o
drivers/net/mdio/mdio-pic64hpsc.c new file +192 -0

192 lines not on this page · raw message

Signature · 1 line
2.47.3

Charles Perry

author maintainer
#0 lore raw

v2 cover Add support for PIC64-HPSC/HX MDIO controller

Hello,

This series adds a driver for the two MDIO controllers of PIC64-HPSC/HX. The hardware supports C22 and C45 but only C22 is implemented for now.

This MDIO hardware is based on a Microsemi design supported in Linux by mdio-mscc-miim.c. However, The register interface is completely different with pic64hpsc, hence the need for a separate driver.

The documentation recommends an input clock of 156.25MHz and a prescaler of 39, which yields an MDIO clock of 1.95MHz.

This was tested on Microchip HB1301 evalkit which has a VSC8574 and a VSC8541 with clock frequencies of 0.6, 1.95 and 2.5 MHz.

Thanks,
Charles

Changes in v2:
- 1/2: Make "clocks" and "interrupts" required (Andrew)
- 1/2: Add a default value to "clock-frequency" (Andrew)
- 2/2: Remove #define for unused registers (Maxime)
- 2/2: Add "c22" to clause 22 read/write ops (Maxime)
- 2/2: Remove the call to platform_set_drvdata() (Andrew)
- 2/2: Make the clock mandatory (Andrew)
- 2/2: Use 2.5MHz if no clock-frequency was specified (Andrew)
- 2/2: Change the error message for bad clock-frequency (Andrew)
- 2/2: Fix a use without initialization on bus_freq (Andrew)

Charles Perry (2):
dt-bindings: net: document Microchip PIC64-HPSC/HX MDIO controller
net: mdio: add a driver for PIC64-HPSC/HX MDIO controller

 .../net/microchip,pic64hpsc-mdio.yaml         |  68 +++++++
 drivers/net/mdio/Kconfig                      |   7 +
 drivers/net/mdio/Makefile                     |   1 +
 drivers/net/mdio/mdio-pic64hpsc.c             | 192 ++++++++++++++++++
 4 files changed, 268 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml
 create mode 100644 drivers/net/mdio/mdio-pic64hpsc.c
Signature · 1 line
2.47.3
maintainer
#5 lore raw
Quoted 4 lines · On Mon, 23 Mar 2026 15:02:52 -0700 Charles Perry wrote:
 .../net/microchip,pic64hpsc-mdio.yaml         |  68 +++++++
 drivers/net/mdio/Kconfig                      |   7 +
 drivers/net/mdio/Makefile                     |   1 +
 drivers/net/mdio/mdio-pic64hpsc.c             | 192 ++++++++++++++++++

Speaking under correction from PHY maintainers but I think we need a MAINTAINERS entry that will cover Microchip MDIO, or at least the files you're adding. Important read:
https://docs.kernel.org/next/maintainer/feature-and-driver-maintainers.html

Signature · 1 line
pw-bot: cr
author maintainer
#6 lore raw
Quoted 10 lines · Jakub Kicinski
Quoted 4 lines · On Mon, 23 Mar 2026 15:02:52 -0700 Charles Perry wrote:
 .../net/microchip,pic64hpsc-mdio.yaml         |  68 +++++++
 drivers/net/mdio/Kconfig                      |   7 +
 drivers/net/mdio/Makefile                     |   1 +
 drivers/net/mdio/mdio-pic64hpsc.c             | 192 ++++++++++++++++++

Speaking under correction from PHY maintainers but I think we need a MAINTAINERS entry that will cover Microchip MDIO, or at least the files you're adding. Important read:
https://docs.kernel.org/next/maintainer/feature-and-driver-maintainers.html

Sure, I think this should go under "RISC-V MICROCHIP SUPPORT" or maybe a new "MICROCHIP PIC64-HPSC/HX DRIVER" entry if the former was meant only for Polarfire SoC.

I'll add something in v3.

Thanks,
Charles

Quoted 2 lines
Signature · 1 line
pw-bot: cr
maintainer
#7 lore raw
Quoted 12 lines · On Fri, 27 Mar 2026 05:34:32 -0700 Charles Perry wrote:
Quoted 10 lines · Jakub Kicinski
Quoted 4 lines · On Mon, 23 Mar 2026 15:02:52 -0700 Charles Perry wrote:
 .../net/microchip,pic64hpsc-mdio.yaml         |  68 +++++++
 drivers/net/mdio/Kconfig                      |   7 +
 drivers/net/mdio/Makefile                     |   1 +
 drivers/net/mdio/mdio-pic64hpsc.c             | 192 ++++++++++++++++++  

Speaking under correction from PHY maintainers but I think we need a MAINTAINERS entry that will cover Microchip MDIO, or at least the files you're adding. Important read:
https://docs.kernel.org/next/maintainer/feature-and-driver-maintainers.html

Quoted 5 lines

Sure, I think this should go under "RISC-V MICROCHIP SUPPORT" or maybe a new "MICROCHIP PIC64-HPSC/HX DRIVER" entry if the former was meant only for Polarfire SoC.

I'll add something in v3.

Thanks! FWIW I'd prefer the latter - smaller entries make the responsibility clear. Under a big arch entry the maintainers are usually seeing too many random patches to act. You can add _both_ dedicated a entry and add the files to RISC-V MICROCHIP, if you prefer, too.

author maintainer
#8 lore raw
Quoted 17 lines · Jakub Kicinski
Quoted 16 lines · On Fri, 27 Mar 2026 05:34:32 -0700 Charles Perry wrote:
Quoted 10 lines · Jakub Kicinski
Quoted 4 lines · On Mon, 23 Mar 2026 15:02:52 -0700 Charles Perry wrote:
 .../net/microchip,pic64hpsc-mdio.yaml         |  68 +++++++
 drivers/net/mdio/Kconfig                      |   7 +
 drivers/net/mdio/Makefile                     |   1 +
 drivers/net/mdio/mdio-pic64hpsc.c             | 192 ++++++++++++++++++  

Speaking under correction from PHY maintainers but I think we need a MAINTAINERS entry that will cover Microchip MDIO, or at least the files you're adding. Important read:
https://docs.kernel.org/next/maintainer/feature-and-driver-maintainers.html

Sure, I think this should go under "RISC-V MICROCHIP SUPPORT" or maybe a new "MICROCHIP PIC64-HPSC/HX DRIVER" entry if the former was meant only for Polarfire SoC.

Quoted 7 lines
Quoted 1 line

I'll add something in v3.

Thanks! FWIW I'd prefer the latter - smaller entries make the responsibility clear. Under a big arch entry the maintainers are usually seeing too many random patches to act. You can add _both_ dedicated a entry and add the files to RISC-V MICROCHIP, if you prefer, too.

Ok, thank you for the suggestion.

I'll go with "MICROCHIP PIC64-HPSC/HX DRIVERS" for all the small SoC drivers (MDIO, GPIO, timers, etc.) and a separate entry for the big things like RDMA or FRER hw accelerator, if we ever get there.

I won't add anything to RISC-V MICROCHIP SUPPORT even if PIC64-HPSC is indeed a RISC-V chip since this entry is all Polarfire.

Thanks,
Charles

maintainer
#2 lore raw

Re: [PATCH net-next v2 1/2] dt-bindings: net: document Microchip PIC64-HPSC/HX MDIO controller

In reply to Charles Perry
Quoted 33 lines · Charles Perry

This MDIO hardware is based on a Microsemi design supported in Linux by mdio-mscc-miim.c. However, The register interface is completely different with pic64hpsc, hence the need for separate documentation.

The hardware supports C22 and C45.

The documentation recommends an input clock of 156.25MHz and a prescaler of 39, which yields an MDIO clock of 1.95MHz.

The hardware supports an interrupt pin to signal transaction completion which is not strictly needed as the software can also poll a "TRIGGER" bit for this.

---

Notes:
Changes in v2:
- Make "clocks" and "interrupts" required (Andrew)
- Add a default value to "clock-frequency" (Andrew)

 .../net/microchip,pic64hpsc-mdio.yaml         | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +2 -0
new file mode 100644
index 000000000000..d690afe3d3cf
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 12

Quoted 10 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/net/microchip,pic64hpsc-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip PIC64-HPSC/HX MDIO controller
+
+maintainers:
+  - Charles Perry <[email protected]>
+
+description: |

Don't need '|' if no formatting to preserve.

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 13

Quoted 1 line
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +1 -0
+  Microchip PIC64-HPSC/HX SoCs have two MDIO bus controller. This MDIO bus

s/controller/controllers/

Though how many instances there are is not really applicable to the binding unless there is some difference.

Quoted 32 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +32 -0
+  controller supports C22 and C45 register access. It is named "MDIO Initiator"
+  in the documentation.
+
+allOf:
+  - $ref: mdio.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - const: microchip,pic64hpsc-mdio
+      - items:
+          - const: microchip,pic64hx-mdio
+          - const: microchip,pic64hpsc-mdio
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-frequency:
+    default: 2500000
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - interrupts
+

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 55

Quoted 10 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +10 -0
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        mdio@4000C21E000 {

Unit-addresses are lower case hex.

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 57

Quoted 2 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +2 -0
+            compatible = "microchip,pic64hpsc-mdio";
+            reg = <0x400 0x0C21E000 0x0 0x1000>;

And generally we use lower case here too.

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 64

Quoted 7 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +7 -0
+            #address-cells = <1>;
+            #size-cells = <0>;
+            clocks = <&svc_clk>;
+            interrupt-parent = <&saplic0>;
+            interrupts = <168 IRQ_TYPE_LEVEL_HIGH>;
+
+            phy0: ethernet-phy@0 {

Drop unused labels.

Quoted 7 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +4 -0
+                reg = <0>;
+            };
+        };
+    };
Signature · 1 line
2.47.3
author maintainer
#3 lore raw

Re: [PATCH net-next v2 1/2] dt-bindings: net: document Microchip PIC64-HPSC/HX MDIO controller

Quoted 38 lines · Rob Herring
Quoted 37 lines · Charles Perry

This MDIO hardware is based on a Microsemi design supported in Linux by mdio-mscc-miim.c. However, The register interface is completely different with pic64hpsc, hence the need for separate documentation.

The hardware supports C22 and C45.

The documentation recommends an input clock of 156.25MHz and a prescaler of 39, which yields an MDIO clock of 1.95MHz.

The hardware supports an interrupt pin to signal transaction completion which is not strictly needed as the software can also poll a "TRIGGER" bit for this.

---

Notes:
Changes in v2:
- Make "clocks" and "interrupts" required (Andrew)
- Add a default value to "clock-frequency" (Andrew)

 .../net/microchip,pic64hpsc-mdio.yaml         | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +6 -0
new file mode 100644
index 000000000000..d690afe3d3cf
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/microchip,pic64hpsc-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
Quoted 9 lines

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 12

Quoted 6 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +6 -0
+title: Microchip PIC64-HPSC/HX MDIO controller
+
+maintainers:
+  - Charles Perry <[email protected]>
+
+description: |

Don't need '|' if no formatting to preserve.

Ok

Quoted 6 lines

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 13

Quoted 1 line
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +1 -0
+  Microchip PIC64-HPSC/HX SoCs have two MDIO bus controller. This MDIO bus

s/controller/controllers/

Though how many instances there are is not really applicable to the binding unless there is some difference.

There are no differences between the two instances. I'll remove the mention about the SoC containing two instances.

Quoted 37 lines
Quoted 37 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +36 -0
+  controller supports C22 and C45 register access. It is named "MDIO Initiator"
+  in the documentation.
+
+allOf:
+  - $ref: mdio.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - const: microchip,pic64hpsc-mdio
+      - items:
+          - const: microchip,pic64hx-mdio
+          - const: microchip,pic64hpsc-mdio
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-frequency:
+    default: 2500000
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
Quoted 8 lines

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 55

Quoted 6 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +6 -0
+    #include <dt-bindings/interrupt-controller/irq.h>
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        mdio@4000C21E000 {

Unit-addresses are lower case hex.

Ok

Quoted 5 lines

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 57

Quoted 3 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +2 -0
+            compatible = "microchip,pic64hpsc-mdio";
+            reg = <0x400 0x0C21E000 0x0 0x1000>;

And generally we use lower case here too.

Ok

Quoted 10 lines

Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml line 64

Quoted 8 lines
Documentation/devicetree/bindings/net/microchip,pic64hpsc-mdio.yaml new file +7 -0
+            #address-cells = <1>;
+            #size-cells = <0>;
+            clocks = <&svc_clk>;
+            interrupt-parent = <&saplic0>;
+            interrupts = <168 IRQ_TYPE_LEVEL_HIGH>;
+
+            phy0: ethernet-phy@0 {

Drop unused labels.

Ok

Thanks,
Charles