diff options
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index bdfe51fc3a65..0302483de240 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -230,7 +230,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, | |||
230 | for (i = 1; | 230 | for (i = 1; |
231 | i < num_ids && c45_ids->devices_in_package == 0; | 231 | i < num_ids && c45_ids->devices_in_package == 0; |
232 | i++) { | 232 | i++) { |
233 | reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2; | 233 | retry: reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2; |
234 | phy_reg = mdiobus_read(bus, addr, reg_addr); | 234 | phy_reg = mdiobus_read(bus, addr, reg_addr); |
235 | if (phy_reg < 0) | 235 | if (phy_reg < 0) |
236 | return -EIO; | 236 | return -EIO; |
@@ -242,12 +242,20 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, | |||
242 | return -EIO; | 242 | return -EIO; |
243 | c45_ids->devices_in_package |= (phy_reg & 0xffff); | 243 | c45_ids->devices_in_package |= (phy_reg & 0xffff); |
244 | 244 | ||
245 | /* If mostly Fs, there is no device there, | ||
246 | * let's get out of here. | ||
247 | */ | ||
248 | if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) { | 245 | if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) { |
249 | *phy_id = 0xffffffff; | 246 | if (i) { |
250 | return 0; | 247 | /* If mostly Fs, there is no device there, |
248 | * then let's continue to probe more, as some | ||
249 | * 10G PHYs have zero Devices In package, | ||
250 | * e.g. Cortina CS4315/CS4340 PHY. | ||
251 | */ | ||
252 | i = 0; | ||
253 | goto retry; | ||
254 | } else { | ||
255 | /* no device there, let's get out of here */ | ||
256 | *phy_id = 0xffffffff; | ||
257 | return 0; | ||
258 | } | ||
251 | } | 259 | } |
252 | } | 260 | } |
253 | 261 | ||
@@ -796,10 +804,11 @@ static int genphy_config_advert(struct phy_device *phydev) | |||
796 | if (phydev->supported & (SUPPORTED_1000baseT_Half | | 804 | if (phydev->supported & (SUPPORTED_1000baseT_Half | |
797 | SUPPORTED_1000baseT_Full)) { | 805 | SUPPORTED_1000baseT_Full)) { |
798 | adv |= ethtool_adv_to_mii_ctrl1000_t(advertise); | 806 | adv |= ethtool_adv_to_mii_ctrl1000_t(advertise); |
799 | if (adv != oldadv) | ||
800 | changed = 1; | ||
801 | } | 807 | } |
802 | 808 | ||
809 | if (adv != oldadv) | ||
810 | changed = 1; | ||
811 | |||
803 | err = phy_write(phydev, MII_CTRL1000, adv); | 812 | err = phy_write(phydev, MII_CTRL1000, adv); |
804 | if (err < 0) | 813 | if (err < 0) |
805 | return err; | 814 | return err; |