aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorJesse Brandeburg <jesse.brandeburg@intel.com>2011-07-19 20:56:21 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-08-04 07:59:07 -0400
commit945a51517cc0bd9e461f2018624dfc1faef9ddee (patch)
tree5782ffe27f3fb8f5b4cbc19ffe7b74bff36c6a05 /drivers/net/e1000e
parentd3e614577198757d5854caa912e88f2d4296479b (diff)
intel drivers: repair missing flush operations
after review of all intel drivers, found several instances where drivers had the incorrect pattern of: memory mapped write(); delay(); which should always be: memory mapped write(); write flush(); /* aka memory mapped read */ delay(); explanation: The reason for including the flush is that writes can be held (posted) in PCI/PCIe bridges, but the read always has to complete synchronously and therefore has to flush all pending writes to a device. If a write is held and followed by a delay, the delay means nothing because the write may not have reached hardware (maybe even not until the next read) Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/es2lan.c2
-rw-r--r--drivers/net/e1000e/ethtool.c9
-rw-r--r--drivers/net/e1000e/ich8lan.c4
-rw-r--r--drivers/net/e1000e/lib.c1
-rw-r--r--drivers/net/e1000e/phy.c2
5 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index c0ecb2d9fdb7..e4f42257c24c 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -1313,6 +1313,7 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
1313 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 1313 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1314 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; 1314 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
1315 ew32(KMRNCTRLSTA, kmrnctrlsta); 1315 ew32(KMRNCTRLSTA, kmrnctrlsta);
1316 e1e_flush();
1316 1317
1317 udelay(2); 1318 udelay(2);
1318 1319
@@ -1347,6 +1348,7 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
1347 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 1348 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1348 E1000_KMRNCTRLSTA_OFFSET) | data; 1349 E1000_KMRNCTRLSTA_OFFSET) | data;
1349 ew32(KMRNCTRLSTA, kmrnctrlsta); 1350 ew32(KMRNCTRLSTA, kmrnctrlsta);
1351 e1e_flush();
1350 1352
1351 udelay(2); 1353 udelay(2);
1352 1354
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index cb1a3623253e..72756e4e6448 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -964,6 +964,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
964 964
965 /* Disable all the interrupts */ 965 /* Disable all the interrupts */
966 ew32(IMC, 0xFFFFFFFF); 966 ew32(IMC, 0xFFFFFFFF);
967 e1e_flush();
967 usleep_range(10000, 20000); 968 usleep_range(10000, 20000);
968 969
969 /* Test each interrupt */ 970 /* Test each interrupt */
@@ -996,6 +997,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
996 adapter->test_icr = 0; 997 adapter->test_icr = 0;
997 ew32(IMC, mask); 998 ew32(IMC, mask);
998 ew32(ICS, mask); 999 ew32(ICS, mask);
1000 e1e_flush();
999 usleep_range(10000, 20000); 1001 usleep_range(10000, 20000);
1000 1002
1001 if (adapter->test_icr & mask) { 1003 if (adapter->test_icr & mask) {
@@ -1014,6 +1016,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1014 adapter->test_icr = 0; 1016 adapter->test_icr = 0;
1015 ew32(IMS, mask); 1017 ew32(IMS, mask);
1016 ew32(ICS, mask); 1018 ew32(ICS, mask);
1019 e1e_flush();
1017 usleep_range(10000, 20000); 1020 usleep_range(10000, 20000);
1018 1021
1019 if (!(adapter->test_icr & mask)) { 1022 if (!(adapter->test_icr & mask)) {
@@ -1032,6 +1035,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1032 adapter->test_icr = 0; 1035 adapter->test_icr = 0;
1033 ew32(IMC, ~mask & 0x00007FFF); 1036 ew32(IMC, ~mask & 0x00007FFF);
1034 ew32(ICS, ~mask & 0x00007FFF); 1037 ew32(ICS, ~mask & 0x00007FFF);
1038 e1e_flush();
1035 usleep_range(10000, 20000); 1039 usleep_range(10000, 20000);
1036 1040
1037 if (adapter->test_icr) { 1041 if (adapter->test_icr) {
@@ -1043,6 +1047,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1043 1047
1044 /* Disable all the interrupts */ 1048 /* Disable all the interrupts */
1045 ew32(IMC, 0xFFFFFFFF); 1049 ew32(IMC, 0xFFFFFFFF);
1050 e1e_flush();
1046 usleep_range(10000, 20000); 1051 usleep_range(10000, 20000);
1047 1052
1048 /* Unhook test interrupt handler */ 1053 /* Unhook test interrupt handler */
@@ -1276,6 +1281,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1276 E1000_CTRL_FD); /* Force Duplex to FULL */ 1281 E1000_CTRL_FD); /* Force Duplex to FULL */
1277 1282
1278 ew32(CTRL, ctrl_reg); 1283 ew32(CTRL, ctrl_reg);
1284 e1e_flush();
1279 udelay(500); 1285 udelay(500);
1280 1286
1281 return 0; 1287 return 0;
@@ -1418,6 +1424,7 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
1418 */ 1424 */
1419#define E1000_SERDES_LB_ON 0x410 1425#define E1000_SERDES_LB_ON 0x410
1420 ew32(SCTL, E1000_SERDES_LB_ON); 1426 ew32(SCTL, E1000_SERDES_LB_ON);
1427 e1e_flush();
1421 usleep_range(10000, 20000); 1428 usleep_range(10000, 20000);
1422 1429
1423 return 0; 1430 return 0;
@@ -1513,6 +1520,7 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
1513 hw->phy.media_type == e1000_media_type_internal_serdes) { 1520 hw->phy.media_type == e1000_media_type_internal_serdes) {
1514#define E1000_SERDES_LB_OFF 0x400 1521#define E1000_SERDES_LB_OFF 0x400
1515 ew32(SCTL, E1000_SERDES_LB_OFF); 1522 ew32(SCTL, E1000_SERDES_LB_OFF);
1523 e1e_flush();
1516 usleep_range(10000, 20000); 1524 usleep_range(10000, 20000);
1517 break; 1525 break;
1518 } 1526 }
@@ -1592,6 +1600,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1592 k = 0; 1600 k = 0;
1593 } 1601 }
1594 ew32(TDT, k); 1602 ew32(TDT, k);
1603 e1e_flush();
1595 msleep(200); 1604 msleep(200);
1596 time = jiffies; /* set the start time for the receive */ 1605 time = jiffies; /* set the start time for the receive */
1597 good_cnt = 0; 1606 good_cnt = 0;
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index c1752124f3cd..f7a75c1531ad 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -283,6 +283,7 @@ static void e1000_toggle_lanphypc_value_ich8lan(struct e1000_hw *hw)
283 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; 283 ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE;
284 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; 284 ctrl &= ~E1000_CTRL_LANPHYPC_VALUE;
285 ew32(CTRL, ctrl); 285 ew32(CTRL, ctrl);
286 e1e_flush();
286 udelay(10); 287 udelay(10);
287 ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; 288 ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE;
288 ew32(CTRL, ctrl); 289 ew32(CTRL, ctrl);
@@ -1230,9 +1231,11 @@ s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable)
1230 ew32(CTRL, reg); 1231 ew32(CTRL, reg);
1231 1232
1232 ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS); 1233 ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS);
1234 e1e_flush();
1233 udelay(20); 1235 udelay(20);
1234 ew32(CTRL, ctrl_reg); 1236 ew32(CTRL, ctrl_reg);
1235 ew32(CTRL_EXT, ctrl_ext); 1237 ew32(CTRL_EXT, ctrl_ext);
1238 e1e_flush();
1236 udelay(20); 1239 udelay(20);
1237 1240
1238out: 1241out:
@@ -3090,6 +3093,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
3090 ret_val = e1000_acquire_swflag_ich8lan(hw); 3093 ret_val = e1000_acquire_swflag_ich8lan(hw);
3091 e_dbg("Issuing a global reset to ich8lan\n"); 3094 e_dbg("Issuing a global reset to ich8lan\n");
3092 ew32(CTRL, (ctrl | E1000_CTRL_RST)); 3095 ew32(CTRL, (ctrl | E1000_CTRL_RST));
3096 /* cannot issue a flush here because it hangs the hardware */
3093 msleep(20); 3097 msleep(20);
3094 3098
3095 if (!ret_val) 3099 if (!ret_val)
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 65580b405942..7898a67d6505 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -1986,6 +1986,7 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
1986 /* Clear SK and CS */ 1986 /* Clear SK and CS */
1987 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); 1987 eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
1988 ew32(EECD, eecd); 1988 ew32(EECD, eecd);
1989 e1e_flush();
1989 udelay(1); 1990 udelay(1);
1990 1991
1991 /* 1992 /*
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 2a6ee13285b1..8666476cb9be 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -537,6 +537,7 @@ static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data,
537 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 537 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
538 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; 538 E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
539 ew32(KMRNCTRLSTA, kmrnctrlsta); 539 ew32(KMRNCTRLSTA, kmrnctrlsta);
540 e1e_flush();
540 541
541 udelay(2); 542 udelay(2);
542 543
@@ -609,6 +610,7 @@ static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data,
609 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & 610 kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
610 E1000_KMRNCTRLSTA_OFFSET) | data; 611 E1000_KMRNCTRLSTA_OFFSET) | data;
611 ew32(KMRNCTRLSTA, kmrnctrlsta); 612 ew32(KMRNCTRLSTA, kmrnctrlsta);
613 e1e_flush();
612 614
613 udelay(2); 615 udelay(2);
614 616