diff mbox

[v5] net: ethernet: nb8800: support fixed-link DT node

Message ID 56B86C88.5090504@laposte.net
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Sebastian Frias Feb. 8, 2016, 10:23 a.m. UTC
Under some circumstances, for example when connecting
to a switch:

https://stackoverflow.com/questions/31046172/device-tree-for-phy-less-connection-to-a-dsa-switch

the ethernet port will not be connected to a PHY.
In that case a "fixed-link" DT node can be used to replace it.

This patch adds support for the "fixed-link" node to the
nb8800 driver.

Signed-off-by: Sebastian Frias <sf84@laposte.net>
---
  drivers/net/ethernet/aurora/nb8800.c | 14 +++++++++++++-
  1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Måns Rullgård Feb. 8, 2016, 1:19 p.m. UTC | #1
Sebastian Frias <sf84@laposte.net> writes:

> Under some circumstances, for example when connecting
> to a switch:
>
> https://stackoverflow.com/questions/31046172/device-tree-for-phy-less-connection-to-a-dsa-switch
>
> the ethernet port will not be connected to a PHY.
> In that case a "fixed-link" DT node can be used to replace it.
>
> This patch adds support for the "fixed-link" node to the
> nb8800 driver.
>
> Signed-off-by: Sebastian Frias <sf84@laposte.net>

Acked-by: Mans Rullgard <mans@mansr.com>

> ---
>  drivers/net/ethernet/aurora/nb8800.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/aurora/nb8800.c
> b/drivers/net/ethernet/aurora/nb8800.c
> index ecc4a33..e1fb071 100644
> --- a/drivers/net/ethernet/aurora/nb8800.c
> +++ b/drivers/net/ethernet/aurora/nb8800.c
> @@ -1460,7 +1460,19 @@ static int nb8800_probe(struct platform_device *pdev)
>  		goto err_disable_clk;
>  	}
>
> -	priv->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
> +	if (of_phy_is_fixed_link(pdev->dev.of_node)) {
> +		ret = of_phy_register_fixed_link(pdev->dev.of_node);
> +		if (ret < 0) {
> +			dev_err(&pdev->dev, "bad fixed-link spec\n");
> +			goto err_free_bus;
> +		}
> +		priv->phy_node = of_node_get(pdev->dev.of_node);
> +	}
> +
> +	if (!priv->phy_node)
> +		priv->phy_node = of_parse_phandle(pdev->dev.of_node,
> +						  "phy-handle", 0);
> +
>  	if (!priv->phy_node) {
>  		dev_err(&pdev->dev, "no PHY specified\n");
>  		ret = -ENODEV;
> -- 
> 2.1.4
>
David Miller Feb. 16, 2016, 8:04 p.m. UTC | #2
From: Sebastian Frias <sf84@laposte.net>
Date: Mon, 08 Feb 2016 11:23:04 +0100

> 
> Under some circumstances, for example when connecting
> to a switch:
> 
> https://stackoverflow.com/questions/31046172/device-tree-for-phy-less-connection-to-a-dsa-switch
> 
> the ethernet port will not be connected to a PHY.
> In that case a "fixed-link" DT node can be used to replace it.
> 
> This patch adds support for the "fixed-link" node to the
> nb8800 driver.
> 
> Signed-off-by: Sebastian Frias <sf84@laposte.net>

This doesn't apply, please respin against my tree.
Mason Feb. 22, 2016, 12:39 p.m. UTC | #3
On 16/02/2016 21:04, David Miller wrote:

> This doesn't apply, please respin against my tree.

I fixed several formatting issues with Sebastian's patch,
and submitted v6.

Regards.
diff mbox

Patch

diff --git a/drivers/net/ethernet/aurora/nb8800.c 
b/drivers/net/ethernet/aurora/nb8800.c
index ecc4a33..e1fb071 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1460,7 +1460,19 @@  static int nb8800_probe(struct platform_device *pdev)
  		goto err_disable_clk;
  	}

-	priv->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
+	if (of_phy_is_fixed_link(pdev->dev.of_node)) {
+		ret = of_phy_register_fixed_link(pdev->dev.of_node);
+		if (ret < 0) {
+			dev_err(&pdev->dev, "bad fixed-link spec\n");
+			goto err_free_bus;
+		}
+		priv->phy_node = of_node_get(pdev->dev.of_node);
+	}
+
+	if (!priv->phy_node)
+		priv->phy_node = of_parse_phandle(pdev->dev.of_node,
+						  "phy-handle", 0);
+
  	if (!priv->phy_node) {
  		dev_err(&pdev->dev, "no PHY specified\n");
  		ret = -ENODEV;