]> err.no Git - linux-2.6/blobdiff - drivers/net/sky2.c
Remove unused kernel config option DLCI_COUNT
[linux-2.6] / drivers / net / sky2.c
index 67ecd66f26d6cee6c265fa148df05023eeaaa7f9..bf1abf034d8a3fcf825b8e4ea0c7e7b714c18969 100644 (file)
@@ -10,8 +10,7 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation; either version 2 of the License.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -50,7 +49,7 @@
 #include "sky2.h"
 
 #define DRV_NAME               "sky2"
-#define DRV_VERSION            "1.10"
+#define DRV_VERSION            "1.11.1"
 #define PFX                    DRV_NAME " "
 
 /*
@@ -101,32 +100,32 @@ module_param(idle_timeout, int, 0);
 MODULE_PARM_DESC(idle_timeout, "Watchdog timer for lost interrupts (ms)");
 
 static const struct pci_device_id sky2_id_table[] = {
-       { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
-       { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) },
+       { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */
+       { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */
        { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },    /* DGE-560T */
        { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) },    /* DGE-550SX */
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4343) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4344) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4345) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4346) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4347) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4350) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4351) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4365) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) },
-       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4369) },
+       { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B02) },    /* DGE-560SX */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, /* 88E8021 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, /* 88E8022 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, /* 88E8061 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4343) }, /* 88E8062 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4344) }, /* 88E8021 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4345) }, /* 88E8022 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4346) }, /* 88E8061 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4347) }, /* 88E8062 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4350) }, /* 88E8035 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4351) }, /* 88E8036 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */
        { 0 }
 };
 
@@ -193,76 +192,52 @@ static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
        return v;
 }
 
-static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
-{
-       u16 power_control;
-       int vaux;
-
-       pr_debug("sky2_set_power_state %d\n", state);
-       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
-
-       power_control = sky2_pci_read16(hw, hw->pm_cap + PCI_PM_PMC);
-       vaux = (sky2_read16(hw, B0_CTST) & Y2_VAUX_AVAIL) &&
-               (power_control & PCI_PM_CAP_PME_D3cold);
-
-       power_control = sky2_pci_read16(hw, hw->pm_cap + PCI_PM_CTRL);
-
-       power_control |= PCI_PM_CTRL_PME_STATUS;
-       power_control &= ~(PCI_PM_CTRL_STATE_MASK);
-
-       switch (state) {
-       case PCI_D0:
-               /* switch power to VCC (WA for VAUX problem) */
-               sky2_write8(hw, B0_POWER_CTRL,
-                           PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON);
-
-               /* disable Core Clock Division, */
-               sky2_write32(hw, B2_Y2_CLK_CTRL, Y2_CLK_DIV_DIS);
 
-               if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
-                       /* enable bits are inverted */
-                       sky2_write8(hw, B2_Y2_CLK_GATE,
-                                   Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
-                                   Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
-                                   Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS);
-               else
-                       sky2_write8(hw, B2_Y2_CLK_GATE, 0);
+static void sky2_power_on(struct sky2_hw *hw)
+{
+       /* switch power to VCC (WA for VAUX problem) */
+       sky2_write8(hw, B0_POWER_CTRL,
+                   PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON);
 
-               if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
-                       u32 reg1;
+       /* disable Core Clock Division, */
+       sky2_write32(hw, B2_Y2_CLK_CTRL, Y2_CLK_DIV_DIS);
 
-                       sky2_pci_write32(hw, PCI_DEV_REG3, 0);
-                       reg1 = sky2_pci_read32(hw, PCI_DEV_REG4);
-                       reg1 &= P_ASPM_CONTROL_MSK;
-                       sky2_pci_write32(hw, PCI_DEV_REG4, reg1);
-                       sky2_pci_write32(hw, PCI_DEV_REG5, 0);
-               }
+       if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
+               /* enable bits are inverted */
+               sky2_write8(hw, B2_Y2_CLK_GATE,
+                           Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
+                           Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
+                           Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS);
+       else
+               sky2_write8(hw, B2_Y2_CLK_GATE, 0);
 
-               break;
+       if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
+               u32 reg1;
 
-       case PCI_D3hot:
-       case PCI_D3cold:
-               if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
-                       sky2_write8(hw, B2_Y2_CLK_GATE, 0);
-               else
-                       /* enable bits are inverted */
-                       sky2_write8(hw, B2_Y2_CLK_GATE,
-                                   Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
-                                   Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
-                                   Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS);
-
-               /* switch power to VAUX */
-               if (vaux && state != PCI_D3cold)
-                       sky2_write8(hw, B0_POWER_CTRL,
-                                   (PC_VAUX_ENA | PC_VCC_ENA |
-                                    PC_VAUX_ON | PC_VCC_OFF));
-               break;
-       default:
-               printk(KERN_ERR PFX "Unknown power state %d\n", state);
+               sky2_pci_write32(hw, PCI_DEV_REG3, 0);
+               reg1 = sky2_pci_read32(hw, PCI_DEV_REG4);
+               reg1 &= P_ASPM_CONTROL_MSK;
+               sky2_pci_write32(hw, PCI_DEV_REG4, reg1);
+               sky2_pci_write32(hw, PCI_DEV_REG5, 0);
        }
+}
 
