aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/net/igb/e1000_defines.h7
-rw-r--r--drivers/net/igb/e1000_regs.h4
-rw-r--r--drivers/net/igb/igb.h1
-rw-r--r--drivers/net/igb/igb_ethtool.c53
-rw-r--r--drivers/net/igb/igb_main.c131
5 files changed, 193 insertions, 3 deletions
diff --git a/drivers/net/igb/e1000_defines.h b/drivers/net/igb/e1000_defines.h
index c58c4fdfee0c..6e036ae3138f 100644
--- a/drivers/net/igb/e1000_defines.h
+++ b/drivers/net/igb/e1000_defines.h
@@ -330,6 +330,7 @@
330#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */ 330#define E1000_ICR_RXDMT0 0x00000010 /* rx desc min. threshold (0) */
331#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */ 331#define E1000_ICR_RXT0 0x00000080 /* rx timer intr (ring 0) */
332#define E1000_ICR_VMMB 0x00000100 /* VM MB event */ 332#define E1000_ICR_VMMB 0x00000100 /* VM MB event */
333#define E1000_ICR_DRSTA 0x40000000 /* Device Reset Asserted */
333/* If this bit asserted, the driver should claim the interrupt */ 334/* If this bit asserted, the driver should claim the interrupt */
334#define E1000_ICR_INT_ASSERTED 0x80000000 335#define E1000_ICR_INT_ASSERTED 0x80000000
335/* LAN connected device generates an interrupt */ 336/* LAN connected device generates an interrupt */
@@ -371,6 +372,7 @@
371#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */ 372#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* rx sequence error */
372#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ 373#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
373#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */ 374#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* rx timer intr */
375#define E1000_IMS_DRSTA E1000_ICR_DRSTA /* Device Reset Asserted */
374#define E1000_IMS_DOUTSYNC E1000_ICR_DOUTSYNC /* NIC DMA out of sync */ 376#define E1000_IMS_DOUTSYNC E1000_ICR_DOUTSYNC /* NIC DMA out of sync */
375 377
376/* Extended Interrupt Mask Set */ 378/* Extended Interrupt Mask Set */
@@ -379,6 +381,7 @@
379/* Interrupt Cause Set */ 381/* Interrupt Cause Set */
380#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ 382#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
381#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ 383#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */
384#define E1000_ICS_DRSTA E1000_ICR_DRSTA /* Device Reset Aserted */
382 385
383/* Extended Interrupt Cause Set */ 386/* Extended Interrupt Cause Set */
384 387
@@ -717,4 +720,8 @@
717#define E1000_VFTA_ENTRY_MASK 0x7F 720#define E1000_VFTA_ENTRY_MASK 0x7F
718#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F 721#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F
719 722
723/* DMA Coalescing register fields */
724#define E1000_PCIEMISC_LX_DECISION 0x00000080 /* Lx power decision based
725 on DMA coal */
726
720#endif 727#endif
diff --git a/drivers/net/igb/e1000_regs.h b/drivers/net/igb/e1000_regs.h
index 409c44b4d779..dd4e6ffd29f5 100644
--- a/drivers/net/igb/e1000_regs.h
+++ b/drivers/net/igb/e1000_regs.h
@@ -89,6 +89,8 @@
89#define E1000_SYSTIML 0x0B600 /* System time register Low - RO */ 89#define E1000_SYSTIML 0x0B600 /* System time register Low - RO */
90#define E1000_SYSTIMH 0x0B604 /* System time register High - RO */ 90#define E1000_SYSTIMH 0x0B604 /* System time register High - RO */
91#define E1000_TIMINCA 0x0B608 /* Increment attributes register - RW */ 91#define E1000_TIMINCA 0x0B608 /* Increment attributes register - RW */
92#define E1000_TSAUXC 0x0B640 /* Timesync Auxiliary Control register */
93#define E1000_SYSTIMR 0x0B6F8 /* System time register Residue */
92 94
93/* Filtering Registers */ 95/* Filtering Registers */
94#define E1000_SAQF(_n) (0x5980 + 4 * (_n)) 96#define E1000_SAQF(_n) (0x5980 + 4 * (_n))
@@ -318,4 +320,6 @@
318#define array_rd32(reg, offset) \ 320#define array_rd32(reg, offset) \
319 (readl(hw->hw_addr + reg + ((offset) << 2))) 321 (readl(hw->hw_addr + reg + ((offset) << 2)))
320 322
323/* DMA Coalescing registers */
324#define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */
321#endif 325#endif
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index 63abd1c0d75e..c458d9b188ba 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -320,6 +320,7 @@ struct igb_adapter {
320#define IGB_FLAG_QUEUE_PAIRS (1 << 3) 320#define IGB_FLAG_QUEUE_PAIRS (1 << 3)
321 321
322#define IGB_82576_TSYNC_SHIFT 19 322#define IGB_82576_TSYNC_SHIFT 19
323#define IGB_82580_TSYNC_SHIFT 24
323enum e1000_state_t { 324enum e1000_state_t {
324 __IGB_TESTING, 325 __IGB_TESTING,
325 __IGB_RESETTING, 326 __IGB_RESETTING,
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 2e238bfa1f91..ac9d5272650d 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -881,6 +881,49 @@ struct igb_reg_test {
881#define TABLE64_TEST_LO 5 881#define TABLE64_TEST_LO 5
882#define TABLE64_TEST_HI 6 882#define TABLE64_TEST_HI 6
883 883
884/* 82580 reg test */
885static struct igb_reg_test reg_test_82580[] = {
886 { E1000_FCAL, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
887 { E1000_FCAH, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF },
888 { E1000_FCT, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF },
889 { E1000_VET, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
890 { E1000_RDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
891 { E1000_RDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
892 { E1000_RDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
893 { E1000_RDBAL(4), 0x40, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
894 { E1000_RDBAH(4), 0x40, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
895 { E1000_RDLEN(4), 0x40, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
896 /* RDH is read-only for 82580, only test RDT. */
897 { E1000_RDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
898 { E1000_RDT(4), 0x40, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
899 { E1000_FCRTH, 0x100, 1, PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 },
900 { E1000_FCTTV, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
901 { E1000_TIPG, 0x100, 1, PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF },
902 { E1000_TDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
903 { E1000_TDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
904 { E1000_TDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
905 { E1000_TDBAL(4), 0x40, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
906 { E1000_TDBAH(4), 0x40, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
907 { E1000_TDLEN(4), 0x40, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
908 { E1000_TDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
909 { E1000_TDT(4), 0x40, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
910 { E1000_RCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 },
911 { E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0x003FFFFB },
912 { E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0xFFFFFFFF },
913 { E1000_TCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 },
914 { E1000_RA, 0, 16, TABLE64_TEST_LO,
915 0xFFFFFFFF, 0xFFFFFFFF },
916 { E1000_RA, 0, 16, TABLE64_TEST_HI,
917 0x83FFFFFF, 0xFFFFFFFF },
918 { E1000_RA2, 0, 8, TABLE64_TEST_LO,
919 0xFFFFFFFF, 0xFFFFFFFF },
920 { E1000_RA2, 0, 8, TABLE64_TEST_HI,
921 0x83FFFFFF, 0xFFFFFFFF },
922 { E1000_MTA, 0, 128, TABLE32_TEST,
923 0xFFFFFFFF, 0xFFFFFFFF },
924 { 0, 0, 0, 0 }
925};
926
884/* 82576 reg test */ 927/* 82576 reg test */
885static struct igb_reg_test reg_test_82576[] = { 928static struct igb_reg_test reg_test_82576[] = {
886 { E1000_FCAL, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, 929 { E1000_FCAL, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
@@ -1013,6 +1056,10 @@ static int igb_reg_test(struct igb_adapter *adapter, u64 *data)
1013 u32 i, toggle; 1056 u32 i, toggle;
1014 1057
1015 switch (adapter->hw.mac.type) { 1058 switch (adapter->hw.mac.type) {
1059 case e1000_82580:
1060 test = reg_test_82580;
1061 toggle = 0x7FEFF3FF;
1062 break;
1016 case e1000_82576: 1063 case e1000_82576:
1017 test = reg_test_82576; 1064 test = reg_test_82576;
1018 toggle = 0x7FFFF3FF; 1065 toggle = 0x7FFFF3FF;
@@ -1167,6 +1214,9 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
1167 case e1000_82576: 1214 case e1000_82576:
1168 ics_mask = 0x77D4FBFD; 1215 ics_mask = 0x77D4FBFD;
1169 break; 1216 break;
1217 case e1000_82580:
1218 ics_mask = 0x77DCFED5;
1219 break;
1170 default: 1220 default:
1171 ics_mask = 0x7FFFFFFF; 1221 ics_mask = 0x7FFFFFFF;
1172 break; 1222 break;
@@ -1338,6 +1388,9 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
1338 igb_write_phy_reg(hw, PHY_CONTROL, 0x9140); 1388 igb_write_phy_reg(hw, PHY_CONTROL, 0x9140);
1339 /* autoneg off */ 1389 /* autoneg off */
1340 igb_write_phy_reg(hw, PHY_CONTROL, 0x8140); 1390 igb_write_phy_reg(hw, PHY_CONTROL, 0x8140);
1391 } else if (hw->phy.type == e1000_phy_82580) {
1392 /* enable MII loopback */
1393 igb_write_phy_reg(hw, I82580_PHY_LBK_CTRL, 0x8041);
1341 } 1394 }
1342 1395
1343 ctrl_reg = rd32(E1000_CTRL); 1396 ctrl_reg = rd32(E1000_CTRL);
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));