mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-20 08:40:47 +00:00
net/fsl_pq_mdio: Replace spin_event_timeout() with arch independent
spin_event_timeout() is PPC dependent, use an arch independent equivalent instead. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f5bbd262e7
commit
e4b081f543
@ -104,7 +104,7 @@ static int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
|
|||||||
{
|
{
|
||||||
struct fsl_pq_mdio_priv *priv = bus->priv;
|
struct fsl_pq_mdio_priv *priv = bus->priv;
|
||||||
struct fsl_pq_mii __iomem *regs = priv->regs;
|
struct fsl_pq_mii __iomem *regs = priv->regs;
|
||||||
u32 status;
|
unsigned int timeout;
|
||||||
|
|
||||||
/* Set the PHY address and the register address we want to write */
|
/* Set the PHY address and the register address we want to write */
|
||||||
iowrite32be((mii_id << 8) | regnum, ®s->miimadd);
|
iowrite32be((mii_id << 8) | regnum, ®s->miimadd);
|
||||||
@ -113,10 +113,13 @@ static int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
|
|||||||
iowrite32be(value, ®s->miimcon);
|
iowrite32be(value, ®s->miimcon);
|
||||||
|
|
||||||
/* Wait for the transaction to finish */
|
/* Wait for the transaction to finish */
|
||||||
status = spin_event_timeout(!(ioread32be(®s->miimind) &
|
timeout = MII_TIMEOUT;
|
||||||
MIIMIND_BUSY), MII_TIMEOUT, 0);
|
while ((ioread32be(®s->miimind) & MIIMIND_BUSY) && timeout) {
|
||||||
|
cpu_relax();
|
||||||
|
timeout--;
|
||||||
|
}
|
||||||
|
|
||||||
return status ? 0 : -ETIMEDOUT;
|
return timeout ? 0 : -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -133,7 +136,7 @@ static int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
|
|||||||
{
|
{
|
||||||
struct fsl_pq_mdio_priv *priv = bus->priv;
|
struct fsl_pq_mdio_priv *priv = bus->priv;
|
||||||
struct fsl_pq_mii __iomem *regs = priv->regs;
|
struct fsl_pq_mii __iomem *regs = priv->regs;
|
||||||
u32 status;
|
unsigned int timeout;
|
||||||
u16 value;
|
u16 value;
|
||||||
|
|
||||||
/* Set the PHY address and the register address we want to read */
|
/* Set the PHY address and the register address we want to read */
|
||||||
@ -144,10 +147,14 @@ static int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
|
|||||||
iowrite32be(MII_READ_COMMAND, ®s->miimcom);
|
iowrite32be(MII_READ_COMMAND, ®s->miimcom);
|
||||||
|
|
||||||
/* Wait for the transaction to finish, normally less than 100us */
|
/* Wait for the transaction to finish, normally less than 100us */
|
||||||
status = spin_event_timeout(!(ioread32be(®s->miimind) &
|
timeout = MII_TIMEOUT;
|
||||||
(MIIMIND_NOTVALID | MIIMIND_BUSY)),
|
while ((ioread32be(®s->miimind) &
|
||||||
MII_TIMEOUT, 0);
|
(MIIMIND_NOTVALID | MIIMIND_BUSY)) && timeout) {
|
||||||
if (!status)
|
cpu_relax();
|
||||||
|
timeout--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!timeout)
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
|
|
||||||
/* Grab the value of the register from miimstat */
|
/* Grab the value of the register from miimstat */
|
||||||
@ -162,7 +169,7 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus)
|
|||||||
{
|
{
|
||||||
struct fsl_pq_mdio_priv *priv = bus->priv;
|
struct fsl_pq_mdio_priv *priv = bus->priv;
|
||||||
struct fsl_pq_mii __iomem *regs = priv->regs;
|
struct fsl_pq_mii __iomem *regs = priv->regs;
|
||||||
u32 status;
|
unsigned int timeout;
|
||||||
|
|
||||||
mutex_lock(&bus->mdio_lock);
|
mutex_lock(&bus->mdio_lock);
|
||||||
|
|
||||||
@ -173,12 +180,15 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus)
|
|||||||
iowrite32be(MIIMCFG_INIT_VALUE, ®s->miimcfg);
|
iowrite32be(MIIMCFG_INIT_VALUE, ®s->miimcfg);
|
||||||
|
|
||||||
/* Wait until the bus is free */
|
/* Wait until the bus is free */
|
||||||
status = spin_event_timeout(!(ioread32be(®s->miimind) &
|
timeout = MII_TIMEOUT;
|
||||||
MIIMIND_BUSY), MII_TIMEOUT, 0);
|
while ((ioread32be(®s->miimind) & MIIMIND_BUSY) && timeout) {
|
||||||
|
cpu_relax();
|
||||||
|
timeout--;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_unlock(&bus->mdio_lock);
|
mutex_unlock(&bus->mdio_lock);
|
||||||
|
|
||||||
if (!status) {
|
if (!timeout) {
|
||||||
dev_err(&bus->dev, "timeout waiting for MII bus\n");
|
dev_err(&bus->dev, "timeout waiting for MII bus\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user