aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/igb_main.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-11-19 07:42:21 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-20 13:00:13 -0500
commit55cac248caa4a5f181a11cd2f269a672bef3d3b5 (patch)
treea4eec7f298d197646124346e5bb7cb9eb4de2586 /drivers/net/igb/igb_main.c
parentbb2ac47bcfd47ed9431ff1676ec8d79250c941c9 (diff)
igb: Add full support for 82580 devices
This patch makes use of the 82580 PHY and MAC support added and adds a set of supported device IDs for said hardware. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb/igb_main.c')
-rw-r--r--drivers/net/igb/igb_main.c131
1 files changed, 128 insertions, 3 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 958305e92d67..bb1a6eeade06 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -49,7 +49,7 @@
49#endif 49#endif
50#include "igb.h" 50#include "igb.h"
51 51
52#define DRV_VERSION "1.3.16-k2" 52#define DRV_VERSION "2.1.0-k2"
53char igb_driver_name[] = "igb"; 53char igb_driver_name[] = "igb";
54char igb_driver_version[] = DRV_VERSION; 54char igb_driver_version[] = DRV_VERSION;
55static const char igb_driver_string[] = 55static const char igb_driver_string[] =
@@ -61,6 +61,11 @@ static const struct e1000_info *igb_info_tbl[] = {
61}; 61};
62 62
63static struct pci_device_id igb_pci_tbl[] = { 63static struct pci_device_id igb_pci_tbl[] = {
64 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER), board_82575 },
65 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_FIBER), board_82575 },
66 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SERDES), board_82575 },
67 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SGMII), board_82575 },
68 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER_DUAL), board_82575 },
64 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 }, 69 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 },
65 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS), board_82575 }, 70 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS), board_82575 },
66 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS_SERDES), board_82575 }, 71 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_NS_SERDES), board_82575 },
@@ -195,6 +200,16 @@ static cycle_t igb_read_clock(const struct cyclecounter *tc)
195 u64 stamp = 0; 200 u64 stamp = 0;
196 int shift = 0; 201 int shift = 0;
197 202
203 /*
204 * The timestamp latches on lowest register read. For the 82580
205 * the lowest register is SYSTIMR instead of SYSTIML. However we never
206 * adjusted TIMINCA so SYSTIMR will just read as all 0s so ignore it.
207 */
208 if (hw->mac.type == e1000_82580) {
209 stamp = rd32(E1000_SYSTIMR) >> 8;
210 shift = IGB_82580_TSYNC_SHIFT;
211 }
212
198 stamp |= (u64)rd32(E1000_SYSTIML) << shift; 213 stamp |= (u64)rd32(E1000_SYSTIML) << shift;
199 stamp |= (u64)rd32(E1000_SYSTIMH) << (shift + 32); 214 stamp |= (u64)rd32(E1000_SYSTIMH) << (shift + 32);
200 return stamp; 215 return stamp;
@@ -304,6 +319,7 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
304 Q_IDX_82576(j); 319 Q_IDX_82576(j);
305 } 320 }
306 case e1000_82575: 321 case e1000_82575:
322 case e1000_82580:
307 default: 323 default:
308 for (; i < adapter->num_rx_queues; i++) 324 for (; i < adapter->num_rx_queues; i++)
309 adapter->rx_ring[i].reg_idx = rbase_offset + i; 325 adapter->rx_ring[i].reg_idx = rbase_offset + i;
@@ -443,6 +459,39 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
443 } 459 }
444 q_vector->eims_value = 1 << msix_vector; 460 q_vector->eims_value = 1 << msix_vector;
445 break; 461 break;
462 case e1000_82580:
463 /* 82580 uses the same table-based approach as 82576 but has fewer
464 entries as a result we carry over for queues greater than 4. */
465 if (rx_queue > IGB_N0_QUEUE) {
466 index = (rx_queue >> 1);
467 ivar = array_rd32(E1000_IVAR0, index);
468 if (rx_queue & 0x1) {
469 /* vector goes into third byte of register */
470 ivar = ivar & 0xFF00FFFF;
471 ivar |= (msix_vector | E1000_IVAR_VALID) << 16;
472 } else {
473 /* vector goes into low byte of register */
474 ivar = ivar & 0xFFFFFF00;
475 ivar |= msix_vector | E1000_IVAR_VALID;
476 }
477 array_wr32(E1000_IVAR0, index, ivar);
478 }
479 if (tx_queue > IGB_N0_QUEUE) {
480 index = (tx_queue >> 1);
481 ivar = array_rd32(E1000_IVAR0, index);
482 if (tx_queue & 0x1) {
483 /* vector goes into high byte of register */
484 ivar = ivar & 0x00FFFFFF;
485 ivar |= (msix_vector | E1000_IVAR_VALID) << 24;
486 } else {
487 /* vector goes into second byte of register */
488 ivar = ivar & 0xFFFF00FF;
489 ivar |= (msix_vector | E1000_IVAR_VALID) << 8;
490 }
491 array_wr32(E1000_IVAR0, index, ivar);
492 }
493 q_vector->eims_value = 1 << msix_vector;
494 break;
446 default: 495 default:
447 BUG(); 496 BUG();
448 break; 497 break;
@@ -484,6 +533,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
484 break; 533 break;
485 534
486 case e1000_82576: 535 case e1000_82576:
536 case e1000_82580:
487 /* Turn on MSI-X capability first, or our settings 537 /* Turn on MSI-X capability first, or our settings
488 * won't stick. And it will take days to debug. */ 538 * won't stick. And it will take days to debug. */
489 wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE | 539 wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE |
@@ -866,6 +916,7 @@ static int igb_request_irq(struct igb_adapter *adapter)
866 E1000_EICR_TX_QUEUE0 | 916 E1000_EICR_TX_QUEUE0 |
867 E1000_EIMS_OTHER)); 917 E1000_EIMS_OTHER));
868 break; 918 break;
919 case e1000_82580:
869 case e1000_82576: 920 case e1000_82576:
870 wr32(E1000_IVAR0, E1000_IVAR_VALID); 921 wr32(E1000_IVAR0, E1000_IVAR_VALID);
871 break; 922 break;
@@ -959,10 +1010,15 @@ static void igb_irq_enable(struct igb_adapter *adapter)
959 wr32(E1000_MBVFIMR, 0xFF); 1010 wr32(E1000_MBVFIMR, 0xFF);
960 ims |= E1000_IMS_VMMB; 1011 ims |= E1000_IMS_VMMB;
961 } 1012 }
1013 if (adapter->hw.mac.type == e1000_82580)
1014 ims |= E1000_IMS_DRSTA;
1015
962 wr32(E1000_IMS, ims); 1016 wr32(E1000_IMS, ims);
963 } else { 1017 } else {
964 wr32(E1000_IMS, IMS_ENABLE_MASK); 1018 wr32(E1000_IMS, IMS_ENABLE_MASK |
965 wr32(E1000_IAM, IMS_ENABLE_MASK); 1019 E1000_IMS_DRSTA);
1020 wr32(E1000_IAM, IMS_ENABLE_MASK |
1021 E1000_IMS_DRSTA);
966 } 1022 }
967} 1023}
968 1024
@@ -1184,6 +1240,10 @@ void igb_reset(struct igb_adapter *adapter)
1184 * To take effect CTRL.RST is required. 1240 * To take effect CTRL.RST is required.
1185 */ 1241 */
1186 switch (mac->type) { 1242 switch (mac->type) {
1243 case e1000_82580:
1244 pba = rd32(E1000_RXPBS);
1245 pba = igb_rxpbs_adjust_82580(pba);
1246 break;
1187 case e1000_82576: 1247 case e1000_82576:
1188 pba = rd32(E1000_RXPBS); 1248 pba = rd32(E1000_RXPBS);
1189 pba &= E1000_RXPBS_SIZE_MASK_82576; 1249 pba &= E1000_RXPBS_SIZE_MASK_82576;
@@ -1278,6 +1338,11 @@ void igb_reset(struct igb_adapter *adapter)
1278 if (hw->mac.ops.init_hw(hw)) 1338 if (hw->mac.ops.init_hw(hw))
1279 dev_err(&pdev->dev, "Hardware Error\n"); 1339 dev_err(&pdev->dev, "Hardware Error\n");
1280 1340
1341 if (hw->mac.type == e1000_82580) {
1342 u32 reg = rd32(E1000_PCIEMISC);
1343 wr32(E1000_PCIEMISC,
1344 reg & ~E1000_PCIEMISC_LX_DECISION);
1345 }
1281 igb_update_mng_vlan(adapter); 1346 igb_update_mng_vlan(adapter);
1282 1347
1283 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 1348 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
@@ -1508,6 +1573,10 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1508 1573
1509 if (hw->bus.func == 0) 1574 if (hw->bus.func == 0)
1510 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); 1575 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
1576 else if (hw->mac.type == e1000_82580)
1577 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A +
1578 NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1,
1579 &eeprom_data);
1511 else if (hw->bus.func == 1) 1580 else if (hw->bus.func == 1)
1512 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); 1581 hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
1513 1582
@@ -1746,6 +1815,48 @@ static void igb_init_hw_timer(struct igb_adapter *adapter)
1746 struct e1000_hw *hw = &adapter->hw; 1815 struct e1000_hw *hw = &adapter->hw;
1747 1816
1748 switch (hw->mac.type) { 1817 switch (hw->mac.type) {
1818 case e1000_82580:
1819 memset(&adapter->cycles, 0, sizeof(adapter->cycles));
1820 adapter->cycles.read = igb_read_clock;
1821 adapter->cycles.mask = CLOCKSOURCE_MASK(64);
1822 adapter->cycles.mult = 1;
1823 /*
1824 * The 82580 timesync updates the system timer every 8ns by 8ns
1825 * and the value cannot be shifted. Instead we need to shift
1826 * the registers to generate a 64bit timer value. As a result
1827 * SYSTIMR/L/H, TXSTMPL/H, RXSTMPL/H all have to be shifted by
1828 * 24 in order to generate a larger value for synchronization.
1829 */
1830 adapter->cycles.shift = IGB_82580_TSYNC_SHIFT;
1831 /* disable system timer temporarily by setting bit 31 */
1832 wr32(E1000_TSAUXC, 0x80000000);
1833 wrfl();
1834
1835 /* Set registers so that rollover occurs soon to test this. */
1836 wr32(E1000_SYSTIMR, 0x00000000);
1837 wr32(E1000_SYSTIML, 0x80000000);
1838 wr32(E1000_SYSTIMH, 0x000000FF);
1839 wrfl();
1840
1841 /* enable system timer by clearing bit 31 */
1842 wr32(E1000_TSAUXC, 0x0);
1843 wrfl();
1844
1845 timecounter_init(&adapter->clock,
1846 &adapter->cycles,
1847 ktime_to_ns(ktime_get_real()));
1848 /*
1849 * Synchronize our NIC clock against system wall clock. NIC
1850 * time stamp reading requires ~3us per sample, each sample
1851 * was pretty stable even under load => only require 10
1852 * samples for each offset comparison.
1853 */
1854 memset(&adapter->compare, 0, sizeof(adapter->compare));
1855 adapter->compare.source = &adapter->clock;
1856 adapter->compare.target = ktime_get_real;
1857 adapter->compare.num_samples = 10;
1858 timecompare_update(&adapter->compare, 0);
1859 break;
1749 case e1000_82576: 1860 case e1000_82576:
1750 /* 1861 /*
1751 * Initialize hardware timer: we keep it running just in case 1862 * Initialize hardware timer: we keep it running just in case
@@ -2217,6 +2328,10 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
2217 if (adapter->vfs_allocated_count) { 2328 if (adapter->vfs_allocated_count) {
2218 /* 82575 and 82576 supports 2 RSS queues for VMDq */ 2329 /* 82575 and 82576 supports 2 RSS queues for VMDq */
2219 switch (hw->mac.type) { 2330 switch (hw->mac.type) {
2331 case e1000_82580:
2332 num_rx_queues = 1;
2333 shift = 0;
2334 break;
2220 case e1000_82576: 2335 case e1000_82576:
2221 shift = 3; 2336 shift = 3;
2222 num_rx_queues = 2; 2337 num_rx_queues = 2;
@@ -3694,6 +3809,9 @@ static void igb_tx_timeout(struct net_device *netdev)
3694 /* Do the reset outside of interrupt context */ 3809 /* Do the reset outside of interrupt context */
3695 adapter->tx_timeout_count++; 3810 adapter->tx_timeout_count++;
3696 3811
3812 if (hw->mac.type == e1000_82580)
3813 hw->dev_spec._82575.global_device_reset = true;
3814
3697 schedule_work(&adapter->reset_task); 3815 schedule_work(&adapter->reset_task);
3698 wr32(E1000_EICS, 3816 wr32(E1000_EICS,
3699 (adapter->eims_enable_mask & ~adapter->eims_other)); 3817 (adapter->eims_enable_mask & ~adapter->eims_other));
@@ -4700,6 +4818,13 @@ static void igb_systim_to_hwtstamp(struct igb_adapter *adapter,
4700{ 4818{
4701 u64 ns; 4819 u64 ns;
4702 4820
4821 /*
4822 * The 82580 starts with 1ns at bit 0 in RX/TXSTMPL, shift this up to
4823 * 24 to match clock shift we setup earlier.
4824 */
4825 if (adapter->hw.mac.type == e1000_82580)
4826 regval <<= IGB_82580_TSYNC_SHIFT;
4827
4703 ns = timecounter_cyc2time(&adapter->clock, regval); 4828 ns = timecounter_cyc2time(&adapter->clock, regval);
4704 timecompare_update(&adapter->compare, ns); 4829 timecompare_update(&adapter->compare, ns);
4705 memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps)); 4830 memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps));