Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 85603
b: refs/heads/master
c: 321f69a
h: refs/heads/master
i:
  85601: 671844d
  85599: c93adf3
v: v3
  • Loading branch information
Ben Dooks authored and Jeff Garzik committed Feb 11, 2008
1 parent 936e1b3 commit 7ea4323
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 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: 89c8b0e6cd3859a6445398c5aa94ebd21d0e64ce
refs/heads/master: 321f69a4c3bb807abdf1fd6329403ec0449a3d78
23 changes: 21 additions & 2 deletions trunk/drivers/net/dm9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ typedef struct board_info {
u8 io_mode; /* 0:word, 2:byte */
u8 phy_addr;
unsigned int flags;
unsigned int in_suspend :1;

int debug_level;

Expand Down Expand Up @@ -1107,6 +1108,18 @@ dm9000_hash_table(struct net_device *dev)
}


/*
* Sleep, either by using msleep() or if we are suspending, then
* use mdelay() to sleep.
*/
static void dm9000_msleep(board_info_t *db, unsigned int ms)
{
if (db->in_suspend)
mdelay(ms);
else
msleep(ms);
}

/*
* Read a word from phyxcer
*/
Expand All @@ -1131,7 +1144,7 @@ dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
writeb(reg_save, db->io_addr);
spin_unlock_irqrestore(&db->lock,flags);

udelay(100); /* Wait read complete */
dm9000_msleep(db, 1); /* Wait read complete */

spin_lock_irqsave(&db->lock,flags);
reg_save = readb(db->io_addr);
Expand Down Expand Up @@ -1175,7 +1188,7 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
writeb(reg_save, db->io_addr);
spin_unlock_irqrestore(&db->lock,flags);

udelay(500); /* Wait write complete */
dm9000_msleep(db, 1); /* Wait write complete */

spin_lock_irqsave(&db->lock,flags);
reg_save = readb(db->io_addr);
Expand All @@ -1192,8 +1205,12 @@ static int
dm9000_drv_suspend(struct platform_device *dev, pm_message_t state)
{
struct net_device *ndev = platform_get_drvdata(dev);
board_info_t *db;

if (ndev) {
db = (board_info_t *) ndev->priv;
db->in_suspend = 1;

if (netif_running(ndev)) {
netif_device_detach(ndev);
dm9000_shutdown(ndev);
Expand All @@ -1216,6 +1233,8 @@ dm9000_drv_resume(struct platform_device *dev)

netif_device_attach(ndev);
}

db->in_suspend = 0;
}
return 0;
}
Expand Down

0 comments on commit 7ea4323

Please sign in to comment.