aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2013-03-05 19:41:32 -0500
committerDavid S. Miller <davem@davemloft.net>2013-03-06 15:40:53 -0500
commit09e7fae97702f9fcc875b56f3b687e88408b32e5 (patch)
tree2caec264a00dae91f686d86b7637b6234837d4d1
parent7a6742003f3c8650c4d3f9edcae1cf8a5cdda276 (diff)
r6040: check MDIO register busy waiting result
We are currently busy waiting for MDIO registers to complete their operation but we did not propagate the result back to the caller. Update r6040_phy_{read,write} to report the busy waiting result accordingly. Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/rdc/r6040.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index 5b4103db70f5..d5622ab5a1da 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -224,11 +224,14 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
224 break; 224 break;
225 } 225 }
226 226
227 if (limit < 0)
228 return -ETIMEDOUT;
229
227 return ioread16(ioaddr + MMRD); 230 return ioread16(ioaddr + MMRD);
228} 231}
229 232
230/* Write a word data from PHY Chip */ 233/* Write a word data from PHY Chip */
231static void r6040_phy_write(void __iomem *ioaddr, 234static int r6040_phy_write(void __iomem *ioaddr,
232 int phy_addr, int reg, u16 val) 235 int phy_addr, int reg, u16 val)
233{ 236{
234 int limit = MAC_DEF_TIMEOUT; 237 int limit = MAC_DEF_TIMEOUT;
@@ -243,6 +246,8 @@ static void r6040_phy_write(void __iomem *ioaddr,
243 if (!(cmd & MDIO_WRITE)) 246 if (!(cmd & MDIO_WRITE))
244 break; 247 break;
245 } 248 }
249
250 return (limit < 0) ? -ETIMEDOUT : 0;
246} 251}
247 252
248static int r6040_mdiobus_read(struct mii_bus *bus, int phy_addr, int reg) 253static int r6040_mdiobus_read(struct mii_bus *bus, int phy_addr, int reg)
@@ -261,9 +266,7 @@ static int r6040_mdiobus_write(struct mii_bus *bus, int phy_addr,
261 struct r6040_private *lp = netdev_priv(dev); 266 struct r6040_private *lp = netdev_priv(dev);
262 void __iomem *ioaddr = lp->base; 267 void __iomem *ioaddr = lp->base;
263 268
264 r6040_phy_write(ioaddr, phy_addr, reg, value); 269 return r6040_phy_write(ioaddr, phy_addr, reg, value);
265
266 return 0;
267} 270}
268 271
269static int r6040_mdiobus_reset(struct mii_bus *bus) 272static int r6040_mdiobus_reset(struct mii_bus *bus)