public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Mason <slash.tmp@free•fr>
To: "David S. Miller" <davem@davemloft•net>
Cc: Sebastian Frias <sf84@laposte•net>,
	Mans Rullgard <mans@mansr•com>, netdev <netdev@vger•kernel.org>
Subject: [PATCH v6] net: ethernet: nb8800: support fixed-link DT node
Date: Mon, 22 Feb 2016 13:33:14 +0100	[thread overview]
Message-ID: <56CB000A.1070809@free.fr> (raw)

From: Sebastian Frias <sf84@laposte•net>

Under some circumstances, e.g. when connecting to a 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.

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

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>
Cc: Mason <slash.tmp@free•fr>
---
There were spurious spaces in the previous patch.
---
 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 f71ab2647a3b..08a23e6b60e9 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.7.0

             reply	other threads:[~2016-02-22 12:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 12:33 Mason [this message]
2016-02-24 16:32 ` [PATCH v6] net: ethernet: nb8800: support fixed-link DT node David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CB000A.1070809@free.fr \
    --to=slash.tmp@free$(echo .)fr \
    --cc=davem@davemloft$(echo .)net \
    --cc=mans@mansr$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sf84@laposte$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox