Commit 882119ff authored by Kurt Kanzenbach's avatar Kurt Kanzenbach Committed by David S. Miller

1/2] net: axienet: use readx_poll_timeout() in mdio wait function

On loaded systems with a preemptible kernel the mdio_wait() function may
report an error while everything is working fine:

axienet_mdio_wait_until_ready():
  axienet_ior() -> chip not ready
  --> interrupt here (other work for some time / chip become ready)
  if (time_before_eq(end, jiffies))
    --> false positive error report

Replace the current code with readx_poll_timeout() which take care
of the situation.
Signed-off-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: default avatarBenedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fa2c52be
......@@ -484,6 +484,11 @@ static inline u32 axienet_ior(struct axienet_local *lp, off_t offset)
return in_be32(lp->regs + offset);
}
static inline u32 axinet_ior_read_mcr(struct axienet_local *lp)
{
return axienet_ior(lp, XAE_MDIO_MCR_OFFSET);
}
/**
* axienet_iow - Memory mapped Axi Ethernet register write
* @lp: Pointer to axienet local structure
......
......@@ -11,6 +11,7 @@
#include <linux/of_address.h>
#include <linux/of_mdio.h>
#include <linux/jiffies.h>
#include <linux/iopoll.h>
#include "xilinx_axienet.h"
......@@ -20,16 +21,11 @@
/* Wait till MDIO interface is ready to accept a new transaction.*/
int axienet_mdio_wait_until_ready(struct axienet_local *lp)
{
unsigned long end = jiffies + 2;
while (!(axienet_ior(lp, XAE_MDIO_MCR_OFFSET) &
XAE_MDIO_MCR_READY_MASK)) {
if (time_before_eq(end, jiffies)) {
WARN_ON(1);
return -ETIMEDOUT;
}
udelay(1);
}
return 0;
u32 val;
return readx_poll_timeout(axinet_ior_read_mcr, lp,
val, val & XAE_MDIO_MCR_READY_MASK,
1, 20000);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment