gianfar: Wait for both RX and TX to stop
authorAndy Fleming <afleming@freescale.com>
Tue, 27 Apr 2010 23:43:31 +0000 (16:43 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Apr 2010 23:43:31 +0000 (16:43 -0700)
When gracefully stopping the controller, the driver was continuing if
*either* RX or TX had stopped.  We need to wait for both, or the
controller could get into an invalid state.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/gianfar.c

index df49af382159907ab6268a17f99c4a041d26b766..4e97ca182997e68f242050e3990deb6339c38a88 100644 (file)
@@ -1511,9 +1511,9 @@ static void gfar_halt_nodisable(struct net_device *dev)
                tempval |= (DMACTRL_GRS | DMACTRL_GTS);
                gfar_write(&regs->dmactrl, tempval);
 
-               while (!(gfar_read(&regs->ievent) &
-                        (IEVENT_GRSC | IEVENT_GTSC)))
-                       cpu_relax();
+               spin_event_timeout(((gfar_read(&regs->ievent) &
+                        (IEVENT_GRSC | IEVENT_GTSC)) ==
+                        (IEVENT_GRSC | IEVENT_GTSC)), -1, 0);
        }
 }