Commit 7a495dde authored by Raju Lakkaraju's avatar Raju Lakkaraju Committed by David S. Miller

net: phy: mxl-gpy: Change gpy_update_interface() function return type

gpy_update_interface() is called from gpy_read_status() which does
return error codes. gpy_read_status() would benefit from returning
-EINVAL, etc.
Signed-off-by: default avatarRaju Lakkaraju <Raju.Lakkaraju@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 12dee519
...@@ -370,14 +370,14 @@ static int gpy_config_aneg(struct phy_device *phydev) ...@@ -370,14 +370,14 @@ static int gpy_config_aneg(struct phy_device *phydev)
VSPEC1_SGMII_CTRL_ANRS, VSPEC1_SGMII_CTRL_ANRS); VSPEC1_SGMII_CTRL_ANRS, VSPEC1_SGMII_CTRL_ANRS);
} }
static void gpy_update_interface(struct phy_device *phydev) static int gpy_update_interface(struct phy_device *phydev)
{ {
int ret; int ret;
/* Interface mode is fixed for USXGMII and integrated PHY */ /* Interface mode is fixed for USXGMII and integrated PHY */
if (phydev->interface == PHY_INTERFACE_MODE_USXGMII || if (phydev->interface == PHY_INTERFACE_MODE_USXGMII ||
phydev->interface == PHY_INTERFACE_MODE_INTERNAL) phydev->interface == PHY_INTERFACE_MODE_INTERNAL)
return; return -EINVAL;
/* Automatically switch SERDES interface between SGMII and 2500-BaseX /* Automatically switch SERDES interface between SGMII and 2500-BaseX
* according to speed. Disable ANEG in 2500-BaseX mode. * according to speed. Disable ANEG in 2500-BaseX mode.
...@@ -387,10 +387,12 @@ static void gpy_update_interface(struct phy_device *phydev) ...@@ -387,10 +387,12 @@ static void gpy_update_interface(struct phy_device *phydev)
phydev->interface = PHY_INTERFACE_MODE_2500BASEX; phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
VSPEC1_SGMII_CTRL_ANEN, 0); VSPEC1_SGMII_CTRL_ANEN, 0);
if (ret < 0) if (ret < 0) {
phydev_err(phydev, phydev_err(phydev,
"Error: Disable of SGMII ANEG failed: %d\n", "Error: Disable of SGMII ANEG failed: %d\n",
ret); ret);
return ret;
}
break; break;
case SPEED_1000: case SPEED_1000:
case SPEED_100: case SPEED_100:
...@@ -404,15 +406,22 @@ static void gpy_update_interface(struct phy_device *phydev) ...@@ -404,15 +406,22 @@ static void gpy_update_interface(struct phy_device *phydev)
ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
VSPEC1_SGMII_ANEN_ANRS, VSPEC1_SGMII_ANEN_ANRS,
VSPEC1_SGMII_ANEN_ANRS); VSPEC1_SGMII_ANEN_ANRS);
if (ret < 0) if (ret < 0) {
phydev_err(phydev, phydev_err(phydev,
"Error: Enable of SGMII ANEG failed: %d\n", "Error: Enable of SGMII ANEG failed: %d\n",
ret); ret);
return ret;
}
break; break;
} }
if (phydev->speed == SPEED_2500 || phydev->speed == SPEED_1000) if (phydev->speed == SPEED_2500 || phydev->speed == SPEED_1000) {
genphy_read_master_slave(phydev); ret = genphy_read_master_slave(phydev);
if (ret < 0)
return ret;
}
return 0;
} }
static int gpy_read_status(struct phy_device *phydev) static int gpy_read_status(struct phy_device *phydev)
...@@ -463,8 +472,11 @@ static int gpy_read_status(struct phy_device *phydev) ...@@ -463,8 +472,11 @@ static int gpy_read_status(struct phy_device *phydev)
break; break;
} }
if (phydev->link) if (phydev->link) {
gpy_update_interface(phydev); ret = gpy_update_interface(phydev);
if (ret < 0)
return ret;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment