]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: stmmac: Make MDIO bus reset optional
authorThierry Reding <treding@nvidia.com>
Fri, 26 Jul 2019 10:27:40 +0000 (12:27 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 27 Jul 2019 20:52:26 +0000 (13:52 -0700)
The Tegra EQOS driver already resets the MDIO bus at probe time via the
reset GPIO specified in the phy-reset-gpios device tree property. There
is no need to reset the bus again later on.

This avoids the need to query the device tree for the snps,reset GPIO,
which is not part of the Tegra EQOS device tree bindings. This quiesces
an error message from the generic bus reset code if it doesn't find the
snps,reset related delays.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
include/linux/stmmac.h

index 3a14cdd01f5fe6422d56d42680fa760bc2589060..66933332c68edf1b76dfb303c1ed913830380497 100644 (file)
@@ -333,6 +333,9 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
        usleep_range(2000, 4000);
        gpiod_set_value(eqos->reset, 0);
 
+       /* MDIO bus was already reset just above */
+       data->mdio_bus_data->needs_reset = false;
+
        eqos->rst = devm_reset_control_get(&pdev->dev, "eqos");
        if (IS_ERR(eqos->rst)) {
                err = PTR_ERR(eqos->rst);
index 4304c1abc5d1da1d55f4006f603006355e9b3172..40c42637ad7551ace5e51064b16ab238384cf8cc 100644 (file)
@@ -348,7 +348,9 @@ int stmmac_mdio_register(struct net_device *ndev)
                max_addr = PHY_MAX_ADDR;
        }
 
-       new_bus->reset = &stmmac_mdio_reset;
+       if (mdio_bus_data->needs_reset)
+               new_bus->reset = &stmmac_mdio_reset;
+
        snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s-%x",
                 new_bus->name, priv->plat->bus_id);
        new_bus->priv = ndev;
index 86f9c07a38cf889c0be550e3758e4e2bd8f81592..d5d08e11c35378121b638e0aade35b2a38cee2fe 100644 (file)
@@ -63,6 +63,7 @@ static void common_default_data(struct plat_stmmacenet_data *plat)
        plat->has_gmac = 1;
        plat->force_sf_dma_mode = 1;
 
+       plat->mdio_bus_data->needs_reset = true;
        plat->mdio_bus_data->phy_mask = 0;
 
        /* Set default value for multicast hash bins */
index 73fc2524372e25269a3f4e39987ae65270054ef3..333b09564b885ae2df415d82b0c10192df54d501 100644 (file)
@@ -342,10 +342,16 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
                mdio = true;
        }
 
-       if (mdio)
+       if (mdio) {
                plat->mdio_bus_data =
                        devm_kzalloc(dev, sizeof(struct stmmac_mdio_bus_data),
                                     GFP_KERNEL);
+               if (!plat->mdio_bus_data)
+                       return -ENOMEM;
+
+               plat->mdio_bus_data->needs_reset = true;
+       }
+
        return 0;
 }
 
index 7d06241582dd9837245aa0cb0b8592a8cf5787b5..7b3e354bcd3caa57b9eef4d4edc20c0c5a81fb60 100644 (file)
@@ -81,6 +81,7 @@ struct stmmac_mdio_bus_data {
        unsigned int phy_mask;
        int *irqs;
        int probed_phy_irq;
+       bool needs_reset;
 };
 
 struct stmmac_dma_cfg {