All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/7] Add an MDIO sub-node under MACB
@ 2020-07-24 10:50 ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, f.fainelli,
	robh+dt, alexandre.belloni, ludovic.desroches, Codrin Ciubotariu

Changes in v3:
 - in patch 3/7, moved the checking for mdio node at the beginning of
   the macb_mdiobus_register(). This allows to probe the MDIO devices
   even if macb is a fixed-link
 - added tags received on v2

Changes in v2:
 - renamed patch 2/7 from "macb: bindings doc: use an MDIO node as a
   container for PHY nodes" to "dt-bindings: net: macb: use an MDIO
   node as a container for PHY nodes"
 - added back a newline removed by mistake in patch 3/7

Codrin Ciubotariu (7):
  net: macb: use device-managed devm_mdiobus_alloc()
  dt-bindings: net: macb: use an MDIO node as a container for PHY nodes
  net: macb: parse PHY nodes found under an MDIO node
  ARM: dts: at91: sama5d2: add an mdio sub-node to macb
  ARM: dts: at91: sama5d3: add an mdio sub-node to macb
  ARM: dts: at91: sama5d4: add an mdio sub-node to macb
  ARM: dts: at91: sam9x60: add an mdio sub-node to macb

 Documentation/devicetree/bindings/net/macb.txt | 15 ++++++++++++---
 arch/arm/boot/dts/at91-sam9x60ek.dts           |  8 ++++++--
 arch/arm/boot/dts/at91-sama5d27_som1.dtsi      | 16 ++++++++++------
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi    | 17 ++++++++++-------
 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts      | 13 ++++++++-----
 arch/arm/boot/dts/at91-sama5d2_xplained.dts    | 12 ++++++++----
 arch/arm/boot/dts/at91-sama5d3_xplained.dts    | 16 ++++++++++++----
 arch/arm/boot/dts/at91-sama5d4_xplained.dts    | 12 ++++++++----
 drivers/net/ethernet/cadence/macb_main.c       | 18 ++++++++++++------
 9 files changed, 86 insertions(+), 41 deletions(-)

-- 
2.25.1


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

* [PATCH net-next v3 0/7] Add an MDIO sub-node under MACB
@ 2020-07-24 10:50 ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, f.fainelli, claudiu.beznea,
	ludovic.desroches, robh+dt, kuba, Codrin Ciubotariu, davem

Changes in v3:
 - in patch 3/7, moved the checking for mdio node at the beginning of
   the macb_mdiobus_register(). This allows to probe the MDIO devices
   even if macb is a fixed-link
 - added tags received on v2

Changes in v2:
 - renamed patch 2/7 from "macb: bindings doc: use an MDIO node as a
   container for PHY nodes" to "dt-bindings: net: macb: use an MDIO
   node as a container for PHY nodes"
 - added back a newline removed by mistake in patch 3/7

Codrin Ciubotariu (7):
  net: macb: use device-managed devm_mdiobus_alloc()
  dt-bindings: net: macb: use an MDIO node as a container for PHY nodes
  net: macb: parse PHY nodes found under an MDIO node
  ARM: dts: at91: sama5d2: add an mdio sub-node to macb
  ARM: dts: at91: sama5d3: add an mdio sub-node to macb
  ARM: dts: at91: sama5d4: add an mdio sub-node to macb
  ARM: dts: at91: sam9x60: add an mdio sub-node to macb

 Documentation/devicetree/bindings/net/macb.txt | 15 ++++++++++++---
 arch/arm/boot/dts/at91-sam9x60ek.dts           |  8 ++++++--
 arch/arm/boot/dts/at91-sama5d27_som1.dtsi      | 16 ++++++++++------
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi    | 17 ++++++++++-------
 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts      | 13 ++++++++-----
 arch/arm/boot/dts/at91-sama5d2_xplained.dts    | 12 ++++++++----
 arch/arm/boot/dts/at91-sama5d3_xplained.dts    | 16 ++++++++++++----
 arch/arm/boot/dts/at91-sama5d4_xplained.dts    | 12 ++++++++----
 drivers/net/ethernet/cadence/macb_main.c       | 18 ++++++++++++------
 9 files changed, 86 insertions(+), 41 deletions(-)

-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 1/7] net: macb: use device-managed devm_mdiobus_alloc()
  2020-07-24 10:50 ` Codrin Ciubotariu
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  -1 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, f.fainelli,
	robh+dt, alexandre.belloni, ludovic.desroches, Codrin Ciubotariu

Use the device-managed variant for the allocating the MDIO bus. This
cleans-up the code a little on the remove and error paths.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tags from Claudiu and Florian

Changes in v2:
 - none

 drivers/net/ethernet/cadence/macb_main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index a6a35e1b0115..89fe7af5e408 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -769,7 +769,7 @@ static int macb_mii_init(struct macb *bp)
 	/* Enable management port */
 	macb_writel(bp, NCR, MACB_BIT(MPE));
 
-	bp->mii_bus = mdiobus_alloc();
+	bp->mii_bus = devm_mdiobus_alloc(&bp->pdev->dev);
 	if (!bp->mii_bus) {
 		err = -ENOMEM;
 		goto err_out;
@@ -787,7 +787,7 @@ static int macb_mii_init(struct macb *bp)
 
 	err = macb_mdiobus_register(bp);
 	if (err)
-		goto err_out_free_mdiobus;
+		goto err_out;
 
 	err = macb_mii_probe(bp->dev);
 	if (err)
@@ -797,8 +797,6 @@ static int macb_mii_init(struct macb *bp)
 
 err_out_unregister_bus:
 	mdiobus_unregister(bp->mii_bus);
-err_out_free_mdiobus:
-	mdiobus_free(bp->mii_bus);
 err_out:
 	return err;
 }
@@ -4571,7 +4569,6 @@ static int macb_probe(struct platform_device *pdev)
 
 err_out_unregister_mdio:
 	mdiobus_unregister(bp->mii_bus);
-	mdiobus_free(bp->mii_bus);
 
 err_out_free_netdev:
 	free_netdev(dev);
@@ -4599,7 +4596,6 @@ static int macb_remove(struct platform_device *pdev)
 	if (dev) {
 		bp = netdev_priv(dev);
 		mdiobus_unregister(bp->mii_bus);
-		mdiobus_free(bp->mii_bus);
 
 		unregister_netdev(dev);
 		tasklet_kill(&bp->hresp_err_tasklet);
-- 
2.25.1


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

* [PATCH net-next v3 1/7] net: macb: use device-managed devm_mdiobus_alloc()
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, f.fainelli, claudiu.beznea,
	ludovic.desroches, robh+dt, kuba, Codrin Ciubotariu, davem

Use the device-managed variant for the allocating the MDIO bus. This
cleans-up the code a little on the remove and error paths.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tags from Claudiu and Florian

Changes in v2:
 - none

 drivers/net/ethernet/cadence/macb_main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index a6a35e1b0115..89fe7af5e408 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -769,7 +769,7 @@ static int macb_mii_init(struct macb *bp)
 	/* Enable management port */
 	macb_writel(bp, NCR, MACB_BIT(MPE));
 
-	bp->mii_bus = mdiobus_alloc();
+	bp->mii_bus = devm_mdiobus_alloc(&bp->pdev->dev);
 	if (!bp->mii_bus) {
 		err = -ENOMEM;
 		goto err_out;
@@ -787,7 +787,7 @@ static int macb_mii_init(struct macb *bp)
 
 	err = macb_mdiobus_register(bp);
 	if (err)
-		goto err_out_free_mdiobus;
+		goto err_out;
 
 	err = macb_mii_probe(bp->dev);
 	if (err)
@@ -797,8 +797,6 @@ static int macb_mii_init(struct macb *bp)
 
 err_out_unregister_bus:
 	mdiobus_unregister(bp->mii_bus);
-err_out_free_mdiobus:
-	mdiobus_free(bp->mii_bus);
 err_out:
 	return err;
 }
@@ -4571,7 +4569,6 @@ static int macb_probe(struct platform_device *pdev)
 
 err_out_unregister_mdio:
 	mdiobus_unregister(bp->mii_bus);
-	mdiobus_free(bp->mii_bus);
 
 err_out_free_netdev:
 	free_netdev(dev);
@@ -4599,7 +4596,6 @@ static int macb_remove(struct platform_device *pdev)
 	if (dev) {
 		bp = netdev_priv(dev);
 		mdiobus_unregister(bp->mii_bus);
-		mdiobus_free(bp->mii_bus);
 
 		unregister_netdev(dev);
 		tasklet_kill(&bp->hresp_err_tasklet);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 2/7] dt-bindings: net: macb: use an MDIO node as a container for PHY nodes
  2020-07-24 10:50 ` Codrin Ciubotariu
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  -1 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, f.fainelli,
	robh+dt, alexandre.belloni, ludovic.desroches, Codrin Ciubotariu,
	Rob Herring

The MACB driver embeds an MDIO bus controller and for this reason there
was no need for an MDIO sub-node present to contain the PHY nodes. Adding
MDIO devies directly under an Ethernet node is deprecated, so an MDIO node
is included to contain of the PHY nodes (and other MDIO devices' nodes).

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Acked-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - Added tags from Claudiu, Rob and Florian

Changes in v2:
 - patch renamed from "macb: bindings doc: use an MDIO node as a
   container for PHY nodes" to "dt-bindings: net: macb: use an MDIO
   node as a container for PHY nodes" 

 Documentation/devicetree/bindings/net/macb.txt | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt
index 0b61a90f1592..88d5199c2279 100644
--- a/Documentation/devicetree/bindings/net/macb.txt
+++ b/Documentation/devicetree/bindings/net/macb.txt
@@ -32,6 +32,11 @@ Required properties:
 The MAC address will be determined using the optional properties
 defined in ethernet.txt.
 
+Optional subnodes:
+- mdio : specifies the MDIO bus in the MACB, used as a container for PHY nodes or other
+  nodes of devices present on the MDIO bus. Please see ethernet-phy.yaml in the same
+  directory for more details.
+
 Optional properties for PHY child node:
 - reset-gpios : Should specify the gpio for phy reset
 - magic-packet : If present, indicates that the hardware supports waking
@@ -48,8 +53,12 @@ Examples:
 		local-mac-address = [3a 0e 03 04 05 06];
 		clock-names = "pclk", "hclk", "tx_clk";
 		clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
-		ethernet-phy@1 {
-			reg = <0x1>;
-			reset-gpios = <&pioE 6 1>;
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ethernet-phy@1 {
+				reg = <0x1>;
+				reset-gpios = <&pioE 6 1>;
+			};
 		};
 	};
-- 
2.25.1


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

* [PATCH net-next v3 2/7] dt-bindings: net: macb: use an MDIO node as a container for PHY nodes
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, f.fainelli, Rob Herring,
	claudiu.beznea, ludovic.desroches, robh+dt, kuba,
	Codrin Ciubotariu, davem

The MACB driver embeds an MDIO bus controller and for this reason there
was no need for an MDIO sub-node present to contain the PHY nodes. Adding
MDIO devies directly under an Ethernet node is deprecated, so an MDIO node
is included to contain of the PHY nodes (and other MDIO devices' nodes).

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Acked-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - Added tags from Claudiu, Rob and Florian

Changes in v2:
 - patch renamed from "macb: bindings doc: use an MDIO node as a
   container for PHY nodes" to "dt-bindings: net: macb: use an MDIO
   node as a container for PHY nodes" 

 Documentation/devicetree/bindings/net/macb.txt | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt
index 0b61a90f1592..88d5199c2279 100644
--- a/Documentation/devicetree/bindings/net/macb.txt
+++ b/Documentation/devicetree/bindings/net/macb.txt
@@ -32,6 +32,11 @@ Required properties:
 The MAC address will be determined using the optional properties
 defined in ethernet.txt.
 
+Optional subnodes:
+- mdio : specifies the MDIO bus in the MACB, used as a container for PHY nodes or other
+  nodes of devices present on the MDIO bus. Please see ethernet-phy.yaml in the same
+  directory for more details.
+
 Optional properties for PHY child node:
 - reset-gpios : Should specify the gpio for phy reset
 - magic-packet : If present, indicates that the hardware supports waking
@@ -48,8 +53,12 @@ Examples:
 		local-mac-address = [3a 0e 03 04 05 06];
 		clock-names = "pclk", "hclk", "tx_clk";
 		clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
-		ethernet-phy@1 {
-			reg = <0x1>;
-			reset-gpios = <&pioE 6 1>;
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			ethernet-phy@1 {
+				reg = <0x1>;
+				reset-gpios = <&pioE 6 1>;
+			};
 		};
 	};
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 3/7] net: macb: parse PHY nodes found under an MDIO node
  2020-07-24 10:50 ` Codrin Ciubotariu
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  -1 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, f.fainelli,
	robh+dt, alexandre.belloni, ludovic.desroches, Codrin Ciubotariu

The MACB embeds an MDIO bus controller. For this reason, the PHY nodes
were represented as sub-nodes in the MACB node. Generally, the
Ethernet controller is different than the MDIO controller, so the PHYs
are probed by a separate MDIO driver. Since adding the PHY nodes directly
under the ETH node became deprecated, we adjust the MACB driver to look
for an MDIO node and register the subnode MDIO devices.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
---

Changes in v3:
 - moved the check for the mdio node at the beginnging of
   macb_mdiobus_register(). This way, the mdio devices will be probed even
   if macb is a fixed-link

Changes in v2:
 - readded newline removed by mistake;

 drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 89fe7af5e408..cb0b3637651c 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -740,6 +740,16 @@ static int macb_mii_probe(struct net_device *dev)
 static int macb_mdiobus_register(struct macb *bp)
 {
 	struct device_node *child, *np = bp->pdev->dev.of_node;
+	struct device_node *mdio_node;
+	int ret;
+
+	/* if an MDIO node is present, it should contain the PHY nodes */
+	mdio_node = of_get_child_by_name(np, "mdio");
+	if (mdio_node) {
+		ret = of_mdiobus_register(bp->mii_bus, mdio_node);
+		of_node_put(mdio_node);
+		return ret;
+	}
 
 	if (of_phy_is_fixed_link(np))
 		return mdiobus_register(bp->mii_bus);
-- 
2.25.1


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

* [PATCH net-next v3 3/7] net: macb: parse PHY nodes found under an MDIO node
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, f.fainelli, claudiu.beznea,
	ludovic.desroches, robh+dt, kuba, Codrin Ciubotariu, davem

The MACB embeds an MDIO bus controller. For this reason, the PHY nodes
were represented as sub-nodes in the MACB node. Generally, the
Ethernet controller is different than the MDIO controller, so the PHYs
are probed by a separate MDIO driver. Since adding the PHY nodes directly
under the ETH node became deprecated, we adjust the MACB driver to look
for an MDIO node and register the subnode MDIO devices.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
---

Changes in v3:
 - moved the check for the mdio node at the beginnging of
   macb_mdiobus_register(). This way, the mdio devices will be probed even
   if macb is a fixed-link

Changes in v2:
 - readded newline removed by mistake;

 drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 89fe7af5e408..cb0b3637651c 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -740,6 +740,16 @@ static int macb_mii_probe(struct net_device *dev)
 static int macb_mdiobus_register(struct macb *bp)
 {
 	struct device_node *child, *np = bp->pdev->dev.of_node;
+	struct device_node *mdio_node;
+	int ret;
+
+	/* if an MDIO node is present, it should contain the PHY nodes */
+	mdio_node = of_get_child_by_name(np, "mdio");
+	if (mdio_node) {
+		ret = of_mdiobus_register(bp->mii_bus, mdio_node);
+		of_node_put(mdio_node);
+		return ret;
+	}
 
 	if (of_phy_is_fixed_link(np))
 		return mdiobus_register(bp->mii_bus);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 4/7] ARM: dts: at91: sama5d2: add an mdio sub-node to macb
  2020-07-24 10:50 ` Codrin Ciubotariu
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  -1 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, f.fainelli,
	robh+dt, alexandre.belloni, ludovic.desroches, Codrin Ciubotariu

Use the new macb bindings and add an mdio sub-node to contain all the
phy nodes.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tag from Florian

Changes in v2:
 - none

 arch/arm/boot/dts/at91-sama5d27_som1.dtsi   | 16 ++++++++++------
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 17 ++++++++++-------
 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts   | 13 ++++++++-----
 arch/arm/boot/dts/at91-sama5d2_xplained.dts | 12 ++++++++----
 4 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d27_som1.dtsi b/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
