summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/phy/marvell.c73
1 files changed, 71 insertions, 2 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index fb4d4028f674..c2dcf02df202 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1224,6 +1224,75 @@ error:
1224 phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_COPPER); 1224 phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_COPPER);
1225 return err; 1225 return err;
1226} 1226}
1227
1228/* marvell_suspend
1229 *
1230 * Some Marvell's phys have two modes: fiber and copper.
1231 * Both need to be suspended
1232 */
1233static int marvell_suspend(struct phy_device *phydev)
1234{
1235 int err;
1236
1237 /* Suspend the fiber mode first */
1238 if (!(phydev->supported & SUPPORTED_FIBRE)) {
1239 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_FIBER);
1240 if (err < 0)
1241 goto error;
1242
1243 /* With the page set, use the generic suspend */
1244 err = genphy_suspend(phydev);
1245 if (err < 0)
1246 goto error;
1247
1248 /* Then, the copper link */
1249 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_COPPER);
1250 if (err < 0)
1251 goto error;
1252 }
1253
1254 /* With the page set, use the generic suspend */
1255 return genphy_suspend(phydev);
1256
1257error:
1258 phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_COPPER);
1259 return err;
1260}
1261
1262/* marvell_resume
1263 *
1264 * Some Marvell's phys have two modes: fiber and copper.
1265 * Both need to be resumed
1266 */
1267static int marvell_resume(struct phy_device *phydev)
1268{
1269 int err;
1270
1271 /* Resume the fiber mode first */
1272 if (!(phydev->supported & SUPPORTED_FIBRE)) {
1273 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_FIBER);
1274 if (err < 0)
1275 goto error;
1276
1277 /* With the page set, use the generic resume */
1278 err = genphy_resume(phydev);
1279 if (err < 0)
1280 goto error;
1281
1282 /* Then, the copper link */
1283 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_COPPER);
1284 if (err < 0)
1285 goto error;
1286 }
1287
1288 /* With the page set, use the generic resume */
1289 return genphy_resume(phydev);
1290
1291error:
1292 phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_COPPER);
1293 return err;
1294}
1295
1227static int marvell_aneg_done(struct phy_device *phydev) 1296static int marvell_aneg_done(struct phy_device *phydev)
1228{ 1297{
1229 int retval = phy_read(phydev, MII_M1011_PHY_STATUS); 1298 int retval = phy_read(phydev, MII_M1011_PHY_STATUS);
@@ -1611,8 +1680,8 @@ static struct phy_driver marvell_drivers[] = {
1611 .ack_interrupt = &marvell_ack_interrupt, 1680 .ack_interrupt = &marvell_ack_interrupt,
1612 .config_intr = &marvell_config_intr, 1681 .config_intr = &marvell_config_intr,
1613 .did_interrupt = &m88e1121_did_interrupt, 1682 .did_interrupt = &m88e1121_did_interrupt,
1614 .resume = &genphy_resume, 1683 .resume = &marvell_resume,
1615 .suspend = &genphy_suspend, 1684 .suspend = &marvell_suspend,
1616 .get_sset_count = marvell_get_sset_count, 1685 .get_sset_count = marvell_get_sset_count,
1617 .get_strings = marvell_get_strings, 1686 .get_strings = marvell_get_strings,
1618 .get_stats = marvell_get_stats, 1687 .get_stats = marvell_get_stats,