summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-09-27 20:52:36 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-10-02 00:39:46 +0200
commit819031b60dcb0e2175da3ef5d75637bdd5642571 (patch)
tree1f7015bf4a5433c789d42ca793810324f081c6b0
parent6cdeb09e8576c0cd008b8f9163219d4555a09b22 (diff)
stmmac_mdio: Re-enable mdio bus scanning if no PHY in DTS.
A previous patch disabled PHY probing in case a PHY is specified in the DTS. However, it also broke mdio bus registration for the case that no PHY is specified in the DTS (i.e. when PHY probing is what we want). This patch solves this issue by fixing the mdio bus registration code properly. Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index adefc03a02c8..0e4aa3e01892 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -233,14 +233,24 @@ int stmmac_mdio_register(struct net_device *ndev)
new_bus->irq = irqlist;
new_bus->phy_mask = mdio_bus_data->phy_mask;
new_bus->parent = priv->device;
- err = of_mdiobus_register(new_bus, mdio_node);
- if (err != 0) {
- pr_err("%s: Cannot register as MDIO bus\n", new_bus->name);
- goto bus_register_fail;
+ if (mdio_node) {
+ err = of_mdiobus_register(new_bus, mdio_node);
+ if (err != 0) {
+ pr_err("%s: Cannot register as MDIO bus\n", new_bus->name);
+ goto bus_register_fail;
+ }
+ } else {
+ err = mdiobus_register(new_bus);
+ if (err != 0) {
+ pr_err("%s: Cannot register as MDIO bus\n", new_bus->name);
+ goto bus_register_fail;
+ }
}
- if (priv->plat->phy_node)
+ if (priv->plat->phy_node) {
+ pr_err("%s: Skipping PHY probing...\n", ndev->name);
goto bus_register_done;
+ }
found = 0;
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {