aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorClaudiu Manoil <claudiu.manoil@freescale.com>2014-10-07 03:44:30 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-09 01:40:37 -0400
commite4b081f543030fc0b23d2cd7d1f6e3ac69d7f47f (patch)
tree7c4de805a8d2215297c32255c439f12391181be9 /drivers/net
parentf5bbd262e70ff2355ce4284b0ad9eaf93fb5e374 (diff)
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/freescale/fsl_pq_mdio.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index a422838b4f1d..964c6bf37710 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -104,7 +104,7 @@ static int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
104{ 104{
105 struct fsl_pq_mdio_priv *priv = bus->priv; 105 struct fsl_pq_mdio_priv *priv = bus->priv;
106 struct fsl_pq_mii __iomem *regs = priv->regs; 106 struct fsl_pq_mii __iomem *regs = priv->regs;
107 u32 status; 107 unsigned int timeout;
108 108
109 /* Set the PHY address and the register address we want to write */ 109 /* Set the PHY address and the register address we want to write */
110 iowrite32be((mii_id << 8) | regnum, &regs->miimadd); 110 iowrite32be((mii_id << 8) | regnum, &regs->miimadd);
@@ -113,10 +113,13 @@ static int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
113 iowrite32be(value, &regs->miimcon); 113 iowrite32be(value, &regs->miimcon);
114 114
115 /* Wait for the transaction to finish */ 115 /* Wait for the transaction to finish */
116 status = spin_event_timeout(!(ioread32be(&regs->miimind) & 116 timeout = MII_TIMEOUT;
117 MIIMIND_BUSY), MII_TIMEOUT, 0); 117 while ((ioread32be(&regs->miimind) & MIIMIND_BUSY) && timeout) {
118 cpu_relax();
119 timeout--;
120 }
118 121
119 return status ? 0 : -ETIMEDOUT; 122 return timeout ? 0 : -ETIMEDOUT;
120} 123}
121 124
122/* 125/*
@@ -133,7 +136,7 @@ static int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
133{ 136{
134 struct fsl_pq_mdio_priv *priv = bus->priv; 137 struct fsl_pq_mdio_priv *priv = bus->priv;
135 struct fsl_pq_mii __iomem *regs = priv->regs; 138 struct fsl_pq_mii __iomem *regs = priv->regs;
136 u32 status; 139 unsigned int timeout;
137 u16 value; 140 u16 value;
138 141
139 /* Set the PHY address and the register address we want to read */ 142 /* 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)
144 iowrite32be(MII_READ_COMMAND, &regs->miimcom); 147 iowrite32be(MII_READ_COMMAND, &regs->miimcom);
145 148
146 /* Wait for the transaction to finish, normally less than 100us */ 149 /* Wait for the transaction to finish, normally less than 100us */
147 status = spin_event_timeout(!(ioread32be(&regs->miimind) & 150 timeout = MII_TIMEOUT;
148 (MIIMIND_NOTVALID | MIIMIND_BUSY)), 151 while ((ioread32be(&regs->miimind) &
149 MII_TIMEOUT, 0); 152 (MIIMIND_NOTVALID | MIIMIND_BUSY)) && timeout) {
150 if (!status) 153 cpu_relax();
154 timeout--;
155 }
156
157 if (!timeout)
151 return -ETIMEDOUT; 158 return -ETIMEDOUT;
152 159
153 /* Grab the value of the register from miimstat */ 160 /* Grab the value of the register from miimstat */
@@ -162,7 +169,7 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus)
162{ 169{
163 struct fsl_pq_mdio_priv *priv = bus->priv; 170 struct fsl_pq_mdio_priv *priv = bus->priv;
164 struct fsl_pq_mii __iomem *regs = priv->regs; 171 struct fsl_pq_mii __iomem *regs = priv->regs;
165 u32 status; 172 unsigned int timeout;
166 173
167 mutex_lock(&bus->mdio_lock); 174 mutex_lock(&bus->mdio_lock);
168 175
@@ -173,12 +180,15 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus)
173 iowrite32be(MIIMCFG_INIT_VALUE, &regs->miimcfg); 180 iowrite32be(MIIMCFG_INIT_VALUE, &regs->miimcfg);
174 181
175 /* Wait until the bus is free */ 182 /* Wait until the bus is free */
176 status = spin_event_timeout(!(ioread32be(&regs->miimind) & 183 timeout = MII_TIMEOUT;
177 MIIMIND_BUSY), MII_TIMEOUT, 0); 184 while ((ioread32be(&regs->miimind) & MIIMIND_BUSY) && timeout) {
185 cpu_relax();
186 timeout--;
187 }
178 188
179 mutex_unlock(&bus->mdio_lock); 189 mutex_unlock(&bus->mdio_lock);
180 190
181 if (!status) { 191 if (!timeout) {
182 dev_err(&bus->dev, "timeout waiting for MII bus\n"); 192 dev_err(&bus->dev, "timeout waiting for MII bus\n");
183 return -EBUSY; 193 return -EBUSY;
184 } 194 }