aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/phy/icplus.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index c81f136ae670..7ee4f5822bb9 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -98,20 +98,24 @@ static int ip175c_config_init(struct phy_device *phydev)
98 98
99static int ip1xx_reset(struct phy_device *phydev) 99static int ip1xx_reset(struct phy_device *phydev)
100{ 100{
101 int err, bmcr; 101 int bmcr;
102 102
103 /* Software Reset PHY */ 103 /* Software Reset PHY */
104 bmcr = phy_read(phydev, MII_BMCR); 104 bmcr = phy_read(phydev, MII_BMCR);
105 if (bmcr < 0)
106 return bmcr;
105 bmcr |= BMCR_RESET; 107 bmcr |= BMCR_RESET;
106 err = phy_write(phydev, MII_BMCR, bmcr); 108 bmcr = phy_write(phydev, MII_BMCR, bmcr);
107 if (err < 0) 109 if (bmcr < 0)
108 return err; 110 return bmcr;
109 111
110 do { 112 do {
111 bmcr = phy_read(phydev, MII_BMCR); 113 bmcr = phy_read(phydev, MII_BMCR);
114 if (bmcr < 0)
115 return bmcr;
112 } while (bmcr & BMCR_RESET); 116 } while (bmcr & BMCR_RESET);
113 117
114 return err; 118 return 0;
115} 119}
116 120
117static int ip1001_config_init(struct phy_device *phydev) 121static int ip1001_config_init(struct phy_device *phydev)
@@ -124,7 +128,10 @@ static int ip1001_config_init(struct phy_device *phydev)
124 128
125 /* Enable Auto Power Saving mode */ 129 /* Enable Auto Power Saving mode */
126 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2); 130 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2);
131 if (c < 0)
132 return c;
127 c |= IP1001_APS_ON; 133 c |= IP1001_APS_ON;
134 c = phy_write(phydev, IP1001_SPEC_CTRL_STATUS_2, c);
128 if (c < 0) 135 if (c < 0)
129 return c; 136 return c;
130 137
@@ -132,11 +139,16 @@ static int ip1001_config_init(struct phy_device *phydev)
132 /* Additional delay (2ns) used to adjust RX clock phase 139 /* Additional delay (2ns) used to adjust RX clock phase
133 * at RGMII interface */ 140 * at RGMII interface */
134 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 141 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
142 if (c < 0)
143 return c;
144
135 c |= IP1001_PHASE_SEL_MASK; 145 c |= IP1001_PHASE_SEL_MASK;
136 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); 146 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c);
147 if (c < 0)
148 return c;
137 } 149 }
138 150
139 return c; 151 return 0;
140} 152}
141 153
142static int ip101a_config_init(struct phy_device *phydev) 154static int ip101a_config_init(struct phy_device *phydev)