Skip to content

Commit

Permalink
[PATCH] sundance: correct initial and close hardware step.
Browse files Browse the repository at this point in the history
Correct initial and close hardware step.  In some embedded system down and up
IP100A will cause DMA crash.  We add some for safe down and up IP100A.

Signed-off-by: Jesse Huang <jesse@icplus.com.tw>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Jesse Huang authored and Jeff Garzik committed Dec 2, 2006
1 parent 6b65552 commit acd70c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/sundance.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ static int netdev_open(struct net_device *dev)
{
struct netdev_private *np = netdev_priv(dev);
void __iomem *ioaddr = np->base;
unsigned long flags;
int i;

/* Do we need to reset the chip??? */
Expand Down Expand Up @@ -832,6 +833,10 @@ static int netdev_open(struct net_device *dev)
iowrite8(0x01, ioaddr + DebugCtrl1);
netif_start_queue(dev);

spin_lock_irqsave(&np->lock, flags);
reset_tx(dev);
spin_unlock_irqrestore(&np->lock, flags);

iowrite16 (StatsEnable | RxEnable | TxEnable, ioaddr + MACCtrl1);

if (netif_msg_ifup(np))
Expand Down Expand Up @@ -1651,6 +1656,9 @@ static int netdev_close(struct net_device *dev)
/* Disable interrupts by clearing the interrupt mask. */
iowrite16(0x0000, ioaddr + IntrEnable);

/* Disable Rx and Tx DMA for safely release resource */
iowrite32(0x500, ioaddr + DMACtrl);

/* Stop the chip's Tx and Rx processes. */
iowrite16(TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl1);

Expand Down

0 comments on commit acd70c2

Please sign in to comment.