mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
net: phy: Handle phy_startup() error codes properly
Propagate error code from genphy_update_link() to phy startup(). Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
ef5e821bd8
commit
b733c278d7
11 changed files with 119 additions and 60 deletions
|
@ -84,11 +84,14 @@ static int bcm54xx_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int bcm54xx_startup(struct phy_device *phydev)
|
||||
{
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
genphy_update_link(phydev);
|
||||
bcm54xx_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return bcm54xx_parse_status(phydev);
|
||||
}
|
||||
|
||||
/* Broadcom BCM5482S */
|
||||
|
@ -139,11 +142,14 @@ static int bcm5482_config(struct phy_device *phydev)
|
|||
|
||||
static int bcm_cygnus_startup(struct phy_device *phydev)
|
||||
{
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
genphy_update_link(phydev);
|
||||
genphy_parse_link(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return genphy_parse_link(phydev);
|
||||
}
|
||||
|
||||
static int bcm_cygnus_config(struct phy_device *phydev)
|
||||
|
@ -239,17 +245,21 @@ static u32 bcm5482_parse_serdes_sr(struct phy_device *phydev)
|
|||
*/
|
||||
static int bcm5482_startup(struct phy_device *phydev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (bcm5482_is_serdes(phydev)) {
|
||||
bcm5482_parse_serdes_sr(phydev);
|
||||
phydev->port = PORT_FIBRE;
|
||||
} else {
|
||||
/* Wait for auto-negotiation to complete or fail */
|
||||
genphy_update_link(phydev);
|
||||
/* Parse BCM54xx copper aux status register */
|
||||
bcm54xx_parse_status(phydev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Wait for auto-negotiation to complete or fail */
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Parse BCM54xx copper aux status register */
|
||||
return bcm54xx_parse_status(phydev);
|
||||
}
|
||||
|
||||
static struct phy_driver BCM5461S_driver = {
|
||||
|
|
|
@ -60,10 +60,13 @@ static int dm9161_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int dm9161_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
dm9161_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return dm9161_parse_status(phydev);
|
||||
}
|
||||
|
||||
static struct phy_driver DM9161_driver = {
|
||||
|
|
|
@ -79,9 +79,13 @@ static int et1011c_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int et1011c_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
et1011c_parse_status(phydev);
|
||||
return 0;
|
||||
int ret;
|
||||
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return et1011c_parse_status(phydev);
|
||||
}
|
||||
|
||||
static struct phy_driver et1011c_driver = {
|
||||
|
|
|
@ -49,10 +49,13 @@ static int lxt971_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int lxt971_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
lxt971_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return lxt971_parse_status(phydev);
|
||||
}
|
||||
|
||||
static struct phy_driver LXT971_driver = {
|
||||
|
|
|
@ -162,10 +162,13 @@ static int m88e1xxx_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int m88e1011s_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
m88e1xxx_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return m88e1xxx_parse_status(phydev);
|
||||
}
|
||||
|
||||
/* Marvell 88E1111S */
|
||||
|
@ -358,13 +361,16 @@ static int m88e1118_config(struct phy_device *phydev)
|
|||
|
||||
static int m88e1118_startup(struct phy_device *phydev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Change Page Number */
|
||||
phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x0000);
|
||||
|
||||
genphy_update_link(phydev);
|
||||
m88e1xxx_parse_status(phydev);
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
return m88e1xxx_parse_status(phydev);
|
||||
}
|
||||
|
||||
/* Marvell 88E1121R */
|
||||
|
@ -421,12 +427,15 @@ static int m88e1145_config(struct phy_device *phydev)
|
|||
|
||||
static int m88e1145_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
int ret;
|
||||
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1145_PHY_LED_CONTROL,
|
||||
MIIM_88E1145_PHY_LED_DIRECT);
|
||||
m88e1xxx_parse_status(phydev);
|
||||
|
||||
return 0;
|
||||
return m88e1xxx_parse_status(phydev);
|
||||
}
|
||||
|
||||
/* Marvell 88E1149S */
|
||||
|
|
|
@ -181,7 +181,12 @@ static struct phy_driver KS8721_driver = {
|
|||
static int ksz90xx_startup(struct phy_device *phydev)
|
||||
{
|
||||
unsigned phy_ctl;
|
||||
genphy_update_link(phydev);
|
||||
int ret;
|
||||
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
phy_ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_KSZ90xx_PHY_CTL);
|
||||
|
||||
if (phy_ctl & MIIM_KSZ90xx_PHYCTL_DUPLEX)
|
||||
|
|
|
@ -93,10 +93,13 @@ static int dp83865_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int dp83865_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
dp83865_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return dp83865_parse_status(phydev);
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,10 +137,13 @@ static int dp83848_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int dp83848_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
dp83848_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return dp83848_parse_status(phydev);
|
||||
}
|
||||
|
||||
static struct phy_driver DP83848_driver = {
|
||||
|
|
|
@ -431,10 +431,13 @@ int genphy_config(struct phy_device *phydev)
|
|||
|
||||
int genphy_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
genphy_parse_link(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return genphy_parse_link(phydev);
|
||||
}
|
||||
|
||||
int genphy_shutdown(struct phy_device *phydev)
|
||||
|
|
|
@ -208,28 +208,38 @@ static int rtl8211f_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int rtl8211x_startup(struct phy_device *phydev)
|
||||
{
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
genphy_update_link(phydev);
|
||||
rtl8211x_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return rtl8211x_parse_status(phydev);
|
||||
}
|
||||
|
||||
static int rtl8211e_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
genphy_parse_link(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return genphy_parse_link(phydev);
|
||||
}
|
||||
|
||||
static int rtl8211f_startup(struct phy_device *phydev)
|
||||
{
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
genphy_update_link(phydev);
|
||||
rtl8211f_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
/* Read the Status (2x to make sure link is right) */
|
||||
|
||||
return rtl8211f_parse_status(phydev);
|
||||
}
|
||||
|
||||
/* Support for RTL8211B PHY */
|
||||
|
|
|
@ -34,9 +34,13 @@ static int smsc_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int smsc_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
smsc_parse_status(phydev);
|
||||
return 0;
|
||||
int ret;
|
||||
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return smsc_parse_status(phydev);
|
||||
}
|
||||
|
||||
static struct phy_driver lan8700_driver = {
|
||||
|
|
|
@ -112,10 +112,12 @@ static int vitesse_parse_status(struct phy_device *phydev)
|
|||
|
||||
static int vitesse_startup(struct phy_device *phydev)
|
||||
{
|
||||
genphy_update_link(phydev);
|
||||
vitesse_parse_status(phydev);
|
||||
int ret;
|
||||
|
||||
return 0;
|
||||
ret = genphy_update_link(phydev);
|
||||
if (ret)
|
||||
return ret;
|
||||
return vitesse_parse_status(phydev);
|
||||
}
|
||||
|
||||
static int cis8204_config(struct phy_device *phydev)
|
||||
|
|
Loading…
Add table
Reference in a new issue