diff options
| -rw-r--r-- | drivers/net/ethernet/smsc/smsc911x.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index c3bf17f89b05..77ed74561e5f 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
| @@ -1342,6 +1342,42 @@ static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata) | |||
| 1342 | spin_unlock(&pdata->mac_lock); | 1342 | spin_unlock(&pdata->mac_lock); |
| 1343 | } | 1343 | } |
| 1344 | 1344 | ||
| 1345 | static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata) | ||
| 1346 | { | ||
| 1347 | int rc = 0; | ||
| 1348 | |||
| 1349 | if (!pdata->phy_dev) | ||
| 1350 | return rc; | ||
| 1351 | |||
| 1352 | /* If the internal PHY is in General Power-Down mode, all, except the | ||
| 1353 | * management interface, is powered-down and stays in that condition as | ||
| 1354 | * long as Phy register bit 0.11 is HIGH. | ||
| 1355 | * | ||
| 1356 | * In that case, clear the bit 0.11, so the PHY powers up and we can | ||
| 1357 | * access to the phy registers. | ||
| 1358 | */ | ||
| 1359 | rc = phy_read(pdata->phy_dev, MII_BMCR); | ||
| 1360 | if (rc < 0) { | ||
| 1361 | SMSC_WARN(pdata, drv, "Failed reading PHY control reg"); | ||
| 1362 | return rc; | ||
| 1363 | } | ||
| 1364 | |||
| 1365 | /* If the PHY general power-down bit is not set is not necessary to | ||
| 1366 | * disable the general power down-mode. | ||
| 1367 | */ | ||
| 1368 | if (rc & BMCR_PDOWN) { | ||
| 1369 | rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN); | ||
| 1370 | if (rc < 0) { | ||
| 1371 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); | ||
| 1372 | return rc; | ||
| 1373 | } | ||
| 1374 | |||
| 1375 | usleep_range(1000, 1500); | ||
| 1376 | } | ||
| 1377 | |||
| 1378 | return 0; | ||
| 1379 | } | ||
| 1380 | |||
| 1345 | static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) | 1381 | static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) |
| 1346 | { | 1382 | { |
| 1347 | int rc = 0; | 1383 | int rc = 0; |
| @@ -1408,6 +1444,16 @@ static int smsc911x_soft_reset(struct smsc911x_data *pdata) | |||
| 1408 | int ret; | 1444 | int ret; |
| 1409 | 1445 | ||
| 1410 | /* | 1446 | /* |
| 1447 | * Make sure to power-up the PHY chip before doing a reset, otherwise | ||
| 1448 | * the reset fails. | ||
| 1449 | */ | ||
| 1450 | ret = smsc911x_phy_general_power_up(pdata); | ||
| 1451 | if (ret) { | ||
| 1452 | SMSC_WARN(pdata, drv, "Failed to power-up the PHY chip"); | ||
| 1453 | return ret; | ||
| 1454 | } | ||
| 1455 | |||
| 1456 | /* | ||
| 1411 | * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that | 1457 | * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that |
| 1412 | * are initialized in a Energy Detect Power-Down mode that prevents | 1458 | * are initialized in a Energy Detect Power-Down mode that prevents |
| 1413 | * the MAC chip to be software reseted. So we have to wakeup the PHY | 1459 | * the MAC chip to be software reseted. So we have to wakeup the PHY |
