diff options
author | Shaohui Xie <Shaohui.Xie@freescale.com> | 2015-01-21 06:08:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-26 02:36:06 -0500 |
commit | 22f6bba77fc4aa80ffea31f4c1009993f98aa020 (patch) | |
tree | d59836d45cdfe84f1d7596cceed579391a23a91e /drivers/net/ethernet/freescale | |
parent | ca43e58ca2fb9f8d09578e190d664332e0111ed4 (diff) |
net/fsl: Replace spin_event_timeout() with arch independent in xgmac_mdio
spin_event_timeout() is PPC dependent, use an arch independent
equivalent instead.
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale')
-rw-r--r-- | drivers/net/ethernet/freescale/xgmac_mdio.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index ab9a6bfcae77..3a83bc2c613c 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c | |||
@@ -52,12 +52,16 @@ struct tgec_mdio_controller { | |||
52 | static int xgmac_wait_until_free(struct device *dev, | 52 | static int xgmac_wait_until_free(struct device *dev, |
53 | struct tgec_mdio_controller __iomem *regs) | 53 | struct tgec_mdio_controller __iomem *regs) |
54 | { | 54 | { |
55 | uint32_t status; | 55 | unsigned int timeout; |
56 | 56 | ||
57 | /* Wait till the bus is free */ | 57 | /* Wait till the bus is free */ |
58 | status = spin_event_timeout( | 58 | timeout = TIMEOUT; |
59 | !((ioread32be(®s->mdio_stat)) & MDIO_STAT_BSY), TIMEOUT, 0); | 59 | while ((ioread32be(®s->mdio_stat) & MDIO_STAT_BSY) && timeout) { |
60 | if (!status) { | 60 | cpu_relax(); |
61 | timeout--; | ||
62 | } | ||
63 | |||
64 | if (!timeout) { | ||
61 | dev_err(dev, "timeout waiting for bus to be free\n"); | 65 | dev_err(dev, "timeout waiting for bus to be free\n"); |
62 | return -ETIMEDOUT; | 66 | return -ETIMEDOUT; |
63 | } | 67 | } |
@@ -71,12 +75,16 @@ static int xgmac_wait_until_free(struct device *dev, | |||
71 | static int xgmac_wait_until_done(struct device *dev, | 75 | static int xgmac_wait_until_done(struct device *dev, |
72 | struct tgec_mdio_controller __iomem *regs) | 76 | struct tgec_mdio_controller __iomem *regs) |
73 | { | 77 | { |
74 | uint32_t status; | 78 | unsigned int timeout; |
75 | 79 | ||
76 | /* Wait till the MDIO write is complete */ | 80 | /* Wait till the MDIO write is complete */ |
77 | status = spin_event_timeout( | 81 | timeout = TIMEOUT; |
78 | !((ioread32be(®s->mdio_data)) & MDIO_DATA_BSY), TIMEOUT, 0); | 82 | while ((ioread32be(®s->mdio_data) & MDIO_DATA_BSY) && timeout) { |
79 | if (!status) { | 83 | cpu_relax(); |
84 | timeout--; | ||
85 | } | ||
86 | |||
87 | if (!timeout) { | ||
80 | dev_err(dev, "timeout waiting for operation to complete\n"); | 88 | dev_err(dev, "timeout waiting for operation to complete\n"); |
81 | return -ETIMEDOUT; | 89 | return -ETIMEDOUT; |
82 | } | 90 | } |