iwmc3200wifi: Update wireless_mode with eeprom values
[safe/jmp/linux-2.6] / drivers / net / atlx / atl1.c
index 6ddc911..e547f78 100644 (file)
  * file called COPYING.
  *
  * Contact Information:
- * Xiong Huang <xiong_huang@attansic.com>
- * Attansic Technology Corp. 3F 147, Xianzheng 9th Road, Zhubei,
- * Xinzhu  302, TAIWAN, REPUBLIC OF CHINA
- *
+ * Xiong Huang <xiong.huang@atheros.com>
+ * Jie Yang <jie.yang@atheros.com>
  * Chris Snook <csnook@redhat.com>
  * Jay Cliburn <jcliburn@gmail.com>
  *
- * This version is adapted from the Attansic reference driver for
- * inclusion in the Linux kernel.  It is currently under heavy development.
- * A very incomplete list of things that need to be dealt with:
+ * This version is adapted from the Attansic reference driver.
  *
  * TODO:
  * Add more ethtool functions.
 
 #include "atl1.h"
 
+#define ATLX_DRIVER_VERSION "2.1.3"
+MODULE_AUTHOR("Xiong Huang <xiong.huang@atheros.com>, \
+       Chris Snook <csnook@redhat.com>, Jay Cliburn <jcliburn@gmail.com>");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(ATLX_DRIVER_VERSION);
+
 /* Temporary hack for merging atl1 and atl2 */
 #include "atlx.c"
 
  * Default Value: 100 (200us)
  */
 static int __devinitdata int_mod_timer[ATL1_MAX_NIC+1] = ATL1_PARAM_INIT;
-static int num_int_mod_timer;
+static unsigned int num_int_mod_timer;
 module_param_array_named(int_mod_timer, int_mod_timer, int,
        &num_int_mod_timer, 0);
 MODULE_PARM_DESC(int_mod_timer, "Interrupt moderator timer");
@@ -199,7 +201,7 @@ static int __devinit atl1_validate_option(int *value, struct atl1_option *opt,
  * value exists, a default value is used.  The final value is stored
  * in a variable in the adapter structure.
  */
-void __devinit atl1_check_options(struct atl1_adapter *adapter)
+static void __devinit atl1_check_options(struct atl1_adapter *adapter)
 {
        struct pci_dev *pdev = adapter->pdev;
        int bd = adapter->bd_number;
@@ -471,7 +473,6 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
                        memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
                        return 0;
                }
-               return 1;
        }
 
        /* see if SPI FLAGS exist ? */
@@ -528,7 +529,7 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
  * Reads the adapter's MAC address from the EEPROM
  * hw - Struct containing variables accessed by shared code
  */
-s32 atl1_read_mac_addr(struct atl1_hw *hw)
+static s32 atl1_read_mac_addr(struct atl1_hw *hw)
 {
        u16 i;
 
@@ -637,22 +638,6 @@ static s32 atl1_phy_leave_power_saving(struct atl1_hw *hw)
 }
 
 /*
- * Force the PHY into power saving mode using vendor magic.
- */
-#ifdef CONFIG_PM
-static void atl1_phy_enter_power_saving(struct atl1_hw *hw)
-{
-       atl1_write_phy_reg(hw, MII_DBG_ADDR, 0);
-       atl1_write_phy_reg(hw, MII_DBG_DATA, 0x124E);
-       atl1_write_phy_reg(hw, MII_DBG_ADDR, 2);
-       atl1_write_phy_reg(hw, MII_DBG_DATA, 0x3000);
-       atl1_write_phy_reg(hw, MII_DBG_ADDR, 3);
-       atl1_write_phy_reg(hw, MII_DBG_DATA, 0);
-
-}
-#endif
-
-/*
  * Resets the PHY and make all config validate
  * hw - Struct containing variables accessed by shared code
  *
@@ -1325,7 +1310,6 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
                                dev_info(&adapter->pdev->dev, "link is down\n");
                        adapter->link_speed = SPEED_0;
                        netif_carrier_off(netdev);
-                       netif_stop_queue(netdev);
                }
                return 0;
        }
@@ -1375,7 +1359,6 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
                if (!netif_carrier_ok(netdev)) {
                        /* Link down -> Up */
                        netif_carrier_on(netdev);
