Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224520
b: refs/heads/master
c: 8dac428
h: refs/heads/master
v: v3
  • Loading branch information
Jonas Bonn authored and David S. Miller committed Nov 28, 2010
1 parent 5a79edb commit 40cdde2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa98eb0e867c6c16e239545d4deb7ad8f40631b3
refs/heads/master: 8dac428ae9ae54d8e8540ac157d92925dd7ebed8
14 changes: 6 additions & 8 deletions trunk/drivers/net/ethoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,45 +611,43 @@ static int ethoc_poll(struct napi_struct *napi, int budget)

static int ethoc_mdio_read(struct mii_bus *bus, int phy, int reg)
{
unsigned long timeout = jiffies + ETHOC_MII_TIMEOUT;
struct ethoc *priv = bus->priv;
int i;

ethoc_write(priv, MIIADDRESS, MIIADDRESS_ADDR(phy, reg));
ethoc_write(priv, MIICOMMAND, MIICOMMAND_READ);

while (time_before(jiffies, timeout)) {
for (i=0; i < 5; i++) {
u32 status = ethoc_read(priv, MIISTATUS);
if (!(status & MIISTATUS_BUSY)) {
u32 data = ethoc_read(priv, MIIRX_DATA);
/* reset MII command register */
ethoc_write(priv, MIICOMMAND, 0);
return data;
}

schedule();
usleep_range(100,200);
}

return -EBUSY;
}

static int ethoc_mdio_write(struct mii_bus *bus, int phy, int reg, u16 val)
{
unsigned long timeout = jiffies + ETHOC_MII_TIMEOUT;
struct ethoc *priv = bus->priv;
int i;

ethoc_write(priv, MIIADDRESS, MIIADDRESS_ADDR(phy, reg));
ethoc_write(priv, MIITX_DATA, val);
ethoc_write(priv, MIICOMMAND, MIICOMMAND_WRITE);

while (time_before(jiffies, timeout)) {
for (i=0; i < 5; i++) {
u32 stat = ethoc_read(priv, MIISTATUS);
if (!(stat & MIISTATUS_BUSY)) {
/* reset MII command register */
ethoc_write(priv, MIICOMMAND, 0);
return 0;
}

schedule();
usleep_range(100,200);
}

return -EBUSY;
Expand Down

0 comments on commit 40cdde2

Please sign in to comment.