diff options
author | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2019-06-12 20:52:04 +0200 |
---|---|---|
committer | Christoph Muellner <christoph.muellner@theobroma-systems.com> | 2019-10-02 00:39:46 +0200 |
commit | 6cdeb09e8576c0cd008b8f9163219d4555a09b22 (patch) | |
tree | fb39432be012d75bb34ca5a1ffaca794b0d0b7b3 | |
parent | fddf4072a68babc0c1ff283004f777f936b8e640 (diff) |
net: stmmac: Backport mdio logic from mainline.
* net: stmmac: Don't search for phys if mdio node is defined.
* Invoke of_mdiobus_register() instead of mdiobus_register() to pass DT
to phy driver.
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 90d95b3654f5..adefc03a02c8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -29,6 +29,7 @@ #include <linux/slab.h> #include <linux/of.h> #include <linux/of_gpio.h> +#include <linux/of_mdio.h> #include <asm/io.h> @@ -199,6 +200,7 @@ int stmmac_mdio_register(struct net_device *ndev) int *irqlist; struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; + struct device_node *mdio_node = priv->plat->mdio_node; int addr, found; if (!mdio_bus_data) @@ -231,12 +233,15 @@ 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 = mdiobus_register(new_bus); + 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 (priv->plat->phy_node) + goto bus_register_done; + found = 0; for (addr = 0; addr < PHY_MAX_ADDR; addr++) { struct phy_device *phydev = new_bus->phy_map[addr]; @@ -291,6 +296,7 @@ int stmmac_mdio_register(struct net_device *ndev) return -ENODEV; } +bus_register_done: priv->mii = new_bus; return 0; |