diff mbox

net: ethernet: support "fixed-link" DT node on nb8800 driver

Message ID 56B4A445.7080402@laposte.net
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Sebastian Frias Feb. 5, 2016, 1:31 p.m. UTC
Signed-off-by: Sebastian Frias <sf84@laposte.net>
---
  drivers/net/ethernet/aurora/nb8800.c | 19 +++++++++++++++----
  1 file changed, 15 insertions(+), 4 deletions(-)

  	priv->mii_bus = bus;

Comments

Andy Shevchenko Feb. 5, 2016, 3:57 p.m. UTC | #1
On Fri, Feb 5, 2016 at 3:39 PM, Måns Rullgård <mans@mansr.com> wrote:
>> +                     if (ret < 0) {
>> +                             dev_err(&pdev->dev, "broken fixed-link specification\n");
>
> Line is longer than 80 chars.

This is actually okay, though I would recommend to move long string
literal to the next line.
Måns Rullgård Feb. 5, 2016, 3:58 p.m. UTC | #2
Andy Shevchenko <andy.shevchenko@gmail.com> writes:

> On Fri, Feb 5, 2016 at 3:39 PM, Måns Rullgård <mans@mansr.com> wrote:
>>> +                     if (ret < 0) {
>>> +                             dev_err(&pdev->dev, "broken fixed-link specification\n");
>>
>> Line is longer than 80 chars.
>
> This is actually okay, though I would recommend to move long string
> literal to the next line.

I only mentioned it because fixing it was trivial.
diff mbox

Patch

diff --git a/drivers/net/ethernet/aurora/nb8800.c 
b/drivers/net/ethernet/aurora/nb8800.c
index ecc4a33..1353fee 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1461,10 +1461,21 @@  static int nb8800_probe(struct platform_device 
*pdev)
  	}

  	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;
-		goto err_free_bus;
+	if (!priv->phy_node)
+	{
+		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, "broken fixed-link specification\n");
+				goto err_free_bus;
+			}
+			priv->phy_node = of_node_get(pdev->dev.of_node);
+		}
+		else {
+			dev_err(&pdev->dev, "no PHY specified\n");
+			ret = -ENODEV;
+			goto err_free_bus;
+		}
  	}