Revert "stmmac: Fix 'eth0: No PHY found' regression"
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Fri, 1 Apr 2016 07:07:15 +0000 (09:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Apr 2016 18:38:58 +0000 (14:38 -0400)
This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493.
due to problems on GeekBox and Banana Pi M1 board when
connected to a real transceiver instead of a switch via
fixed-link.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org>
Cc: Andreas Färber <afaerber@suse.de>
Cc: Frank Schäfer <fschaefer.oss@googlemail.com>
Cc: Dinh Nguyen <dinh.linux@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
include/linux/stmmac.h

index ea76129dafc2bc6e6e0d602bb1da9a66b39810e1..af09ced53bd89faf9c59aee5f8fe3460961472b4 100644 (file)
@@ -199,12 +199,21 @@ int stmmac_mdio_register(struct net_device *ndev)
        struct stmmac_priv *priv = netdev_priv(ndev);
        struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
        int addr, found;
-       struct device_node *mdio_node = priv->plat->mdio_node;
+       struct device_node *mdio_node = NULL;
+       struct device_node *child_node = NULL;
 
        if (!mdio_bus_data)
                return 0;
 
        if (IS_ENABLED(CONFIG_OF)) {
+               for_each_child_of_node(priv->device->of_node, child_node) {
+                       if (of_device_is_compatible(child_node,
+                                                   "snps,dwmac-mdio")) {
+                               mdio_node = child_node;
+                               break;
+                       }
+               }
+
                if (mdio_node) {
                        netdev_dbg(ndev, "FOUND MDIO subnode\n");
                } else {
index dcbd2a1601e89a620bb2dc1c77887e374d3fe2ba..9cf181f839fd3dcda71aa32f6a4476846a2e4287 100644 (file)
@@ -146,7 +146,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
        struct device_node *np = pdev->dev.of_node;
        struct plat_stmmacenet_data *plat;
        struct stmmac_dma_cfg *dma_cfg;
-       struct device_node *child_node = NULL;
 
        plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
        if (!plat)
@@ -177,19 +176,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
                plat->phy_node = of_node_get(np);
        }
 
-       for_each_child_of_node(np, child_node)
-               if (of_device_is_compatible(child_node, "snps,dwmac-mdio")) {
-                       plat->mdio_node = child_node;
-                       break;
-               }
-
        /* "snps,phy-addr" is not a standard property. Mark it as deprecated
         * and warn of its use. Remove this when phy node support is added.
         */
        if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0)
                dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n");
 
-       if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node)
+       if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name)
                plat->mdio_bus_data = NULL;
        else
                plat->mdio_bus_data =
index 4bcf5a61aada05b02d33c33928dc4d7d7e9f0bb2..6e53fa8942a470cb74b9baa2dc2b7d228c23876c 100644 (file)
@@ -114,7 +114,6 @@ struct plat_stmmacenet_data {
        int interface;
        struct stmmac_mdio_bus_data *mdio_bus_data;
        struct device_node *phy_node;
-       struct device_node *mdio_node;
        struct stmmac_dma_cfg *dma_cfg;
        int clk_csr;
        int has_gmac;