phy: fixed_phy: Set supported speed in phydev
authorAndrew Lunn <andrew@lunn.ch>
Mon, 31 Aug 2015 13:56:48 +0000 (15:56 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Aug 2015 21:48:02 +0000 (14:48 -0700)
Set the supported field of the phydev to indicate the speed features
of the phy. If the phy is never attached to a netdev, but used in an
adjust_link() function, the speed will be incorrectly evaluated to
10/half rather than the correct speed/duplex.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/fixed_phy.c

index ce46428ff21fa5b47288984e874d966c94d822d8..2f9457f05a2e45130f16255bc80e09f230549fbd 100644 (file)
@@ -305,6 +305,18 @@ struct phy_device *fixed_phy_register(unsigned int irq,
        phy->dev.of_node = np;
        phy->is_pseudo_fixed_link = true;
 
+       switch (status->speed) {
+       case SPEED_1000:
+               phy->supported = PHY_1000BT_FEATURES;
+               break;
+       case SPEED_100:
+               phy->supported = PHY_100BT_FEATURES;
+               break;
+       case SPEED_10:
+       default:
+               phy->supported = PHY_10BT_FEATURES;
+       }
+
        ret = phy_device_register(phy);
        if (ret) {
                phy_device_free(phy);