stmmac: fix MDIO settings
Initially the phy_bus_name was added to manipulate the driver name but it was recently just used to manage the fixed-link and then to take some decision at run-time. So the patch uses the is_pseudo_fixed_link and removes the phy_bus_name variable not necessary anymore. The driver can manage the mdio registration by using phy-handle, dwmac-mdio and own parameter e.g. snps,phy-addr. This patch takes care about all these possible configurations and fixes the mdio registration in case of there is a real transceiver or a switch (that needs to be managed by using fixed-link). Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Tested-by: Frank Schäfer <fschaefer.oss@googlemail.com> Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> Cc: Dinh Nguyen <dinh.linux@gmail.com> Cc: David S. Miller <davem@davemloft.net> Cc: Phil Reid <preid@electromag.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
d7e944c8dd
commit
a7657f128c
@@ -278,7 +278,6 @@ static void stmmac_eee_ctrl_timer(unsigned long arg)
|
||||
*/
|
||||
bool stmmac_eee_init(struct stmmac_priv *priv)
|
||||
{
|
||||
char *phy_bus_name = priv->plat->phy_bus_name;
|
||||
unsigned long flags;
|
||||
bool ret = false;
|
||||
|
||||
@@ -290,7 +289,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
|
||||
goto out;
|
||||
|
||||
/* Never init EEE in case of a switch is attached */
|
||||
if (phy_bus_name && (!strcmp(phy_bus_name, "fixed")))
|
||||
if (priv->phydev->is_pseudo_fixed_link)
|
||||
goto out;
|
||||
|
||||
/* MAC core supports the EEE feature. */
|
||||
@@ -827,12 +826,8 @@ static int stmmac_init_phy(struct net_device *dev)
|
||||
phydev = of_phy_connect(dev, priv->plat->phy_node,
|
||||
&stmmac_adjust_link, 0, interface);
|
||||
} else {
|
||||
if (priv->plat->phy_bus_name)
|
||||
snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x",
|
||||
priv->plat->phy_bus_name, priv->plat->bus_id);
|
||||
else
|
||||
snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
|
||||
priv->plat->bus_id);
|
||||
snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
|
||||
priv->plat->bus_id);
|
||||
|
||||
snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id,
|
||||
priv->plat->phy_addr);
|
||||
@@ -871,9 +866,8 @@ static int stmmac_init_phy(struct net_device *dev)
|
||||
}
|
||||
|
||||
/* If attached to a switch, there is no reason to poll phy handler */
|
||||
if (priv->plat->phy_bus_name)
|
||||
if (!strcmp(priv->plat->phy_bus_name, "fixed"))
|
||||
phydev->irq = PHY_IGNORE_INTERRUPT;
|
||||
if (phydev->is_pseudo_fixed_link)
|
||||
phydev->irq = PHY_IGNORE_INTERRUPT;
|
||||
|
||||
pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)"
|
||||
" Link = %d\n", dev->name, phydev->phy_id, phydev->link);
|
||||
|
||||
Reference in New Issue
Block a user