-       sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control);
-       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
+static void sky2_power_aux(struct sky2_hw *hw)
+{
+       if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
+               sky2_write8(hw, B2_Y2_CLK_GATE, 0);
+       else
+               /* enable bits are inverted */
+               sky2_write8(hw, B2_Y2_CLK_GATE,
+                           Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
+                           Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
+                           Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS);
+
+       /* switch power to VAUX */
+       if (sky2_read16(hw, B0_CTST) & Y2_VAUX_AVAIL)
+               sky2_write8(hw, B0_POWER_CTRL,
+                           (PC_VAUX_ENA | PC_VCC_ENA |
+                            PC_VAUX_ON | PC_VCC_OFF));
 }
 
 static void sky2_gmac_reset(struct sky2_hw *hw, unsigned port)
@@ -522,7 +497,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
                /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */
                ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL;
                /* turn off the Rx LED (LED_RX) */
-               ledover |= PHY_M_LED_MO_RX(MO_LED_OFF);
+               ledover &= ~PHY_M_LED_MO_RX;
        }
 
        if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) {
@@ -545,7 +520,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
 
                if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) {
                        /* turn on 100 Mbps LED (LED_LINK100) */
-                       ledover |= PHY_M_LED_MO_100(MO_LED_ON);
+                       ledover |= PHY_M_LED_MO_100;
                }
 
                if (ledover)
@@ -570,8 +545,8 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
        if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1)
                onoff = !onoff;
 
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
        reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
-
        if (onoff)
                /* Turn off phy power saving */
                reg1 &= ~phy_power[port];
@@ -580,6 +555,7 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff)
 
        sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
        sky2_pci_read32(hw, PCI_DEV_REG1);
+       sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
        udelay(100);
 }
 
@@ -677,17 +653,15 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
        /* Flush Rx MAC FIFO on any flow control or error */
        sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
 
-       /* Set threshold to 0xa (64 bytes)
-        *  ASF disabled so no need to do WA dev #4.30
-        */
-       sky2_write16(hw, SK_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF);
+       /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug  */
+       sky2_write16(hw, SK_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF+1);
 
        /* Configure Tx MAC FIFO */
        sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR);
        sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON);
 
        if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
-               sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 512/8);
+               sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8);
                sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8);
                if (hw->dev[port]->mtu > ETH_DATA_LEN) {
                        /* set Tx GMAC FIFO Almost Empty Threshold */
@@ -699,16 +673,15 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
 
 }
 
