Patchwork [v2.6.29,01/14] gianfar: Use gfar_halt to stop DMA in gfar_probe

login
register
mail settings
Submitter Andy Fleming
Date Dec. 16, 2008, 11:20 p.m.
Message ID <1229469667-25002-2-git-send-email-afleming@freescale.com>
Download mbox | patch
Permalink /patch/14360/
State Accepted
Delegated to: David Miller
Headers show

Comments

Andy Fleming - Dec. 16, 2008, 11:20 p.m.
gfar_halt does everything we want to do there, including disabling
TX/RX.  It also doesn't unnecessarily enable DMA if it's already
stopped.

Signed-off-by: Andy Fleming <afleming@freescale.com>
---
 drivers/net/gianfar.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)
David Miller - Dec. 16, 2008, 11:25 p.m.
From: Andy Fleming <afleming@freescale.com>
Date: Tue, 16 Dec 2008 17:20:54 -0600

> gfar_halt does everything we want to do there, including disabling
> TX/RX.  It also doesn't unnecessarily enable DMA if it's already
> stopped.
> 
> Signed-off-by: Andy Fleming <afleming@freescale.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 451f6b8..6ceff8d 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -225,19 +225,7 @@  static int gfar_probe(struct platform_device *pdev)
 
 	/* Stop the DMA engine now, in case it was running before */
 	/* (The firmware could have used it, and left it running). */
-	/* To do this, we write Graceful Receive Stop and Graceful */
-	/* Transmit Stop, and then wait until the corresponding bits */
-	/* in IEVENT indicate the stops have completed. */
-	tempval = gfar_read(&priv->regs->dmactrl);
-	tempval &= ~(DMACTRL_GRS | DMACTRL_GTS);
-	gfar_write(&priv->regs->dmactrl, tempval);
-
-	tempval = gfar_read(&priv->regs->dmactrl);
-	tempval |= (DMACTRL_GRS | DMACTRL_GTS);
-	gfar_write(&priv->regs->dmactrl, tempval);
-
-	while (!(gfar_read(&priv->regs->ievent) & (IEVENT_GRSC | IEVENT_GTSC)))
-		cpu_relax();
+	gfar_halt(dev);
 
 	/* Reset MAC layer */
 	gfar_write(&priv->regs->maccfg1, MACCFG1_SOFT_RESET);