Staging: phison: depends on ATA_BMDMA
[safe/jmp/linux-2.6] / drivers / net / sky2.c
index bf9c05b..2111c7b 100644 (file)
@@ -53,7 +53,7 @@
 #include "sky2.h"
 
 #define DRV_NAME               "sky2"
-#define DRV_VERSION            "1.27"
+#define DRV_VERSION            "1.28"
 
 /*
  * The Yukon II chipset takes 64 bit command blocks (called list elements)
@@ -2275,8 +2275,8 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
        sky2_write32(hw, B0_IMSK, 0);
 
        dev->trans_start = jiffies;     /* prevent tx timeout */
-       netif_stop_queue(dev);
        napi_disable(&hw->napi);
+       netif_tx_disable(dev);
 
        synchronize_irq(hw->pdev->irq);
 
@@ -3312,18 +3312,14 @@ static int sky2_reattach(struct net_device *dev)
        return err;
 }
 
-static void sky2_restart(struct work_struct *work)
+static void sky2_all_down(struct sky2_hw *hw)
 {
-       struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
-       u32 imask;
        int i;
 
-       rtnl_lock();
-
-       napi_disable(&hw->napi);
-       synchronize_irq(hw->pdev->irq);
-       imask = sky2_read32(hw, B0_IMSK);
+       sky2_read32(hw, B0_IMSK);
        sky2_write32(hw, B0_IMSK, 0);
+       synchronize_irq(hw->pdev->irq);
+       napi_disable(&hw->napi);
 
        for (i = 0; i < hw->ports; i++) {
                struct net_device *dev = hw->dev[i];
@@ -3336,8 +3332,12 @@ static void sky2_restart(struct work_struct *work)
                netif_tx_disable(dev);
                sky2_hw_down(sky2);
        }
+}
 
-       sky2_reset(hw);
+static void sky2_all_up(struct sky2_hw *hw)
+{
+       u32 imask = Y2_IS_BASE;
+       int i;
 
        for (i = 0; i < hw->ports; i++) {
                struct net_device *dev = hw->dev[i];
@@ -3347,6 +3347,8 @@ static void sky2_restart(struct work_struct *work)
                        continue;
 
                sky2_hw_up(sky2);
+               sky2_set_multicast(dev);
+               imask |= portirq_msk[i];
                netif_wake_queue(dev);
        }
 
@@ -3355,6 +3357,17 @@ static void sky2_restart(struct work_struct *work)
 
        sky2_read32(hw, B0_Y2_SP_LISR);
        napi_enable(&hw->napi);
+}
+
+static void sky2_restart(struct work_struct *work)
+{
+       struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
+
+       rtnl_lock();
+
+       sky2_all_down(hw);
+       sky2_reset(hw);
+       sky2_all_up(hw);
 
        rtnl_unlock();
 }
@@ -4913,12 +4926,12 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
        cancel_work_sync(&hw->restart_work);
 
        rtnl_lock();
+
+       sky2_all_down(hw);
        for (i = 0; i < hw->ports; i++) {
                struct net_device *dev = hw->dev[i];
                struct sky2_port *sky2 = netdev_priv(dev);
 
-               sky2_detach(dev);
-
                if (sky2->wol)
                        sky2_wol_init(sky2);
 
@@ -4927,8 +4940,6 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
 
        device_set_wakeup_enable(&pdev->dev, wol != 0);
 
-       sky2_write32(hw, B0_IMSK, 0);
-       napi_disable(&hw->napi);
        sky2_power_aux(hw);
        rtnl_unlock();
 
@@ -4943,12 +4954,11 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
 static int sky2_resume(struct pci_dev *pdev)
 {
        struct sky2_hw *hw = pci_get_drvdata(pdev);
-       int i, err;
+       int err;
 
        if (!hw)
                return 0;
 
-       rtnl_lock();
        err = pci_set_power_state(pdev, PCI_D0);
        if (err)
                goto out;
@@ -4966,20 +4976,13 @@ static int sky2_resume(struct pci_dev *pdev)
                goto out;
        }
 
+       rtnl_lock();
        sky2_reset(hw);
-       sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
-       napi_enable(&hw->napi);
-
-       for (i = 0; i < hw->ports; i++) {
-               err = sky2_reattach(hw->dev[i]);
-               if (err)
-                       goto out;
-       }
+       sky2_all_up(hw);
        rtnl_unlock();
 
        return 0;
 out:
-       rtnl_unlock();
 
        dev_err(&pdev->dev, "resume failed (%d)\n", err);
        pci_disable_device(pdev);