-                       netif_wake_queue(netdev);
                }
                return 0;
        }
@@ -1413,7 +1396,8 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
        /* auto-neg, insert timer to re-config phy */
        if (!adapter->phy_timer_pending) {
                adapter->phy_timer_pending = true;
-               mod_timer(&adapter->phy_config_timer, jiffies + 3 * HZ);
+               mod_timer(&adapter->phy_config_timer,
+                         round_jiffies(jiffies + 3 * HZ));
        }
 
        return 0;
@@ -1685,6 +1669,7 @@ static void atl1_via_workaround(struct atl1_adapter *adapter)
 
 static void atl1_inc_smb(struct atl1_adapter *adapter)
 {
+       struct net_device *netdev = adapter->netdev;
        struct stats_msg_block *smb = adapter->smb.smb;
 
        /* Fill out the OS statistics structure */
@@ -1727,30 +1712,30 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
        adapter->soft_stats.tx_trunc += smb->tx_trunc;
        adapter->soft_stats.tx_pause += smb->tx_pause;
 
-       adapter->net_stats.rx_packets = adapter->soft_stats.rx_packets;
-       adapter->net_stats.tx_packets = adapter->soft_stats.tx_packets;
-       adapter->net_stats.rx_bytes = adapter->soft_stats.rx_bytes;
-       adapter->net_stats.tx_bytes = adapter->soft_stats.tx_bytes;
-       adapter->net_stats.multicast = adapter->soft_stats.multicast;
-       adapter->net_stats.collisions = adapter->soft_stats.collisions;
-       adapter->net_stats.rx_errors = adapter->soft_stats.rx_errors;
-       adapter->net_stats.rx_over_errors =
+       netdev->stats.rx_packets = adapter->soft_stats.rx_packets;
+       netdev->stats.tx_packets = adapter->soft_stats.tx_packets;
+       netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes;
+       netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes;
+       netdev->stats.multicast = adapter->soft_stats.multicast;
+       netdev->stats.collisions = adapter->soft_stats.collisions;
+       netdev->stats.rx_errors = adapter->soft_stats.rx_errors;
+       netdev->stats.rx_over_errors =
                adapter->soft_stats.rx_missed_errors;
-       adapter->net_stats.rx_length_errors =
+       netdev->stats.rx_length_errors =
                adapter->soft_stats.rx_length_errors;
-       adapter->net_stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
-       adapter->net_stats.rx_frame_errors =
+       netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
+       netdev->stats.rx_frame_errors =
                adapter->soft_stats.rx_frame_errors;
-       adapter->net_stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
-       adapter->net_stats.rx_missed_errors =
+       netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
+       netdev->stats.rx_missed_errors =
                adapter->soft_stats.rx_missed_errors;
-       adapter->net_stats.tx_errors = adapter->soft_stats.tx_errors;
-       adapter->net_stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
-       adapter->net_stats.tx_aborted_errors =
+       netdev->stats.tx_errors = adapter->soft_stats.tx_errors;
+       netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
+       netdev->stats.tx_aborted_errors =
                adapter->soft_stats.tx_aborted_errors;
-       adapter->net_stats.tx_window_errors =
+       netdev->stats.tx_window_errors =
                adapter->soft_stats.tx_window_errors;
-       adapter->net_stats.tx_carrier_errors =
+       netdev->stats.tx_carrier_errors =
                adapter->soft_stats.tx_carrier_errors;
 }
 