index b1f994c0ae79..dfcee23dcce0 100644
--- a/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
@@ -84,12 +84,16 @@ macb0: ethernet@f8008000 {
 				pinctrl-0 = <&pinctrl_macb0_default>;
 				phy-mode = "rmii";
 
-				ethernet-phy@0 {
-					reg = <0x0>;
-					interrupt-parent = <&pioA>;
-					interrupts = <PIN_PD31 IRQ_TYPE_LEVEL_LOW>;
-					pinctrl-names = "default";
-					pinctrl-0 = <&pinctrl_macb0_phy_irq>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@0 {
+						reg = <0x0>;
+						interrupt-parent = <&pioA>;
+						interrupts = <PIN_PD31 IRQ_TYPE_LEVEL_LOW>;
+						pinctrl-names = "default";
+						pinctrl-0 = <&pinctrl_macb0_phy_irq>;
+					};
 				};
 			};
 
diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
index a06700e53e4c..9c4dce29d2fe 100644
--- a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
@@ -181,13 +181,16 @@ &macb0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_macb0_default>;
 	phy-mode = "rmii";
-
-	ethernet-phy@0 {
-		reg = <0x0>;
-		interrupt-parent = <&pioA>;
-		interrupts = <PIN_PB24 IRQ_TYPE_LEVEL_LOW>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&pinctrl_macb0_phy_irq>;
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		ethernet-phy@0 {
+			reg = <0x0>;
+			interrupt-parent = <&pioA>;
+			interrupts = <PIN_PB24 IRQ_TYPE_LEVEL_LOW>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_macb0_phy_irq>;
+		};
 	};
 };
 
diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
index c894c7c788a9..fc3375c43ef6 100644
--- a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
+++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
@@ -140,11 +140,14 @@ macb0: ethernet@f8008000 {
 				pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
 				phy-mode = "rmii";
 				status = "okay";
-
-				ethernet-phy@1 {
-					reg = <0x1>;
-					interrupt-parent = <&pioA>;
-					interrupts = <56 IRQ_TYPE_LEVEL_LOW>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@1 {
+						reg = <0x1>;
+						interrupt-parent = <&pioA>;
+						interrupts = <56 IRQ_TYPE_LEVEL_LOW>;
+					};
 				};
 			};
 
diff --git a/arch/arm/boot/dts/at91-sama5d2_xplained.dts b/arch/arm/boot/dts/at91-sama5d2_xplained.dts
index a927165ea7c2..a62f475d9d0a 100644
--- a/arch/arm/boot/dts/at91-sama5d2_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d2_xplained.dts
@@ -149,10 +149,14 @@ macb0: ethernet@f8008000 {
 				phy-mode = "rmii";
 				status = "okay";
 
-				ethernet-phy@1 {
-					reg = <0x1>;
-					interrupt-parent = <&pioA>;
-					interrupts = <PIN_PC9 IRQ_TYPE_LEVEL_LOW>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@1 {
+						reg = <0x1>;
+						interrupt-parent = <&pioA>;
+						interrupts = <PIN_PC9 IRQ_TYPE_LEVEL_LOW>;
+					};
 				};
 			};
 
-- 
2.25.1


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

* [PATCH net-next v3 4/7] ARM: dts: at91: sama5d2: add an mdio sub-node to macb
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, f.fainelli, claudiu.beznea,
	ludovic.desroches, robh+dt, kuba, Codrin Ciubotariu, davem

Use the new macb bindings and add an mdio sub-node to contain all the
phy nodes.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tag from Florian

Changes in v2:
 - none

 arch/arm/boot/dts/at91-sama5d27_som1.dtsi   | 16 ++++++++++------
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 17 ++++++++++-------
 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts   | 13 ++++++++-----
 arch/arm/boot/dts/at91-sama5d2_xplained.dts | 12 ++++++++----
 4 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d27_som1.dtsi b/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
index b1f994c0ae79..dfcee23dcce0 100644
--- a/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
@@ -84,12 +84,16 @@ macb0: ethernet@f8008000 {
 				pinctrl-0 = <&pinctrl_macb0_default>;
 				phy-mode = "rmii";
 
-				ethernet-phy@0 {
-					reg = <0x0>;
-					interrupt-parent = <&pioA>;
-					interrupts = <PIN_PD31 IRQ_TYPE_LEVEL_LOW>;
-					pinctrl-names = "default";
-					pinctrl-0 = <&pinctrl_macb0_phy_irq>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@0 {
+						reg = <0x0>;
+						interrupt-parent = <&pioA>;
+						interrupts = <PIN_PD31 IRQ_TYPE_LEVEL_LOW>;
+						pinctrl-names = "default";
+						pinctrl-0 = <&pinctrl_macb0_phy_irq>;
+					};
 				};
 			};
 
diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
index a06700e53e4c..9c4dce29d2fe 100644
--- a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
@@ -181,13 +181,16 @@ &macb0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_macb0_default>;
 	phy-mode = "rmii";
-
-	ethernet-phy@0 {
-		reg = <0x0>;
-		interrupt-parent = <&pioA>;
-		interrupts = <PIN_PB24 IRQ_TYPE_LEVEL_LOW>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&pinctrl_macb0_phy_irq>;
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		ethernet-phy@0 {
+			reg = <0x0>;
+			interrupt-parent = <&pioA>;
+			interrupts = <PIN_PB24 IRQ_TYPE_LEVEL_LOW>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_macb0_phy_irq>;
+		};
 	};
 };
 
diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
index c894c7c788a9..fc3375c43ef6 100644
--- a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
+++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
@@ -140,11 +140,14 @@ macb0: ethernet@f8008000 {
 				pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
 				phy-mode = "rmii";
 				status = "okay";
-
-				ethernet-phy@1 {
-					reg = <0x1>;
-					interrupt-parent = <&pioA>;
-					interrupts = <56 IRQ_TYPE_LEVEL_LOW>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@1 {
+						reg = <0x1>;
+						interrupt-parent = <&pioA>;
+						interrupts = <56 IRQ_TYPE_LEVEL_LOW>;
+					};
 				};
 			};
 
diff --git a/arch/arm/boot/dts/at91-sama5d2_xplained.dts b/arch/arm/boot/dts/at91-sama5d2_xplained.dts
index a927165ea7c2..a62f475d9d0a 100644
--- a/arch/arm/boot/dts/at91-sama5d2_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d2_xplained.dts
@@ -149,10 +149,14 @@ macb0: ethernet@f8008000 {
 				phy-mode = "rmii";
 				status = "okay";
 
-				ethernet-phy@1 {
-					reg = <0x1>;
-					interrupt-parent = <&pioA>;
-					interrupts = <PIN_PC9 IRQ_TYPE_LEVEL_LOW>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@1 {
+						reg = <0x1>;
+						interrupt-parent = <&pioA>;
+						interrupts = <PIN_PC9 IRQ_TYPE_LEVEL_LOW>;
+					};
 				};
 			};
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 5/7] ARM: dts: at91: sama5d3: add an mdio sub-node to macb
  2020-07-24 10:50 ` Codrin Ciubotariu
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  -1 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, f.fainelli,
	robh+dt, alexandre.belloni, ludovic.desroches, Codrin Ciubotariu

Use the new macb bindings and add an mdio sub-node to contain all the
phy nodes.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tag from Florian

Changes in v2:
 - none

 arch/arm/boot/dts/at91-sama5d3_xplained.dts | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
index 61f068a7b362..25d2646ce4cb 100644
--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
@@ -133,8 +133,12 @@ macb0: ethernet@f0028000 {
 				#size-cells = <0>;
 				status = "okay";
 
-				ethernet-phy@7 {
-					reg = <0x7>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@7 {
+						reg = <0x7>;
+					};
 				};
 			};
 
@@ -200,8 +204,12 @@ macb1: ethernet@f802c000 {
 				#size-cells = <0>;
 				status = "okay";
 
-				ethernet-phy@1 {
-					reg = <0x1>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@1 {
+						reg = <0x1>;
+					};
 				};
 			};
 
-- 
2.25.1


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

* [PATCH net-next v3 5/7] ARM: dts: at91: sama5d3: add an mdio sub-node to macb
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, f.fainelli, claudiu.beznea,
	ludovic.desroches, robh+dt, kuba, Codrin Ciubotariu, davem

Use the new macb bindings and add an mdio sub-node to contain all the
phy nodes.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tag from Florian

Changes in v2:
 - none

 arch/arm/boot/dts/at91-sama5d3_xplained.dts | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
index 61f068a7b362..25d2646ce4cb 100644
--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
@@ -133,8 +133,12 @@ macb0: ethernet@f0028000 {
 				#size-cells = <0>;
 				status = "okay";
 
-				ethernet-phy@7 {
-					reg = <0x7>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@7 {
+						reg = <0x7>;
+					};
 				};
 			};
 
@@ -200,8 +204,12 @@ macb1: ethernet@f802c000 {
 				#size-cells = <0>;
 				status = "okay";
 
-				ethernet-phy@1 {
-					reg = <0x1>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					ethernet-phy@1 {
+						reg = <0x1>;
+					};
 				};
 			};
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 6/7] ARM: dts: at91: sama5d4: add an mdio sub-node to macb
  2020-07-24 10:50 ` Codrin Ciubotariu
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  -1 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, f.fainelli,
	robh+dt, alexandre.belloni, ludovic.desroches, Codrin Ciubotariu

Use the new macb bindings and add an mdio sub-node to contain all the
phy nodes.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tag from Florian

Changes in v2:
 - none

 arch/arm/boot/dts/at91-sama5d4_xplained.dts | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
index 924d9491780d..62598d06aead 100644
--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
@@ -59,10 +59,14 @@ macb0: ethernet@f8020000 {
 				pinctrl-names = "default";
 				pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>;
 
-				phy0: ethernet-phy@1 {
-					interrupt-parent = <&pioE>;
-					interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
-					reg = <1>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					phy0: ethernet-phy@1 {
+						interrupt-parent = <&pioE>;
+						interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
+						reg = <1>;
+					};
 				};
 			};
 
-- 
2.25.1


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

* [PATCH net-next v3 6/7] ARM: dts: at91: sama5d4: add an mdio sub-node to macb
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, f.fainelli, claudiu.beznea,
	ludovic.desroches, robh+dt, kuba, Codrin Ciubotariu, davem

Use the new macb bindings and add an mdio sub-node to contain all the
phy nodes.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tag from Florian

Changes in v2:
 - none

 arch/arm/boot/dts/at91-sama5d4_xplained.dts | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
