Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1686401 > unrolled thread

[PATCH net] xgene: Don't fail probe, if there is no clk resource for SGMII interfaces

Started byThomas Bogendoerfer <tsbogend@alpha.franken.de>
First post2017-07-13 11:30 +0200
Last post2017-07-13 18:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net] xgene: Don't fail probe, if there is no clk resource for SGMII interfaces Thomas Bogendoerfer <tsbogend@alpha.franken.de> - 2017-07-13 11:30 +0200
    Re: [PATCH net] xgene: Don't fail probe, if there is no clk  resource for SGMII interfaces David Miller <davem@davemloft.net> - 2017-07-13 18:30 +0200

#1686401 — [PATCH net] xgene: Don't fail probe, if there is no clk resource for SGMII interfaces

FromThomas Bogendoerfer <tsbogend@alpha.franken.de>
Date2017-07-13 11:30 +0200
Subject[PATCH net] xgene: Don't fail probe, if there is no clk resource for SGMII interfaces
Message-ID<u2IBA-3Pg-7@gated-at.bofh.it>
From: Thomas Bogendoerfer <tbogendoerfer@suse.de>

This change fixes following problem

[    1.827940] xgene-enet: probe of 1f210030.ethernet failed with error -2

which leads to a missing ethernet interface (reproducable at least on
Gigabyte MP30-AR0 and APM Mustang systems).

The check for a valid clk resource fails, because DT doesn't provide a
clock for sgenet1. But the driver doesn't use this clk, if the ethernet
port is connected via SGMII. Therefore this patch avoids probing for clk
on SGMII interfaces.

Fixes: 9aea7779b764 drivers: net: xgene: Fix crash on DT systems
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index d3906f6b01bd..86058a9f3417 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1785,16 +1785,18 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 
 	xgene_enet_gpiod_get(pdata);
 
-	pdata->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(pdata->clk)) {
-		/* Abort if the clock is defined but couldn't be retrived.
-		 * Always abort if the clock is missing on DT system as
-		 * the driver can't cope with this case.
-		 */
-		if (PTR_ERR(pdata->clk) != -ENOENT || dev->of_node)
-			return PTR_ERR(pdata->clk);
-		/* Firmware may have set up the clock already. */
-		dev_info(dev, "clocks have been setup already\n");
+	if (pdata->phy_mode != PHY_INTERFACE_MODE_SGMII) {
+		pdata->clk = devm_clk_get(&pdev->dev, NULL);
+		if (IS_ERR(pdata->clk)) {
+			/* Abort if the clock is defined but couldn't be
+			 * retrived. Always abort if the clock is missing on
+			 * DT system as the driver can't cope with this case.
+			 */
+			if (PTR_ERR(pdata->clk) != -ENOENT || dev->of_node)
+				return PTR_ERR(pdata->clk);
+			/* Firmware may have set up the clock already. */
+			dev_info(dev, "clocks have been setup already\n");
+		}
 	}
 
 	if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
-- 
2.12.3

[toc] | [next] | [standalone]


#1686761 — Re: [PATCH net] xgene: Don't fail probe, if there is no clk resource for SGMII interfaces

FromDavid Miller <davem@davemloft.net>
Date2017-07-13 18:30 +0200
SubjectRe: [PATCH net] xgene: Don't fail probe, if there is no clk resource for SGMII interfaces
Message-ID<u2Pa1-7UJ-1@gated-at.bofh.it>
In reply to#1686401
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Date: Thu, 13 Jul 2017 10:57:40 +0200

> From: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> 
> This change fixes following problem
> 
> [    1.827940] xgene-enet: probe of 1f210030.ethernet failed with error -2
> 
> which leads to a missing ethernet interface (reproducable at least on
> Gigabyte MP30-AR0 and APM Mustang systems).
> 
> The check for a valid clk resource fails, because DT doesn't provide a
> clock for sgenet1. But the driver doesn't use this clk, if the ethernet
> port is connected via SGMII. Therefore this patch avoids probing for clk
> on SGMII interfaces.

Applied, thanks.

> Fixes: 9aea7779b764 drivers: net: xgene: Fix crash on DT systems

Please put the commit header text inside of parenthesis and double quotes,
like this:

Fixes: 9aea7779b764 ("drivers: net: xgene: Fix crash on DT systems")

I fixed it up for you this time.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web