@@ -1809,6 +1794,17 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter,
 {
        struct pci_dev *pdev = adapter->pdev;
 
+       /*
+        * The L1 hardware contains a bug that erroneously sets the
+        * PACKET_FLAG_ERR and ERR_FLAG_L4_CHKSUM bits whenever a
+        * fragmented IP packet is received, even though the packet
+        * is perfectly valid and its checksum is correct. There's
+        * no way to distinguish between one of these good packets
+        * and a packet that actually contains a TCP/UDP checksum
+        * error, so all we can do is allow it to be handed up to
+        * the higher layers and let it be sorted out there.
+        */
+
        skb->ip_summed = CHECKSUM_NONE;
 
        if (unlikely(rrd->pkt_flg & PACKET_FLAG_ERR)) {
@@ -1835,14 +1831,6 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter,
                return;
        }
 
-       /* IPv4, but hardware thinks its checksum is wrong */
-       if (netif_msg_rx_err(adapter))
-               dev_printk(KERN_DEBUG, &pdev->dev,
-                       "hw csum wrong, pkt_flag:%x, err_flag:%x\n",
-                       rrd->pkt_flg, rrd->err_flg);
-       skb->ip_summed = CHECKSUM_COMPLETE;
-       skb->csum = htons(rrd->xsz.xsum_sz.rx_chksum);
-       adapter->hw_csum_err++;
        return;
 }
 
@@ -1876,20 +1864,14 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter)
 
                rfd_desc = ATL1_RFD_DESC(rfd_ring, rfd_next_to_use);
 
-               skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN);
+               skb = netdev_alloc_skb_ip_align(adapter->netdev,
+                                               adapter->rx_buffer_len);
                if (unlikely(!skb)) {
                        /* Better luck next round */
-                       adapter->net_stats.rx_dropped++;
+                       adapter->netdev->stats.rx_dropped++;
                        break;
                }
 
-               /*
-                * Make buffer alignment 2 beyond a 16 byte boundary
-                * this will result in a 16 byte aligned IP header after
-                * the 14 byte MAC header is removed
-                */
-               skb_reserve(skb, NET_IP_ALIGN);
-
                buffer_info->alloced = 1;
                buffer_info->skb = skb;
                buffer_info->length = (u16) adapter->rx_buffer_len;
@@ -2045,8 +2027,6 @@ rrd_ok:
                buffer_info->skb = NULL;
                buffer_info->alloced = 0;
                rrd->xsz.valid = 0;
-
-               adapter->netdev->last_rx = jiffies;
        }
 
        atomic_set(&rrd_ring->next_to_clean, rrd_next_to_clean);
