Skip to contentSkip to conversation

net: mdio: add ipq8064 mdio driver

PATCH Superseded Ansuel Smith 2 participants 4 messages Feb 27, 2020

Subsystems (5)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH v8 1/2 net: mdio: add ipq8064 mdio driver

Currently ipq806x soc use generic bitbang driver to comunicate with the gmac ethernet interface. Add a dedicated driver created by chunkeey to fix this.

---
Changes in v8:
- Drop syscon_regmap_lookup_by_phandle and make
clock definition in dts mandatory

Changes in v7:
- Add myself as module author and copyright
- Reduced usleep_range to 8-10 as suggested by chunkeey

Changes in v6:
- Fix error in commit description
- Add co-developed tag

Changes in v5:
- Rename define to more rappresentative name

Changes in v4:
- Fix wrong print value in dev_err

Changes in v3:
- Fix wrong return logic on error

Changes in v2:
- Use regmap_read_poll_timeout
- Reject clause 45

 drivers/net/phy/Kconfig        |   8 ++
 drivers/net/phy/Makefile       |   1 +
 drivers/net/phy/mdio-ipq8064.c | 166 +++++++++++++++++++++++++++++++++
 3 files changed, 175 insertions(+)
 create mode 100644 drivers/net/phy/mdio-ipq8064.c
drivers/net/phy/Kconfig +8 -0
index 9dabe03a668c..ec2a5493a7e8 100644
@@ -157,6 +157,14 @@ config MDIO_I2C
 
 	  This is library mode.
 
+config MDIO_IPQ8064
+	tristate "Qualcomm IPQ8064 MDIO interface support"
+	depends on HAS_IOMEM && OF_MDIO
+	depends on MFD_SYSCON
+	help
+	  This driver supports the MDIO interface found in the network
+	  interface units of the IPQ8064 SoC
+
 config MDIO_MOXART
 	tristate "MOXA ART MDIO interface support"
 	depends on ARCH_MOXART || COMPILE_TEST
drivers/net/phy/Makefile +1 -0
index fe5badf13b65..8f02bd2089f3 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_MDIO_CAVIUM)	+= mdio-cavium.o
 obj-$(CONFIG_MDIO_GPIO)		+= mdio-gpio.o
 obj-$(CONFIG_MDIO_HISI_FEMAC)	+= mdio-hisi-femac.o
 obj-$(CONFIG_MDIO_I2C)		+= mdio-i2c.o
+obj-$(CONFIG_MDIO_IPQ8064)	+= mdio-ipq8064.o
 obj-$(CONFIG_MDIO_MOXART)	+= mdio-moxart.o
 obj-$(CONFIG_MDIO_MSCC_MIIM)	+= mdio-mscc-miim.o
 obj-$(CONFIG_MDIO_OCTEON)	+= mdio-octeon.o
drivers/net/phy/mdio-ipq8064.c new file +166 -0

166 lines not on this page · raw message

Signature · 1 line
2.25.0
#1 lore raw

PATCH v8 2/2 dt-bindings: net: Add ipq806x mdio bindings

Add documentations for ipq806x mdio driver.

---
Changes in v8:
- Fix error in dtb check
- Remove not needed reset definition from example
- Add include header for ipq806x clocks
- Fix wrong License type

Changes in v7:
- Fix dt_binding_check problem

 .../bindings/net/qcom,ipq8064-mdio.yaml       | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +61 -0
new file mode 100644
index 000000000000..4334a415f23c
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/qcom,ipq8064-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm ipq806x MDIO bus controller
+
+maintainers:
+  - Ansuel Smith <[email protected]>
+
+description:
+  The ipq806x soc have a MDIO dedicated controller that is
+  used to comunicate with the gmac phy conntected.
+  Child nodes of this MDIO bus controller node are standard
+  Ethernet PHY device nodes as described in
+  Documentation/devicetree/bindings/net/phy.txt
+
+allOf:
+  - $ref: "mdio.yaml#"
+
+properties:
+  compatible:
+    items:
+        - const: qcom,ipq8064-mdio
+        - const: syscon
+
+  reg:
+    description: address and length of the register set for the device
+
+  clocks:
+    description: A reference to the clock supplying the MDIO bus controller
+
+  clock-names:
+    const: master
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - "#address-cells"
+  - "#size-cells"
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
+
+    mdio0: mdio@37000000 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        compatible = "qcom,ipq8064-mdio", "syscon";
+        reg = <0x37000000 0x200000>;
+
+        clocks = <&gcc GMAC_CORE1_CLK>;
+
+        switch@10 {
+            compatible = "qca,qca8337";
+            /* ... */
+        };
+    };
Signature · 1 line
2.25.0
maintainer
#2 lore raw

Re: [PATCH v8 2/2] dt-bindings: net: Add ipq806x mdio bindings

Quoted 23 lines · Ansuel Smith

Add documentations for ipq806x mdio driver.

---
Changes in v8:
- Fix error in dtb check
- Remove not needed reset definition from example
- Add include header for ipq806x clocks
- Fix wrong License type

Changes in v7:
- Fix dt_binding_check problem

 .../bindings/net/qcom,ipq8064-mdio.yaml       | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +0 -0
new file mode 100644
index 000000000000..4334a415f23c

Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 1

