From 950d12ef6960c49bf6753a4e7b3da01a0694058e Mon Sep 17 00:00:00 2001
From: nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Sun, 4 Jul 2010 01:31:33 +0000
Subject: ag71xx: fix a memory corruption bug that happens if you flood the
 interface with packets while it's being brought down fixes boot time crashes
 under load reported by matteo

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22054 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'target')

diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
index a57b6d46f..9fd41527d 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
@@ -454,6 +454,12 @@ static void ag71xx_dma_reset(struct ag71xx *ag)
 	ag71xx_wr(ag, AG71XX_REG_RX_CTRL, 0);
 	ag71xx_wr(ag, AG71XX_REG_TX_CTRL, 0);
 
+	/*
+	 * give the hardware some time to really stop all rx/tx activity
+	 * clearing the descriptors too early causes random memory corruption
+	 */
+	mdelay(1);
+
 	/* clear descriptor addresses */
 	ag71xx_wr(ag, AG71XX_REG_TX_DESC, 0);
 	ag71xx_wr(ag, AG71XX_REG_RX_DESC, 0);
-- 
cgit v1.2.3