Skip to content

Commit

Permalink
net/fsl: Replace spin_event_timeout() with arch independent in xgmac_…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Shaohui Xie authored and David S. Miller committed Jan 26, 2015
1 parent ca43e58 commit 22f6bba
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions drivers/net/ethernet/freescale/xgmac_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ struct tgec_mdio_controller {
static int xgmac_wait_until_free(struct device *dev,
struct tgec_mdio_controller __iomem *regs)
{
uint32_t status;
unsigned int timeout;

/* Wait till the bus is free */
status = spin_event_timeout(
!((ioread32be(&regs->mdio_stat)) & MDIO_STAT_BSY), TIMEOUT, 0);
if (!status) {
timeout = TIMEOUT;
while ((ioread32be(&regs->mdio_stat) & MDIO_STAT_BSY) && timeout) {
cpu_relax();
timeout--;
}

if (!timeout) {
dev_err(dev, "timeout waiting for bus to be free\n");
return -ETIMEDOUT;
}
Expand All @@ -71,12 +75,16 @@ static int xgmac_wait_until_free(struct device *dev,
static int xgmac_wait_until_done(struct device *dev,
struct tgec_mdio_controller __iomem *regs)
{
uint32_t status;
unsigned int timeout;

/* Wait till the MDIO write is complete */
status = spin_event_timeout(
!((ioread32be(&regs->mdio_data)) & MDIO_DATA_BSY), TIMEOUT, 0);
if (!status) {
timeout = TIMEOUT;
while ((ioread32be(&regs->mdio_data) & MDIO_DATA_BSY) && timeout) {
cpu_relax();
timeout--;
}

if (!timeout) {
dev_err(dev, "timeout waiting for operation to complete\n");
return -ETIMEDOUT;
}
Expand Down

0 comments on commit 22f6bba

Please sign in to comment.