diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-11-26 14:54:50 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-01 16:32:29 -0500 |
commit | 799b21d2bddd43145130e509efb92339eabafef9 (patch) | |
tree | 2a5ea59435d0b723e98d57b9dc01f919ece5b78b | |
parent | d08b9bdf0264a8134677373f97641712062c603f (diff) |
skge: retry on MAC shutdown
Make sure and retry when shutting down the MAC. This code is copied
from sk98lin driver.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/skge.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 82edf44b9e2a..b680cb08e9ce 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -1713,7 +1713,7 @@ static void genesis_stop(struct skge_port *skge) | |||
1713 | { | 1713 | { |
1714 | struct skge_hw *hw = skge->hw; | 1714 | struct skge_hw *hw = skge->hw; |
1715 | int port = skge->port; | 1715 | int port = skge->port; |
1716 | u32 reg; | 1716 | unsigned retries = 1000; |
1717 | 1717 | ||
1718 | genesis_reset(hw, port); | 1718 | genesis_reset(hw, port); |
1719 | 1719 | ||
@@ -1721,20 +1721,17 @@ static void genesis_stop(struct skge_port *skge) | |||
1721 | skge_write16(hw, B3_PA_CTRL, | 1721 | skge_write16(hw, B3_PA_CTRL, |
1722 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); | 1722 | port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); |
1723 | 1723 | ||
1724 | /* | ||
1725 | * If the transfer sticks at the MAC the STOP command will not | ||
1726 | * terminate if we don't flush the XMAC's transmit FIFO ! | ||
1727 | */ | ||
1728 | xm_write32(hw, port, XM_MODE, | ||
1729 | xm_read32(hw, port, XM_MODE)|XM_MD_FTF); | ||
1730 | |||
1731 | |||
1732 | /* Reset the MAC */ | 1724 | /* Reset the MAC */ |
1733 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); | 1725 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); |
1726 | do { | ||
1727 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST); | ||
1728 | if (!(skge_read16(hw, SK_REG(port, TX_MFF_CTRL1)) & MFF_SET_MAC_RST)) | ||
1729 | break; | ||
1730 | } while (--retries > 0); | ||
1734 | 1731 | ||
1735 | /* For external PHYs there must be special handling */ | 1732 | /* For external PHYs there must be special handling */ |
1736 | if (hw->phy_type != SK_PHY_XMAC) { | 1733 | if (hw->phy_type != SK_PHY_XMAC) { |
1737 | reg = skge_read32(hw, B2_GP_IO); | 1734 | u32 reg = skge_read32(hw, B2_GP_IO); |
1738 | if (port == 0) { | 1735 | if (port == 0) { |
1739 | reg |= GP_DIR_0; | 1736 | reg |= GP_DIR_0; |
1740 | reg &= ~GP_IO_0; | 1737 | reg &= ~GP_IO_0; |