@@ -2124,7 +2104,6 @@ static u16 atl1_tpd_avail(struct atl1_tpd_ring *tpd_ring)
 static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
        struct tx_packet_desc *ptpd)
 {
-       /* spinlock held */
        u8 hdr_len, ip_off;
        u32 real_len;
        int err;
@@ -2211,7 +2190,6 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb,
 static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
        struct tx_packet_desc *ptpd)
 {
-       /* spinlock held */
        struct atl1_tpd_ring *tpd_ring = &adapter->tpd_ring;
        struct atl1_buffer *buffer_info;
        u16 buf_len = skb->len;
@@ -2228,8 +2206,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
        nr_frags = skb_shinfo(skb)->nr_frags;
        next_to_use = atomic_read(&tpd_ring->next_to_use);
        buffer_info = &tpd_ring->buffer_info[next_to_use];
-       if (unlikely(buffer_info->skb))
-               BUG();
+       BUG_ON(buffer_info->skb);
        /* put skb in last TPD */
        buffer_info->skb = NULL;
 
@@ -2295,8 +2272,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
                        ATL1_MAX_TX_BUF_LEN;
                for (i = 0; i < nseg; i++) {
                        buffer_info = &tpd_ring->buffer_info[next_to_use];
-                       if (unlikely(buffer_info->skb))
-                               BUG();
+                       BUG_ON(buffer_info->skb);
+
                        buffer_info->skb = NULL;
                        buffer_info->length = (buf_len > ATL1_MAX_TX_BUF_LEN) ?
                                ATL1_MAX_TX_BUF_LEN : buf_len;
@@ -2318,7 +2295,6 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
 static void atl1_tx_queue(struct atl1_adapter *adapter, u16 count,
        struct tx_packet_desc *ptpd)
 {
-       /* spinlock held */
        struct atl1_tpd_ring *tpd_ring = &adapter->tpd_ring;
        struct atl1_buffer *buffer_info;
        struct tx_packet_desc *tpd;
@@ -2332,7 +2308,8 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, u16 count,
                if (tpd != ptpd)
                        memcpy(tpd, ptpd, sizeof(struct tx_packet_desc));
                tpd->buffer_addr = cpu_to_le64(buffer_info->dma);
-               tpd->word2 = (cpu_to_le16(buffer_info->length) &
+               tpd->word2 &= ~(TPD_BUFLEN_MASK << TPD_BUFLEN_SHIFT);
+               tpd->word2 |= (cpu_to_le16(buffer_info->length) &
                        TPD_BUFLEN_MASK) << TPD_BUFLEN_SHIFT;
 
                /*
@@ -2365,7 +2342,8 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, u16 count,
        atomic_set(&tpd_ring->next_to_use, next_to_use);
 }
 
-static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
+static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb,
+                                        struct net_device *netdev)
 {
        struct atl1_adapter *adapter = netdev_priv(netdev);
        struct atl1_tpd_ring *tpd_ring = &adapter->tpd_ring;
@@ -2376,7 +2354,6 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        struct tx_packet_desc *ptpd;
        u16 frag_size;
        u16 vlan_tag;
-       unsigned long flags;
        unsigned int nr_frags = 0;
        unsigned int mss = 0;
        unsigned int f;
@@ -2399,7 +2376,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 
        mss = skb_shinfo(skb)->gso_size;
        if (mss) {
-               if (skb->protocol == ntohs(ETH_P_IP)) {
+               if (skb->protocol == htons(ETH_P_IP)) {
                        proto_hdr_len = (skb_transport_offset(skb) +
                                         tcp_hdrlen(skb));
                        if (unlikely(proto_hdr_len > len)) {
@@ -2414,18 +2391,9 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                }
        }
 
-       if (!spin_trylock_irqsave(&adapter->lock, flags)) {
-               /* Can't get lock - tell upper layer to requeue */
-               if (netif_msg_tx_queued(adapter))
-                       dev_printk(KERN_DEBUG, &adapter->pdev->dev,
-                               "tx locked\n");
-               return NETDEV_TX_LOCKED;
-       }
-
        if (atl1_tpd_avail(&adapter->tpd_ring) < count) {
                /* not enough descriptors */
                netif_stop_queue(netdev);
-               spin_unlock_irqrestore(&adapter->lock, flags);
                if (netif_msg_tx_queued(adapter))
                        dev_printk(KERN_DEBUG, &adapter->pdev->dev,
                                "tx busy\n");
@@ -2441,13 +2409,12 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) |
                        ((vlan_tag >> 9) & 0x8);
                ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT;
-               ptpd->word3 |= (vlan_tag & TPD_VL_TAGGED_MASK) <<
-                       TPD_VL_TAGGED_SHIFT;
+               ptpd->word2 |= (vlan_tag & TPD_VLANTAG_MASK) <<
+                       TPD_VLANTAG_SHIFT;
        }
 
        tso = atl1_tso(adapter, skb, ptpd);
        if (tso < 0) {
-               spin_unlock_irqrestore(&adapter->lock, flags);
                dev_kfree_skb_any(skb);
                return NETDEV_TX_OK;
        }
@@ -2455,7 +2422,6 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        if (!tso) {
                ret_val = atl1_tx_csum(adapter, skb, ptpd);
                if (ret_val < 0) {
-                       spin_unlock_irqrestore(&adapter->lock, flags);
                        dev_kfree_skb_any(skb);
                        return NETDEV_TX_OK;
                }
@@ -2464,8 +2430,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        atl1_tx_map(adapter, skb, ptpd);
        atl1_tx_queue(adapter, count, ptpd);
        atl1_update_mailbox(adapter);
-       spin_unlock_irqrestore(&adapter->lock, flags);
-       netdev->trans_start = jiffies;
+       mmiowb();
        return NETDEV_TX_OK;
 }
 
@@ -2557,17 +2522,6 @@ static irqreturn_t atl1_intr(int irq, void *data)
        return IRQ_HANDLED;
 }
 
-/*
- * atl1_watchdog - Timer Call-back
- * @data: pointer to netdev cast into an unsigned long
- */
-static void atl1_watchdog(unsigned long data)
-{
-       struct atl1_adapter *adapter = (struct atl1_adapter *)data;
-
-       /* Reset the timer */
-       mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
-}
 
 /*
  * atl1_phy_config - Timer Call-back
@@ -2635,14 +2589,14 @@ static s32 atl1_up(struct atl1_adapter *adapter)
                irq_flags |= IRQF_SHARED;
        }
 
-       err = request_irq(adapter->pdev->irq, &atl1_intr, irq_flags,
+       err = request_irq(adapter->pdev->irq, atl1_intr, irq_flags,
                        netdev->name, netdev);
        if (unlikely(err))
                goto err_up;
 
-       mod_timer(&adapter->watchdog_timer, jiffies);
        atlx_irq_enable(adapter);
        atl1_check_link(adapter);
+       netif_start_queue(netdev);
        return 0;
 
 err_up:
@@ -2656,7 +2610,7 @@ static void atl1_down(struct atl1_adapter *adapter)
 {
        struct net_device *netdev = adapter->netdev;
 
-       del_timer_sync(&adapter->watchdog_timer);
+       netif_stop_queue(netdev);
        del_timer_sync(&adapter->phy_config_timer);
        adapter->phy_timer_pending = false;
 
@@ -2669,7 +2623,6 @@ static void atl1_down(struct atl1_adapter *adapter)
        adapter->link_speed = SPEED_0;
        adapter->link_duplex = -1;
        netif_carrier_off(netdev);
-       netif_stop_queue(netdev);
 
        atl1_clean_tx_ring(adapter);
        atl1_clean_rx_ring(adapter);
@@ -2738,6 +2691,8 @@ static int atl1_open(struct net_device *netdev)
        struct atl1_adapter *adapter = netdev_priv(netdev);
        int err;
 
+       netif_carrier_off(netdev);
+
        /* allocate transmit descriptors */
        err = atl1_setup_ring_resources(adapter);
        if (err)
@@ -2860,7 +2815,6 @@ disable_wol:
        ctrl |= PCIE_PHYMISC_FORCE_RCV_DET;
        iowrite32(ctrl, hw->hw_addr + REG_PCIE_PHYMISC);
        ioread32(hw->hw_addr + REG_PCIE_PHYMISC);
-       atl1_phy_enter_power_saving(hw);
        hw->phy_configured = false;
        pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
 exit:
@@ -2924,6 +2878,22 @@ static void atl1_poll_controller(struct net_device *netdev)
 }
 #endif
 
