Browse Source

net: phy: bcm7xxx: re-advertise all supported modes out of suspend

The BCM7xxx internal Gigabit PHYs on 28nm process platforms come out
reset without any half-duplex or "hub" compatible advertised modes,
which was causing auto-negotiation issues coming out of S3
suspend/resume, we just could not establish a link with a half-duplex
only link partner.

Make sure that the resume function properly re-configures the PHY device
to advertise all supported modes.

Fixes: b560a58c45c6 ("net: phy: add Broadcom BCM7xxx internal PHY driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@greenl8ke.davemloft.net>
Florian Fainelli 11 years ago
parent
commit
4fd14e0b4a
1 changed files with 20 additions and 3 deletions
  1. 20 3
      drivers/net/phy/bcm7xxx.c

+ 20 - 3
drivers/net/phy/bcm7xxx.c

@@ -157,6 +157,23 @@ static int bcm7xxx_28nm_config_init(struct phy_device *phydev)
 	return bcm7xxx_28nm_afe_config_init(phydev);
 	return bcm7xxx_28nm_afe_config_init(phydev);
 }
 }
 
 
+static int bcm7xxx_28nm_resume(struct phy_device *phydev)
+{
+	int ret;
+
+	/* Re-apply workarounds coming out suspend/resume */
+	ret = bcm7xxx_28nm_config_init(phydev);
+	if (ret)
+		return ret;
+
+	/* 28nm Gigabit PHYs come out of reset without any half-duplex
+	 * or "hub" compliant advertised mode, fix that. This does not
+	 * cause any problems with the PHY library since genphy_config_aneg()
+	 * gracefully handles auto-negotiated and forced modes.
+	 */
+	return genphy_config_aneg(phydev);
+}
+
 static int phy_set_clr_bits(struct phy_device *dev, int location,
 static int phy_set_clr_bits(struct phy_device *dev, int location,
 					int set_mask, int clr_mask)
 					int set_mask, int clr_mask)
 {
 {
@@ -258,7 +275,7 @@ static struct phy_driver bcm7xxx_driver[] = {
 	.config_aneg	= genphy_config_aneg,
 	.config_aneg	= genphy_config_aneg,
 	.read_status	= genphy_read_status,
 	.read_status	= genphy_read_status,
 	.suspend	= bcm7xxx_suspend,
 	.suspend	= bcm7xxx_suspend,
-	.resume		= bcm7xxx_28nm_afe_config_init,
+	.resume		= bcm7xxx_28nm_resume,
 	.driver		= { .owner = THIS_MODULE },
 	.driver		= { .owner = THIS_MODULE },
 }, {
 }, {
 	.phy_id		= PHY_ID_BCM7439,
 	.phy_id		= PHY_ID_BCM7439,
@@ -271,7 +288,7 @@ static struct phy_driver bcm7xxx_driver[] = {
 	.config_aneg	= genphy_config_aneg,
 	.config_aneg	= genphy_config_aneg,
 	.read_status	= genphy_read_status,
 	.read_status	= genphy_read_status,
 	.suspend	= bcm7xxx_suspend,
 	.suspend	= bcm7xxx_suspend,
-	.resume		= bcm7xxx_28nm_afe_config_init,
+	.resume		= bcm7xxx_28nm_resume,
 	.driver		= { .owner = THIS_MODULE },
 	.driver		= { .owner = THIS_MODULE },
 }, {
 }, {
 	.phy_id		= PHY_ID_BCM7445,
 	.phy_id		= PHY_ID_BCM7445,
@@ -284,7 +301,7 @@ static struct phy_driver bcm7xxx_driver[] = {
 	.config_aneg	= genphy_config_aneg,
 	.config_aneg	= genphy_config_aneg,
 	.read_status	= genphy_read_status,
 	.read_status	= genphy_read_status,
 	.suspend	= bcm7xxx_suspend,
 	.suspend	= bcm7xxx_suspend,
-	.resume		= bcm7xxx_28nm_config_init,
+	.resume		= bcm7xxx_28nm_afe_config_init,
 	.driver		= { .owner = THIS_MODULE },
 	.driver		= { .owner = THIS_MODULE },
 }, {
 }, {
 	.phy_id		= PHY_BCM_OUI_4,
 	.phy_id		= PHY_BCM_OUI_4,