Skip to content

Commit d7e944c

Browse files
cavagiudavem330
authored andcommitted
Revert "stmmac: Fix 'eth0: No PHY found' regression"
This reverts commit 88f8b1b. 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>
1 parent a00e3ab commit d7e944c

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,21 @@ int stmmac_mdio_register(struct net_device *ndev)
199199
struct stmmac_priv *priv = netdev_priv(ndev);
200200
struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
201201
int addr, found;
202-
struct device_node *mdio_node = priv->plat->mdio_node;
202+
struct device_node *mdio_node = NULL;
203+
struct device_node *child_node = NULL;
203204

204205
if (!mdio_bus_data)
205206
return 0;
206207

207208
if (IS_ENABLED(CONFIG_OF)) {
209+
for_each_child_of_node(priv->device->of_node, child_node) {
210+
if (of_device_is_compatible(child_node,
211+
"snps,dwmac-mdio")) {
212+
mdio_node = child_node;
213+
break;
214+
}
215+
}
216+
208217
if (mdio_node) {
209218
netdev_dbg(ndev, "FOUND MDIO subnode\n");
210219
} else {

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
146146
struct device_node *np = pdev->dev.of_node;
147147
struct plat_stmmacenet_data *plat;
148148
struct stmmac_dma_cfg *dma_cfg;
149-
struct device_node *child_node = NULL;
150149

151150
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
152151
if (!plat)
@@ -177,19 +176,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
177176
plat->phy_node = of_node_get(np);
178177
}
179178

180-
for_each_child_of_node(np, child_node)
181-
if (of_device_is_compatible(child_node, "snps,dwmac-mdio")) {
182-
plat->mdio_node = child_node;
183-
break;
184-
}
185-
186179
/* "snps,phy-addr" is not a standard property. Mark it as deprecated
187180
* and warn of its use. Remove this when phy node support is added.
188181
*/
189182
if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0)
190183
dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n");
191184

192-
if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node)
185+
if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name)
193186
plat->mdio_bus_data = NULL;
194187
else
195188
plat->mdio_bus_data =

include/linux/stmmac.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ struct plat_stmmacenet_data {
114114
int interface;
115115
struct stmmac_mdio_bus_data *mdio_bus_data;
116116
struct device_node *phy_node;
117-
struct device_node *mdio_node;
118117
struct stmmac_dma_cfg *dma_cfg;
119118
int clk_csr;
120119
int has_gmac;

0 commit comments

Comments
 (0)