Quoted 1 line
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +1 -0
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: GPL-2.0-only

Dual license new bindings please:

(GPL-2.0-only OR BSD-2-Clause)

Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 14

Quoted 13 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +13 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/qcom,ipq8064-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm ipq806x MDIO bus controller
+
+maintainers:
+  - Ansuel Smith <[email protected]>
+
+description:
+  The ipq806x soc have a MDIO dedicated controller that is
+  used to comunicate with the gmac phy conntected.

2 typos

Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 17

Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +3 -0
+  Child nodes of this MDIO bus controller node are standard
+  Ethernet PHY device nodes as described in
+  Documentation/devicetree/bindings/net/phy.txt

You might want to read what that file says now.

Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 26

Quoted 9 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +9 -0
+
+allOf:
+  - $ref: "mdio.yaml#"
+
+properties:
+  compatible:
+    items:
+        - const: qcom,ipq8064-mdio
+        - const: syscon

Why is this a 'syscon'? Does it have more than 1 function?

Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 29

Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +3 -0
+
+  reg:
+    description: address and length of the register set for the device

Drop this and you need to state how many (maxItems).

Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml line 32

Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +3 -0
+
+  clocks:
+    description: A reference to the clock supplying the MDIO bus controller

Same here.

Quoted 32 lines
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml new file +29 -0
+
+  clock-names:
+    const: master
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - "#address-cells"
+  - "#size-cells"
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
+
+    mdio0: mdio@37000000 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        compatible = "qcom,ipq8064-mdio", "syscon";
+        reg = <0x37000000 0x200000>;
+
+        clocks = <&gcc GMAC_CORE1_CLK>;
+
+        switch@10 {
+            compatible = "qca,qca8337";
+            /* ... */
+        };
+    };
Signature · 1 line
2.25.0
#3 lore raw

R: [PATCH v8 2/2] dt-bindings: net: Add ipq806x mdio bindings

Quoted 57 lines · Ansuel Smith
Quoted 10 lines

Add documentations for ipq806x mdio driver.

---
Changes in v8:
- Fix error in dtb check
- Remove not needed reset definition from example
- Add include header for ipq806x clocks
- Fix wrong License type

Quoted 4 lines

Changes in v7:
- Fix dt_binding_check problem

 .../bindings/net/qcom,ipq8064-mdio.yaml       | 61

+++++++++++++++++++

Quoted 2 lines
 1 file changed, 61 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml

Review

Quoted 2 lines
(quoted diff) +0 -0

mdio.yaml b/Documentation/devicetree/bindings/net/qcom,ipq8064- mdio.yaml

Documentation/devicetree/bindings/net/qcom,ipq8064-

Quoted 4 lines

new file mode 100644
index 000000000000..4334a415f23c

Documentation/devicetree/bindings/net/qcom,ipq8064- new file +0 -0

mdio.yaml

Documentation/devicetree/bindings/net/qcom,ipq8064- line 1

Quoted 2 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +1 -0
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: GPL-2.0-only

Dual license new bindings please:

(GPL-2.0-only OR BSD-2-Clause)

Documentation/devicetree/bindings/net/qcom,ipq8064- line 14

Quoted 13 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +13 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/qcom,ipq8064-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm ipq806x MDIO bus controller
+
+maintainers:
+  - Ansuel Smith <[email protected]>
+
+description:
+  The ipq806x soc have a MDIO dedicated controller that is
+  used to comunicate with the gmac phy conntected.

2 typos

Documentation/devicetree/bindings/net/qcom,ipq8064- line 17

Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +3 -0
+  Child nodes of this MDIO bus controller node are standard
+  Ethernet PHY device nodes as described in
+  Documentation/devicetree/bindings/net/phy.txt

You might want to read what that file says now.

Quoted 12 lines

Documentation/devicetree/bindings/net/qcom,ipq8064- line 26

Quoted 9 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +9 -0
+
+allOf:
+  - $ref: "mdio.yaml#"
+
+properties:
+  compatible:
+    items:
+        - const: qcom,ipq8064-mdio
+        - const: syscon

Why is this a 'syscon'? Does it have more than 1 function?

Since the code use syscon_node_to_regmap, the syscon compatible is need or the driver fails to load. (since the reg is used also for the gmac node)

Again sorry for the mess as I misread the email... Will fix all in v9

Quoted 45 lines

Documentation/devicetree/bindings/net/qcom,ipq8064- line 29

Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +3 -0
+
+  reg:
+    description: address and length of the register set for the device

Drop this and you need to state how many (maxItems).

Documentation/devicetree/bindings/net/qcom,ipq8064- line 32

Quoted 3 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +3 -0
+
+  clocks:
+    description: A reference to the clock supplying the MDIO bus

controller

Same here.

Quoted 32 lines
Documentation/devicetree/bindings/net/qcom,ipq8064- new file +29 -1
+
+  clock-names:
+    const: master
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - "#address-cells"
+  - "#size-cells"
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-ipq806x.h>
+
+    mdio0: mdio@37000000 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        compatible = "qcom,ipq8064-mdio", "syscon";
+        reg = <0x37000000 0x200000>;
+
+        clocks = <&gcc GMAC_CORE1_CLK>;
+
+        switch@10 {
+            compatible = "qca,qca8337";
+            /* ... */
+        };
+    };
--

2.25.0