[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c7d1dbac1940853c22db8215ed60181b2abe3050.1561556556.git.joabreu@synopsys.com>
Date: Wed, 26 Jun 2019 15:47:44 +0200
From: Jose Abreu <Jose.Abreu@...opsys.com>
To: linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Cc: Jose Abreu <Jose.Abreu@...opsys.com>,
Joao Pinto <Joao.Pinto@...opsys.com>,
"David S . Miller" <davem@...emloft.net>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...com>
Subject: [PATCH net-next 10/10] net: stmmac: Try to get C45 PHY if everything else fails
On PCI based setups that are connected to C45 PHY we won't have DT
bindings specifying what's the correct PHY type.
Fallback to C45 if everything else fails when trying to acquire PHY.
Signed-off-by: Jose Abreu <joabreu@...opsys.com>
Cc: Joao Pinto <jpinto@...opsys.com>
Cc: David S. Miller <davem@...emloft.net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>
Cc: Alexandre Torgue <alexandre.torgue@...com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index bc949665c529..e790ab79e819 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1014,6 +1014,20 @@ static int stmmac_init_phy(struct net_device *dev)
phydev = mdiobus_get_phy(priv->mii, addr);
if (!phydev) {
+ /* Try C45 */
+ phydev = get_phy_device(priv->mii, addr, true);
+ if (phydev && !IS_ERR(phydev)) {
+ ret = phy_device_register(phydev);
+ if (ret) {
+ phy_device_free(phydev);
+ phydev = NULL;
+ }
+ } else {
+ phydev = NULL;
+ }
+ }
+
+ if (!phydev) {
netdev_err(priv->dev, "no phy at addr %d\n", addr);
return -ENODEV;
}
--
2.7.4
Powered by blists - more mailing lists