linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node
@ 2021-10-22 16:35 Sean Anderson
  2021-10-22 16:35 ` [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists Sean Anderson
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Sean Anderson @ 2021-10-22 16:35 UTC (permalink / raw)
  To: netdev, Nicolas Ferre, Claudiu Beznea
  Cc: Jakub Kicinski, David S . Miller, linux-kernel, Sean Anderson,
	Rob Herring, devicetree

This adds an optional mdio bus child node. If present, the mac will
look for PHYs there instead of directly under the top-level node. This
eliminates any ambiguity about whether child nodes are PHYs, and allows
the MDIO bus to contain non-PHY devices.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

 Documentation/devicetree/bindings/net/macb.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt
index af9df2f01a1c..a1b06fd1962e 100644
--- a/Documentation/devicetree/bindings/net/macb.txt
+++ b/Documentation/devicetree/bindings/net/macb.txt
@@ -30,6 +30,10 @@ Required properties:
 	Optional elements: 'tsu_clk'
 - clocks: Phandles to input clocks.
 
+Optional properties:
+- mdio: node containing PHY children. If this node is not present, then PHYs
+        will be direct children.
+
 The MAC address will be determined using the optional properties
 defined in ethernet.txt.
 
-- 
2.25.1


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

* [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists
  2021-10-22 16:35 [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node Sean Anderson
@ 2021-10-22 16:35 ` Sean Anderson
  2021-10-22 19:43   ` Andrew Lunn
  2021-10-26 16:49   ` Guenter Roeck
  2021-10-22 19:37 ` [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node Andrew Lunn
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 7+ messages in thread
From: Sean Anderson @ 2021-10-22 16:35 UTC (permalink / raw)
  To: netdev, Nicolas Ferre, Claudiu Beznea
  Cc: Jakub Kicinski, David S . Miller, linux-kernel, Sean Anderson

This allows explicitly specifying which children are present on the mdio
bus. Additionally, it allows for non-phy MDIO devices on the bus.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

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

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 029dea2873e3..30a65cac9e87 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -898,6 +898,17 @@ static int macb_mdiobus_register(struct macb *bp)
 {
 	struct device_node *child, *np = bp->pdev->dev.of_node;
 
+	/* If we have a child named mdio, probe it instead of looking for PHYs
+	 * directly under the MAC node
+	 */
+	child = of_get_child_by_name(np, "mdio");
+	if (np) {
+		int ret = of_mdiobus_register(bp->mii_bus, child);
+
+		of_node_put(child);
+		return ret;
+	}
+
 	if (of_phy_is_fixed_link(np))
 		return mdiobus_register(bp->mii_bus);
 
-- 
2.25.1


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

* Re: [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node
  2021-10-22 16:35 [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node Sean Anderson
  2021-10-22 16:35 ` [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists Sean Anderson
@ 2021-10-22 19:37 ` Andrew Lunn
  2021-10-22 19:39 ` Andrew Lunn
  2021-10-24 12:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2021-10-22 19:37 UTC (permalink / raw)
  To: Sean Anderson
  Cc: netdev, Nicolas Ferre, Claudiu Beznea, Jakub Kicinski,
	David S . Miller, linux-kernel, Rob Herring, devicetree

On Fri, Oct 22, 2021 at 12:35:47PM -0400, Sean Anderson wrote:
> This adds an optional mdio bus child node. If present, the mac will
> look for PHYs there instead of directly under the top-level node. This
> eliminates any ambiguity about whether child nodes are PHYs, and allows
> the MDIO bus to contain non-PHY devices.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>

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

    Andrew

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

* Re: [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node
  2021-10-22 16:35 [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node Sean Anderson
  2021-10-22 16:35 ` [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists Sean Anderson
  2021-10-22 19:37 ` [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node Andrew Lunn
@ 2021-10-22 19:39 ` Andrew Lunn
  2021-10-24 12:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2021-10-22 19:39 UTC (permalink / raw)
  To: Sean Anderson
  Cc: netdev, Nicolas Ferre, Claudiu Beznea, Jakub Kicinski,
	David S . Miller, linux-kernel, Rob Herring, devicetree

On Fri, Oct 22, 2021 at 12:35:47PM -0400, Sean Anderson wrote:
> This adds an optional mdio bus child node. If present, the mac will
> look for PHYs there instead of directly under the top-level node. This
> eliminates any ambiguity about whether child nodes are PHYs, and allows
> the MDIO bus to contain non-PHY devices.

Hi Sean

Please always have a patch 0/X for patchsets, which explains the big
picture of the patchset. This is also used as the merge commit
message.

	Andrew

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

* Re: [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists
  2021-10-22 16:35 ` [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists Sean Anderson
@ 2021-10-22 19:43   ` Andrew Lunn
  2021-10-26 16:49   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2021-10-22 19:43 UTC (permalink / raw)
  To: Sean Anderson
  Cc: netdev, Nicolas Ferre, Claudiu Beznea, Jakub Kicinski,
	David S . Miller, linux-kernel

On Fri, Oct 22, 2021 at 12:35:48PM -0400, Sean Anderson wrote:
> This allows explicitly specifying which children are present on the mdio
> bus. Additionally, it allows for non-phy MDIO devices on the bus.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>

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

    Andrew

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

* Re: [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node
  2021-10-22 16:35 [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node Sean Anderson
                   ` (2 preceding siblings ...)
  2021-10-22 19:39 ` Andrew Lunn
@ 2021-10-24 12:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-24 12:50 UTC (permalink / raw)
  To: Sean Anderson
  Cc: netdev, nicolas.ferre, claudiu.beznea, kuba, davem, linux-kernel,
	robh, devicetree

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 22 Oct 2021 12:35:47 -0400 you wrote:
> This adds an optional mdio bus child node. If present, the mac will
> look for PHYs there instead of directly under the top-level node. This
> eliminates any ambiguity about whether child nodes are PHYs, and allows
> the MDIO bus to contain non-PHY devices.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] dt-bindings: net: macb: Add mdio bus child node
    https://git.kernel.org/netdev/net-next/c/25790844006a
  - [net-next,2/2] net: macb: Use mdio child node for MDIO bus if it exists
    https://git.kernel.org/netdev/net-next/c/4d98bb0d7ec2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists
  2021-10-22 16:35 ` [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists Sean Anderson
  2021-10-22 19:43   ` Andrew Lunn
@ 2021-10-26 16:49   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-10-26 16:49 UTC (permalink / raw)
  To: Sean Anderson
  Cc: netdev, Nicolas Ferre, Claudiu Beznea, Jakub Kicinski,
	David S . Miller, linux-kernel

Hi,

while bisecting I noticed the following.

On Fri, Oct 22, 2021 at 12:35:48PM -0400, Sean Anderson wrote:
> This allows explicitly specifying which children are present on the mdio
> bus. Additionally, it allows for non-phy MDIO devices on the bus.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
> 
>  drivers/net/ethernet/cadence/macb_main.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 029dea2873e3..30a65cac9e87 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -898,6 +898,17 @@ static int macb_mdiobus_register(struct macb *bp)
>  {
>  	struct device_node *child, *np = bp->pdev->dev.of_node;
>  
> +	/* If we have a child named mdio, probe it instead of looking for PHYs
> +	 * directly under the MAC node
> +	 */
> +	child = of_get_child_by_name(np, "mdio");
> +	if (np) {

s/np/child/ 

to avoid network interface failures with messages like

[   12.764530] macb 10090000.ethernet eth0: Could not attach PHY (-19)

I'll send a patch in a minute to fix this up, after bisect is complete
and after testing, to make sure that there is no additional problem.

Guenter

> +		int ret = of_mdiobus_register(bp->mii_bus, child);
> +
> +		of_node_put(child);
> +		return ret;
> +	}
> +
>  	if (of_phy_is_fixed_link(np))
>  		return mdiobus_register(bp->mii_bus);
>  
> -- 
> 2.25.1
> 

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

end of thread, other threads:[~2021-10-26 16:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 16:35 [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node Sean Anderson
2021-10-22 16:35 ` [net-next PATCH 2/2] net: macb: Use mdio child node for MDIO bus if it exists Sean Anderson
2021-10-22 19:43   ` Andrew Lunn
2021-10-26 16:49   ` Guenter Roeck
2021-10-22 19:37 ` [net-next PATCH 1/2] dt-bindings: net: macb: Add mdio bus child node Andrew Lunn
2021-10-22 19:39 ` Andrew Lunn
2021-10-24 12:50 ` patchwork-bot+netdevbpf

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