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-09-27 20:57:22 +0200
commit6903a6d6c2ee1a591be70ffd8b8b582d9d4e3473 (patch)
tree4ad1dd58af88b8363a95e7fda3d0db8fefb0d0c6
parent1e4a5ad6d80ab2eb9b1d81500e8234fc9dc3085d (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++) {