index 924d9491780d..62598d06aead 100644
--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
@@ -59,10 +59,14 @@ macb0: ethernet@f8020000 {
 				pinctrl-names = "default";
 				pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>;
 
-				phy0: ethernet-phy@1 {
-					interrupt-parent = <&pioE>;
-					interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
-					reg = <1>;
+				mdio {
+					#address-cells = <1>;
+					#size-cells = <0>;
+					phy0: ethernet-phy@1 {
+						interrupt-parent = <&pioE>;
+						interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
+						reg = <1>;
+					};
 				};
 			};
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 7/7] ARM: dts: at91: sam9x60: add an mdio sub-node to macb
  2020-07-24 10:50 ` Codrin Ciubotariu
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  -1 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, f.fainelli,
	robh+dt, alexandre.belloni, ludovic.desroches, Codrin Ciubotariu

Use the new macb bindings and add an mdio sub-node to contain all the
phy nodes.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tag from Florian

Changes in v2:
 - none

 arch/arm/boot/dts/at91-sam9x60ek.dts | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts
index a5f5718c711a..ba871ebe10d4 100644
--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
+++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
@@ -324,8 +324,12 @@ &macb0 {
 	pinctrl-0 = <&pinctrl_macb0_rmii>;
 	status = "okay";
 
-	ethernet-phy@0 {
-		reg = <0x0>;
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		ethernet-phy@0 {
+			reg = <0x0>;
+		};
 	};
 };
 
-- 
2.25.1


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

* [PATCH net-next v3 7/7] ARM: dts: at91: sam9x60: add an mdio sub-node to macb
@ 2020-07-24 10:50   ` Codrin Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin Ciubotariu @ 2020-07-24 10:50 UTC (permalink / raw)
  To: netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, f.fainelli, claudiu.beznea,
	ludovic.desroches, robh+dt, kuba, Codrin Ciubotariu, davem

Use the new macb bindings and add an mdio sub-node to contain all the
phy nodes.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

Changes in v3:
 - added tag from Florian

Changes in v2:
 - none

 arch/arm/boot/dts/at91-sam9x60ek.dts | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts
index a5f5718c711a..ba871ebe10d4 100644
--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
+++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
@@ -324,8 +324,12 @@ &macb0 {
 	pinctrl-0 = <&pinctrl_macb0_rmii>;
 	status = "okay";
 
-	ethernet-phy@0 {
-		reg = <0x0>;
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		ethernet-phy@0 {
+			reg = <0x0>;
+		};
 	};
 };
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next v3 3/7] net: macb: parse PHY nodes found under an MDIO node
  2020-07-24 10:50   ` Codrin Ciubotariu
@ 2020-07-24 17:40     ` Florian Fainelli
  -1 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2020-07-24 17:40 UTC (permalink / raw)
  To: Codrin Ciubotariu, netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: nicolas.ferre, claudiu.beznea, davem, kuba, andrew, robh+dt,
	alexandre.belloni, ludovic.desroches