-/* Assign Ram Buffer allocation.
- * start and end are in units of 4k bytes
- * ram registers are in units of 64bit words
- */
-static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
+/* Assign Ram Buffer allocation to queue */
+static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space)
 {
-       u32 start, end;
+       u32 end;
 
-       start = startk * 4096/8;
-       end = (endk * 4096/8) - 1;
+       /* convert from K bytes to qwords used for hw register */
+       start *= 1024/8;
+       space *= 1024/8;
+       end = start + space - 1;
 
        sky2_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
        sky2_write32(hw, RB_ADDR(q, RB_START), start);
@@ -717,7 +690,6 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u8 startk, u8 endk)
        sky2_write32(hw, RB_ADDR(q, RB_RP), start);
 
        if (q == Q_R1 || q == Q_R2) {
-               u32 space = (endk - startk) * 4096/8;
                u32 tp = space - space/4;
 
                /* On receive queue's set the thresholds
@@ -1067,10 +1039,16 @@ static int sky2_rx_start(struct sky2_port *sky2)
        sky2->rx_put = sky2->rx_next = 0;
        sky2_qset(hw, rxq);
 
-       if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev >= 2) {
-               /* MAC Rx RAM Read is controlled by hardware */
+       /* On PCI express lowering the watermark gives better performance */
+       if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP))
+               sky2_write32(hw, Q_ADDR(rxq, Q_WM), BMU_WM_PEX);
+
+       /* These chips have no ram buffer?
+        * MAC Rx RAM Read is controlled by hardware */
+       if (hw->chip_id == CHIP_ID_YUKON_EC_U &&
+           (hw->chip_rev == CHIP_REV_YU_EC_U_A1
+            || hw->chip_rev == CHIP_REV_YU_EC_U_B0))
                sky2_write32(hw, Q_ADDR(rxq, Q_F), F_M_RX_RAM_DIS);
-       }
 
        sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1);
 
@@ -1146,7 +1124,7 @@ static int sky2_up(struct net_device *dev)
        struct sky2_port *sky2 = netdev_priv(dev);
        struct sky2_hw *hw = sky2->hw;
        unsigned port = sky2->port;
-       u32 ramsize, rxspace, imask;
+       u32 ramsize, imask;
        int cap, err = -ENOMEM;
        struct net_device *otherdev = hw->dev[sky2->port^1];
 
@@ -1199,23 +1177,25 @@ static int sky2_up(struct net_device *dev)
 
        sky2_mac_init(hw, port);
 
-       /* Determine available ram buffer space (in 4K blocks).
-        * Note: not sure about the FE setting below yet
-        */
-       if (hw->chip_id == CHIP_ID_YUKON_FE)
-               ramsize = 4;
-       else
-               ramsize = sky2_read8(hw, B2_E_0);
+       /* Register is number of 4K blocks on internal RAM buffer. */
+       ramsize = sky2_read8(hw, B2_E_0) * 4;
+       printk(KERN_INFO PFX "%s: ram buffer %dK\n", dev->name, ramsize);
 
-       /* Give transmitter one third (rounded up) */
-       rxspace = ramsize - (ramsize + 2) / 3;
+       if (ramsize > 0) {
+               u32 rxspace;
 
-       sky2_ramset(hw, rxqaddr[port], 0, rxspace);
-       sky2_ramset(hw, txqaddr[port], rxspace, ramsize);
+               if (ramsize < 16)
+                       rxspace = ramsize / 2;
+               else
+                       rxspace = 8 + (2*(ramsize - 16))/3;
 
-       /* Make sure SyncQ is disabled */
-       sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL),
-                   RB_RST_SET);
+               sky2_ramset(hw, rxqaddr[port], 0, rxspace);
+               sky2_ramset(hw, txqaddr[port], rxspace, ramsize - rxspace);
+
+               /* Make sure SyncQ is disabled */
+               sky2_write8(hw, RB_ADDR(port == 0 ? Q_XS1 : Q_XS2, RB_CTRL),
+                           RB_RST_SET);
+       }
 
        sky2_qset(hw, txqaddr[port]);
 
@@ -1360,7 +1340,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
                u32 tcpsum;
 
                tcpsum = offset << 16;          /* sum start */
-               tcpsum |= offset + skb->csum;   /* sum write */
+               tcpsum |= offset + skb->csum_offset;    /* sum write */
 
                ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
                if (skb->nh.iph->protocol == IPPROTO_UDP)
@@ -1463,7 +1443,10 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
                        if (unlikely(netif_msg_tx_done(sky2)))
                                printk(KERN_DEBUG "%s: tx done %u\n",
                                       dev->name, idx);
-                       dev_kfree_skb(re->skb);
+                       sky2->net_stats.tx_packets++;
+                       sky2->net_stats.tx_bytes += re->skb->len;
+
+                       dev_kfree_skb_any(re->skb);
                }
 
                le->opcode = 0; /* paranoia */
@@ -1508,6 +1491,13 @@ static int sky2_down(struct net_device *dev)
        imask &= ~portirq_msk[port];
        sky2_write32(hw, B0_IMSK, imask);
 
+       /*
+        * Both ports share the NAPI poll on port 0, so if necessary undo the
+        * the disable that is done in dev_close.
+        */
+       if (sky2->port == 0 && hw->ports > 1)
+               netif_poll_enable(dev);
+
        sky2_gmac_reset(hw, port);
 
        /* Stop transmitter */
@@ -1519,7 +1509,7 @@ static int sky2_down(struct net_device *dev)
 
        /* WA for dev. #4.209 */
        if (hw->chip_id == CHIP_ID_YUKON_EC_U
-           && hw->chip_rev == CHIP_REV_YU_EC_U_A1)
+           && (hw->chip_rev == CHIP_REV_YU_EC_U_A1 || hw->chip_rev == CHIP_REV_YU_EC_U_B0))
                sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
                             sky2->speed != SPEED_1000 ?
                             TX_STFW_ENA : TX_STFW_DIS);
@@ -2075,9 +2065,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
                case OP_RXSTAT:
                        skb = sky2_receive(dev, length, status);
                        if (!skb)
-                               break;
+                               goto force_update;
 
                        skb->protocol = eth_type_trans(skb, dev);
+                       sky2->net_stats.rx_packets++;
+                       sky2->net_stats.rx_bytes += skb->len;
                        dev->last_rx = jiffies;
 
 #ifdef SKY2_VLAN_TAG_USED
@@ -2091,8 +2083,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
 
                        /* Update receiver after 16 frames */
                        if (++buf_write[le->link] == RX_BUF_WRITE) {
-                               sky2_put_idx(hw, rxqaddr[le->link],
-                                            sky2->rx_put);
+force_update:
+                               sky2_put_idx(hw, rxqaddr[le->link], sky2->rx_put);
                                buf_write[le->link] = 0;
                        }
 
@@ -2469,7 +2461,7 @@ static int sky2_reset(struct sky2_hw *hw)
                        ++hw->ports;
        }
 
-       sky2_set_power_state(hw, PCI_D0);
+       sky2_power_on(hw);
 
        for (i = 0; i < hw->ports; i++) {
                sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET);
@@ -2803,25 +2795,9 @@ static void sky2_get_strings(struct net_device *dev, u32 stringset, u8 * data)
        }
 }
 
-/* Use hardware MIB variables for critical path statistics and
- * transmit feedback not reported at interrupt.
- * Other errors are accounted for in interrupt handler.
- */
 static struct net_device_stats *sky2_get_stats(struct net_device *dev)
 {
        struct sky2_port *sky2 = netdev_priv(dev);
-       u64 data[13];
-
-       sky2_phy_stats(sky2, data, ARRAY_SIZE(data));
-
-       sky2->net_stats.tx_bytes = data[0];
-       sky2->net_stats.rx_bytes = data[1];
-       sky2->net_stats.tx_packets = data[2] + data[4] + data[6];
-       sky2->net_stats.rx_packets = data[3] + data[5] + data[7];
-       sky2->net_stats.multicast = data[3] + data[5];
-       sky2->net_stats.collisions = data[10];
-       sky2->net_stats.tx_aborted_errors = data[12];
-
        return &sky2->net_stats;
 }
 
@@ -2927,18 +2903,8 @@ static void sky2_led(struct sky2_hw *hw, unsigned port, int on)
 
        default:
                gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0);
-               gm_phy_write(hw, port, PHY_MARV_LED_OVER,
-                            on ? PHY_M_LED_MO_DUP(MO_LED_ON) |
-                            PHY_M_LED_MO_10(MO_LED_ON) |
-                            PHY_M_LED_MO_100(MO_LED_ON) |
-                            PHY_M_LED_MO_1000(MO_LED_ON) |
-                            PHY_M_LED_MO_RX(MO_LED_ON)
-                            : PHY_M_LED_MO_DUP(MO_LED_OFF) |
-                            PHY_M_LED_MO_10(MO_LED_OFF) |
-                            PHY_M_LED_MO_100(MO_LED_OFF) |
-                            PHY_M_LED_MO_1000(MO_LED_OFF) |
-                            PHY_M_LED_MO_RX(MO_LED_OFF));
-
+               gm_phy_write(hw, port, PHY_MARV_LED_OVER, 
+                            on ? PHY_M_LED_ALL : 0);
        }
 }
 
@@ -3248,7 +3214,11 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
                dev->poll = sky2_poll;
        dev->weight = NAPI_WEIGHT;
 #ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = sky2_netpoll;
+       /* Network console (only works on port 0)
+        * because netpoll makes assumptions about NAPI
+        */
+       if (port == 0)
+               dev->poll_controller = sky2_netpoll;
 #endif
 
        sky2 = netdev_priv(dev);
@@ -3317,7 +3287,7 @@ static irqreturn_t __devinit sky2_test_intr(int irq, void *dev_id)
                return IRQ_NONE;
 
        if (status & Y2_IS_IRQ_SW) {
-               hw->msi_detected = 1;
+               hw->msi = 1;
                wake_up(&hw->msi_wait);
                sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
        }
@@ -3336,7 +3306,7 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
 
        sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
 
-       err = request_irq(pdev->irq, sky2_test_intr, IRQF_SHARED, DRV_NAME, hw);
+       err = request_irq(pdev->irq, sky2_test_intr, 0, DRV_NAME, hw);
        if (err) {
                printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
                       pci_name(pdev), pdev->irq);
@@ -3346,9 +3316,9 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
        sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ);
        sky2_read8(hw, B0_CTST);
 
-       wait_event_timeout(hw->msi_wait, hw->msi_detected, HZ/10);
+       wait_event_timeout(hw->msi_wait, hw->msi, HZ/10);
 
