netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next,v3 0/2] ravb: Support describing the MDIO bus
@ 2024-03-11 14:11 Niklas Söderlund
  2024-03-11 14:11 ` [net-next,v3 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node Niklas Söderlund
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Niklas Söderlund @ 2024-03-11 14:11 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Claudiu Beznea, Yoshihiro Shimoda, Biju Das,
	netdev, devicetree
  Cc: linux-renesas-soc, Niklas Söderlund

Hello,

This series adds support to the binding and driver of the Renesas
Ethernet AVB to described the MDIO bus. Currently the driver uses the OF
node of the device itself when registering the MDIO bus. This forces any
MDIO bus properties the MDIO core should react on to be set on the
device OF node. This is confusing and non of the MDIO bus properties are
described in the Ethernet AVB bindings.

Patch 1/2 extends the bindings with an optional mdio child-node to the
device that can be used to contain the MDIO bus settings. While patch
2/2 changes the driver to use this node (if present) when registering
the MDIO bus.

If the new optional mdio child-node is not present the driver fallback
to the old behavior and uses the device OF node like before. This change
is fully backward compatible with existing usage of the bindings.

For changelog see individual patches.

Niklas Söderlund (2):
  dt-bindings: net: renesas,etheravb: Add optional MDIO bus node
  ravb: Add support for an optional MDIO mode

 .../devicetree/bindings/net/renesas,etheravb.yaml        | 8 ++++++++
 drivers/net/ethernet/renesas/ravb_main.c                 | 9 ++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

-- 
2.44.0


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

* [net-next,v3 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node
  2024-03-11 14:11 [net-next,v3 0/2] ravb: Support describing the MDIO bus Niklas Söderlund
@ 2024-03-11 14:11 ` Niklas Söderlund
  2024-03-12 14:25   ` Rob Herring
  2024-03-11 14:11 ` [net-next,v3 2/2] ravb: Add support for an optional MDIO mode Niklas Söderlund
  2024-03-12  4:29 ` [net-next,v3 0/2] ravb: Support describing the MDIO bus Jakub Kicinski
  2 siblings, 1 reply; 6+ messages in thread
From: Niklas Söderlund @ 2024-03-11 14:11 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Claudiu Beznea, Yoshihiro Shimoda, Biju Das,
	netdev, devicetree
  Cc: linux-renesas-soc, Niklas Söderlund

The Renesas Ethernet AVB bindings do not allow the MDIO bus to be
described. This has not been needed as only a single PHY is
supported and no MDIO bus properties have been needed.

Add an optional mdio node to the binding which allows the MDIO bus to be
described and allow bus properties to be set.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
* Changes since v2
- Mark the PHY pattern as deprecated and add a comment that new bindings
  should describe the PHY inside the MDIO node.
---
 .../devicetree/bindings/net/renesas,etheravb.yaml         | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
index de7ba7f345a9..8bfd4fb5f834 100644
--- a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
+++ b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
@@ -93,6 +93,10 @@ properties:
     description: Number of size cells on the MDIO bus.
     const: 0
 
+  mdio:
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false
+
   renesas,no-ether-link:
     type: boolean
     description:
@@ -110,9 +114,13 @@ properties:
   tx-internal-delay-ps:
     enum: [0, 2000]
 
+# In older bindings there where no mdio child-node to describe the MDIO bus
+# and the PHY. To not fail older bindings accept any node with an address. New
+# users should describe the PHY inside the mdio child-node.
 patternProperties:
   "@[0-9a-f]$":
     type: object
+    deprecated: true
 
 required:
   - compatible
-- 
2.44.0


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

* [net-next,v3 2/2] ravb: Add support for an optional MDIO mode
  2024-03-11 14:11 [net-next,v3 0/2] ravb: Support describing the MDIO bus Niklas Söderlund
  2024-03-11 14:11 ` [net-next,v3 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node Niklas Söderlund
@ 2024-03-11 14:11 ` Niklas Söderlund
  2024-03-12 22:05   ` Andrew Lunn
  2024-03-12  4:29 ` [net-next,v3 0/2] ravb: Support describing the MDIO bus Jakub Kicinski
  2 siblings, 1 reply; 6+ messages in thread
From: Niklas Söderlund @ 2024-03-11 14:11 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Claudiu Beznea, Yoshihiro Shimoda, Biju Das,
	netdev, devicetree
  Cc: linux-renesas-soc, Niklas Söderlund

The driver used the DT node of the device itself when registering the
MDIO bus. While this works, it creates a problem: it forces any MDIO bus
properties to also be set on the devices DT node. This mixes the
properties of two distinctly different things and is confusing.

This change adds support for an optional mdio node to be defined as a
child to the device DT node. The child node can then be used to describe
MDIO bus properties that the MDIO core can act on when registering the
bus.

If no mdio child node is found the driver fallback to the old behavior
and register the MDIO bus using the device DT node. This change is
backward compatible with old bindings in use.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
* Changes since v2
- Use DT node instead of OF ode in commit message.
- Update punctuation in commit message.
- Simplify the node selection in the driver.
---
 drivers/net/ethernet/renesas/ravb_main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index fa48ff4aba2d..b6adf608ebfa 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2564,6 +2564,7 @@ static int ravb_mdio_init(struct ravb_private *priv)
 {
 	struct platform_device *pdev = priv->pdev;
 	struct device *dev = &pdev->dev;
+	struct device_node *mdio_node;
 	struct phy_device *phydev;
 	struct device_node *pn;
 	int error;
@@ -2583,7 +2584,13 @@ static int ravb_mdio_init(struct ravb_private *priv)
 		 pdev->name, pdev->id);
 
 	/* Register MDIO bus */
-	error = of_mdiobus_register(priv->mii_bus, dev->of_node);
+	mdio_node = of_get_child_by_name(dev->of_node, "mdio");
+	if (!mdio_node) {
+		/* backwards compatibility for DT lacking mdio subnode */
+		mdio_node = of_node_get(dev->of_node);
+	}
+	error = of_mdiobus_register(priv->mii_bus, mdio_node);
+	of_node_put(mdio_node);
 	if (error)
 		goto out_free_bus;
 
-- 
2.44.0


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

* Re: [net-next,v3 0/2] ravb: Support describing the MDIO bus
  2024-03-11 14:11 [net-next,v3 0/2] ravb: Support describing the MDIO bus Niklas Söderlund
  2024-03-11 14:11 ` [net-next,v3 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node Niklas Söderlund
  2024-03-11 14:11 ` [net-next,v3 2/2] ravb: Add support for an optional MDIO mode Niklas Söderlund
@ 2024-03-12  4:29 ` Jakub Kicinski
  2 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2024-03-12  4:29 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Claudiu Beznea, Yoshihiro Shimoda, Biju Das,
	netdev, devicetree, linux-renesas-soc

On Mon, 11 Mar 2024 15:11:04 +0100 Niklas Söderlund wrote:
> This series adds support to the binding and driver of the Renesas
> Ethernet AVB to described the MDIO bus. Currently the driver uses the OF
> node of the device itself when registering the MDIO bus. This forces any
> MDIO bus properties the MDIO core should react on to be set on the
> device OF node. This is confusing and non of the MDIO bus properties are
> described in the Ethernet AVB bindings.

## Form letter - net-next-closed

The merge window for v6.9 has begun and we have already posted our pull
request. Therefore net-next is closed for new drivers, features, code
refactoring and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after March 25th.

RFC patches sent for review only are obviously welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
-- 
pw-bot: defer

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

* Re: [net-next,v3 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node
  2024-03-11 14:11 ` [net-next,v3 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node Niklas Söderlund
@ 2024-03-12 14:25   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2024-03-12 14:25 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Yoshihiro Shimoda, Eric Dumazet, Geert Uytterhoeven,
	Conor Dooley, Claudiu Beznea, Jakub Kicinski, linux-renesas-soc,
	devicetree, Biju Das, netdev, Sergey Shtylyov, Paolo Abeni,
	Krzysztof Kozlowski, David S. Miller, Rob Herring


On Mon, 11 Mar 2024 15:11:05 +0100, Niklas Söderlund wrote:
> The Renesas Ethernet AVB bindings do not allow the MDIO bus to be
> described. This has not been needed as only a single PHY is
> supported and no MDIO bus properties have been needed.
> 
> Add an optional mdio node to the binding which allows the MDIO bus to be
> described and allow bus properties to be set.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
> * Changes since v2
> - Mark the PHY pattern as deprecated and add a comment that new bindings
>   should describe the PHY inside the MDIO node.
> ---
>  .../devicetree/bindings/net/renesas,etheravb.yaml         | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>


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

* Re: [net-next,v3 2/2] ravb: Add support for an optional MDIO mode
  2024-03-11 14:11 ` [net-next,v3 2/2] ravb: Add support for an optional MDIO mode Niklas Söderlund
@ 2024-03-12 22:05   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2024-03-12 22:05 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Claudiu Beznea, Yoshihiro Shimoda, Biju Das,
	netdev, devicetree, linux-renesas-soc

On Mon, Mar 11, 2024 at 03:11:06PM +0100, Niklas Söderlund wrote:
> The driver used the DT node of the device itself when registering the
> MDIO bus. While this works, it creates a problem: it forces any MDIO bus
> properties to also be set on the devices DT node. This mixes the
> properties of two distinctly different things and is confusing.
> 
> This change adds support for an optional mdio node to be defined as a
> child to the device DT node. The child node can then be used to describe
> MDIO bus properties that the MDIO core can act on when registering the
> bus.
> 
> If no mdio child node is found the driver fallback to the old behavior
> and register the MDIO bus using the device DT node. This change is
> backward compatible with old bindings in use.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

end of thread, other threads:[~2024-03-12 22:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 14:11 [net-next,v3 0/2] ravb: Support describing the MDIO bus Niklas Söderlund
2024-03-11 14:11 ` [net-next,v3 1/2] dt-bindings: net: renesas,etheravb: Add optional MDIO bus node Niklas Söderlund
2024-03-12 14:25   ` Rob Herring
2024-03-11 14:11 ` [net-next,v3 2/2] ravb: Add support for an optional MDIO mode Niklas Söderlund
2024-03-12 22:05   ` Andrew Lunn
2024-03-12  4:29 ` [net-next,v3 0/2] ravb: Support describing the MDIO bus Jakub Kicinski

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).