@@ -149,6 +149,11 @@ phy_lookup_setting(int speed, int duplex, const unsigned long *mask,
const struct phy_setting *p, *match = NULL, *last = NULL;
int i;
+ if (!exact && speed == SPEED_UNKNOWN)
+ speed = INT_MAX;
+ if (!exact && duplex == DUPLEX_UNKNOWN)
+ duplex = DUPLEX_FULL;
+
for (i = 0, p = settings; i < ARRAY_SIZE(settings); i++, p++) {
if (p->bit < maxbit && test_bit(p->bit, mask)) {
last = p;
@@ -1785,6 +1785,8 @@ static int phy_probe(struct device *dev)
phydev->supported = phydrv->features;
of_set_phy_supported(phydev);
phydev->advertising = phydev->supported;
+ phydev->speed = SPEED_UNKNOWN;
+ phydev->duplex = DUPLEX_UNKNOWN;
/* Get the EEE modes we want to prohibit. We will ask
* the PHY stop advertising these mode later on
Init speed and duplex to unknown, so phy_lookup_setting() knows that it should select the mode only based on the PHY allowed link modes. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- drivers/net/phy/phy-core.c | 5 +++++ drivers/net/phy/phy_device.c | 2 ++ 2 files changed, 7 insertions(+)