-       if (!hw->msi_detected) {
+       if (!hw->msi) {
                /* MSI test failed, go back to INTx mode */
                printk(KERN_INFO PFX "%s: No interrupt generated using MSI, "
                       "switching to INTx mode.\n",
@@ -3369,9 +3339,9 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
 static int __devinit sky2_probe(struct pci_dev *pdev,
                                const struct pci_device_id *ent)
 {
-       struct net_device *dev, *dev1 = NULL;
+       struct net_device *dev;
        struct sky2_hw *hw;
-       int err, pm_cap, using_dac = 0;
+       int err, using_dac = 0;
 
        err = pci_enable_device(pdev);
        if (err) {
@@ -3389,15 +3359,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
 
        pci_set_master(pdev);
 
-       /* Find power-management capability. */
-       pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
-       if (pm_cap == 0) {
-               printk(KERN_ERR PFX "Cannot find PowerManagement capability, "
-                      "aborting.\n");
-               err = -EIO;
-               goto err_out_free_regions;
-       }
-
        if (sizeof(dma_addr_t) > sizeof(u32) &&
            !(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
                using_dac = 1;
@@ -3433,7 +3394,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
                       pci_name(pdev));
                goto err_out_free_hw;
        }
-       hw->pm_cap = pm_cap;
 
 #ifdef __BIG_ENDIAN
        /* The sk98lin vendor driver uses hardware byte swapping but
@@ -3463,8 +3423,10 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
               hw->chip_id, hw->chip_rev);
 
        dev = sky2_init_netdev(hw, 0, using_dac);
-       if (!dev)
+       if (!dev) {
+               err = -ENOMEM;
                goto err_out_free_pci;
+       }
 
        if (!disable_msi && pci_enable_msi(pdev) == 0) {
                err = sky2_test_msi(hw);
@@ -3481,7 +3443,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
                goto err_out_free_netdev;
        }
 
-       err = request_irq(pdev->irq,  sky2_intr, IRQF_SHARED, dev->name, hw);
+       err = request_irq(pdev->irq,  sky2_intr, hw->msi ? 0 : IRQF_SHARED,
+                         dev->name, hw);
        if (err) {
                printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
                       pci_name(pdev), pdev->irq);
@@ -3491,13 +3454,19 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
 
        sky2_show_addr(dev);
 
-       if (hw->ports > 1 && (dev1 = sky2_init_netdev(hw, 1, using_dac))) {
-               if (register_netdev(dev1) == 0)
+       if (hw->ports > 1) {
+               struct net_device *dev1;
+
+               dev1 = sky2_init_netdev(hw, 1, using_dac);
+               if (!dev1) {
+                       printk(KERN_WARNING PFX
+                              "allocation of second port failed\n");
+               }
+               else if (!(err = register_netdev(dev1)))
                        sky2_show_addr(dev1);
                else {
-                       /* Failure to register second port need not be fatal */
                        printk(KERN_WARNING PFX
-                              "register of second port failed\n");
+                              "register of second port failed (%d)\n", err);
                        hw->dev[1] = NULL;
                        free_netdev(dev1);
                }
@@ -3511,7 +3480,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
        return 0;
 
 err_out_unregister:
-       pci_disable_msi(pdev);
+       if (hw->msi)
+               pci_disable_msi(pdev);
        unregister_netdev(dev);
 err_out_free_netdev:
        free_netdev(dev);
@@ -3548,13 +3518,15 @@ static void __devexit sky2_remove(struct pci_dev *pdev)
                unregister_netdev(dev1);
        unregister_netdev(dev0);
 
-       sky2_set_power_state(hw, PCI_D3hot);
+       sky2_power_aux(hw);
+
        sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
        sky2_write8(hw, B0_CTST, CS_RST_SET);
        sky2_read8(hw, B0_CTST);
 
        free_irq(pdev->irq, hw);
-       pci_disable_msi(pdev);
+       if (hw->msi)
+               pci_disable_msi(pdev);
        pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
@@ -3573,10 +3545,6 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct sky2_hw *hw = pci_get_drvdata(pdev);
        int i;
-       pci_power_t pstate = pci_choose_state(pdev, state);
-
-       if (!(pstate == PCI_D3hot || pstate == PCI_D3cold))
-               return -EINVAL;
 
        del_timer_sync(&hw->idle_timer);
        netif_poll_disable(hw->dev[0]);
@@ -3591,8 +3559,10 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
        }
 
        sky2_write32(hw, B0_IMSK, 0);
+       sky2_power_aux(hw);
        pci_save_state(pdev);
-       sky2_set_power_state(hw, pstate);
+       pci_set_power_state(pdev, pci_choose_state(pdev, state));
+
        return 0;
 }
 
@@ -3601,9 +3571,15 @@ static int sky2_resume(struct pci_dev *pdev)
        struct sky2_hw *hw = pci_get_drvdata(pdev);
        int i, err;
 
-       pci_restore_state(pdev);
+       err = pci_set_power_state(pdev, PCI_D0);
+       if (err)
+               goto out;
+
+       err = pci_restore_state(pdev);
+       if (err)
+               goto out;
+
        pci_enable_wake(pdev, PCI_D0, 0);
-       sky2_set_power_state(hw, PCI_D0);
 
        err = sky2_reset(hw);
        if (err)
@@ -3628,7 +3604,10 @@ static int sky2_resume(struct pci_dev *pdev)
 
        netif_poll_enable(hw->dev[0]);
        sky2_idle_start(hw);
+       return 0;
 out:
+       printk(KERN_ERR PFX "%s: resume failed (%d)\n", pci_name(pdev), err);
+       pci_disable_device(pdev);
        return err;
 }
 #endif
@@ -3658,6 +3637,6 @@ module_init(sky2_init_module);
 module_exit(sky2_cleanup_module);
 
 MODULE_DESCRIPTION("Marvell Yukon 2 Gigabit Ethernet driver");
-MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>");
+MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);