Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=799b21d2bddd43145130e509efb92339eabafef9
Commit:     799b21d2bddd43145130e509efb92339eabafef9
Parent:     d08b9bdf0264a8134677373f97641712062c603f
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 26 11:54:50 2007 -0800
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Sat Dec 1 16:32:29 2007 -0500

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 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 82edf44..b680cb0 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -1713,7 +1713,7 @@ static void genesis_stop(struct skge_port *skge)
 {
        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_port *skge)
        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;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to