d35230f
From 44f947bb8ef5f4add9f2d84e1ff53afd8f2f5537 Mon Sep 17 00:00:00 2001
d35230f
From: Peter Robinson <pbrobinson@gmail.com>
d35230f
Date: Wed, 16 Mar 2016 15:21:44 +0000
d35230f
Subject: [PATCH 1/2] Revert "stmmac: Fix 'eth0: No PHY found' regression"
d35230f
d35230f
This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493.
d35230f
---
d35230f
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c     | 11 ++++++++++-
d35230f
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |  9 +--------
d35230f
 include/linux/stmmac.h                                |  1 -
d35230f
 3 files changed, 11 insertions(+), 10 deletions(-)
d35230f
d35230f
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
d35230f
index efb54f3..0faf163 100644
d35230f
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
d35230f
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
d35230f
@@ -199,12 +199,21 @@ int stmmac_mdio_register(struct net_device *ndev)
d35230f
 	struct stmmac_priv *priv = netdev_priv(ndev);
d35230f
 	struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
d35230f
 	int addr, found;
d35230f
-	struct device_node *mdio_node = priv->plat->mdio_node;
d35230f
+	struct device_node *mdio_node = NULL;
d35230f
+	struct device_node *child_node = NULL;
d35230f
 
d35230f
 	if (!mdio_bus_data)
d35230f
 		return 0;
d35230f
 
d35230f
 	if (IS_ENABLED(CONFIG_OF)) {
d35230f
+		for_each_child_of_node(priv->device->of_node, child_node) {
d35230f
+			if (of_device_is_compatible(child_node,
d35230f
+						    "snps,dwmac-mdio")) {
d35230f
+				mdio_node = child_node;
d35230f
+				break;
d35230f
+			}
d35230f
+		}
d35230f
+
d35230f
 		if (mdio_node) {
d35230f
 			netdev_dbg(ndev, "FOUND MDIO subnode\n");
d35230f
 		} else {
d35230f
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
d35230f
index 4514ba7..6a52fa1 100644
d35230f
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
d35230f
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
d35230f
@@ -110,7 +110,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
d35230f
 	struct device_node *np = pdev->dev.of_node;
d35230f
 	struct plat_stmmacenet_data *plat;
d35230f
 	struct stmmac_dma_cfg *dma_cfg;
d35230f
-	struct device_node *child_node = NULL;
d35230f
 
d35230f
 	plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
d35230f
 	if (!plat)
d35230f
@@ -141,19 +140,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
d35230f
 		plat->phy_node = of_node_get(np);
d35230f
 	}
d35230f
 
d35230f
-	for_each_child_of_node(np, child_node)
d35230f
-		if (of_device_is_compatible(child_node,	"snps,dwmac-mdio")) {
d35230f
-			plat->mdio_node = child_node;
d35230f
-			break;
d35230f
-		}
d35230f
-
d35230f
 	/* "snps,phy-addr" is not a standard property. Mark it as deprecated
d35230f
 	 * and warn of its use. Remove this when phy node support is added.
d35230f
 	 */
d35230f
 	if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0)
d35230f
 		dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n");
d35230f
 
d35230f
-	if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node)
d35230f
+	if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name)
d35230f
 		plat->mdio_bus_data = NULL;
d35230f
 	else
d35230f
 		plat->mdio_bus_data =
d35230f
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
d35230f
index 881a79d..eead8ab 100644
d35230f
--- a/include/linux/stmmac.h
d35230f
+++ b/include/linux/stmmac.h
d35230f
@@ -100,7 +100,6 @@ struct plat_stmmacenet_data {
d35230f
 	int interface;
d35230f
 	struct stmmac_mdio_bus_data *mdio_bus_data;
d35230f
 	struct device_node *phy_node;
d35230f
-	struct device_node *mdio_node;
d35230f
 	struct stmmac_dma_cfg *dma_cfg;
d35230f
 	int clk_csr;
d35230f
 	int has_gmac;
d35230f
-- 
d35230f
2.5.0
d35230f