On 7/24/20 3:50 AM, Codrin Ciubotariu wrote:
> The MACB embeds an MDIO bus controller. For this reason, the PHY nodes
> were represented as sub-nodes in the MACB node. Generally, the
> Ethernet controller is different than the MDIO controller, so the PHYs
> are probed by a separate MDIO driver. Since adding the PHY nodes directly
> under the ETH node became deprecated, we adjust the MACB driver to look
> for an MDIO node and register the subnode MDIO devices.
> 
> Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
> ---
> 
> Changes in v3:
>  - moved the check for the mdio node at the beginnging of
>    macb_mdiobus_register(). This way, the mdio devices will be probed even
>    if macb is a fixed-link
> 
> Changes in v2:
>  - readded newline removed by mistake;
> 
>  drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 89fe7af5e408..cb0b3637651c 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -740,6 +740,16 @@ static int macb_mii_probe(struct net_device *dev)
>  static int macb_mdiobus_register(struct macb *bp)
>  {
>  	struct device_node *child, *np = bp->pdev->dev.of_node;
> +	struct device_node *mdio_node;
> +	int ret;
> +
> +	/* if an MDIO node is present, it should contain the PHY nodes */
> +	mdio_node = of_get_child_by_name(np, "mdio");
> +	if (mdio_node) {
> +		ret = of_mdiobus_register(bp->mii_bus, mdio_node);
> +		of_node_put(mdio_node);
> +		return ret;
> +	}

This does take care of registering the MDIO bus controller when present
as a sub-node, however if you also plan on making use of fixed-link, we
will have already returned.

>  
>  	if (of_phy_is_fixed_link(np))
>  		return mdiobus_register(bp->mii_bus);
> 

Really not sure what this is achieving, because we start off assuming
that we have an OF driven configuration, but later on we register the
MDIO bus with mdiobus_register() (and not of_mdiobus_register()), so no
scanning of the MDIO bus will happen.

How does the driver currently support being provided a fixed-link
property? Should not we at least have this pattern:

         */
        if (of_phy_is_fixed_link(dn)) {
                ret = of_phy_register_fixed_link(dn);
                if (ret)
			return ret;

                priv->phy_dn = dn;
        }

It does not look like you are breaking anything here, because it does
not look like this works at all.
-- 
Florian

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

* Re: [PATCH net-next v3 3/7] net: macb: parse PHY nodes found under an MDIO node
@ 2020-07-24 17:40     ` Florian Fainelli
  0 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2020-07-24 17:40 UTC (permalink / raw)
  To: Codrin Ciubotariu, netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, claudiu.beznea, ludovic.desroches,
	robh+dt, kuba, davem

On 7/24/20 3:50 AM, Codrin Ciubotariu wrote:
> The MACB embeds an MDIO bus controller. For this reason, the PHY nodes
> were represented as sub-nodes in the MACB node. Generally, the
> Ethernet controller is different than the MDIO controller, so the PHYs
> are probed by a separate MDIO driver. Since adding the PHY nodes directly
> under the ETH node became deprecated, we adjust the MACB driver to look
> for an MDIO node and register the subnode MDIO devices.
> 
> Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
> ---
> 
> Changes in v3:
>  - moved the check for the mdio node at the beginnging of
>    macb_mdiobus_register(). This way, the mdio devices will be probed even
>    if macb is a fixed-link
> 
> Changes in v2:
>  - readded newline removed by mistake;
> 
>  drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 89fe7af5e408..cb0b3637651c 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -740,6 +740,16 @@ static int macb_mii_probe(struct net_device *dev)
>  static int macb_mdiobus_register(struct macb *bp)
>  {
>  	struct device_node *child, *np = bp->pdev->dev.of_node;
> +	struct device_node *mdio_node;
> +	int ret;
> +
> +	/* if an MDIO node is present, it should contain the PHY nodes */
> +	mdio_node = of_get_child_by_name(np, "mdio");
> +	if (mdio_node) {
> +		ret = of_mdiobus_register(bp->mii_bus, mdio_node);
> +		of_node_put(mdio_node);
> +		return ret;
> +	}

This does take care of registering the MDIO bus controller when present
as a sub-node, however if you also plan on making use of fixed-link, we
will have already returned.

>  
>  	if (of_phy_is_fixed_link(np))
>  		return mdiobus_register(bp->mii_bus);
> 

Really not sure what this is achieving, because we start off assuming
that we have an OF driven configuration, but later on we register the
MDIO bus with mdiobus_register() (and not of_mdiobus_register()), so no
scanning of the MDIO bus will happen.

How does the driver currently support being provided a fixed-link
property? Should not we at least have this pattern:

         */
        if (of_phy_is_fixed_link(dn)) {
                ret = of_phy_register_fixed_link(dn);
                if (ret)
			return ret;

                priv->phy_dn = dn;
        }

It does not look like you are breaking anything here, because it does
not look like this works at all.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next v3 3/7] net: macb: parse PHY nodes found under an MDIO node
  2020-07-24 17:40     ` Florian Fainelli
@ 2020-07-27  9:13       ` Codrin.Ciubotariu
  -1 siblings, 0 replies; 20+ messages in thread
From: Codrin.Ciubotariu @ 2020-07-27  9:13 UTC (permalink / raw)
  To: f.fainelli, netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: Nicolas.Ferre, Claudiu.Beznea, davem, kuba, andrew, robh+dt,
	alexandre.belloni, Ludovic.Desroches

On 24.07.2020 20:40, Florian Fainelli wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 7/24/20 3:50 AM, Codrin Ciubotariu wrote:
>> The MACB embeds an MDIO bus controller. For this reason, the PHY nodes
>> were represented as sub-nodes in the MACB node. Generally, the
>> Ethernet controller is different than the MDIO controller, so the PHYs
>> are probed by a separate MDIO driver. Since adding the PHY nodes directly
>> under the ETH node became deprecated, we adjust the MACB driver to look
>> for an MDIO node and register the subnode MDIO devices.
>>
>> Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
>> ---
>>
>> Changes in v3:
>>   - moved the check for the mdio node at the beginnging of
>>     macb_mdiobus_register(). This way, the mdio devices will be probed even
>>     if macb is a fixed-link
>>
>> Changes in v2:
>>   - readded newline removed by mistake;
>>
>>   drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
>> index 89fe7af5e408..cb0b3637651c 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -740,6 +740,16 @@ static int macb_mii_probe(struct net_device *dev)
>>   static int macb_mdiobus_register(struct macb *bp)
>>   {
>>        struct device_node *child, *np = bp->pdev->dev.of_node;
>> +     struct device_node *mdio_node;
>> +     int ret;
>> +
>> +     /* if an MDIO node is present, it should contain the PHY nodes */
>> +     mdio_node = of_get_child_by_name(np, "mdio");
>> +     if (mdio_node) {
>> +             ret = of_mdiobus_register(bp->mii_bus, mdio_node);
>> +             of_node_put(mdio_node);
>> +             return ret;
>> +     }
> 
> This does take care of registering the MDIO bus controller when present
> as a sub-node, however if you also plan on making use of fixed-link, we
> will have already returned.
> 
>>
>>        if (of_phy_is_fixed_link(np))
>>                return mdiobus_register(bp->mii_bus);
>>
> 
> Really not sure what this is achieving, because we start off assuming
> that we have an OF driven configuration, but later on we register the
> MDIO bus with mdiobus_register() (and not of_mdiobus_register()), so no
> scanning of the MDIO bus will happen.

I agree that returning mdiobus_register() here makes no sense since 
there are no other PHY devices to scan for and probe. I can replace this 
with NULL.
The reason for fixed-link check here is to skip the following loop:
for_each_available_child_of_node(np, child)
		if (of_mdiobus_child_is_phy(child)) {
			of_node_put(child);
			return of_mdiobus_register(bp->mii_bus, np);
		}
of_mdiobus_child_is_phy() returns true when it finds the fixed-link 
node, because it has no compatible.

> 
> How does the driver currently support being provided a fixed-link
> property? Should not we at least have this pattern:
> 
>           */
>          if (of_phy_is_fixed_link(dn)) {
>                  ret = of_phy_register_fixed_link(dn);
>                  if (ret)
>                          return ret;
> 
>                  priv->phy_dn = dn;
>          }
> 
> It does not look like you are breaking anything here, because it does
> not look like this works at all.

 From what I understand, the new phylink(_create) handles the fixed-link 
case, so there is not reason to explicitly register the fixed-link.

Best regards,
Codrin

> --
> Florian
> 


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

* Re: [PATCH net-next v3 3/7] net: macb: parse PHY nodes found under an MDIO node
@ 2020-07-27  9:13       ` Codrin.Ciubotariu
  0 siblings, 0 replies; 20+ messages in thread
From: Codrin.Ciubotariu @ 2020-07-27  9:13 UTC (permalink / raw)
  To: f.fainelli, netdev, devicetree, linux-arm-kernel, linux-kernel
  Cc: andrew, alexandre.belloni, Claudiu.Beznea, Ludovic.Desroches,
	robh+dt, kuba, davem

On 24.07.2020 20:40, Florian Fainelli wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 7/24/20 3:50 AM, Codrin Ciubotariu wrote:
>> The MACB embeds an MDIO bus controller. For this reason, the PHY nodes
>> were represented as sub-nodes in the MACB node. Generally, the
>> Ethernet controller is different than the MDIO controller, so the PHYs
>> are probed by a separate MDIO driver. Since adding the PHY nodes directly
>> under the ETH node became deprecated, we adjust the MACB driver to look
>> for an MDIO node and register the subnode MDIO devices.
>>
>> Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
>> ---
>>
>> Changes in v3:
>>   - moved the check for the mdio node at the beginnging of
>>     macb_mdiobus_register(). This way, the mdio devices will be probed even
>>     if macb is a fixed-link
>>
>> Changes in v2:
>>   - readded newline removed by mistake;
>>
>>   drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
>> index 89fe7af5e408..cb0b3637651c 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -740,6 +740,16 @@ static int macb_mii_probe(struct net_device *dev)
>>   static int macb_mdiobus_register(struct macb *bp)
>>   {
>>        struct device_node *child, *np = bp->pdev->dev.of_node;
>> +     struct device_node *mdio_node;
>> +     int ret;
>> +
>> +     /* if an MDIO node is present, it should contain the PHY nodes */
>> +     mdio_node = of_get_child_by_name(np, "mdio");
>> +     if (mdio_node) {
>> +             ret = of_mdiobus_register(bp->mii_bus, mdio_node);
>> +             of_node_put(mdio_node);
>> +             return ret;
>> +     }
> 
> This does take care of registering the MDIO bus controller when present
> as a sub-node, however if you also plan on making use of fixed-link, we
> will have already returned.
> 
>>
>>        if (of_phy_is_fixed_link(np))
>>                return mdiobus_register(bp->mii_bus);
>>
> 
> Really not sure what this is achieving, because we start off assuming
> that we have an OF driven configuration, but later on we register the
> MDIO bus with mdiobus_register() (and not of_mdiobus_register()), so no
> scanning of the MDIO bus will happen.

I agree that returning mdiobus_register() here makes no sense since 
there are no other PHY devices to scan for and probe. I can replace this 
with NULL.
The reason for fixed-link check here is to skip the following loop:
for_each_available_child_of_node(np, child)
		if (of_mdiobus_child_is_phy(child)) {
			of_node_put(child);
			return of_mdiobus_register(bp->mii_bus, np);
		}
of_mdiobus_child_is_phy() returns true when it finds the fixed-link 
node, because it has no compatible.

> 
> How does the driver currently support being provided a fixed-link
> property? Should not we at least have this pattern:
> 
>           */
>          if (of_phy_is_fixed_link(dn)) {
>                  ret = of_phy_register_fixed_link(dn);
>                  if (ret)
>                          return ret;
> 
>                  priv->phy_dn = dn;
>          }
> 
> It does not look like you are breaking anything here, because it does
> not look like this works at all.

 From what I understand, the new phylink(_create) handles the fixed-link 
case, so there is not reason to explicitly register the fixed-link.

Best regards,
Codrin

> --
> Florian
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-07-27  9:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24 10:50 [PATCH net-next v3 0/7] Add an MDIO sub-node under MACB Codrin Ciubotariu
2020-07-24 10:50 ` Codrin Ciubotariu
2020-07-24 10:50 ` [PATCH net-next v3 1/7] net: macb: use device-managed devm_mdiobus_alloc() Codrin Ciubotariu
2020-07-24 10:50   ` Codrin Ciubotariu
2020-07-24 10:50 ` [PATCH net-next v3 2/7] dt-bindings: net: macb: use an MDIO node as a container for PHY nodes Codrin Ciubotariu
2020-07-24 10:50   ` Codrin Ciubotariu
2020-07-24 10:50 ` [PATCH net-next v3 3/7] net: macb: parse PHY nodes found under an MDIO node Codrin Ciubotariu
2020-07-24 10:50   ` Codrin Ciubotariu
2020-07-24 17:40   ` Florian Fainelli
2020-07-24 17:40     ` Florian Fainelli
2020-07-27  9:13     ` Codrin.Ciubotariu
2020-07-27  9:13       ` Codrin.Ciubotariu
2020-07-24 10:50 ` [PATCH net-next v3 4/7] ARM: dts: at91: sama5d2: add an mdio sub-node to macb Codrin Ciubotariu
2020-07-24 10:50   ` Codrin Ciubotariu
2020-07-24 10:50 ` [PATCH net-next v3 5/7] ARM: dts: at91: sama5d3: " Codrin Ciubotariu
2020-07-24 10:50   ` Codrin Ciubotariu
2020-07-24 10:50 ` [PATCH net-next v3 6/7] ARM: dts: at91: sama5d4: " Codrin Ciubotariu
2020-07-24 10:50   ` Codrin Ciubotariu
2020-07-24 10:50 ` [PATCH net-next v3 7/7] ARM: dts: at91: sam9x60: " Codrin Ciubotariu
2020-07-24 10:50   ` Codrin Ciubotariu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.