linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update
@ 2020-05-06 18:13 Grygorii Strashko
  2020-05-06 18:13 ` [PATCH net-next 1/3] net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio Grygorii Strashko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Grygorii Strashko @ 2020-05-06 18:13 UTC (permalink / raw)
  To: David S. Miller, Rob Herring, devicetree, Tero Kristo
  Cc: netdev, Sekhar Nori, linux-kernel, linux-arm-kernel, Grygorii Strashko

Hi Rob, David,

This series is follow update for  TI A65x/J721E Common platform time sync (CPTS)
driver [1] to implement  DT bindings review comments from
Rob Herring <robh@kernel.org> [2].
 - "reg" and "compatible" properties are made required for CPTS DT nodes which
   also required to change K3 CPSW driver to use of_platform_device_create()
   instead of of_platform_populate() for proper CPTS and MDIO initialization
 - minor DT bindings format changes
 - K3 CPTS example added to K3 MCU CPSW bindings

[1] https://lwn.net/Articles/819313/
[2] https://lwn.net/ml/linux-kernel/20200505040419.GA8509@bogus/
Grygorii Strashko (3):
  net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for
    mdio
  dt-binding: net: ti: am65x-cpts: make reg and compatible required
  arm64: dts: ti: k3-am65/j721e-mcu: update cpts node

 .../bindings/net/ti,k3-am654-cpsw-nuss.yaml   | 15 ++++++++++-
 .../bindings/net/ti,k3-am654-cpts.yaml        | 25 +++++++------------
 arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi       |  4 ++-
 .../boot/dts/ti/k3-j721e-mcu-wakeup.dtsi      |  4 ++-
 drivers/net/ethernet/ti/am65-cpsw-nuss.c      | 24 +++++++++++++-----
 drivers/net/ethernet/ti/am65-cpsw-nuss.h      |  2 ++
 6 files changed, 49 insertions(+), 25 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/3] net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio
  2020-05-06 18:13 [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update Grygorii Strashko
@ 2020-05-06 18:13 ` Grygorii Strashko
  2020-05-06 18:14 ` [PATCH net-next 2/3] dt-binding: net: ti: am65x-cpts: make reg and compatible required Grygorii Strashko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Grygorii Strashko @ 2020-05-06 18:13 UTC (permalink / raw)
  To: David S. Miller, Rob Herring, devicetree, Tero Kristo
  Cc: netdev, Sekhar Nori, linux-kernel, linux-arm-kernel, Grygorii Strashko

The MCU CPSW expected to populate only MDIO device, but follow up patches
will add "compatible" property to the MCU CPSW CPTS node which will cause
creation of CPTS device and MCU CPSW init failure. Hence, switch to use
of_platform_device_create() instead of of_platform_populate() for MDIO
device population.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 24 ++++++++++++++++++------
 drivers/net/ethernet/ti/am65-cpsw-nuss.h |  2 ++
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index bb391286d89e..64c9eba3c32a 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -2030,10 +2030,21 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
-	/* We do not want to force this, as in some cases may not have child */
-	if (ret)
-		dev_warn(dev, "populating child nodes err:%d\n", ret);
+	node = of_get_child_by_name(dev->of_node, "mdio");
+	if (!node) {
+		dev_warn(dev, "MDIO node not found\n");
+	} else if (of_device_is_available(node)) {
+		struct platform_device *mdio_pdev;
+
+		mdio_pdev = of_platform_device_create(node, NULL, dev);
+		if (!mdio_pdev) {
+			ret = -ENODEV;
+			goto err_pm_clear;
+		}
+
+		common->mdio_dev =  &mdio_pdev->dev;
+	}
+	of_node_put(node);
 
 	am65_cpsw_nuss_get_ver(common);
 
@@ -2089,7 +2100,8 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
 	return 0;
 
 err_of_clear:
-	of_platform_depopulate(dev);
+	of_platform_device_destroy(common->mdio_dev, NULL);
+err_pm_clear:
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
 	return ret;
@@ -2114,7 +2126,7 @@ static int am65_cpsw_nuss_remove(struct platform_device *pdev)
 	 */
 	am65_cpsw_nuss_cleanup_ndev(common);
 
-	of_platform_depopulate(dev);
+	of_platform_device_destroy(common->mdio_dev, NULL);
 
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.h b/drivers/net/ethernet/ti/am65-cpsw-nuss.h
index b1cddfd05a45..8a6382188cb5 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.h
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.h
@@ -9,6 +9,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
+#include <linux/platform_device.h>
 
 struct am65_cpts;
 
@@ -76,6 +77,7 @@ struct am65_cpsw_pdata {
 
 struct am65_cpsw_common {
 	struct device		*dev;
+	struct device		*mdio_dev;
 	const struct am65_cpsw_pdata *pdata;
 
 	void __iomem		*ss_base;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/3] dt-binding: net: ti: am65x-cpts: make reg and compatible required
  2020-05-06 18:13 [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update Grygorii Strashko
  2020-05-06 18:13 ` [PATCH net-next 1/3] net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio Grygorii Strashko
@ 2020-05-06 18:14 ` Grygorii Strashko
  2020-05-06 18:14 ` [PATCH net-next 3/3] arm64: dts: ti: k3-am65/j721e-mcu: update cpts node Grygorii Strashko
  2020-05-08  0:51 ` [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Grygorii Strashko @ 2020-05-06 18:14 UTC (permalink / raw)
  To: David S. Miller, Rob Herring, devicetree, Tero Kristo
  Cc: netdev, Sekhar Nori, linux-kernel, linux-arm-kernel,
	Grygorii Strashko, Rob Herring

This patch follows K3 CPTS review comments from Rob Herring
<robh@kernel.org>.
 - "reg" and "compatible" properties are required now
 - minor format changes
 - K3 CPTS example added to K3 MCU CPSW bindings

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 .../bindings/net/ti,k3-am654-cpsw-nuss.yaml   | 15 ++++++++++-
 .../bindings/net/ti,k3-am654-cpts.yaml        | 25 +++++++------------
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml b/Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml
index 0c054a2ce5ba..c87395f360a6 100644
--- a/Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml
+++ b/Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml
@@ -144,7 +144,7 @@ patternProperties:
     description:
       CPSW MDIO bus.
 
-  "^cpts$":
+  "^cpts@[0-9a-f]+":
     type: object
     allOf:
       - $ref: "ti,k3-am654-cpts.yaml#"
@@ -171,6 +171,8 @@ examples:
     #include <dt-bindings/pinctrl/k3.h>
     #include <dt-bindings/soc/ti,sci_pm_domain.h>
     #include <dt-bindings/net/ti-dp83867.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
 
     mcu_cpsw: ethernet@46000000 {
         compatible = "ti,am654-cpsw-nuss";
@@ -229,4 +231,15 @@ examples:
                     ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
               };
         };
+
+        cpts@3d000 {
+             compatible = "ti,am65-cpts";
+             reg = <0x0 0x3d000 0x0 0x400>;
+             clocks = <&k3_clks 18 2>;
+             clock-names = "cpts";
+             interrupts-extended = <&gic500 GIC_SPI 858 IRQ_TYPE_LEVEL_HIGH>;
+             interrupt-names = "cpts";
+             ti,cpts-ext-ts-inputs = <4>;
+             ti,cpts-periodic-outputs = <2>;
+        };
     };
diff --git a/Documentation/devicetree/bindings/net/ti,k3-am654-cpts.yaml b/Documentation/devicetree/bindings/net/ti,k3-am654-cpts.yaml
index df83c320e61b..50e027911dd4 100644
--- a/Documentation/devicetree/bindings/net/ti,k3-am654-cpts.yaml
+++ b/Documentation/devicetree/bindings/net/ti,k3-am654-cpts.yaml
@@ -42,7 +42,7 @@ description: |+
 
 properties:
   $nodename:
-    pattern: "^cpts(@.*|-[0-9a-f])*$"
+    pattern: "^cpts@[0-9a-f]+$"
 
   compatible:
     oneOf:
@@ -52,7 +52,7 @@ properties:
   reg:
     maxItems: 1
     description:
-       The physical base address and size of CPTS IO range
+      The physical base address and size of CPTS IO range
 
   reg-names:
     items:
@@ -65,27 +65,27 @@ properties:
     items:
       - const: cpts
 
-  interrupts-extended:
+  interrupts:
     items:
       - description: CPTS events interrupt
 
   interrupt-names:
     items:
-      - const: "cpts"
+      - const: cpts
 
   ti,cpts-ext-ts-inputs:
     allOf:
       - $ref: /schemas/types.yaml#/definitions/uint32
     maximum: 8
     description:
-        Number of hardware timestamp push inputs (HWx_TS_PUSH)
+      Number of hardware timestamp push inputs (HWx_TS_PUSH)
 
   ti,cpts-periodic-outputs:
     allOf:
       - $ref: /schemas/types.yaml#/definitions/uint32
     maximum: 8
     description:
-         Number of timestamp Generator function outputs (TS_GENFx)
+      Number of timestamp Generator function outputs (TS_GENFx)
 
   refclk-mux:
     type: object
@@ -107,9 +107,11 @@ properties:
       - clocks
 
 required:
+  - compatible
+  - reg
   - clocks
   - clock-names
-  - interrupts-extended
+  - interrupts
   - interrupt-names
 
 additionalProperties: false
@@ -140,13 +142,4 @@ examples:
                assigned-clock-parents = <&k3_clks 118 11>;
          };
     };
-  - |
 
-    cpts {
-             clocks = <&k3_clks 18 2>;
-             clock-names = "cpts";
-             interrupts-extended = <&gic500 GIC_SPI 858 IRQ_TYPE_LEVEL_HIGH>;
-             interrupt-names = "cpts";
-             ti,cpts-ext-ts-inputs = <4>;
-             ti,cpts-periodic-outputs = <2>;
-    };
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 3/3] arm64: dts: ti: k3-am65/j721e-mcu: update cpts node
  2020-05-06 18:13 [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update Grygorii Strashko
  2020-05-06 18:13 ` [PATCH net-next 1/3] net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio Grygorii Strashko
  2020-05-06 18:14 ` [PATCH net-next 2/3] dt-binding: net: ti: am65x-cpts: make reg and compatible required Grygorii Strashko
@ 2020-05-06 18:14 ` Grygorii Strashko
  2020-05-08  0:51 ` [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Grygorii Strashko @ 2020-05-06 18:14 UTC (permalink / raw)
  To: David S. Miller, Rob Herring, devicetree, Tero Kristo
  Cc: netdev, Sekhar Nori, linux-kernel, linux-arm-kernel, Grygorii Strashko

Update CPTS node following DT binding update:
 - add reg and compatible properties
 - fix node name

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi         | 4 +++-
 arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
index 0e773e0b3f89..ae5f813d0cac 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
@@ -248,7 +248,9 @@
 			bus_freq = <1000000>;
 		};
 
-		cpts {
+		cpts@3d000 {
+			compatible = "ti,am65-cpts";
+			reg = <0x0 0x3d000 0x0 0x400>;
 			clocks = <&mcu_cpsw_cpts_mux>;
 			clock-names = "cpts";
 			interrupts-extended = <&gic500 GIC_SPI 570 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
index 37c355e5a833..dc31bd0434cb 100644
--- a/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
@@ -339,7 +339,9 @@
 			bus_freq = <1000000>;
 		};
 
-		cpts {
+		cpts@3d000 {
+			compatible = "ti,am65-cpts";
+			reg = <0x0 0x3d000 0x0 0x400>;
 			clocks = <&k3_clks 18 2>;
 			clock-names = "cpts";
 			interrupts-extended = <&gic500 GIC_SPI 858 IRQ_TYPE_LEVEL_HIGH>;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update
  2020-05-06 18:13 [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update Grygorii Strashko
                   ` (2 preceding siblings ...)
  2020-05-06 18:14 ` [PATCH net-next 3/3] arm64: dts: ti: k3-am65/j721e-mcu: update cpts node Grygorii Strashko
@ 2020-05-08  0:51 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2020-05-08  0:51 UTC (permalink / raw)
  To: grygorii.strashko
  Cc: robh+dt, devicetree, t-kristo, netdev, nsekhar, linux-kernel,
	linux-arm-kernel

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: Wed, 6 May 2020 21:13:58 +0300

> This series is follow update for  TI A65x/J721E Common platform time sync (CPTS)
> driver [1] to implement  DT bindings review comments from
> Rob Herring <robh@kernel.org> [2].
>  - "reg" and "compatible" properties are made required for CPTS DT nodes which
>    also required to change K3 CPSW driver to use of_platform_device_create()
>    instead of of_platform_populate() for proper CPTS and MDIO initialization
>  - minor DT bindings format changes
>  - K3 CPTS example added to K3 MCU CPSW bindings
> 
> [1] https://lwn.net/Articles/819313/
> [2] https://lwn.net/ml/linux-kernel/20200505040419.GA8509@bogus/

Series applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-08  0:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 18:13 [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update Grygorii Strashko
2020-05-06 18:13 ` [PATCH net-next 1/3] net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio Grygorii Strashko
2020-05-06 18:14 ` [PATCH net-next 2/3] dt-binding: net: ti: am65x-cpts: make reg and compatible required Grygorii Strashko
2020-05-06 18:14 ` [PATCH net-next 3/3] arm64: dts: ti: k3-am65/j721e-mcu: update cpts node Grygorii Strashko
2020-05-08  0:51 ` [PATCH net-next 0/3] net: ethernet: ti: am65x-cpts: follow up dt bindings update David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).