ramips: fix gigabit switch PHY access on MDIO
authorDaniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
Wed, 1 Aug 2018 14:51:47 +0000 (07:51 -0700)
committerJohn Crispin <john@phrozen.org>
Mon, 6 Aug 2018 05:05:37 +0000 (07:05 +0200)
When PHY's are defined on the MDIO bus in the DTS, gigabit support was
being masked out for no apparent reason, pegging all such ports to 10/100.
If gigabit support must be disabled for some reason, there should be a
"max-speed" property in the DTS.

Reported-by: James McKenzie <openwrt@madingley.org>
Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c

index bdfdf7a432c7c9f4850708ee65814858d39d7cc2..a1c115687ec56fb9c4c71347db842f440c824d7a 100644 (file)
@@ -110,7 +110,8 @@ static void phy_init(struct fe_priv *priv, struct phy_device *phy)
        phy->autoneg = AUTONEG_ENABLE;
        phy->speed = 0;
        phy->duplex = 0;
-       phy->supported &= PHY_BASIC_FEATURES;
+       phy->supported &= IS_ENABLED(CONFIG_NET_MEDIATEK_MDIO_MT7620) ?
+                       PHY_GBIT_FEATURES : PHY_BASIC_FEATURES;
        phy->advertising = phy->supported | ADVERTISED_Autoneg;
 
        phy_start_aneg(phy);