Merge branch 'for-greg' of git://gitorious.org/usb/usb into usb-linus
[pandora-kernel.git] / drivers / net / igb / igb_main.c
index b4f92b0..0dfd1b9 100644 (file)
@@ -106,6 +106,7 @@ static void igb_free_all_rx_resources(struct igb_adapter *);
 static void igb_setup_mrqc(struct igb_adapter *);
 static int igb_probe(struct pci_dev *, const struct pci_device_id *);
 static void __devexit igb_remove(struct pci_dev *pdev);
+static void igb_init_hw_timer(struct igb_adapter *adapter);
 static int igb_sw_init(struct igb_adapter *);
 static int igb_open(struct net_device *);
 static int igb_close(struct net_device *);
@@ -199,7 +200,7 @@ static struct pci_driver igb_driver = {
        .probe    = igb_probe,
        .remove   = __devexit_p(igb_remove),
 #ifdef CONFIG_PM
-       /* Power Managment Hooks */
+       /* Power Management Hooks */
        .suspend  = igb_suspend,
        .resume   = igb_resume,
 #endif
@@ -2048,6 +2049,9 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        }
 
 #endif
+       /* do hw tstamp init after resetting */
+       igb_init_hw_timer(adapter);
+
        dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");
        /* print bus type/speed/width info */
        dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n",
@@ -2288,7 +2292,7 @@ static void igb_init_hw_timer(struct igb_adapter *adapter)
                /**
                 * Scale the NIC clock cycle by a large factor so that
                 * relatively small clock corrections can be added or
-                * substracted at each clock tick. The drawbacks of a large
+                * subtracted at each clock tick. The drawbacks of a large
                 * factor are a) that the clock register overflows more quickly
                 * (not such a big deal) and b) that the increment per tick has
                 * to fit into 24 bits.  As a result we need to use a shift of
@@ -2384,7 +2388,6 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
                return -ENOMEM;
        }
 
-       igb_init_hw_timer(adapter);
        igb_probe_vfs(adapter);
 
        /* Explicitly disable IRQ since the NIC can be in any state. */
@@ -3406,7 +3409,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
                } else {
                        /*
                         * Write addresses to the MTA, if the attempt fails
-                        * then we should just turn on promiscous mode so
+                        * then we should just turn on promiscuous mode so
                         * that we can at least receive multicast traffic
                         */
                        count = igb_write_mc_addr_list(netdev);
@@ -3420,7 +3423,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
                /*
                 * Write addresses to available RAR registers, if there is not
                 * sufficient space to store all the addresses then enable
-                * unicast promiscous mode
+                * unicast promiscuous mode
                 */
                count = igb_write_uc_addr_list(netdev);
                if (count < 0) {
@@ -3547,7 +3550,7 @@ static void igb_watchdog_task(struct work_struct *work)
                                                    watchdog_task);
        struct e1000_hw *hw = &adapter->hw;
        struct net_device *netdev = adapter->netdev;
-       u32 link;
+       u32 link, ctrl_ext, thstat;
        int i;
 
        link = igb_has_link(adapter);
@@ -3571,6 +3574,25 @@ static void igb_watchdog_task(struct work_struct *work)
                               ((ctrl & E1000_CTRL_RFCE) ?  "RX" :
                               ((ctrl & E1000_CTRL_TFCE) ?  "TX" : "None")));
 
+                       /* check for thermal sensor event on i350,
+                        * copper only */
+                       if (hw->mac.type == e1000_i350) {
+                               thstat = rd32(E1000_THSTAT);
+                               ctrl_ext = rd32(E1000_CTRL_EXT);
+                               if ((hw->phy.media_type ==
+                                    e1000_media_type_copper) && !(ctrl_ext &
+                                    E1000_CTRL_EXT_LINK_MODE_SGMII)) {
+                                       if (thstat &
+                                           E1000_THSTAT_LINK_THROTTLE) {
+                                               printk(KERN_INFO "igb: %s The "
+                                                      "network adapter link "
+                                                      "speed was downshifted "
+                                                      "because it "
+                                                      "overheated.\n",
+                                                      netdev->name);
+                                       }
+                               }
+                       }
                        /* adjust timeout factor according to speed/duplex */
                        adapter->tx_timeout_factor = 1;
                        switch (adapter->link_speed) {
@@ -3596,6 +3618,22 @@ static void igb_watchdog_task(struct work_struct *work)
                if (netif_carrier_ok(netdev)) {
                        adapter->link_speed = 0;
                        adapter->link_duplex = 0;
+                       /* check for thermal sensor event on i350
+                        * copper only*/
+                       if (hw->mac.type == e1000_i350) {
+                               thstat = rd32(E1000_THSTAT);
+                               ctrl_ext = rd32(E1000_CTRL_EXT);
+                               if ((hw->phy.media_type ==
+                                    e1000_media_type_copper) && !(ctrl_ext &
+                                    E1000_CTRL_EXT_LINK_MODE_SGMII)) {
+                                       if (thstat & E1000_THSTAT_PWR_DOWN) {
+                                               printk(KERN_ERR "igb: %s The "
+                                               "network adapter was stopped "
+                                               "because it overheated.\n",
+                                               netdev->name);
+                                       }
+                               }
+                       }
                        /* Links status message must follow this format */
                        printk(KERN_INFO "igb: %s NIC Link is Down\n",
                               netdev->name);
@@ -4279,7 +4317,7 @@ netdev_tx_t igb_xmit_frame_ring_adv(struct sk_buff *skb,
 
        /*
         * count reflects descriptors mapped, if 0 or less then mapping error
-        * has occured and we need to rewind the descriptor queue
+        * has occurred and we need to rewind the descriptor queue
         */
        count = igb_tx_map_adv(tx_ring, skb, first);
        if (!count) {
@@ -5314,8 +5352,8 @@ static void igb_msg_task(struct igb_adapter *adapter)
  *  The unicast table address is a register array of 32-bit registers.
  *  The table is meant to be used in a way similar to how the MTA is used
  *  however due to certain limitations in the hardware it is necessary to
- *  set all the hash bits to 1 and use the VMOLR ROPE bit as a promiscous
- *  enable bit to allow vlan tag stripping when promiscous mode is enabled
+ *  set all the hash bits to 1 and use the VMOLR ROPE bit as a promiscuous
+ *  enable bit to allow vlan tag stripping when promiscuous mode is enabled
  **/
 static void igb_set_uta(struct igb_adapter *adapter)
 {