aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Kresin <dev@kresin.me>2018-04-04 18:26:24 +0200
committerPetr Štetiar <ynezz@true.cz>2019-06-20 08:48:19 +0200
commitfb423f6e01ce95523959aa3e428aa2ae7cee27f5 (patch)
tree526f01fa856d4b124d34d82b29283644016b78f7
parentab7f8146fdebe8e67a9154993154fdfe20ef51df (diff)
downloadupstream-fb423f6e01ce95523959aa3e428aa2ae7cee27f5.tar.gz
upstream-fb423f6e01ce95523959aa3e428aa2ae7cee27f5.tar.bz2
upstream-fb423f6e01ce95523959aa3e428aa2ae7cee27f5.zip
ramips: ignore already handled ethernet phys
The whole logic in fe_phy_connect() is based on the asumption that mdio address and switch port id are equal. Albeit it is true for most boards, it doesn't is for all. It isn't yet clear which subtargets/boards require the devicetree less ethernet phy handling. Hence change the code in a way that it doesn't touch ethernet phys which were early attached and are already handled. Signed-off-by: Mathias Kresin <dev@kresin.me>
-rw-r--r--target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c
index a1c115687e..2e2da6021f 100644
--- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c
+++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c
@@ -127,8 +127,14 @@ static int fe_phy_connect(struct fe_priv *priv)
priv->phy_dev = priv->phy->phy[i];
priv->phy_flags = FE_PHY_FLAG_PORT;
}
- } else if (priv->mii_bus && mdiobus_get_phy(priv->mii_bus, i)) {
- phy_init(priv, mdiobus_get_phy(priv->mii_bus, i));
+ } else if (priv->mii_bus) {
+ struct phy_device *phydev;
+
+ phydev = mdiobus_get_phy(priv->mii_bus, i);
+ if (!phydev || phydev->attached_dev)
+ continue;
+
+ phy_init(priv, phydev);
if (!priv->phy_dev) {
priv->phy_dev = mdiobus_get_phy(priv->mii_bus, i);
priv->phy_flags = FE_PHY_FLAG_ATTACH;