Thread (10 messages) 10 messages, 2 authors, 2007-12-01
STALE6759d

[PATCH 3/6] skge: retry on MAC shutdown

From: Stephen Hemminger <hidden>
Date: 2007-11-26 20:04:36

Make sure and retry when shutting down the MAC. This code is copied
from sk98lin driver.

Signed-off-by: Stephen Hemminger <redacted>

--- a/drivers/net/skge.c	2007-11-21 14:40:58.000000000 -0800
+++ b/drivers/net/skge.c	2007-11-21 14:44:02.000000000 -0800
@@ -1713,7 +1713,7 @@ static void genesis_stop(struct skge_por
 {
 	struct skge_hw *hw = skge->hw;
 	int port = skge->port;
-	u32 reg;
+	unsigned retries = 1000;
 
 	genesis_reset(hw, port);
 
@@ -1721,20 +1721,17 @@ static void genesis_stop(struct skge_por
 	skge_write16(hw, B3_PA_CTRL,
 		     port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2);
 
-	/*
-	 * If the transfer sticks at the MAC the STOP command will not
-	 * terminate if we don't flush the XMAC's transmit FIFO !
-	 */
-	xm_write32(hw, port, XM_MODE,
-			xm_read32(hw, port, XM_MODE)|XM_MD_FTF);
-
-
 	/* Reset the MAC */
-	skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
+	skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
+	do {
+		skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
+		if (!(skge_read16(hw, SK_REG(port, TX_MFF_CTRL1)) & MFF_SET_MAC_RST))
+			break;
+	} while (--retries > 0);
 
 	/* For external PHYs there must be special handling */
 	if (hw->phy_type != SK_PHY_XMAC) {
-		reg = skge_read32(hw, B2_GP_IO);
+		u32 reg = skge_read32(hw, B2_GP_IO);
 		if (port == 0) {
 			reg |= GP_DIR_0;
 			reg &= ~GP_IO_0;
-- 
Stephen Hemminger <shemminger@linux-foundation.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help