+static const struct net_device_ops atl1_netdev_ops = {
+       .ndo_open               = atl1_open,
+       .ndo_stop               = atl1_close,
+       .ndo_start_xmit         = atl1_xmit_frame,
+       .ndo_set_multicast_list = atlx_set_multi,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = atl1_set_mac,
+       .ndo_change_mtu         = atl1_change_mtu,
+       .ndo_do_ioctl           = atlx_ioctl,
+       .ndo_tx_timeout         = atlx_tx_timeout,
+       .ndo_vlan_rx_register   = atlx_vlan_rx_register,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = atl1_poll_controller,
+#endif
+};
+
 /*
  * atl1_probe - Device Initialization Routine
  * @pdev: PCI device information struct
@@ -2957,7 +2927,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
         * various kernel subsystems to support the mechanics required by a
         * fixed-high-32-bit system.
         */
-       err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+       err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
        if (err) {
                dev_err(&pdev->dev, "no usable DMA configuration\n");
                goto err_dma;
@@ -3011,20 +2981,8 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
        adapter->mii.phy_id_mask = 0x1f;
        adapter->mii.reg_num_mask = 0x1f;
 
-       netdev->open = &atl1_open;
-       netdev->stop = &atl1_close;
-       netdev->hard_start_xmit = &atl1_xmit_frame;
-       netdev->get_stats = &atlx_get_stats;
-       netdev->set_multicast_list = &atlx_set_multi;
-       netdev->set_mac_address = &atl1_set_mac;
-       netdev->change_mtu = &atl1_change_mtu;
-       netdev->do_ioctl = &atlx_ioctl;
-       netdev->tx_timeout = &atlx_tx_timeout;
+       netdev->netdev_ops = &atl1_netdev_ops;
        netdev->watchdog_timeo = 5 * HZ;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       netdev->poll_controller = atl1_poll_controller;
-#endif
-       netdev->vlan_rx_register = atlx_vlan_rx_register;
 
        netdev->ethtool_ops = &atl1_ethtool_ops;
        adapter->bd_number = cards_found;
@@ -3037,8 +2995,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
        netdev->features = NETIF_F_HW_CSUM;
        netdev->features |= NETIF_F_SG;
        netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-       netdev->features |= NETIF_F_TSO;
-       netdev->features |= NETIF_F_LLTX;
 
        /*
         * patch for some L1 of old version,
@@ -3082,13 +3038,8 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
        netif_carrier_off(netdev);
        netif_stop_queue(netdev);
 
-       init_timer(&adapter->watchdog_timer);
-       adapter->watchdog_timer.function = &atl1_watchdog;
-       adapter->watchdog_timer.data = (unsigned long)adapter;
-
-       init_timer(&adapter->phy_config_timer);
-       adapter->phy_config_timer.function = &atl1_phy_config;
-       adapter->phy_config_timer.data = (unsigned long)adapter;
+       setup_timer(&adapter->phy_config_timer, &atl1_phy_config,
+                   (unsigned long)adapter);
        adapter->phy_timer_pending = false;
 
        INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task);
@@ -3206,8 +3157,6 @@ static struct atl1_stats atl1_gstrings_stats[] = {
        {"tx_bytes", ATL1_STAT(soft_stats.tx_bytes)},
        {"rx_errors", ATL1_STAT(soft_stats.rx_errors)},
        {"tx_errors", ATL1_STAT(soft_stats.tx_errors)},
-       {"rx_dropped", ATL1_STAT(net_stats.rx_dropped)},
-       {"tx_dropped", ATL1_STAT(net_stats.tx_dropped)},
        {"multicast", ATL1_STAT(soft_stats.multicast)},
        {"collisions", ATL1_STAT(soft_stats.collisions)},
        {"rx_length_errors", ATL1_STAT(soft_stats.rx_length_errors)},
@@ -3423,11 +3372,11 @@ static void atl1_get_drvinfo(struct net_device *netdev,
 {
        struct atl1_adapter *adapter = netdev_priv(netdev);
 
-       strncpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver));
-       strncpy(drvinfo->version, ATLX_DRIVER_VERSION,
+       strlcpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, ATLX_DRIVER_VERSION,
                sizeof(drvinfo->version));
-       strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
-       strncpy(drvinfo->bus_info, pci_name(adapter->pdev),
+       strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
+       strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
                sizeof(drvinfo->bus_info));
        drvinfo->eedump_len = ATL1_EEDUMP_LEN;
 }
@@ -3437,14 +3386,8 @@ static void atl1_get_wol(struct net_device *netdev,
 {
        struct atl1_adapter *adapter = netdev_priv(netdev);
 
-       wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC;
+       wol->supported = WAKE_MAGIC;
        wol->wolopts = 0;
-       if (adapter->wol & ATLX_WUFC_EX)
-               wol->wolopts |= WAKE_UCAST;
-       if (adapter->wol & ATLX_WUFC_MC)
-               wol->wolopts |= WAKE_MCAST;
-       if (adapter->wol & ATLX_WUFC_BC)
-               wol->wolopts |= WAKE_BCAST;
        if (adapter->wol & ATLX_WUFC_MAG)
                wol->wolopts |= WAKE_MAGIC;
        return;
@@ -3455,15 +3398,10 @@ static int atl1_set_wol(struct net_device *netdev,
 {
        struct atl1_adapter *adapter = netdev_priv(netdev);
 
-       if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
+       if (wol->wolopts & (WAKE_PHY | WAKE_UCAST | WAKE_MCAST | WAKE_BCAST |
+               WAKE_ARP | WAKE_MAGICSECURE))
                return -EOPNOTSUPP;
        adapter->wol = 0;
-       if (wol->wolopts & WAKE_UCAST)
-               adapter->wol |= ATLX_WUFC_EX;
-       if (wol->wolopts & WAKE_MCAST)
-               adapter->wol |= ATLX_WUFC_MC;
-       if (wol->wolopts & WAKE_BCAST)
-               adapter->wol |= ATLX_WUFC_BC;
        if (wol->wolopts & WAKE_MAGIC)
                adapter->wol |= ATLX_WUFC_MAG;
        return 0;