e1000e: Move pm_qos_req to e1000e adapter
[deliverable/linux.git] / drivers / net / ethernet / intel / e1000e / netdev.c
index 1e8c40fd5c3d8fbc582dc19c4f71766023901968..c509a5c900f5253973b24c9f966cb95f2fe1a2bc 100644 (file)
@@ -70,6 +70,7 @@ static const struct e1000_info *e1000_info_tbl[] = {
        [board_pchlan]          = &e1000_pch_info,
        [board_pch2lan]         = &e1000_pch2_info,
        [board_pch_lpt]         = &e1000_pch_lpt_info,
+       [board_pch_spt]         = &e1000_pch_spt_info,
 };
 
 struct e1000_reg_info {
@@ -946,7 +947,7 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done,
                if (*work_done >= work_to_do)
                        break;
                (*work_done)++;
-               rmb();  /* read descriptor and rx_buffer_info after status DD */
+               dma_rmb();      /* read descriptor and rx_buffer_info after status DD */
 
                skb = buffer_info->skb;
                buffer_info->skb = NULL;
@@ -1231,7 +1232,7 @@ static bool e1000_clean_tx_irq(struct e1000_ring *tx_ring)
               (count < tx_ring->count)) {
                bool cleaned = false;
 
-               rmb();          /* read buffer_info after eop_desc */
+               dma_rmb();              /* read buffer_info after eop_desc */
                for (; !cleaned; count++) {
                        tx_desc = E1000_TX_DESC(*tx_ring, i);
                        buffer_info = &tx_ring->buffer_info[i];
@@ -1331,7 +1332,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_ring *rx_ring, int *work_done,
                        break;
                (*work_done)++;
                skb = buffer_info->skb;
-               rmb();  /* read descriptor and rx_buffer_info after status DD */
+               dma_rmb();      /* read descriptor and rx_buffer_info after status DD */
 
                /* in the packet split case this is header only */
                prefetch(skb->data - NET_IP_ALIGN);
@@ -1535,7 +1536,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done,
                if (*work_done >= work_to_do)
                        break;
                (*work_done)++;
-               rmb();  /* read descriptor and rx_buffer_info after status DD */
+               dma_rmb();      /* read descriptor and rx_buffer_info after status DD */
 
                skb = buffer_info->skb;
                buffer_info->skb = NULL;
@@ -1796,7 +1797,8 @@ static irqreturn_t e1000_intr_msi(int __always_unused irq, void *data)
        }
 
        /* Reset on uncorrectable ECC error */
-       if ((icr & E1000_ICR_ECCER) && (hw->mac.type == e1000_pch_lpt)) {
+       if ((icr & E1000_ICR_ECCER) && ((hw->mac.type == e1000_pch_lpt) ||
+                                       (hw->mac.type == e1000_pch_spt))) {
                u32 pbeccsts = er32(PBECCSTS);
 
                adapter->corr_errors +=
@@ -1876,7 +1878,8 @@ static irqreturn_t e1000_intr(int __always_unused irq, void *data)
        }
 
        /* Reset on uncorrectable ECC error */
-       if ((icr & E1000_ICR_ECCER) && (hw->mac.type == e1000_pch_lpt)) {
+       if ((icr & E1000_ICR_ECCER) && ((hw->mac.type == e1000_pch_lpt) ||
+                                       (hw->mac.type == e1000_pch_spt))) {
                u32 pbeccsts = er32(PBECCSTS);
 
                adapter->corr_errors +=
@@ -2257,7 +2260,8 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
        if (adapter->msix_entries) {
                ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574);
                ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC);
-       } else if (hw->mac.type == e1000_pch_lpt) {
+       } else if ((hw->mac.type == e1000_pch_lpt) ||
+                  (hw->mac.type == e1000_pch_spt)) {
                ew32(IMS, IMS_ENABLE_MASK | E1000_IMS_ECCER);
        } else {
                ew32(IMS, IMS_ENABLE_MASK);
@@ -3014,6 +3018,19 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
        ew32(TCTL, tctl);
 
        hw->mac.ops.config_collision_dist(hw);
+
+       /* SPT Si errata workaround to avoid data corruption */
+       if (hw->mac.type == e1000_pch_spt) {
+               u32 reg_val;
+
+               reg_val = er32(IOSFPC);
+               reg_val |= E1000_RCTL_RDMTS_HEX;
+               ew32(IOSFPC, reg_val);
+
+               reg_val = er32(TARC(0));
+               reg_val |= E1000_TARC0_CB_MULTIQ_3_REQ;
+               ew32(TARC(0), reg_val);
+       }
 }
 
 /**
@@ -3280,9 +3297,9 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
                        ew32(RXDCTL(0), rxdctl | 0x3);
                }
 
-               pm_qos_update_request(&adapter->netdev->pm_qos_req, lat);
+               pm_qos_update_request(&adapter->pm_qos_req, lat);
        } else {
-               pm_qos_update_request(&adapter->netdev->pm_qos_req,
+               pm_qos_update_request(&adapter->pm_qos_req,
                                      PM_QOS_DEFAULT_VALUE);
        }
 
@@ -3490,8 +3507,11 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
        struct e1000_hw *hw = &adapter->hw;
        u32 incvalue, incperiod, shift;
 
-       /* Make sure clock is enabled on I217 before checking the frequency */
-       if ((hw->mac.type == e1000_pch_lpt) &&
+       /* Make sure clock is enabled on I217/I218/I219  before checking
+        * the frequency
+        */
+       if (((hw->mac.type == e1000_pch_lpt) ||
+            (hw->mac.type == e1000_pch_spt)) &&
            !(er32(TSYNCTXCTL) & E1000_TSYNCTXCTL_ENABLED) &&
            !(er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_ENABLED)) {
                u32 fextnvm7 = er32(FEXTNVM7);
@@ -3505,10 +3525,13 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
        switch (hw->mac.type) {
        case e1000_pch2lan:
        case e1000_pch_lpt:
-               /* On I217, the clock frequency is 25MHz or 96MHz as
-                * indicated by the System Clock Frequency Indication
+       case e1000_pch_spt:
+               /* On I217, I218 and I219, the clock frequency is 25MHz
+                * or 96MHz as indicated by the System Clock Frequency
+                * Indication
                 */
-               if ((hw->mac.type != e1000_pch_lpt) ||
+               if (((hw->mac.type != e1000_pch_lpt) &&
+                    (hw->mac.type != e1000_pch_spt)) ||
                    (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)) {
                        /* Stable 96MHz frequency */
                        incperiod = INCPERIOD_96MHz;
@@ -3875,6 +3898,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
                break;
        case e1000_pch2lan:
        case e1000_pch_lpt:
+       case e1000_pch_spt:
                fc->refresh_time = 0x0400;
 
                if (adapter->netdev->mtu <= ETH_DATA_LEN) {
@@ -4060,6 +4084,8 @@ void e1000e_down(struct e1000_adapter *adapter, bool reset)
         */
        set_bit(__E1000_DOWN, &adapter->state);
 
+       netif_carrier_off(netdev);
+
        /* disable receives in the hardware */
        rctl = er32(RCTL);
        if (!(adapter->flags2 & FLAG2_NO_DISABLE_RX))
@@ -4084,8 +4110,6 @@ void e1000e_down(struct e1000_adapter *adapter, bool reset)
        del_timer_sync(&adapter->watchdog_timer);
        del_timer_sync(&adapter->phy_info_timer);
 
-       netif_carrier_off(netdev);
-
        spin_lock(&adapter->stats64_lock);
        e1000e_update_stats(adapter);
        spin_unlock(&adapter->stats64_lock);
@@ -4379,7 +4403,7 @@ static int e1000_open(struct net_device *netdev)
                e1000_update_mng_vlan(adapter);
 
        /* DMA latency requirement to workaround jumbo issue */
-       pm_qos_add_request(&adapter->netdev->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
+       pm_qos_add_request(&adapter->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
                           PM_QOS_DEFAULT_VALUE);
 
        /* before we allocate an interrupt, we must be ready to handle it.
@@ -4490,7 +4514,7 @@ static int e1000_close(struct net_device *netdev)
            !test_bit(__E1000_TESTING, &adapter->state))
                e1000e_release_hw_control(adapter);
 
-       pm_qos_remove_request(&adapter->netdev->pm_qos_req);
+       pm_qos_remove_request(&adapter->pm_qos_req);
 
        pm_runtime_put_sync(&pdev->dev);
 
@@ -4759,7 +4783,8 @@ static void e1000e_update_stats(struct e1000_adapter *adapter)
        adapter->stats.mgpdc += er32(MGTPDC);
 
        /* Correctable ECC Errors */
-       if (hw->mac.type == e1000_pch_lpt) {
+       if ((hw->mac.type == e1000_pch_lpt) ||
+           (hw->mac.type == e1000_pch_spt)) {
                u32 pbeccsts = er32(PBECCSTS);
 
                adapter->corr_errors +=
@@ -6144,7 +6169,8 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
 
        if (adapter->hw.phy.type == e1000_phy_igp_3) {
                e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw);
-       } else if (hw->mac.type == e1000_pch_lpt) {
+       } else if ((hw->mac.type == e1000_pch_lpt) ||
+                  (hw->mac.type == e1000_pch_spt)) {
                if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC)))
                        /* ULP does not support wake from unicast, multicast
                         * or broadcast.
@@ -6807,7 +6833,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto err_ioremap;
 
        if ((adapter->flags & FLAG_HAS_FLASH) &&
-           (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
+           (pci_resource_flags(pdev, 1) & IORESOURCE_MEM) &&
+           (hw->mac.type < e1000_pch_spt)) {
                flash_start = pci_resource_start(pdev, 1);
                flash_len = pci_resource_len(pdev, 1);
                adapter->hw.flash_address = ioremap(flash_start, flash_len);
@@ -6847,7 +6874,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto err_hw_init;
 
        if ((adapter->flags & FLAG_IS_ICH) &&
-           (adapter->flags & FLAG_READ_ONLY_NVM))
+           (adapter->flags & FLAG_READ_ONLY_NVM) &&
+           (hw->mac.type < e1000_pch_spt))
                e1000e_write_protect_nvm_ich8lan(&adapter->hw);
 
        hw->mac.ops.get_bus_info(&adapter->hw);
@@ -7043,7 +7071,7 @@ err_hw_init:
        kfree(adapter->tx_ring);
        kfree(adapter->rx_ring);
 err_sw_init:
-       if (adapter->hw.flash_address)
+       if ((adapter->hw.flash_address) && (hw->mac.type < e1000_pch_spt))
                iounmap(adapter->hw.flash_address);
        e1000e_reset_interrupt_capability(adapter);
 err_flashmap:
@@ -7116,7 +7144,8 @@ static void e1000_remove(struct pci_dev *pdev)
        kfree(adapter->rx_ring);
 
        iounmap(adapter->hw.hw_addr);
-       if (adapter->hw.flash_address)
+       if ((adapter->hw.flash_address) &&
+           (adapter->hw.mac.type < e1000_pch_spt))
                iounmap(adapter->hw.flash_address);
        pci_release_selected_regions(pdev,
                                     pci_select_bars(pdev, IORESOURCE_MEM));
@@ -7213,6 +7242,10 @@ static const struct pci_device_id e1000_pci_tbl[] = {
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_I218_V2), board_pch_lpt },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_I218_LM3), board_pch_lpt },
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_I218_V3), board_pch_lpt },
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_SPT_I219_LM), board_pch_spt },
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_SPT_I219_V), board_pch_spt },
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_SPT_I219_LM2), board_pch_spt },
+       { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_SPT_I219_V2), board_pch_spt },
 
        { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */
 };
This page took 0.036894 seconds and 5 git commands to generate.