diff options
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r-- | drivers/net/e1000/e1000.h | 2 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 52 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_hw.c | 1024 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_hw.h | 25 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 5 |
5 files changed, 554 insertions, 554 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index d304297c496c..c1107815f22c 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -242,7 +242,7 @@ struct e1000_adapter { | |||
242 | struct timer_list watchdog_timer; | 242 | struct timer_list watchdog_timer; |
243 | struct timer_list phy_info_timer; | 243 | struct timer_list phy_info_timer; |
244 | struct vlan_group *vlgrp; | 244 | struct vlan_group *vlgrp; |
245 | uint16_t mng_vlan_id; | 245 | uint16_t mng_vlan_id; |
246 | uint32_t bd_number; | 246 | uint32_t bd_number; |
247 | uint32_t rx_buffer_len; | 247 | uint32_t rx_buffer_len; |
248 | uint32_t part_num; | 248 | uint32_t part_num; |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 2baccf864328..ab2f153d5735 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -428,12 +428,12 @@ e1000_get_regs(struct net_device *netdev, | |||
428 | regs_buff[23] = regs_buff[18]; /* mdix mode */ | 428 | regs_buff[23] = regs_buff[18]; /* mdix mode */ |
429 | e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0); | 429 | e1000_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0); |
430 | } else { | 430 | } else { |
431 | e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); | 431 | e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
432 | regs_buff[13] = (uint32_t)phy_data; /* cable length */ | 432 | regs_buff[13] = (uint32_t)phy_data; /* cable length */ |
433 | regs_buff[14] = 0; /* Dummy (to align w/ IGP phy reg dump) */ | 433 | regs_buff[14] = 0; /* Dummy (to align w/ IGP phy reg dump) */ |
434 | regs_buff[15] = 0; /* Dummy (to align w/ IGP phy reg dump) */ | 434 | regs_buff[15] = 0; /* Dummy (to align w/ IGP phy reg dump) */ |
435 | regs_buff[16] = 0; /* Dummy (to align w/ IGP phy reg dump) */ | 435 | regs_buff[16] = 0; /* Dummy (to align w/ IGP phy reg dump) */ |
436 | e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); | 436 | e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
437 | regs_buff[17] = (uint32_t)phy_data; /* extended 10bt distance */ | 437 | regs_buff[17] = (uint32_t)phy_data; /* extended 10bt distance */ |
438 | regs_buff[18] = regs_buff[13]; /* cable polarity */ | 438 | regs_buff[18] = regs_buff[13]; /* cable polarity */ |
439 | regs_buff[19] = 0; /* Dummy (to align w/ IGP phy reg dump) */ | 439 | regs_buff[19] = 0; /* Dummy (to align w/ IGP phy reg dump) */ |
@@ -709,7 +709,6 @@ e1000_set_ringparam(struct net_device *netdev, | |||
709 | } | 709 | } |
710 | 710 | ||
711 | clear_bit(__E1000_RESETTING, &adapter->flags); | 711 | clear_bit(__E1000_RESETTING, &adapter->flags); |
712 | |||
713 | return 0; | 712 | return 0; |
714 | err_setup_tx: | 713 | err_setup_tx: |
715 | e1000_free_all_rx_resources(adapter); | 714 | e1000_free_all_rx_resources(adapter); |
@@ -894,16 +893,17 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) | |||
894 | 893 | ||
895 | *data = 0; | 894 | *data = 0; |
896 | 895 | ||
896 | /* NOTE: we don't test MSI interrupts here, yet */ | ||
897 | /* Hook up test interrupt handler just for this test */ | 897 | /* Hook up test interrupt handler just for this test */ |
898 | if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED, | 898 | if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED, |
899 | netdev->name, netdev)) { | 899 | netdev->name, netdev)) |
900 | shared_int = FALSE; | 900 | shared_int = FALSE; |
901 | } else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED, | 901 | else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED, |
902 | netdev->name, netdev)){ | 902 | netdev->name, netdev)) { |
903 | *data = 1; | 903 | *data = 1; |
904 | return -1; | 904 | return -1; |
905 | } | 905 | } |
906 | DPRINTK(PROBE,INFO, "testing %s interrupt\n", | 906 | DPRINTK(HW, INFO, "testing %s interrupt\n", |
907 | (shared_int ? "shared" : "unshared")); | 907 | (shared_int ? "shared" : "unshared")); |
908 | 908 | ||
909 | /* Disable all the interrupts */ | 909 | /* Disable all the interrupts */ |
@@ -1269,11 +1269,10 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1269 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x9140); | 1269 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x9140); |
1270 | /* autoneg off */ | 1270 | /* autoneg off */ |
1271 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8140); | 1271 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x8140); |
1272 | } else if (adapter->hw.phy_type == e1000_phy_gg82563) { | 1272 | } else if (adapter->hw.phy_type == e1000_phy_gg82563) |
1273 | e1000_write_phy_reg(&adapter->hw, | 1273 | e1000_write_phy_reg(&adapter->hw, |
1274 | GG82563_PHY_KMRN_MODE_CTRL, | 1274 | GG82563_PHY_KMRN_MODE_CTRL, |
1275 | 0x1CC); | 1275 | 0x1CC); |
1276 | } | ||
1277 | 1276 | ||
1278 | ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); | 1277 | ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); |
1279 | 1278 | ||
@@ -1301,9 +1300,9 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1301 | } | 1300 | } |
1302 | 1301 | ||
1303 | if (adapter->hw.media_type == e1000_media_type_copper && | 1302 | if (adapter->hw.media_type == e1000_media_type_copper && |
1304 | adapter->hw.phy_type == e1000_phy_m88) { | 1303 | adapter->hw.phy_type == e1000_phy_m88) |
1305 | ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ | 1304 | ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ |
1306 | } else { | 1305 | else { |
1307 | /* Set the ILOS bit on the fiber Nic is half | 1306 | /* Set the ILOS bit on the fiber Nic is half |
1308 | * duplex link is detected. */ | 1307 | * duplex link is detected. */ |
1309 | stat_reg = E1000_READ_REG(&adapter->hw, STATUS); | 1308 | stat_reg = E1000_READ_REG(&adapter->hw, STATUS); |
@@ -1439,11 +1438,10 @@ e1000_loopback_cleanup(struct e1000_adapter *adapter) | |||
1439 | case e1000_82546_rev_3: | 1438 | case e1000_82546_rev_3: |
1440 | default: | 1439 | default: |
1441 | hw->autoneg = TRUE; | 1440 | hw->autoneg = TRUE; |
1442 | if (hw->phy_type == e1000_phy_gg82563) { | 1441 | if (hw->phy_type == e1000_phy_gg82563) |
1443 | e1000_write_phy_reg(hw, | 1442 | e1000_write_phy_reg(hw, |
1444 | GG82563_PHY_KMRN_MODE_CTRL, | 1443 | GG82563_PHY_KMRN_MODE_CTRL, |
1445 | 0x180); | 1444 | 0x180); |
1446 | } | ||
1447 | e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); | 1445 | e1000_read_phy_reg(hw, PHY_CTRL, &phy_reg); |
1448 | if (phy_reg & MII_CR_LOOPBACK) { | 1446 | if (phy_reg & MII_CR_LOOPBACK) { |
1449 | phy_reg &= ~MII_CR_LOOPBACK; | 1447 | phy_reg &= ~MII_CR_LOOPBACK; |
@@ -1915,8 +1913,8 @@ static struct ethtool_ops e1000_ethtool_ops = { | |||
1915 | .get_regs = e1000_get_regs, | 1913 | .get_regs = e1000_get_regs, |
1916 | .get_wol = e1000_get_wol, | 1914 | .get_wol = e1000_get_wol, |
1917 | .set_wol = e1000_set_wol, | 1915 | .set_wol = e1000_set_wol, |
1918 | .get_msglevel = e1000_get_msglevel, | 1916 | .get_msglevel = e1000_get_msglevel, |
1919 | .set_msglevel = e1000_set_msglevel, | 1917 | .set_msglevel = e1000_set_msglevel, |
1920 | .nway_reset = e1000_nway_reset, | 1918 | .nway_reset = e1000_nway_reset, |
1921 | .get_link = ethtool_op_get_link, | 1919 | .get_link = ethtool_op_get_link, |
1922 | .get_eeprom_len = e1000_get_eeprom_len, | 1920 | .get_eeprom_len = e1000_get_eeprom_len, |
@@ -1924,17 +1922,17 @@ static struct ethtool_ops e1000_ethtool_ops = { | |||
1924 | .set_eeprom = e1000_set_eeprom, | 1922 | .set_eeprom = e1000_set_eeprom, |
1925 | .get_ringparam = e1000_get_ringparam, | 1923 | .get_ringparam = e1000_get_ringparam, |
1926 | .set_ringparam = e1000_set_ringparam, | 1924 | .set_ringparam = e1000_set_ringparam, |
1927 | .get_pauseparam = e1000_get_pauseparam, | 1925 | .get_pauseparam = e1000_get_pauseparam, |
1928 | .set_pauseparam = e1000_set_pauseparam, | 1926 | .set_pauseparam = e1000_set_pauseparam, |
1929 | .get_rx_csum = e1000_get_rx_csum, | 1927 | .get_rx_csum = e1000_get_rx_csum, |
1930 | .set_rx_csum = e1000_set_rx_csum, | 1928 | .set_rx_csum = e1000_set_rx_csum, |
1931 | .get_tx_csum = e1000_get_tx_csum, | 1929 | .get_tx_csum = e1000_get_tx_csum, |
1932 | .set_tx_csum = e1000_set_tx_csum, | 1930 | .set_tx_csum = e1000_set_tx_csum, |
1933 | .get_sg = ethtool_op_get_sg, | 1931 | .get_sg = ethtool_op_get_sg, |
1934 | .set_sg = ethtool_op_set_sg, | 1932 | .set_sg = ethtool_op_set_sg, |
1935 | #ifdef NETIF_F_TSO | 1933 | #ifdef NETIF_F_TSO |
1936 | .get_tso = ethtool_op_get_tso, | 1934 | .get_tso = ethtool_op_get_tso, |
1937 | .set_tso = e1000_set_tso, | 1935 | .set_tso = e1000_set_tso, |
1938 | #endif | 1936 | #endif |
1939 | .self_test_count = e1000_diag_test_count, | 1937 | .self_test_count = e1000_diag_test_count, |
1940 | .self_test = e1000_diag_test, | 1938 | .self_test = e1000_diag_test, |
@@ -1942,7 +1940,7 @@ static struct ethtool_ops e1000_ethtool_ops = { | |||
1942 | .phys_id = e1000_phys_id, | 1940 | .phys_id = e1000_phys_id, |
1943 | .get_stats_count = e1000_get_stats_count, | 1941 | .get_stats_count = e1000_get_stats_count, |
1944 | .get_ethtool_stats = e1000_get_ethtool_stats, | 1942 | .get_ethtool_stats = e1000_get_ethtool_stats, |
1945 | .get_perm_addr = ethtool_op_get_perm_addr, | 1943 | .get_perm_addr = ethtool_op_get_perm_addr, |
1946 | }; | 1944 | }; |
1947 | 1945 | ||
1948 | void e1000_set_ethtool_ops(struct net_device *netdev) | 1946 | void e1000_set_ethtool_ops(struct net_device *netdev) |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index f62d17848332..57749eb438e4 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -31,6 +31,7 @@ | |||
31 | * Shared functions for accessing and configuring the MAC | 31 | * Shared functions for accessing and configuring the MAC |
32 | */ | 32 | */ |
33 | 33 | ||
34 | |||
34 | #include "e1000_hw.h" | 35 | #include "e1000_hw.h" |
35 | 36 | ||
36 | static int32_t e1000_set_phy_type(struct e1000_hw *hw); | 37 | static int32_t e1000_set_phy_type(struct e1000_hw *hw); |
@@ -166,10 +167,10 @@ e1000_set_phy_type(struct e1000_hw *hw) | |||
166 | { | 167 | { |
167 | DEBUGFUNC("e1000_set_phy_type"); | 168 | DEBUGFUNC("e1000_set_phy_type"); |
168 | 169 | ||
169 | if(hw->mac_type == e1000_undefined) | 170 | if (hw->mac_type == e1000_undefined) |
170 | return -E1000_ERR_PHY_TYPE; | 171 | return -E1000_ERR_PHY_TYPE; |
171 | 172 | ||
172 | switch(hw->phy_id) { | 173 | switch (hw->phy_id) { |
173 | case M88E1000_E_PHY_ID: | 174 | case M88E1000_E_PHY_ID: |
174 | case M88E1000_I_PHY_ID: | 175 | case M88E1000_I_PHY_ID: |
175 | case M88E1011_I_PHY_ID: | 176 | case M88E1011_I_PHY_ID: |
@@ -177,10 +178,10 @@ e1000_set_phy_type(struct e1000_hw *hw) | |||
177 | hw->phy_type = e1000_phy_m88; | 178 | hw->phy_type = e1000_phy_m88; |
178 | break; | 179 | break; |
179 | case IGP01E1000_I_PHY_ID: | 180 | case IGP01E1000_I_PHY_ID: |
180 | if(hw->mac_type == e1000_82541 || | 181 | if (hw->mac_type == e1000_82541 || |
181 | hw->mac_type == e1000_82541_rev_2 || | 182 | hw->mac_type == e1000_82541_rev_2 || |
182 | hw->mac_type == e1000_82547 || | 183 | hw->mac_type == e1000_82547 || |
183 | hw->mac_type == e1000_82547_rev_2) { | 184 | hw->mac_type == e1000_82547_rev_2) { |
184 | hw->phy_type = e1000_phy_igp; | 185 | hw->phy_type = e1000_phy_igp; |
185 | break; | 186 | break; |
186 | } | 187 | } |
@@ -207,6 +208,7 @@ e1000_set_phy_type(struct e1000_hw *hw) | |||
207 | return E1000_SUCCESS; | 208 | return E1000_SUCCESS; |
208 | } | 209 | } |
209 | 210 | ||
211 | |||
210 | /****************************************************************************** | 212 | /****************************************************************************** |
211 | * IGP phy init script - initializes the GbE PHY | 213 | * IGP phy init script - initializes the GbE PHY |
212 | * | 214 | * |
@@ -220,7 +222,7 @@ e1000_phy_init_script(struct e1000_hw *hw) | |||
220 | 222 | ||
221 | DEBUGFUNC("e1000_phy_init_script"); | 223 | DEBUGFUNC("e1000_phy_init_script"); |
222 | 224 | ||
223 | if(hw->phy_init_script) { | 225 | if (hw->phy_init_script) { |
224 | msec_delay(20); | 226 | msec_delay(20); |
225 | 227 | ||
226 | /* Save off the current value of register 0x2F5B to be restored at | 228 | /* Save off the current value of register 0x2F5B to be restored at |
@@ -236,7 +238,7 @@ e1000_phy_init_script(struct e1000_hw *hw) | |||
236 | 238 | ||
237 | msec_delay(5); | 239 | msec_delay(5); |
238 | 240 | ||
239 | switch(hw->mac_type) { | 241 | switch (hw->mac_type) { |
240 | case e1000_82541: | 242 | case e1000_82541: |
241 | case e1000_82547: | 243 | case e1000_82547: |
242 | e1000_write_phy_reg(hw, 0x1F95, 0x0001); | 244 | e1000_write_phy_reg(hw, 0x1F95, 0x0001); |
@@ -273,22 +275,22 @@ e1000_phy_init_script(struct e1000_hw *hw) | |||
273 | /* Now enable the transmitter */ | 275 | /* Now enable the transmitter */ |
274 | e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); | 276 | e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
275 | 277 | ||
276 | if(hw->mac_type == e1000_82547) { | 278 | if (hw->mac_type == e1000_82547) { |
277 | uint16_t fused, fine, coarse; | 279 | uint16_t fused, fine, coarse; |
278 | 280 | ||
279 | /* Move to analog registers page */ | 281 | /* Move to analog registers page */ |
280 | e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused); | 282 | e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused); |
281 | 283 | ||
282 | if(!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) { | 284 | if (!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) { |
283 | e1000_read_phy_reg(hw, IGP01E1000_ANALOG_FUSE_STATUS, &fused); | 285 | e1000_read_phy_reg(hw, IGP01E1000_ANALOG_FUSE_STATUS, &fused); |
284 | 286 | ||
285 | fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK; | 287 | fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK; |
286 | coarse = fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK; | 288 | coarse = fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK; |
287 | 289 | ||
288 | if(coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) { | 290 | if (coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) { |
289 | coarse -= IGP01E1000_ANALOG_FUSE_COARSE_10; | 291 | coarse -= IGP01E1000_ANALOG_FUSE_COARSE_10; |
290 | fine -= IGP01E1000_ANALOG_FUSE_FINE_1; | 292 | fine -= IGP01E1000_ANALOG_FUSE_FINE_1; |
291 | } else if(coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH) | 293 | } else if (coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH) |
292 | fine -= IGP01E1000_ANALOG_FUSE_FINE_10; | 294 | fine -= IGP01E1000_ANALOG_FUSE_FINE_10; |
293 | 295 | ||
294 | fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | | 296 | fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | |
@@ -418,7 +420,7 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
418 | return -E1000_ERR_MAC_TYPE; | 420 | return -E1000_ERR_MAC_TYPE; |
419 | } | 421 | } |
420 | 422 | ||
421 | switch(hw->mac_type) { | 423 | switch (hw->mac_type) { |
422 | case e1000_ich8lan: | 424 | case e1000_ich8lan: |
423 | hw->swfwhw_semaphore_present = TRUE; | 425 | hw->swfwhw_semaphore_present = TRUE; |
424 | hw->asf_firmware_present = TRUE; | 426 | hw->asf_firmware_present = TRUE; |
@@ -456,7 +458,7 @@ e1000_set_media_type(struct e1000_hw *hw) | |||
456 | 458 | ||
457 | DEBUGFUNC("e1000_set_media_type"); | 459 | DEBUGFUNC("e1000_set_media_type"); |
458 | 460 | ||
459 | if(hw->mac_type != e1000_82543) { | 461 | if (hw->mac_type != e1000_82543) { |
460 | /* tbi_compatibility is only valid on 82543 */ | 462 | /* tbi_compatibility is only valid on 82543 */ |
461 | hw->tbi_compatibility_en = FALSE; | 463 | hw->tbi_compatibility_en = FALSE; |
462 | } | 464 | } |
@@ -516,16 +518,16 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
516 | DEBUGFUNC("e1000_reset_hw"); | 518 | DEBUGFUNC("e1000_reset_hw"); |
517 | 519 | ||
518 | /* For 82542 (rev 2.0), disable MWI before issuing a device reset */ | 520 | /* For 82542 (rev 2.0), disable MWI before issuing a device reset */ |
519 | if(hw->mac_type == e1000_82542_rev2_0) { | 521 | if (hw->mac_type == e1000_82542_rev2_0) { |
520 | DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); | 522 | DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); |
521 | e1000_pci_clear_mwi(hw); | 523 | e1000_pci_clear_mwi(hw); |
522 | } | 524 | } |
523 | 525 | ||
524 | if(hw->bus_type == e1000_bus_type_pci_express) { | 526 | if (hw->bus_type == e1000_bus_type_pci_express) { |
525 | /* Prevent the PCI-E bus from sticking if there is no TLP connection | 527 | /* Prevent the PCI-E bus from sticking if there is no TLP connection |
526 | * on the last TLP read/write transaction when MAC is reset. | 528 | * on the last TLP read/write transaction when MAC is reset. |
527 | */ | 529 | */ |
528 | if(e1000_disable_pciex_master(hw) != E1000_SUCCESS) { | 530 | if (e1000_disable_pciex_master(hw) != E1000_SUCCESS) { |
529 | DEBUGOUT("PCI-E Master disable polling has failed.\n"); | 531 | DEBUGOUT("PCI-E Master disable polling has failed.\n"); |
530 | } | 532 | } |
531 | } | 533 | } |
@@ -553,14 +555,14 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
553 | ctrl = E1000_READ_REG(hw, CTRL); | 555 | ctrl = E1000_READ_REG(hw, CTRL); |
554 | 556 | ||
555 | /* Must reset the PHY before resetting the MAC */ | 557 | /* Must reset the PHY before resetting the MAC */ |
556 | if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { | 558 | if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
557 | E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST)); | 559 | E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST)); |
558 | msec_delay(5); | 560 | msec_delay(5); |
559 | } | 561 | } |
560 | 562 | ||
561 | /* Must acquire the MDIO ownership before MAC reset. | 563 | /* Must acquire the MDIO ownership before MAC reset. |
562 | * Ownership defaults to firmware after a reset. */ | 564 | * Ownership defaults to firmware after a reset. */ |
563 | if(hw->mac_type == e1000_82573) { | 565 | if (hw->mac_type == e1000_82573) { |
564 | timeout = 10; | 566 | timeout = 10; |
565 | 567 | ||
566 | extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); | 568 | extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); |
@@ -570,14 +572,14 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
570 | E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl); | 572 | E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl); |
571 | extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); | 573 | extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); |
572 | 574 | ||
573 | if(extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) | 575 | if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) |
574 | break; | 576 | break; |
575 | else | 577 | else |
576 | extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; | 578 | extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; |
577 | 579 | ||
578 | msec_delay(2); | 580 | msec_delay(2); |
579 | timeout--; | 581 | timeout--; |
580 | } while(timeout); | 582 | } while (timeout); |
581 | } | 583 | } |
582 | 584 | ||
583 | /* Workaround for ICH8 bit corruption issue in FIFO memory */ | 585 | /* Workaround for ICH8 bit corruption issue in FIFO memory */ |
@@ -595,7 +597,7 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
595 | */ | 597 | */ |
596 | DEBUGOUT("Issuing a global reset to MAC\n"); | 598 | DEBUGOUT("Issuing a global reset to MAC\n"); |
597 | 599 | ||
598 | switch(hw->mac_type) { | 600 | switch (hw->mac_type) { |
599 | case e1000_82544: | 601 | case e1000_82544: |
600 | case e1000_82540: | 602 | case e1000_82540: |
601 | case e1000_82545: | 603 | case e1000_82545: |
@@ -634,7 +636,7 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
634 | * device. Later controllers reload the EEPROM automatically, so just wait | 636 | * device. Later controllers reload the EEPROM automatically, so just wait |
635 | * for reload to complete. | 637 | * for reload to complete. |
636 | */ | 638 | */ |
637 | switch(hw->mac_type) { | 639 | switch (hw->mac_type) { |
638 | case e1000_82542_rev2_0: | 640 | case e1000_82542_rev2_0: |
639 | case e1000_82542_rev2_1: | 641 | case e1000_82542_rev2_1: |
640 | case e1000_82543: | 642 | case e1000_82543: |
@@ -669,7 +671,7 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
669 | case e1000_ich8lan: | 671 | case e1000_ich8lan: |
670 | case e1000_80003es2lan: | 672 | case e1000_80003es2lan: |
671 | ret_val = e1000_get_auto_rd_done(hw); | 673 | ret_val = e1000_get_auto_rd_done(hw); |
672 | if(ret_val) | 674 | if (ret_val) |
673 | /* We don't want to continue accessing MAC registers. */ | 675 | /* We don't want to continue accessing MAC registers. */ |
674 | return ret_val; | 676 | return ret_val; |
675 | break; | 677 | break; |
@@ -680,13 +682,13 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
680 | } | 682 | } |
681 | 683 | ||
682 | /* Disable HW ARPs on ASF enabled adapters */ | 684 | /* Disable HW ARPs on ASF enabled adapters */ |
683 | if(hw->mac_type >= e1000_82540 && hw->mac_type <= e1000_82547_rev_2) { | 685 | if (hw->mac_type >= e1000_82540 && hw->mac_type <= e1000_82547_rev_2) { |
684 | manc = E1000_READ_REG(hw, MANC); | 686 | manc = E1000_READ_REG(hw, MANC); |
685 | manc &= ~(E1000_MANC_ARP_EN); | 687 | manc &= ~(E1000_MANC_ARP_EN); |
686 | E1000_WRITE_REG(hw, MANC, manc); | 688 | E1000_WRITE_REG(hw, MANC, manc); |
687 | } | 689 | } |
688 | 690 | ||
689 | if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { | 691 | if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
690 | e1000_phy_init_script(hw); | 692 | e1000_phy_init_script(hw); |
691 | 693 | ||
692 | /* Configure activity LED after PHY reset */ | 694 | /* Configure activity LED after PHY reset */ |
@@ -704,8 +706,8 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
704 | icr = E1000_READ_REG(hw, ICR); | 706 | icr = E1000_READ_REG(hw, ICR); |
705 | 707 | ||
706 | /* If MWI was previously enabled, reenable it. */ | 708 | /* If MWI was previously enabled, reenable it. */ |
707 | if(hw->mac_type == e1000_82542_rev2_0) { | 709 | if (hw->mac_type == e1000_82542_rev2_0) { |
708 | if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) | 710 | if (hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) |
709 | e1000_pci_set_mwi(hw); | 711 | e1000_pci_set_mwi(hw); |
710 | } | 712 | } |
711 | 713 | ||
@@ -758,7 +760,7 @@ e1000_init_hw(struct e1000_hw *hw) | |||
758 | 760 | ||
759 | /* Initialize Identification LED */ | 761 | /* Initialize Identification LED */ |
760 | ret_val = e1000_id_led_init(hw); | 762 | ret_val = e1000_id_led_init(hw); |
761 | if(ret_val) { | 763 | if (ret_val) { |
762 | DEBUGOUT("Error Initializing Identification LED\n"); | 764 | DEBUGOUT("Error Initializing Identification LED\n"); |
763 | return ret_val; | 765 | return ret_val; |
764 | } | 766 | } |
@@ -776,7 +778,7 @@ e1000_init_hw(struct e1000_hw *hw) | |||
776 | } | 778 | } |
777 | 779 | ||
778 | /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ | 780 | /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ |
779 | if(hw->mac_type == e1000_82542_rev2_0) { | 781 | if (hw->mac_type == e1000_82542_rev2_0) { |
780 | DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); | 782 | DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); |
781 | e1000_pci_clear_mwi(hw); | 783 | e1000_pci_clear_mwi(hw); |
782 | E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST); | 784 | E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST); |
@@ -790,11 +792,11 @@ e1000_init_hw(struct e1000_hw *hw) | |||
790 | e1000_init_rx_addrs(hw); | 792 | e1000_init_rx_addrs(hw); |
791 | 793 | ||
792 | /* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */ | 794 | /* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */ |
793 | if(hw->mac_type == e1000_82542_rev2_0) { | 795 | if (hw->mac_type == e1000_82542_rev2_0) { |
794 | E1000_WRITE_REG(hw, RCTL, 0); | 796 | E1000_WRITE_REG(hw, RCTL, 0); |
795 | E1000_WRITE_FLUSH(hw); | 797 | E1000_WRITE_FLUSH(hw); |
796 | msec_delay(1); | 798 | msec_delay(1); |
797 | if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) | 799 | if (hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) |
798 | e1000_pci_set_mwi(hw); | 800 | e1000_pci_set_mwi(hw); |
799 | } | 801 | } |
800 | 802 | ||
@@ -803,7 +805,7 @@ e1000_init_hw(struct e1000_hw *hw) | |||
803 | mta_size = E1000_MC_TBL_SIZE; | 805 | mta_size = E1000_MC_TBL_SIZE; |
804 | if (hw->mac_type == e1000_ich8lan) | 806 | if (hw->mac_type == e1000_ich8lan) |
805 | mta_size = E1000_MC_TBL_SIZE_ICH8LAN; | 807 | mta_size = E1000_MC_TBL_SIZE_ICH8LAN; |
806 | for(i = 0; i < mta_size; i++) { | 808 | for (i = 0; i < mta_size; i++) { |
807 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); | 809 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
808 | /* use write flush to prevent Memory Write Block (MWB) from | 810 | /* use write flush to prevent Memory Write Block (MWB) from |
809 | * occuring when accessing our register space */ | 811 | * occuring when accessing our register space */ |
@@ -815,18 +817,18 @@ e1000_init_hw(struct e1000_hw *hw) | |||
815 | * gives equal priority to transmits and receives. Valid only on | 817 | * gives equal priority to transmits and receives. Valid only on |
816 | * 82542 and 82543 silicon. | 818 | * 82542 and 82543 silicon. |
817 | */ | 819 | */ |
818 | if(hw->dma_fairness && hw->mac_type <= e1000_82543) { | 820 | if (hw->dma_fairness && hw->mac_type <= e1000_82543) { |
819 | ctrl = E1000_READ_REG(hw, CTRL); | 821 | ctrl = E1000_READ_REG(hw, CTRL); |
820 | E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR); | 822 | E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR); |
821 | } | 823 | } |
822 | 824 | ||
823 | switch(hw->mac_type) { | 825 | switch (hw->mac_type) { |
824 | case e1000_82545_rev_3: | 826 | case e1000_82545_rev_3: |
825 | case e1000_82546_rev_3: | 827 | case e1000_82546_rev_3: |
826 | break; | 828 | break; |
827 | default: | 829 | default: |
828 | /* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ | 830 | /* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ |
829 | if(hw->bus_type == e1000_bus_type_pcix) { | 831 | if (hw->bus_type == e1000_bus_type_pcix) { |
830 | e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word); | 832 | e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word); |
831 | e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, | 833 | e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, |
832 | &pcix_stat_hi_word); | 834 | &pcix_stat_hi_word); |
@@ -834,9 +836,9 @@ e1000_init_hw(struct e1000_hw *hw) | |||
834 | PCIX_COMMAND_MMRBC_SHIFT; | 836 | PCIX_COMMAND_MMRBC_SHIFT; |
835 | stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> | 837 | stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> |
836 | PCIX_STATUS_HI_MMRBC_SHIFT; | 838 | PCIX_STATUS_HI_MMRBC_SHIFT; |
837 | if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) | 839 | if (stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) |
838 | stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; | 840 | stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; |
839 | if(cmd_mmrbc > stat_mmrbc) { | 841 | if (cmd_mmrbc > stat_mmrbc) { |
840 | pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK; | 842 | pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK; |
841 | pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; | 843 | pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; |
842 | e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER, | 844 | e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER, |
@@ -854,7 +856,7 @@ e1000_init_hw(struct e1000_hw *hw) | |||
854 | ret_val = e1000_setup_link(hw); | 856 | ret_val = e1000_setup_link(hw); |
855 | 857 | ||
856 | /* Set the transmit descriptor write-back policy */ | 858 | /* Set the transmit descriptor write-back policy */ |
857 | if(hw->mac_type > e1000_82544) { | 859 | if (hw->mac_type > e1000_82544) { |
858 | ctrl = E1000_READ_REG(hw, TXDCTL); | 860 | ctrl = E1000_READ_REG(hw, TXDCTL); |
859 | ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; | 861 | ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; |
860 | switch (hw->mac_type) { | 862 | switch (hw->mac_type) { |
@@ -905,14 +907,13 @@ e1000_init_hw(struct e1000_hw *hw) | |||
905 | case e1000_ich8lan: | 907 | case e1000_ich8lan: |
906 | ctrl = E1000_READ_REG(hw, TXDCTL1); | 908 | ctrl = E1000_READ_REG(hw, TXDCTL1); |
907 | ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; | 909 | ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; |
908 | if(hw->mac_type >= e1000_82571) | 910 | if (hw->mac_type >= e1000_82571) |
909 | ctrl |= E1000_TXDCTL_COUNT_DESC; | 911 | ctrl |= E1000_TXDCTL_COUNT_DESC; |
910 | E1000_WRITE_REG(hw, TXDCTL1, ctrl); | 912 | E1000_WRITE_REG(hw, TXDCTL1, ctrl); |
911 | break; | 913 | break; |
912 | } | 914 | } |
913 | 915 | ||
914 | 916 | ||
915 | |||
916 | if (hw->mac_type == e1000_82573) { | 917 | if (hw->mac_type == e1000_82573) { |
917 | uint32_t gcr = E1000_READ_REG(hw, GCR); | 918 | uint32_t gcr = E1000_READ_REG(hw, GCR); |
918 | gcr |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; | 919 | gcr |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; |
@@ -956,10 +957,10 @@ e1000_adjust_serdes_amplitude(struct e1000_hw *hw) | |||
956 | 957 | ||
957 | DEBUGFUNC("e1000_adjust_serdes_amplitude"); | 958 | DEBUGFUNC("e1000_adjust_serdes_amplitude"); |
958 | 959 | ||
959 | if(hw->media_type != e1000_media_type_internal_serdes) | 960 | if (hw->media_type != e1000_media_type_internal_serdes) |
960 | return E1000_SUCCESS; | 961 | return E1000_SUCCESS; |
961 | 962 | ||
962 | switch(hw->mac_type) { | 963 | switch (hw->mac_type) { |
963 | case e1000_82545_rev_3: | 964 | case e1000_82545_rev_3: |
964 | case e1000_82546_rev_3: | 965 | case e1000_82546_rev_3: |
965 | break; | 966 | break; |
@@ -972,11 +973,11 @@ e1000_adjust_serdes_amplitude(struct e1000_hw *hw) | |||
972 | return ret_val; | 973 | return ret_val; |
973 | } | 974 | } |
974 | 975 | ||
975 | if(eeprom_data != EEPROM_RESERVED_WORD) { | 976 | if (eeprom_data != EEPROM_RESERVED_WORD) { |
976 | /* Adjust SERDES output amplitude only. */ | 977 | /* Adjust SERDES output amplitude only. */ |
977 | eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; | 978 | eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; |
978 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data); | 979 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data); |
979 | if(ret_val) | 980 | if (ret_val) |
980 | return ret_val; | 981 | return ret_val; |
981 | } | 982 | } |
982 | 983 | ||
@@ -1044,10 +1045,10 @@ e1000_setup_link(struct e1000_hw *hw) | |||
1044 | * in case we get disconnected and then reconnected into a different | 1045 | * in case we get disconnected and then reconnected into a different |
1045 | * hub or switch with different Flow Control capabilities. | 1046 | * hub or switch with different Flow Control capabilities. |
1046 | */ | 1047 | */ |
1047 | if(hw->mac_type == e1000_82542_rev2_0) | 1048 | if (hw->mac_type == e1000_82542_rev2_0) |
1048 | hw->fc &= (~e1000_fc_tx_pause); | 1049 | hw->fc &= (~e1000_fc_tx_pause); |
1049 | 1050 | ||
1050 | if((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) | 1051 | if ((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) |
1051 | hw->fc &= (~e1000_fc_rx_pause); | 1052 | hw->fc &= (~e1000_fc_rx_pause); |
1052 | 1053 | ||
1053 | hw->original_fc = hw->fc; | 1054 | hw->original_fc = hw->fc; |
@@ -1062,12 +1063,12 @@ e1000_setup_link(struct e1000_hw *hw) | |||
1062 | * or e1000_phy_setup() is called. | 1063 | * or e1000_phy_setup() is called. |
1063 | */ | 1064 | */ |
1064 | if (hw->mac_type == e1000_82543) { | 1065 | if (hw->mac_type == e1000_82543) { |
1065 | ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, | 1066 | ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, |
1066 | 1, &eeprom_data); | 1067 | 1, &eeprom_data); |
1067 | if (ret_val) { | 1068 | if (ret_val) { |
1068 | DEBUGOUT("EEPROM Read Error\n"); | 1069 | DEBUGOUT("EEPROM Read Error\n"); |
1069 | return -E1000_ERR_EEPROM; | 1070 | return -E1000_ERR_EEPROM; |
1070 | } | 1071 | } |
1071 | ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) << | 1072 | ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) << |
1072 | SWDPIO__EXT_SHIFT); | 1073 | SWDPIO__EXT_SHIFT); |
1073 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); | 1074 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
@@ -1100,14 +1101,14 @@ e1000_setup_link(struct e1000_hw *hw) | |||
1100 | * ability to transmit pause frames in not enabled, then these | 1101 | * ability to transmit pause frames in not enabled, then these |
1101 | * registers will be set to 0. | 1102 | * registers will be set to 0. |
1102 | */ | 1103 | */ |
1103 | if(!(hw->fc & e1000_fc_tx_pause)) { | 1104 | if (!(hw->fc & e1000_fc_tx_pause)) { |
1104 | E1000_WRITE_REG(hw, FCRTL, 0); | 1105 | E1000_WRITE_REG(hw, FCRTL, 0); |
1105 | E1000_WRITE_REG(hw, FCRTH, 0); | 1106 | E1000_WRITE_REG(hw, FCRTH, 0); |
1106 | } else { | 1107 | } else { |
1107 | /* We need to set up the Receive Threshold high and low water marks | 1108 | /* We need to set up the Receive Threshold high and low water marks |
1108 | * as well as (optionally) enabling the transmission of XON frames. | 1109 | * as well as (optionally) enabling the transmission of XON frames. |
1109 | */ | 1110 | */ |
1110 | if(hw->fc_send_xon) { | 1111 | if (hw->fc_send_xon) { |
1111 | E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); | 1112 | E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); |
1112 | E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); | 1113 | E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); |
1113 | } else { | 1114 | } else { |
@@ -1154,11 +1155,11 @@ e1000_setup_fiber_serdes_link(struct e1000_hw *hw) | |||
1154 | * the EEPROM. | 1155 | * the EEPROM. |
1155 | */ | 1156 | */ |
1156 | ctrl = E1000_READ_REG(hw, CTRL); | 1157 | ctrl = E1000_READ_REG(hw, CTRL); |
1157 | if(hw->media_type == e1000_media_type_fiber) | 1158 | if (hw->media_type == e1000_media_type_fiber) |
1158 | signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; | 1159 | signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; |
1159 | 1160 | ||
1160 | ret_val = e1000_adjust_serdes_amplitude(hw); | 1161 | ret_val = e1000_adjust_serdes_amplitude(hw); |
1161 | if(ret_val) | 1162 | if (ret_val) |
1162 | return ret_val; | 1163 | return ret_val; |
1163 | 1164 | ||
1164 | /* Take the link out of reset */ | 1165 | /* Take the link out of reset */ |
@@ -1166,7 +1167,7 @@ e1000_setup_fiber_serdes_link(struct e1000_hw *hw) | |||
1166 | 1167 | ||
1167 | /* Adjust VCO speed to improve BER performance */ | 1168 | /* Adjust VCO speed to improve BER performance */ |
1168 | ret_val = e1000_set_vco_speed(hw); | 1169 | ret_val = e1000_set_vco_speed(hw); |
1169 | if(ret_val) | 1170 | if (ret_val) |
1170 | return ret_val; | 1171 | return ret_val; |
1171 | 1172 | ||
1172 | e1000_config_collision_dist(hw); | 1173 | e1000_config_collision_dist(hw); |
@@ -1237,15 +1238,15 @@ e1000_setup_fiber_serdes_link(struct e1000_hw *hw) | |||
1237 | * less than 500 milliseconds even if the other end is doing it in SW). | 1238 | * less than 500 milliseconds even if the other end is doing it in SW). |
1238 | * For internal serdes, we just assume a signal is present, then poll. | 1239 | * For internal serdes, we just assume a signal is present, then poll. |
1239 | */ | 1240 | */ |
1240 | if(hw->media_type == e1000_media_type_internal_serdes || | 1241 | if (hw->media_type == e1000_media_type_internal_serdes || |
1241 | (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { | 1242 | (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { |
1242 | DEBUGOUT("Looking for Link\n"); | 1243 | DEBUGOUT("Looking for Link\n"); |
1243 | for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { | 1244 | for (i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { |
1244 | msec_delay(10); | 1245 | msec_delay(10); |
1245 | status = E1000_READ_REG(hw, STATUS); | 1246 | status = E1000_READ_REG(hw, STATUS); |
1246 | if(status & E1000_STATUS_LU) break; | 1247 | if (status & E1000_STATUS_LU) break; |
1247 | } | 1248 | } |
1248 | if(i == (LINK_UP_TIMEOUT / 10)) { | 1249 | if (i == (LINK_UP_TIMEOUT / 10)) { |
1249 | DEBUGOUT("Never got a valid link from auto-neg!!!\n"); | 1250 | DEBUGOUT("Never got a valid link from auto-neg!!!\n"); |
1250 | hw->autoneg_failed = 1; | 1251 | hw->autoneg_failed = 1; |
1251 | /* AutoNeg failed to achieve a link, so we'll call | 1252 | /* AutoNeg failed to achieve a link, so we'll call |
@@ -1254,7 +1255,7 @@ e1000_setup_fiber_serdes_link(struct e1000_hw *hw) | |||
1254 | * non-autonegotiating link partners. | 1255 | * non-autonegotiating link partners. |
1255 | */ | 1256 | */ |
1256 | ret_val = e1000_check_for_link(hw); | 1257 | ret_val = e1000_check_for_link(hw); |
1257 | if(ret_val) { | 1258 | if (ret_val) { |
1258 | DEBUGOUT("Error while checking for link\n"); | 1259 | DEBUGOUT("Error while checking for link\n"); |
1259 | return ret_val; | 1260 | return ret_val; |
1260 | } | 1261 | } |
@@ -1288,7 +1289,7 @@ e1000_copper_link_preconfig(struct e1000_hw *hw) | |||
1288 | * the PHY speed and duplex configuration is. In addition, we need to | 1289 | * the PHY speed and duplex configuration is. In addition, we need to |
1289 | * perform a hardware reset on the PHY to take it out of reset. | 1290 | * perform a hardware reset on the PHY to take it out of reset. |
1290 | */ | 1291 | */ |
1291 | if(hw->mac_type > e1000_82543) { | 1292 | if (hw->mac_type > e1000_82543) { |
1292 | ctrl |= E1000_CTRL_SLU; | 1293 | ctrl |= E1000_CTRL_SLU; |
1293 | ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); | 1294 | ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
1294 | E1000_WRITE_REG(hw, CTRL, ctrl); | 1295 | E1000_WRITE_REG(hw, CTRL, ctrl); |
@@ -1296,13 +1297,13 @@ e1000_copper_link_preconfig(struct e1000_hw *hw) | |||
1296 | ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU); | 1297 | ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU); |
1297 | E1000_WRITE_REG(hw, CTRL, ctrl); | 1298 | E1000_WRITE_REG(hw, CTRL, ctrl); |
1298 | ret_val = e1000_phy_hw_reset(hw); | 1299 | ret_val = e1000_phy_hw_reset(hw); |
1299 | if(ret_val) | 1300 | if (ret_val) |
1300 | return ret_val; | 1301 | return ret_val; |
1301 | } | 1302 | } |
1302 | 1303 | ||
1303 | /* Make sure we have a valid PHY */ | 1304 | /* Make sure we have a valid PHY */ |
1304 | ret_val = e1000_detect_gig_phy(hw); | 1305 | ret_val = e1000_detect_gig_phy(hw); |
1305 | if(ret_val) { | 1306 | if (ret_val) { |
1306 | DEBUGOUT("Error, did not detect valid phy.\n"); | 1307 | DEBUGOUT("Error, did not detect valid phy.\n"); |
1307 | return ret_val; | 1308 | return ret_val; |
1308 | } | 1309 | } |
@@ -1310,19 +1311,19 @@ e1000_copper_link_preconfig(struct e1000_hw *hw) | |||
1310 | 1311 | ||
1311 | /* Set PHY to class A mode (if necessary) */ | 1312 | /* Set PHY to class A mode (if necessary) */ |
1312 | ret_val = e1000_set_phy_mode(hw); | 1313 | ret_val = e1000_set_phy_mode(hw); |
1313 | if(ret_val) | 1314 | if (ret_val) |
1314 | return ret_val; | 1315 | return ret_val; |
1315 | 1316 | ||
1316 | if((hw->mac_type == e1000_82545_rev_3) || | 1317 | if ((hw->mac_type == e1000_82545_rev_3) || |
1317 | (hw->mac_type == e1000_82546_rev_3)) { | 1318 | (hw->mac_type == e1000_82546_rev_3)) { |
1318 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); | 1319 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
1319 | phy_data |= 0x00000008; | 1320 | phy_data |= 0x00000008; |
1320 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); | 1321 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
1321 | } | 1322 | } |
1322 | 1323 | ||
1323 | if(hw->mac_type <= e1000_82543 || | 1324 | if (hw->mac_type <= e1000_82543 || |
1324 | hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || | 1325 | hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || |
1325 | hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) | 1326 | hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) |
1326 | hw->phy_reset_disable = FALSE; | 1327 | hw->phy_reset_disable = FALSE; |
1327 | 1328 | ||
1328 | return E1000_SUCCESS; | 1329 | return E1000_SUCCESS; |
@@ -1352,7 +1353,7 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw) | |||
1352 | return ret_val; | 1353 | return ret_val; |
1353 | } | 1354 | } |
1354 | 1355 | ||
1355 | /* Wait 10ms for MAC to configure PHY from eeprom settings */ | 1356 | /* Wait 15ms for MAC to configure PHY from eeprom settings */ |
1356 | msec_delay(15); | 1357 | msec_delay(15); |
1357 | if (hw->mac_type != e1000_ich8lan) { | 1358 | if (hw->mac_type != e1000_ich8lan) { |
1358 | /* Configure activity LED after PHY reset */ | 1359 | /* Configure activity LED after PHY reset */ |
@@ -1407,45 +1408,45 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw) | |||
1407 | } | 1408 | } |
1408 | } | 1409 | } |
1409 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); | 1410 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
1410 | if(ret_val) | 1411 | if (ret_val) |
1411 | return ret_val; | 1412 | return ret_val; |
1412 | 1413 | ||
1413 | /* set auto-master slave resolution settings */ | 1414 | /* set auto-master slave resolution settings */ |
1414 | if(hw->autoneg) { | 1415 | if (hw->autoneg) { |
1415 | e1000_ms_type phy_ms_setting = hw->master_slave; | 1416 | e1000_ms_type phy_ms_setting = hw->master_slave; |
1416 | 1417 | ||
1417 | if(hw->ffe_config_state == e1000_ffe_config_active) | 1418 | if (hw->ffe_config_state == e1000_ffe_config_active) |
1418 | hw->ffe_config_state = e1000_ffe_config_enabled; | 1419 | hw->ffe_config_state = e1000_ffe_config_enabled; |
1419 | 1420 | ||
1420 | if(hw->dsp_config_state == e1000_dsp_config_activated) | 1421 | if (hw->dsp_config_state == e1000_dsp_config_activated) |
1421 | hw->dsp_config_state = e1000_dsp_config_enabled; | 1422 | hw->dsp_config_state = e1000_dsp_config_enabled; |
1422 | 1423 | ||
1423 | /* when autonegotiation advertisment is only 1000Mbps then we | 1424 | /* when autonegotiation advertisment is only 1000Mbps then we |
1424 | * should disable SmartSpeed and enable Auto MasterSlave | 1425 | * should disable SmartSpeed and enable Auto MasterSlave |
1425 | * resolution as hardware default. */ | 1426 | * resolution as hardware default. */ |
1426 | if(hw->autoneg_advertised == ADVERTISE_1000_FULL) { | 1427 | if (hw->autoneg_advertised == ADVERTISE_1000_FULL) { |
1427 | /* Disable SmartSpeed */ | 1428 | /* Disable SmartSpeed */ |
1428 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); | 1429 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
1429 | if(ret_val) | 1430 | &phy_data); |
1431 | if (ret_val) | ||
1430 | return ret_val; | 1432 | return ret_val; |
1431 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; | 1433 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
1432 | ret_val = e1000_write_phy_reg(hw, | 1434 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
1433 | IGP01E1000_PHY_PORT_CONFIG, | 1435 | phy_data); |
1434 | phy_data); | 1436 | if (ret_val) |
1435 | if(ret_val) | ||
1436 | return ret_val; | 1437 | return ret_val; |
1437 | /* Set auto Master/Slave resolution process */ | 1438 | /* Set auto Master/Slave resolution process */ |
1438 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); | 1439 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); |
1439 | if(ret_val) | 1440 | if (ret_val) |
1440 | return ret_val; | 1441 | return ret_val; |
1441 | phy_data &= ~CR_1000T_MS_ENABLE; | 1442 | phy_data &= ~CR_1000T_MS_ENABLE; |
1442 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); | 1443 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
1443 | if(ret_val) | 1444 | if (ret_val) |
1444 | return ret_val; | 1445 | return ret_val; |
1445 | } | 1446 | } |
1446 | 1447 | ||
1447 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); | 1448 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); |
1448 | if(ret_val) | 1449 | if (ret_val) |
1449 | return ret_val; | 1450 | return ret_val; |
1450 | 1451 | ||
1451 | /* load defaults for future use */ | 1452 | /* load defaults for future use */ |
@@ -1469,7 +1470,7 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw) | |||
1469 | break; | 1470 | break; |
1470 | } | 1471 | } |
1471 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); | 1472 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
1472 | if(ret_val) | 1473 | if (ret_val) |
1473 | return ret_val; | 1474 | return ret_val; |
1474 | } | 1475 | } |
1475 | 1476 | ||
@@ -1490,12 +1491,12 @@ e1000_copper_link_ggp_setup(struct e1000_hw *hw) | |||
1490 | 1491 | ||
1491 | DEBUGFUNC("e1000_copper_link_ggp_setup"); | 1492 | DEBUGFUNC("e1000_copper_link_ggp_setup"); |
1492 | 1493 | ||
1493 | if(!hw->phy_reset_disable) { | 1494 | if (!hw->phy_reset_disable) { |
1494 | 1495 | ||
1495 | /* Enable CRS on TX for half-duplex operation. */ | 1496 | /* Enable CRS on TX for half-duplex operation. */ |
1496 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, | 1497 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, |
1497 | &phy_data); | 1498 | &phy_data); |
1498 | if(ret_val) | 1499 | if (ret_val) |
1499 | return ret_val; | 1500 | return ret_val; |
1500 | 1501 | ||
1501 | phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; | 1502 | phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; |
@@ -1504,7 +1505,7 @@ e1000_copper_link_ggp_setup(struct e1000_hw *hw) | |||
1504 | 1505 | ||
1505 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, | 1506 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, |
1506 | phy_data); | 1507 | phy_data); |
1507 | if(ret_val) | 1508 | if (ret_val) |
1508 | return ret_val; | 1509 | return ret_val; |
1509 | 1510 | ||
1510 | /* Options: | 1511 | /* Options: |
@@ -1515,7 +1516,7 @@ e1000_copper_link_ggp_setup(struct e1000_hw *hw) | |||
1515 | * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) | 1516 | * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) |
1516 | */ | 1517 | */ |
1517 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_SPEC_CTRL, &phy_data); | 1518 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_SPEC_CTRL, &phy_data); |
1518 | if(ret_val) | 1519 | if (ret_val) |
1519 | return ret_val; | 1520 | return ret_val; |
1520 | 1521 | ||
1521 | phy_data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK; | 1522 | phy_data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK; |
@@ -1540,11 +1541,11 @@ e1000_copper_link_ggp_setup(struct e1000_hw *hw) | |||
1540 | * 1 - Enabled | 1541 | * 1 - Enabled |
1541 | */ | 1542 | */ |
1542 | phy_data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE; | 1543 | phy_data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE; |
1543 | if(hw->disable_polarity_correction == 1) | 1544 | if (hw->disable_polarity_correction == 1) |
1544 | phy_data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE; | 1545 | phy_data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE; |
1545 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_SPEC_CTRL, phy_data); | 1546 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_SPEC_CTRL, phy_data); |
1546 | 1547 | ||
1547 | if(ret_val) | 1548 | if (ret_val) |
1548 | return ret_val; | 1549 | return ret_val; |
1549 | 1550 | ||
1550 | /* SW Reset the PHY so all changes take effect */ | 1551 | /* SW Reset the PHY so all changes take effect */ |
@@ -1600,9 +1601,9 @@ e1000_copper_link_ggp_setup(struct e1000_hw *hw) | |||
1600 | return ret_val; | 1601 | return ret_val; |
1601 | 1602 | ||
1602 | phy_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; | 1603 | phy_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; |
1603 | |||
1604 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, | 1604 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, |
1605 | phy_data); | 1605 | phy_data); |
1606 | |||
1606 | if (ret_val) | 1607 | if (ret_val) |
1607 | return ret_val; | 1608 | return ret_val; |
1608 | } | 1609 | } |
@@ -1637,12 +1638,12 @@ e1000_copper_link_mgp_setup(struct e1000_hw *hw) | |||
1637 | 1638 | ||
1638 | DEBUGFUNC("e1000_copper_link_mgp_setup"); | 1639 | DEBUGFUNC("e1000_copper_link_mgp_setup"); |
1639 | 1640 | ||
1640 | if(hw->phy_reset_disable) | 1641 | if (hw->phy_reset_disable) |
1641 | return E1000_SUCCESS; | 1642 | return E1000_SUCCESS; |
1642 | 1643 | ||
1643 | /* Enable CRS on TX. This must be set for half-duplex operation. */ | 1644 | /* Enable CRS on TX. This must be set for half-duplex operation. */ |
1644 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); | 1645 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
1645 | if(ret_val) | 1646 | if (ret_val) |
1646 | return ret_val; | 1647 | return ret_val; |
1647 | 1648 | ||
1648 | phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; | 1649 | phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
@@ -1679,7 +1680,7 @@ e1000_copper_link_mgp_setup(struct e1000_hw *hw) | |||
1679 | * 1 - Enabled | 1680 | * 1 - Enabled |
1680 | */ | 1681 | */ |
1681 | phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; | 1682 | phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; |
1682 | if(hw->disable_polarity_correction == 1) | 1683 | if (hw->disable_polarity_correction == 1) |
1683 | phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; | 1684 | phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; |
1684 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); | 1685 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
1685 | if (ret_val) | 1686 | if (ret_val) |
@@ -1719,7 +1720,7 @@ e1000_copper_link_mgp_setup(struct e1000_hw *hw) | |||
1719 | 1720 | ||
1720 | /* SW Reset the PHY so all changes take effect */ | 1721 | /* SW Reset the PHY so all changes take effect */ |
1721 | ret_val = e1000_phy_reset(hw); | 1722 | ret_val = e1000_phy_reset(hw); |
1722 | if(ret_val) { | 1723 | if (ret_val) { |
1723 | DEBUGOUT("Error Resetting the PHY\n"); | 1724 | DEBUGOUT("Error Resetting the PHY\n"); |
1724 | return ret_val; | 1725 | return ret_val; |
1725 | } | 1726 | } |
@@ -1749,7 +1750,7 @@ e1000_copper_link_autoneg(struct e1000_hw *hw) | |||
1749 | /* If autoneg_advertised is zero, we assume it was not defaulted | 1750 | /* If autoneg_advertised is zero, we assume it was not defaulted |
1750 | * by the calling code so we set to advertise full capability. | 1751 | * by the calling code so we set to advertise full capability. |
1751 | */ | 1752 | */ |
1752 | if(hw->autoneg_advertised == 0) | 1753 | if (hw->autoneg_advertised == 0) |
1753 | hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 1754 | hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
1754 | 1755 | ||
1755 | /* IFE phy only supports 10/100 */ | 1756 | /* IFE phy only supports 10/100 */ |
@@ -1758,7 +1759,7 @@ e1000_copper_link_autoneg(struct e1000_hw *hw) | |||
1758 | 1759 | ||
1759 | DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); | 1760 | DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); |
1760 | ret_val = e1000_phy_setup_autoneg(hw); | 1761 | ret_val = e1000_phy_setup_autoneg(hw); |
1761 | if(ret_val) { | 1762 | if (ret_val) { |
1762 | DEBUGOUT("Error Setting up Auto-Negotiation\n"); | 1763 | DEBUGOUT("Error Setting up Auto-Negotiation\n"); |
1763 | return ret_val; | 1764 | return ret_val; |
1764 | } | 1765 | } |
@@ -1768,20 +1769,20 @@ e1000_copper_link_autoneg(struct e1000_hw *hw) | |||
1768 | * the Auto Neg Restart bit in the PHY control register. | 1769 | * the Auto Neg Restart bit in the PHY control register. |
1769 | */ | 1770 | */ |
1770 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); | 1771 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
1771 | if(ret_val) | 1772 | if (ret_val) |
1772 | return ret_val; | 1773 | return ret_val; |
1773 | 1774 | ||
1774 | phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); | 1775 | phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); |
1775 | ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); | 1776 | ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); |
1776 | if(ret_val) | 1777 | if (ret_val) |
1777 | return ret_val; | 1778 | return ret_val; |
1778 | 1779 | ||
1779 | /* Does the user want to wait for Auto-Neg to complete here, or | 1780 | /* Does the user want to wait for Auto-Neg to complete here, or |
1780 | * check at a later time (for example, callback routine). | 1781 | * check at a later time (for example, callback routine). |
1781 | */ | 1782 | */ |
1782 | if(hw->wait_autoneg_complete) { | 1783 | if (hw->wait_autoneg_complete) { |
1783 | ret_val = e1000_wait_autoneg(hw); | 1784 | ret_val = e1000_wait_autoneg(hw); |
1784 | if(ret_val) { | 1785 | if (ret_val) { |
1785 | DEBUGOUT("Error while waiting for autoneg to complete\n"); | 1786 | DEBUGOUT("Error while waiting for autoneg to complete\n"); |
1786 | return ret_val; | 1787 | return ret_val; |
1787 | } | 1788 | } |
@@ -1792,7 +1793,6 @@ e1000_copper_link_autoneg(struct e1000_hw *hw) | |||
1792 | return E1000_SUCCESS; | 1793 | return E1000_SUCCESS; |
1793 | } | 1794 | } |
1794 | 1795 | ||
1795 | |||
1796 | /****************************************************************************** | 1796 | /****************************************************************************** |
1797 | * Config the MAC and the PHY after link is up. | 1797 | * Config the MAC and the PHY after link is up. |
1798 | * 1) Set up the MAC to the current PHY speed/duplex | 1798 | * 1) Set up the MAC to the current PHY speed/duplex |
@@ -1811,25 +1811,25 @@ e1000_copper_link_postconfig(struct e1000_hw *hw) | |||
1811 | int32_t ret_val; | 1811 | int32_t ret_val; |
1812 | DEBUGFUNC("e1000_copper_link_postconfig"); | 1812 | DEBUGFUNC("e1000_copper_link_postconfig"); |
1813 | 1813 | ||
1814 | if(hw->mac_type >= e1000_82544) { | 1814 | if (hw->mac_type >= e1000_82544) { |
1815 | e1000_config_collision_dist(hw); | 1815 | e1000_config_collision_dist(hw); |
1816 | } else { | 1816 | } else { |
1817 | ret_val = e1000_config_mac_to_phy(hw); | 1817 | ret_val = e1000_config_mac_to_phy(hw); |
1818 | if(ret_val) { | 1818 | if (ret_val) { |
1819 | DEBUGOUT("Error configuring MAC to PHY settings\n"); | 1819 | DEBUGOUT("Error configuring MAC to PHY settings\n"); |
1820 | return ret_val; | 1820 | return ret_val; |
1821 | } | 1821 | } |
1822 | } | 1822 | } |
1823 | ret_val = e1000_config_fc_after_link_up(hw); | 1823 | ret_val = e1000_config_fc_after_link_up(hw); |
1824 | if(ret_val) { | 1824 | if (ret_val) { |
1825 | DEBUGOUT("Error Configuring Flow Control\n"); | 1825 | DEBUGOUT("Error Configuring Flow Control\n"); |
1826 | return ret_val; | 1826 | return ret_val; |
1827 | } | 1827 | } |
1828 | 1828 | ||
1829 | /* Config DSP to improve Giga link quality */ | 1829 | /* Config DSP to improve Giga link quality */ |
1830 | if(hw->phy_type == e1000_phy_igp) { | 1830 | if (hw->phy_type == e1000_phy_igp) { |
1831 | ret_val = e1000_config_dsp_after_link_change(hw, TRUE); | 1831 | ret_val = e1000_config_dsp_after_link_change(hw, TRUE); |
1832 | if(ret_val) { | 1832 | if (ret_val) { |
1833 | DEBUGOUT("Error Configuring DSP after link up\n"); | 1833 | DEBUGOUT("Error Configuring DSP after link up\n"); |
1834 | return ret_val; | 1834 | return ret_val; |
1835 | } | 1835 | } |
@@ -1875,7 +1875,7 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1875 | 1875 | ||
1876 | /* Check if it is a valid PHY and set PHY mode if necessary. */ | 1876 | /* Check if it is a valid PHY and set PHY mode if necessary. */ |
1877 | ret_val = e1000_copper_link_preconfig(hw); | 1877 | ret_val = e1000_copper_link_preconfig(hw); |
1878 | if(ret_val) | 1878 | if (ret_val) |
1879 | return ret_val; | 1879 | return ret_val; |
1880 | 1880 | ||
1881 | switch (hw->mac_type) { | 1881 | switch (hw->mac_type) { |
@@ -1896,30 +1896,30 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1896 | hw->phy_type == e1000_phy_igp_3 || | 1896 | hw->phy_type == e1000_phy_igp_3 || |
1897 | hw->phy_type == e1000_phy_igp_2) { | 1897 | hw->phy_type == e1000_phy_igp_2) { |
1898 | ret_val = e1000_copper_link_igp_setup(hw); | 1898 | ret_val = e1000_copper_link_igp_setup(hw); |
1899 | if(ret_val) | 1899 | if (ret_val) |
1900 | return ret_val; | 1900 | return ret_val; |
1901 | } else if (hw->phy_type == e1000_phy_m88) { | 1901 | } else if (hw->phy_type == e1000_phy_m88) { |
1902 | ret_val = e1000_copper_link_mgp_setup(hw); | 1902 | ret_val = e1000_copper_link_mgp_setup(hw); |
1903 | if(ret_val) | 1903 | if (ret_val) |
1904 | return ret_val; | 1904 | return ret_val; |
1905 | } else if (hw->phy_type == e1000_phy_gg82563) { | 1905 | } else if (hw->phy_type == e1000_phy_gg82563) { |
1906 | ret_val = e1000_copper_link_ggp_setup(hw); | 1906 | ret_val = e1000_copper_link_ggp_setup(hw); |
1907 | if(ret_val) | 1907 | if (ret_val) |
1908 | return ret_val; | 1908 | return ret_val; |
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | if(hw->autoneg) { | 1911 | if (hw->autoneg) { |
1912 | /* Setup autoneg and flow control advertisement | 1912 | /* Setup autoneg and flow control advertisement |
1913 | * and perform autonegotiation */ | 1913 | * and perform autonegotiation */ |
1914 | ret_val = e1000_copper_link_autoneg(hw); | 1914 | ret_val = e1000_copper_link_autoneg(hw); |
1915 | if(ret_val) | 1915 | if (ret_val) |
1916 | return ret_val; | 1916 | return ret_val; |
1917 | } else { | 1917 | } else { |
1918 | /* PHY will be set to 10H, 10F, 100H,or 100F | 1918 | /* PHY will be set to 10H, 10F, 100H,or 100F |
1919 | * depending on value from forced_speed_duplex. */ | 1919 | * depending on value from forced_speed_duplex. */ |
1920 | DEBUGOUT("Forcing speed and duplex\n"); | 1920 | DEBUGOUT("Forcing speed and duplex\n"); |
1921 | ret_val = e1000_phy_force_speed_duplex(hw); | 1921 | ret_val = e1000_phy_force_speed_duplex(hw); |
1922 | if(ret_val) { | 1922 | if (ret_val) { |
1923 | DEBUGOUT("Error Forcing Speed and Duplex\n"); | 1923 | DEBUGOUT("Error Forcing Speed and Duplex\n"); |
1924 | return ret_val; | 1924 | return ret_val; |
1925 | } | 1925 | } |
@@ -1928,18 +1928,18 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1928 | /* Check link status. Wait up to 100 microseconds for link to become | 1928 | /* Check link status. Wait up to 100 microseconds for link to become |
1929 | * valid. | 1929 | * valid. |
1930 | */ | 1930 | */ |
1931 | for(i = 0; i < 10; i++) { | 1931 | for (i = 0; i < 10; i++) { |
1932 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 1932 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
1933 | if(ret_val) | 1933 | if (ret_val) |
1934 | return ret_val; | 1934 | return ret_val; |
1935 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 1935 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
1936 | if(ret_val) | 1936 | if (ret_val) |
1937 | return ret_val; | 1937 | return ret_val; |
1938 | 1938 | ||
1939 | if(phy_data & MII_SR_LINK_STATUS) { | 1939 | if (phy_data & MII_SR_LINK_STATUS) { |
1940 | /* Config the MAC and PHY after link is up */ | 1940 | /* Config the MAC and PHY after link is up */ |
1941 | ret_val = e1000_copper_link_postconfig(hw); | 1941 | ret_val = e1000_copper_link_postconfig(hw); |
1942 | if(ret_val) | 1942 | if (ret_val) |
1943 | return ret_val; | 1943 | return ret_val; |
1944 | 1944 | ||
1945 | DEBUGOUT("Valid link established!!!\n"); | 1945 | DEBUGOUT("Valid link established!!!\n"); |
@@ -2041,7 +2041,7 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
2041 | 2041 | ||
2042 | /* Read the MII Auto-Neg Advertisement Register (Address 4). */ | 2042 | /* Read the MII Auto-Neg Advertisement Register (Address 4). */ |
2043 | ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); | 2043 | ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); |
2044 | if(ret_val) | 2044 | if (ret_val) |
2045 | return ret_val; | 2045 | return ret_val; |
2046 | 2046 | ||
2047 | if (hw->phy_type != e1000_phy_ife) { | 2047 | if (hw->phy_type != e1000_phy_ife) { |
@@ -2069,36 +2069,36 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
2069 | DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised); | 2069 | DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised); |
2070 | 2070 | ||
2071 | /* Do we want to advertise 10 Mb Half Duplex? */ | 2071 | /* Do we want to advertise 10 Mb Half Duplex? */ |
2072 | if(hw->autoneg_advertised & ADVERTISE_10_HALF) { | 2072 | if (hw->autoneg_advertised & ADVERTISE_10_HALF) { |
2073 | DEBUGOUT("Advertise 10mb Half duplex\n"); | 2073 | DEBUGOUT("Advertise 10mb Half duplex\n"); |
2074 | mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; | 2074 | mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; |
2075 | } | 2075 | } |
2076 | 2076 | ||
2077 | /* Do we want to advertise 10 Mb Full Duplex? */ | 2077 | /* Do we want to advertise 10 Mb Full Duplex? */ |
2078 | if(hw->autoneg_advertised & ADVERTISE_10_FULL) { | 2078 | if (hw->autoneg_advertised & ADVERTISE_10_FULL) { |
2079 | DEBUGOUT("Advertise 10mb Full duplex\n"); | 2079 | DEBUGOUT("Advertise 10mb Full duplex\n"); |
2080 | mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; | 2080 | mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; |
2081 | } | 2081 | } |
2082 | 2082 | ||
2083 | /* Do we want to advertise 100 Mb Half Duplex? */ | 2083 | /* Do we want to advertise 100 Mb Half Duplex? */ |
2084 | if(hw->autoneg_advertised & ADVERTISE_100_HALF) { | 2084 | if (hw->autoneg_advertised & ADVERTISE_100_HALF) { |
2085 | DEBUGOUT("Advertise 100mb Half duplex\n"); | 2085 | DEBUGOUT("Advertise 100mb Half duplex\n"); |
2086 | mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; | 2086 | mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; |
2087 | } | 2087 | } |
2088 | 2088 | ||
2089 | /* Do we want to advertise 100 Mb Full Duplex? */ | 2089 | /* Do we want to advertise 100 Mb Full Duplex? */ |
2090 | if(hw->autoneg_advertised & ADVERTISE_100_FULL) { | 2090 | if (hw->autoneg_advertised & ADVERTISE_100_FULL) { |
2091 | DEBUGOUT("Advertise 100mb Full duplex\n"); | 2091 | DEBUGOUT("Advertise 100mb Full duplex\n"); |
2092 | mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; | 2092 | mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; |
2093 | } | 2093 | } |
2094 | 2094 | ||
2095 | /* We do not allow the Phy to advertise 1000 Mb Half Duplex */ | 2095 | /* We do not allow the Phy to advertise 1000 Mb Half Duplex */ |
2096 | if(hw->autoneg_advertised & ADVERTISE_1000_HALF) { | 2096 | if (hw->autoneg_advertised & ADVERTISE_1000_HALF) { |
2097 | DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n"); | 2097 | DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n"); |
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | /* Do we want to advertise 1000 Mb Full Duplex? */ | 2100 | /* Do we want to advertise 1000 Mb Full Duplex? */ |
2101 | if(hw->autoneg_advertised & ADVERTISE_1000_FULL) { | 2101 | if (hw->autoneg_advertised & ADVERTISE_1000_FULL) { |
2102 | DEBUGOUT("Advertise 1000mb Full duplex\n"); | 2102 | DEBUGOUT("Advertise 1000mb Full duplex\n"); |
2103 | mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; | 2103 | mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; |
2104 | if (hw->phy_type == e1000_phy_ife) { | 2104 | if (hw->phy_type == e1000_phy_ife) { |
@@ -2160,7 +2160,7 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
2160 | } | 2160 | } |
2161 | 2161 | ||
2162 | ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); | 2162 | ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); |
2163 | if(ret_val) | 2163 | if (ret_val) |
2164 | return ret_val; | 2164 | return ret_val; |
2165 | 2165 | ||
2166 | DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); | 2166 | DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); |
@@ -2208,7 +2208,7 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2208 | 2208 | ||
2209 | /* Read the MII Control Register. */ | 2209 | /* Read the MII Control Register. */ |
2210 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg); | 2210 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg); |
2211 | if(ret_val) | 2211 | if (ret_val) |
2212 | return ret_val; | 2212 | return ret_val; |
2213 | 2213 | ||
2214 | /* We need to disable autoneg in order to force link and duplex. */ | 2214 | /* We need to disable autoneg in order to force link and duplex. */ |
@@ -2216,8 +2216,8 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2216 | mii_ctrl_reg &= ~MII_CR_AUTO_NEG_EN; | 2216 | mii_ctrl_reg &= ~MII_CR_AUTO_NEG_EN; |
2217 | 2217 | ||
2218 | /* Are we forcing Full or Half Duplex? */ | 2218 | /* Are we forcing Full or Half Duplex? */ |
2219 | if(hw->forced_speed_duplex == e1000_100_full || | 2219 | if (hw->forced_speed_duplex == e1000_100_full || |
2220 | hw->forced_speed_duplex == e1000_10_full) { | 2220 | hw->forced_speed_duplex == e1000_10_full) { |
2221 | /* We want to force full duplex so we SET the full duplex bits in the | 2221 | /* We want to force full duplex so we SET the full duplex bits in the |
2222 | * Device and MII Control Registers. | 2222 | * Device and MII Control Registers. |
2223 | */ | 2223 | */ |
@@ -2234,7 +2234,7 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2234 | } | 2234 | } |
2235 | 2235 | ||
2236 | /* Are we forcing 100Mbps??? */ | 2236 | /* Are we forcing 100Mbps??? */ |
2237 | if(hw->forced_speed_duplex == e1000_100_full || | 2237 | if (hw->forced_speed_duplex == e1000_100_full || |
2238 | hw->forced_speed_duplex == e1000_100_half) { | 2238 | hw->forced_speed_duplex == e1000_100_half) { |
2239 | /* Set the 100Mb bit and turn off the 1000Mb and 10Mb bits. */ | 2239 | /* Set the 100Mb bit and turn off the 1000Mb and 10Mb bits. */ |
2240 | ctrl |= E1000_CTRL_SPD_100; | 2240 | ctrl |= E1000_CTRL_SPD_100; |
@@ -2257,7 +2257,7 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2257 | if ((hw->phy_type == e1000_phy_m88) || | 2257 | if ((hw->phy_type == e1000_phy_m88) || |
2258 | (hw->phy_type == e1000_phy_gg82563)) { | 2258 | (hw->phy_type == e1000_phy_gg82563)) { |
2259 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); | 2259 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
2260 | if(ret_val) | 2260 | if (ret_val) |
2261 | return ret_val; | 2261 | return ret_val; |
2262 | 2262 | ||
2263 | /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI | 2263 | /* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI |
@@ -2265,7 +2265,7 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2265 | */ | 2265 | */ |
2266 | phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; | 2266 | phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; |
2267 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); | 2267 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
2268 | if(ret_val) | 2268 | if (ret_val) |
2269 | return ret_val; | 2269 | return ret_val; |
2270 | 2270 | ||
2271 | DEBUGOUT1("M88E1000 PSCR: %x \n", phy_data); | 2271 | DEBUGOUT1("M88E1000 PSCR: %x \n", phy_data); |
@@ -2289,20 +2289,20 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2289 | * forced whenever speed or duplex are forced. | 2289 | * forced whenever speed or duplex are forced. |
2290 | */ | 2290 | */ |
2291 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); | 2291 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); |
2292 | if(ret_val) | 2292 | if (ret_val) |
2293 | return ret_val; | 2293 | return ret_val; |
2294 | 2294 | ||
2295 | phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; | 2295 | phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; |
2296 | phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; | 2296 | phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; |
2297 | 2297 | ||
2298 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); | 2298 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
2299 | if(ret_val) | 2299 | if (ret_val) |
2300 | return ret_val; | 2300 | return ret_val; |
2301 | } | 2301 | } |
2302 | 2302 | ||
2303 | /* Write back the modified PHY MII control register. */ | 2303 | /* Write back the modified PHY MII control register. */ |
2304 | ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg); | 2304 | ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg); |
2305 | if(ret_val) | 2305 | if (ret_val) |
2306 | return ret_val; | 2306 | return ret_val; |
2307 | 2307 | ||
2308 | udelay(1); | 2308 | udelay(1); |
@@ -2314,50 +2314,50 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2314 | * only if the user has set wait_autoneg_complete to 1, which is | 2314 | * only if the user has set wait_autoneg_complete to 1, which is |
2315 | * the default. | 2315 | * the default. |
2316 | */ | 2316 | */ |
2317 | if(hw->wait_autoneg_complete) { | 2317 | if (hw->wait_autoneg_complete) { |
2318 | /* We will wait for autoneg to complete. */ | 2318 | /* We will wait for autoneg to complete. */ |
2319 | DEBUGOUT("Waiting for forced speed/duplex link.\n"); | 2319 | DEBUGOUT("Waiting for forced speed/duplex link.\n"); |
2320 | mii_status_reg = 0; | 2320 | mii_status_reg = 0; |
2321 | 2321 | ||
2322 | /* We will wait for autoneg to complete or 4.5 seconds to expire. */ | 2322 | /* We will wait for autoneg to complete or 4.5 seconds to expire. */ |
2323 | for(i = PHY_FORCE_TIME; i > 0; i--) { | 2323 | for (i = PHY_FORCE_TIME; i > 0; i--) { |
2324 | /* Read the MII Status Register and wait for Auto-Neg Complete bit | 2324 | /* Read the MII Status Register and wait for Auto-Neg Complete bit |
2325 | * to be set. | 2325 | * to be set. |
2326 | */ | 2326 | */ |
2327 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 2327 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
2328 | if(ret_val) | 2328 | if (ret_val) |
2329 | return ret_val; | 2329 | return ret_val; |
2330 | 2330 | ||
2331 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 2331 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
2332 | if(ret_val) | 2332 | if (ret_val) |
2333 | return ret_val; | 2333 | return ret_val; |
2334 | 2334 | ||
2335 | if(mii_status_reg & MII_SR_LINK_STATUS) break; | 2335 | if (mii_status_reg & MII_SR_LINK_STATUS) break; |
2336 | msec_delay(100); | 2336 | msec_delay(100); |
2337 | } | 2337 | } |
2338 | if((i == 0) && | 2338 | if ((i == 0) && |
2339 | ((hw->phy_type == e1000_phy_m88) || | 2339 | ((hw->phy_type == e1000_phy_m88) || |
2340 | (hw->phy_type == e1000_phy_gg82563))) { | 2340 | (hw->phy_type == e1000_phy_gg82563))) { |
2341 | /* We didn't get link. Reset the DSP and wait again for link. */ | 2341 | /* We didn't get link. Reset the DSP and wait again for link. */ |
2342 | ret_val = e1000_phy_reset_dsp(hw); | 2342 | ret_val = e1000_phy_reset_dsp(hw); |
2343 | if(ret_val) { | 2343 | if (ret_val) { |
2344 | DEBUGOUT("Error Resetting PHY DSP\n"); | 2344 | DEBUGOUT("Error Resetting PHY DSP\n"); |
2345 | return ret_val; | 2345 | return ret_val; |
2346 | } | 2346 | } |
2347 | } | 2347 | } |
2348 | /* This loop will early-out if the link condition has been met. */ | 2348 | /* This loop will early-out if the link condition has been met. */ |
2349 | for(i = PHY_FORCE_TIME; i > 0; i--) { | 2349 | for (i = PHY_FORCE_TIME; i > 0; i--) { |
2350 | if(mii_status_reg & MII_SR_LINK_STATUS) break; | 2350 | if (mii_status_reg & MII_SR_LINK_STATUS) break; |
2351 | msec_delay(100); | 2351 | msec_delay(100); |
2352 | /* Read the MII Status Register and wait for Auto-Neg Complete bit | 2352 | /* Read the MII Status Register and wait for Auto-Neg Complete bit |
2353 | * to be set. | 2353 | * to be set. |
2354 | */ | 2354 | */ |
2355 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 2355 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
2356 | if(ret_val) | 2356 | if (ret_val) |
2357 | return ret_val; | 2357 | return ret_val; |
2358 | 2358 | ||
2359 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 2359 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
2360 | if(ret_val) | 2360 | if (ret_val) |
2361 | return ret_val; | 2361 | return ret_val; |
2362 | } | 2362 | } |
2363 | } | 2363 | } |
@@ -2368,32 +2368,31 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2368 | * defaults back to a 2.5MHz clock when the PHY is reset. | 2368 | * defaults back to a 2.5MHz clock when the PHY is reset. |
2369 | */ | 2369 | */ |
2370 | ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); | 2370 | ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); |
2371 | if(ret_val) | 2371 | if (ret_val) |
2372 | return ret_val; | 2372 | return ret_val; |
2373 | 2373 | ||
2374 | phy_data |= M88E1000_EPSCR_TX_CLK_25; | 2374 | phy_data |= M88E1000_EPSCR_TX_CLK_25; |
2375 | ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); | 2375 | ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
2376 | if(ret_val) | 2376 | if (ret_val) |
2377 | return ret_val; | 2377 | return ret_val; |
2378 | 2378 | ||
2379 | /* In addition, because of the s/w reset above, we need to enable CRS on | 2379 | /* In addition, because of the s/w reset above, we need to enable CRS on |
2380 | * TX. This must be set for both full and half duplex operation. | 2380 | * TX. This must be set for both full and half duplex operation. |
2381 | */ | 2381 | */ |
2382 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); | 2382 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
2383 | if(ret_val) | 2383 | if (ret_val) |
2384 | return ret_val; | 2384 | return ret_val; |
2385 | 2385 | ||
2386 | phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; | 2386 | phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
2387 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); | 2387 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
2388 | if(ret_val) | 2388 | if (ret_val) |
2389 | return ret_val; | 2389 | return ret_val; |
2390 | 2390 | ||
2391 | if((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) && | 2391 | if ((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) && |
2392 | (!hw->autoneg) && | 2392 | (!hw->autoneg) && (hw->forced_speed_duplex == e1000_10_full || |
2393 | (hw->forced_speed_duplex == e1000_10_full || | 2393 | hw->forced_speed_duplex == e1000_10_half)) { |
2394 | hw->forced_speed_duplex == e1000_10_half)) { | ||
2395 | ret_val = e1000_polarity_reversal_workaround(hw); | 2394 | ret_val = e1000_polarity_reversal_workaround(hw); |
2396 | if(ret_val) | 2395 | if (ret_val) |
2397 | return ret_val; | 2396 | return ret_val; |
2398 | } | 2397 | } |
2399 | } else if (hw->phy_type == e1000_phy_gg82563) { | 2398 | } else if (hw->phy_type == e1000_phy_gg82563) { |
@@ -2484,10 +2483,10 @@ e1000_config_mac_to_phy(struct e1000_hw *hw) | |||
2484 | * registers depending on negotiated values. | 2483 | * registers depending on negotiated values. |
2485 | */ | 2484 | */ |
2486 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); | 2485 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
2487 | if(ret_val) | 2486 | if (ret_val) |
2488 | return ret_val; | 2487 | return ret_val; |
2489 | 2488 | ||
2490 | if(phy_data & M88E1000_PSSR_DPLX) | 2489 | if (phy_data & M88E1000_PSSR_DPLX) |
2491 | ctrl |= E1000_CTRL_FD; | 2490 | ctrl |= E1000_CTRL_FD; |
2492 | else | 2491 | else |
2493 | ctrl &= ~E1000_CTRL_FD; | 2492 | ctrl &= ~E1000_CTRL_FD; |
@@ -2497,9 +2496,9 @@ e1000_config_mac_to_phy(struct e1000_hw *hw) | |||
2497 | /* Set up speed in the Device Control register depending on | 2496 | /* Set up speed in the Device Control register depending on |
2498 | * negotiated values. | 2497 | * negotiated values. |
2499 | */ | 2498 | */ |
2500 | if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) | 2499 | if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) |
2501 | ctrl |= E1000_CTRL_SPD_1000; | 2500 | ctrl |= E1000_CTRL_SPD_1000; |
2502 | else if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS) | 2501 | else if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS) |
2503 | ctrl |= E1000_CTRL_SPD_100; | 2502 | ctrl |= E1000_CTRL_SPD_100; |
2504 | 2503 | ||
2505 | /* Write the configured values back to the Device Control Reg. */ | 2504 | /* Write the configured values back to the Device Control Reg. */ |
@@ -2567,7 +2566,7 @@ e1000_force_mac_fc(struct e1000_hw *hw) | |||
2567 | } | 2566 | } |
2568 | 2567 | ||
2569 | /* Disable TX Flow Control for 82542 (rev 2.0) */ | 2568 | /* Disable TX Flow Control for 82542 (rev 2.0) */ |
2570 | if(hw->mac_type == e1000_82542_rev2_0) | 2569 | if (hw->mac_type == e1000_82542_rev2_0) |
2571 | ctrl &= (~E1000_CTRL_TFCE); | 2570 | ctrl &= (~E1000_CTRL_TFCE); |
2572 | 2571 | ||
2573 | E1000_WRITE_REG(hw, CTRL, ctrl); | 2572 | E1000_WRITE_REG(hw, CTRL, ctrl); |
@@ -2601,11 +2600,12 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) | |||
2601 | * so we had to force link. In this case, we need to force the | 2600 | * so we had to force link. In this case, we need to force the |
2602 | * configuration of the MAC to match the "fc" parameter. | 2601 | * configuration of the MAC to match the "fc" parameter. |
2603 | */ | 2602 | */ |
2604 | if(((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) || | 2603 | if (((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) || |
2605 | ((hw->media_type == e1000_media_type_internal_serdes) && (hw->autoneg_failed)) || | 2604 | ((hw->media_type == e1000_media_type_internal_serdes) && |
2606 | ((hw->media_type == e1000_media_type_copper) && (!hw->autoneg))) { | 2605 | (hw->autoneg_failed)) || |
2606 | ((hw->media_type == e1000_media_type_copper) && (!hw->autoneg))) { | ||
2607 | ret_val = e1000_force_mac_fc(hw); | 2607 | ret_val = e1000_force_mac_fc(hw); |
2608 | if(ret_val) { | 2608 | if (ret_val) { |
2609 | DEBUGOUT("Error forcing flow control settings\n"); | 2609 | DEBUGOUT("Error forcing flow control settings\n"); |
2610 | return ret_val; | 2610 | return ret_val; |
2611 | } | 2611 | } |
@@ -2616,19 +2616,19 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) | |||
2616 | * has completed, and if so, how the PHY and link partner has | 2616 | * has completed, and if so, how the PHY and link partner has |
2617 | * flow control configured. | 2617 | * flow control configured. |
2618 | */ | 2618 | */ |
2619 | if((hw->media_type == e1000_media_type_copper) && hw->autoneg) { | 2619 | if ((hw->media_type == e1000_media_type_copper) && hw->autoneg) { |
2620 | /* Read the MII Status Register and check to see if AutoNeg | 2620 | /* Read the MII Status Register and check to see if AutoNeg |
2621 | * has completed. We read this twice because this reg has | 2621 | * has completed. We read this twice because this reg has |
2622 | * some "sticky" (latched) bits. | 2622 | * some "sticky" (latched) bits. |
2623 | */ | 2623 | */ |
2624 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 2624 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
2625 | if(ret_val) | 2625 | if (ret_val) |
2626 | return ret_val; | 2626 | return ret_val; |
2627 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 2627 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
2628 | if(ret_val) | 2628 | if (ret_val) |
2629 | return ret_val; | 2629 | return ret_val; |
2630 | 2630 | ||
2631 | if(mii_status_reg & MII_SR_AUTONEG_COMPLETE) { | 2631 | if (mii_status_reg & MII_SR_AUTONEG_COMPLETE) { |
2632 | /* The AutoNeg process has completed, so we now need to | 2632 | /* The AutoNeg process has completed, so we now need to |
2633 | * read both the Auto Negotiation Advertisement Register | 2633 | * read both the Auto Negotiation Advertisement Register |
2634 | * (Address 4) and the Auto_Negotiation Base Page Ability | 2634 | * (Address 4) and the Auto_Negotiation Base Page Ability |
@@ -2637,11 +2637,11 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) | |||
2637 | */ | 2637 | */ |
2638 | ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, | 2638 | ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, |
2639 | &mii_nway_adv_reg); | 2639 | &mii_nway_adv_reg); |
2640 | if(ret_val) | 2640 | if (ret_val) |
2641 | return ret_val; | 2641 | return ret_val; |
2642 | ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, | 2642 | ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, |
2643 | &mii_nway_lp_ability_reg); | 2643 | &mii_nway_lp_ability_reg); |
2644 | if(ret_val) | 2644 | if (ret_val) |
2645 | return ret_val; | 2645 | return ret_val; |
2646 | 2646 | ||
2647 | /* Two bits in the Auto Negotiation Advertisement Register | 2647 | /* Two bits in the Auto Negotiation Advertisement Register |
@@ -2678,15 +2678,15 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) | |||
2678 | * 1 | DC | 1 | DC | e1000_fc_full | 2678 | * 1 | DC | 1 | DC | e1000_fc_full |
2679 | * | 2679 | * |
2680 | */ | 2680 | */ |
2681 | if((mii_nway_adv_reg & NWAY_AR_PAUSE) && | 2681 | if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && |
2682 | (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { | 2682 | (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { |
2683 | /* Now we need to check if the user selected RX ONLY | 2683 | /* Now we need to check if the user selected RX ONLY |
2684 | * of pause frames. In this case, we had to advertise | 2684 | * of pause frames. In this case, we had to advertise |
2685 | * FULL flow control because we could not advertise RX | 2685 | * FULL flow control because we could not advertise RX |
2686 | * ONLY. Hence, we must now check to see if we need to | 2686 | * ONLY. Hence, we must now check to see if we need to |
2687 | * turn OFF the TRANSMISSION of PAUSE frames. | 2687 | * turn OFF the TRANSMISSION of PAUSE frames. |
2688 | */ | 2688 | */ |
2689 | if(hw->original_fc == e1000_fc_full) { | 2689 | if (hw->original_fc == e1000_fc_full) { |
2690 | hw->fc = e1000_fc_full; | 2690 | hw->fc = e1000_fc_full; |
2691 | DEBUGOUT("Flow Control = FULL.\n"); | 2691 | DEBUGOUT("Flow Control = FULL.\n"); |
2692 | } else { | 2692 | } else { |
@@ -2702,10 +2702,10 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) | |||
2702 | * 0 | 1 | 1 | 1 | e1000_fc_tx_pause | 2702 | * 0 | 1 | 1 | 1 | e1000_fc_tx_pause |
2703 | * | 2703 | * |
2704 | */ | 2704 | */ |
2705 | else if(!(mii_nway_adv_reg & NWAY_AR_PAUSE) && | 2705 | else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) && |
2706 | (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && | 2706 | (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
2707 | (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && | 2707 | (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
2708 | (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { | 2708 | (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { |
2709 | hw->fc = e1000_fc_tx_pause; | 2709 | hw->fc = e1000_fc_tx_pause; |
2710 | DEBUGOUT("Flow Control = TX PAUSE frames only.\n"); | 2710 | DEBUGOUT("Flow Control = TX PAUSE frames only.\n"); |
2711 | } | 2711 | } |
@@ -2717,10 +2717,10 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) | |||
2717 | * 1 | 1 | 0 | 1 | e1000_fc_rx_pause | 2717 | * 1 | 1 | 0 | 1 | e1000_fc_rx_pause |
2718 | * | 2718 | * |
2719 | */ | 2719 | */ |
2720 | else if((mii_nway_adv_reg & NWAY_AR_PAUSE) && | 2720 | else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && |
2721 | (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && | 2721 | (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
2722 | !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && | 2722 | !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
2723 | (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { | 2723 | (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { |
2724 | hw->fc = e1000_fc_rx_pause; | 2724 | hw->fc = e1000_fc_rx_pause; |
2725 | DEBUGOUT("Flow Control = RX PAUSE frames only.\n"); | 2725 | DEBUGOUT("Flow Control = RX PAUSE frames only.\n"); |
2726 | } | 2726 | } |
@@ -2744,9 +2744,9 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) | |||
2744 | * be asked to delay transmission of packets than asking | 2744 | * be asked to delay transmission of packets than asking |
2745 | * our link partner to pause transmission of frames. | 2745 | * our link partner to pause transmission of frames. |
2746 | */ | 2746 | */ |
2747 | else if((hw->original_fc == e1000_fc_none || | 2747 | else if ((hw->original_fc == e1000_fc_none || |
2748 | hw->original_fc == e1000_fc_tx_pause) || | 2748 | hw->original_fc == e1000_fc_tx_pause) || |
2749 | hw->fc_strict_ieee) { | 2749 | hw->fc_strict_ieee) { |
2750 | hw->fc = e1000_fc_none; | 2750 | hw->fc = e1000_fc_none; |
2751 | DEBUGOUT("Flow Control = NONE.\n"); | 2751 | DEBUGOUT("Flow Control = NONE.\n"); |
2752 | } else { | 2752 | } else { |
@@ -2759,19 +2759,19 @@ e1000_config_fc_after_link_up(struct e1000_hw *hw) | |||
2759 | * enabled per IEEE 802.3 spec. | 2759 | * enabled per IEEE 802.3 spec. |
2760 | */ | 2760 | */ |
2761 | ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); | 2761 | ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
2762 | if(ret_val) { | 2762 | if (ret_val) { |
2763 | DEBUGOUT("Error getting link speed and duplex\n"); | 2763 | DEBUGOUT("Error getting link speed and duplex\n"); |
2764 | return ret_val; | 2764 | return ret_val; |
2765 | } | 2765 | } |
2766 | 2766 | ||
2767 | if(duplex == HALF_DUPLEX) | 2767 | if (duplex == HALF_DUPLEX) |
2768 | hw->fc = e1000_fc_none; | 2768 | hw->fc = e1000_fc_none; |
2769 | 2769 | ||
2770 | /* Now we call a subroutine to actually force the MAC | 2770 | /* Now we call a subroutine to actually force the MAC |
2771 | * controller to use the correct flow control settings. | 2771 | * controller to use the correct flow control settings. |
2772 | */ | 2772 | */ |
2773 | ret_val = e1000_force_mac_fc(hw); | 2773 | ret_val = e1000_force_mac_fc(hw); |
2774 | if(ret_val) { | 2774 | if (ret_val) { |
2775 | DEBUGOUT("Error forcing flow control settings\n"); | 2775 | DEBUGOUT("Error forcing flow control settings\n"); |
2776 | return ret_val; | 2776 | return ret_val; |
2777 | } | 2777 | } |
@@ -2810,13 +2810,13 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2810 | * set when the optics detect a signal. On older adapters, it will be | 2810 | * set when the optics detect a signal. On older adapters, it will be |
2811 | * cleared when there is a signal. This applies to fiber media only. | 2811 | * cleared when there is a signal. This applies to fiber media only. |
2812 | */ | 2812 | */ |
2813 | if((hw->media_type == e1000_media_type_fiber) || | 2813 | if ((hw->media_type == e1000_media_type_fiber) || |
2814 | (hw->media_type == e1000_media_type_internal_serdes)) { | 2814 | (hw->media_type == e1000_media_type_internal_serdes)) { |
2815 | rxcw = E1000_READ_REG(hw, RXCW); | 2815 | rxcw = E1000_READ_REG(hw, RXCW); |
2816 | 2816 | ||
2817 | if(hw->media_type == e1000_media_type_fiber) { | 2817 | if (hw->media_type == e1000_media_type_fiber) { |
2818 | signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; | 2818 | signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; |
2819 | if(status & E1000_STATUS_LU) | 2819 | if (status & E1000_STATUS_LU) |
2820 | hw->get_link_status = FALSE; | 2820 | hw->get_link_status = FALSE; |
2821 | } | 2821 | } |
2822 | } | 2822 | } |
@@ -2827,20 +2827,20 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2827 | * receive a Link Status Change interrupt or we have Rx Sequence | 2827 | * receive a Link Status Change interrupt or we have Rx Sequence |
2828 | * Errors. | 2828 | * Errors. |
2829 | */ | 2829 | */ |
2830 | if((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { | 2830 | if ((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { |
2831 | /* First we want to see if the MII Status Register reports | 2831 | /* First we want to see if the MII Status Register reports |
2832 | * link. If so, then we want to get the current speed/duplex | 2832 | * link. If so, then we want to get the current speed/duplex |
2833 | * of the PHY. | 2833 | * of the PHY. |
2834 | * Read the register twice since the link bit is sticky. | 2834 | * Read the register twice since the link bit is sticky. |
2835 | */ | 2835 | */ |
2836 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 2836 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
2837 | if(ret_val) | 2837 | if (ret_val) |
2838 | return ret_val; | 2838 | return ret_val; |
2839 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 2839 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
2840 | if(ret_val) | 2840 | if (ret_val) |
2841 | return ret_val; | 2841 | return ret_val; |
2842 | 2842 | ||
2843 | if(phy_data & MII_SR_LINK_STATUS) { | 2843 | if (phy_data & MII_SR_LINK_STATUS) { |
2844 | hw->get_link_status = FALSE; | 2844 | hw->get_link_status = FALSE; |
2845 | /* Check if there was DownShift, must be checked immediately after | 2845 | /* Check if there was DownShift, must be checked immediately after |
2846 | * link-up */ | 2846 | * link-up */ |
@@ -2854,10 +2854,10 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2854 | * happen due to the execution of this workaround. | 2854 | * happen due to the execution of this workaround. |
2855 | */ | 2855 | */ |
2856 | 2856 | ||
2857 | if((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) && | 2857 | if ((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) && |
2858 | (!hw->autoneg) && | 2858 | (!hw->autoneg) && |
2859 | (hw->forced_speed_duplex == e1000_10_full || | 2859 | (hw->forced_speed_duplex == e1000_10_full || |
2860 | hw->forced_speed_duplex == e1000_10_half)) { | 2860 | hw->forced_speed_duplex == e1000_10_half)) { |
2861 | E1000_WRITE_REG(hw, IMC, 0xffffffff); | 2861 | E1000_WRITE_REG(hw, IMC, 0xffffffff); |
2862 | ret_val = e1000_polarity_reversal_workaround(hw); | 2862 | ret_val = e1000_polarity_reversal_workaround(hw); |
2863 | icr = E1000_READ_REG(hw, ICR); | 2863 | icr = E1000_READ_REG(hw, ICR); |
@@ -2874,7 +2874,7 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2874 | /* If we are forcing speed/duplex, then we simply return since | 2874 | /* If we are forcing speed/duplex, then we simply return since |
2875 | * we have already determined whether we have link or not. | 2875 | * we have already determined whether we have link or not. |
2876 | */ | 2876 | */ |
2877 | if(!hw->autoneg) return -E1000_ERR_CONFIG; | 2877 | if (!hw->autoneg) return -E1000_ERR_CONFIG; |
2878 | 2878 | ||
2879 | /* optimize the dsp settings for the igp phy */ | 2879 | /* optimize the dsp settings for the igp phy */ |
2880 | e1000_config_dsp_after_link_change(hw, TRUE); | 2880 | e1000_config_dsp_after_link_change(hw, TRUE); |
@@ -2887,11 +2887,11 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2887 | * speed/duplex on the MAC to the current PHY speed/duplex | 2887 | * speed/duplex on the MAC to the current PHY speed/duplex |
2888 | * settings. | 2888 | * settings. |
2889 | */ | 2889 | */ |
2890 | if(hw->mac_type >= e1000_82544) | 2890 | if (hw->mac_type >= e1000_82544) |
2891 | e1000_config_collision_dist(hw); | 2891 | e1000_config_collision_dist(hw); |
2892 | else { | 2892 | else { |
2893 | ret_val = e1000_config_mac_to_phy(hw); | 2893 | ret_val = e1000_config_mac_to_phy(hw); |
2894 | if(ret_val) { | 2894 | if (ret_val) { |
2895 | DEBUGOUT("Error configuring MAC to PHY settings\n"); | 2895 | DEBUGOUT("Error configuring MAC to PHY settings\n"); |
2896 | return ret_val; | 2896 | return ret_val; |
2897 | } | 2897 | } |
@@ -2902,7 +2902,7 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2902 | * have had to re-autoneg with a different link partner. | 2902 | * have had to re-autoneg with a different link partner. |
2903 | */ | 2903 | */ |
2904 | ret_val = e1000_config_fc_after_link_up(hw); | 2904 | ret_val = e1000_config_fc_after_link_up(hw); |
2905 | if(ret_val) { | 2905 | if (ret_val) { |
2906 | DEBUGOUT("Error configuring flow control\n"); | 2906 | DEBUGOUT("Error configuring flow control\n"); |
2907 | return ret_val; | 2907 | return ret_val; |
2908 | } | 2908 | } |
@@ -2914,7 +2914,7 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2914 | * at gigabit speed, then TBI compatibility is not needed. If we are | 2914 | * at gigabit speed, then TBI compatibility is not needed. If we are |
2915 | * at gigabit speed, we turn on TBI compatibility. | 2915 | * at gigabit speed, we turn on TBI compatibility. |
2916 | */ | 2916 | */ |
2917 | if(hw->tbi_compatibility_en) { | 2917 | if (hw->tbi_compatibility_en) { |
2918 | uint16_t speed, duplex; | 2918 | uint16_t speed, duplex; |
2919 | ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); | 2919 | ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
2920 | if (ret_val) { | 2920 | if (ret_val) { |
@@ -2925,7 +2925,7 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2925 | /* If link speed is not set to gigabit speed, we do not need | 2925 | /* If link speed is not set to gigabit speed, we do not need |
2926 | * to enable TBI compatibility. | 2926 | * to enable TBI compatibility. |
2927 | */ | 2927 | */ |
2928 | if(hw->tbi_compatibility_on) { | 2928 | if (hw->tbi_compatibility_on) { |
2929 | /* If we previously were in the mode, turn it off. */ | 2929 | /* If we previously were in the mode, turn it off. */ |
2930 | rctl = E1000_READ_REG(hw, RCTL); | 2930 | rctl = E1000_READ_REG(hw, RCTL); |
2931 | rctl &= ~E1000_RCTL_SBP; | 2931 | rctl &= ~E1000_RCTL_SBP; |
@@ -2938,7 +2938,7 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2938 | * packets. Some frames have an additional byte on the end and | 2938 | * packets. Some frames have an additional byte on the end and |
2939 | * will look like CRC errors to to the hardware. | 2939 | * will look like CRC errors to to the hardware. |
2940 | */ | 2940 | */ |
2941 | if(!hw->tbi_compatibility_on) { | 2941 | if (!hw->tbi_compatibility_on) { |
2942 | hw->tbi_compatibility_on = TRUE; | 2942 | hw->tbi_compatibility_on = TRUE; |
2943 | rctl = E1000_READ_REG(hw, RCTL); | 2943 | rctl = E1000_READ_REG(hw, RCTL); |
2944 | rctl |= E1000_RCTL_SBP; | 2944 | rctl |= E1000_RCTL_SBP; |
@@ -2954,12 +2954,12 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2954 | * auto-negotiation time to complete, in case the cable was just plugged | 2954 | * auto-negotiation time to complete, in case the cable was just plugged |
2955 | * in. The autoneg_failed flag does this. | 2955 | * in. The autoneg_failed flag does this. |
2956 | */ | 2956 | */ |
2957 | else if((((hw->media_type == e1000_media_type_fiber) && | 2957 | else if ((((hw->media_type == e1000_media_type_fiber) && |
2958 | ((ctrl & E1000_CTRL_SWDPIN1) == signal)) || | 2958 | ((ctrl & E1000_CTRL_SWDPIN1) == signal)) || |
2959 | (hw->media_type == e1000_media_type_internal_serdes)) && | 2959 | (hw->media_type == e1000_media_type_internal_serdes)) && |
2960 | (!(status & E1000_STATUS_LU)) && | 2960 | (!(status & E1000_STATUS_LU)) && |
2961 | (!(rxcw & E1000_RXCW_C))) { | 2961 | (!(rxcw & E1000_RXCW_C))) { |
2962 | if(hw->autoneg_failed == 0) { | 2962 | if (hw->autoneg_failed == 0) { |
2963 | hw->autoneg_failed = 1; | 2963 | hw->autoneg_failed = 1; |
2964 | return 0; | 2964 | return 0; |
2965 | } | 2965 | } |
@@ -2975,7 +2975,7 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2975 | 2975 | ||
2976 | /* Configure Flow Control after forcing link up. */ | 2976 | /* Configure Flow Control after forcing link up. */ |
2977 | ret_val = e1000_config_fc_after_link_up(hw); | 2977 | ret_val = e1000_config_fc_after_link_up(hw); |
2978 | if(ret_val) { | 2978 | if (ret_val) { |
2979 | DEBUGOUT("Error configuring flow control\n"); | 2979 | DEBUGOUT("Error configuring flow control\n"); |
2980 | return ret_val; | 2980 | return ret_val; |
2981 | } | 2981 | } |
@@ -2985,9 +2985,9 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2985 | * Device Control register in an attempt to auto-negotiate with our link | 2985 | * Device Control register in an attempt to auto-negotiate with our link |
2986 | * partner. | 2986 | * partner. |
2987 | */ | 2987 | */ |
2988 | else if(((hw->media_type == e1000_media_type_fiber) || | 2988 | else if (((hw->media_type == e1000_media_type_fiber) || |
2989 | (hw->media_type == e1000_media_type_internal_serdes)) && | 2989 | (hw->media_type == e1000_media_type_internal_serdes)) && |
2990 | (ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { | 2990 | (ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { |
2991 | DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n"); | 2991 | DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n"); |
2992 | E1000_WRITE_REG(hw, TXCW, hw->txcw); | 2992 | E1000_WRITE_REG(hw, TXCW, hw->txcw); |
2993 | E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); | 2993 | E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); |
@@ -2997,12 +2997,12 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2997 | /* If we force link for non-auto-negotiation switch, check link status | 2997 | /* If we force link for non-auto-negotiation switch, check link status |
2998 | * based on MAC synchronization for internal serdes media type. | 2998 | * based on MAC synchronization for internal serdes media type. |
2999 | */ | 2999 | */ |
3000 | else if((hw->media_type == e1000_media_type_internal_serdes) && | 3000 | else if ((hw->media_type == e1000_media_type_internal_serdes) && |
3001 | !(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { | 3001 | !(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { |
3002 | /* SYNCH bit and IV bit are sticky. */ | 3002 | /* SYNCH bit and IV bit are sticky. */ |
3003 | udelay(10); | 3003 | udelay(10); |
3004 | if(E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) { | 3004 | if (E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) { |
3005 | if(!(rxcw & E1000_RXCW_IV)) { | 3005 | if (!(rxcw & E1000_RXCW_IV)) { |
3006 | hw->serdes_link_down = FALSE; | 3006 | hw->serdes_link_down = FALSE; |
3007 | DEBUGOUT("SERDES: Link is up.\n"); | 3007 | DEBUGOUT("SERDES: Link is up.\n"); |
3008 | } | 3008 | } |
@@ -3011,8 +3011,8 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
3011 | DEBUGOUT("SERDES: Link is down.\n"); | 3011 | DEBUGOUT("SERDES: Link is down.\n"); |
3012 | } | 3012 | } |
3013 | } | 3013 | } |
3014 | if((hw->media_type == e1000_media_type_internal_serdes) && | 3014 | if ((hw->media_type == e1000_media_type_internal_serdes) && |
3015 | (E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { | 3015 | (E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { |
3016 | hw->serdes_link_down = !(E1000_STATUS_LU & E1000_READ_REG(hw, STATUS)); | 3016 | hw->serdes_link_down = !(E1000_STATUS_LU & E1000_READ_REG(hw, STATUS)); |
3017 | } | 3017 | } |
3018 | return E1000_SUCCESS; | 3018 | return E1000_SUCCESS; |
@@ -3036,12 +3036,12 @@ e1000_get_speed_and_duplex(struct e1000_hw *hw, | |||
3036 | 3036 | ||
3037 | DEBUGFUNC("e1000_get_speed_and_duplex"); | 3037 | DEBUGFUNC("e1000_get_speed_and_duplex"); |
3038 | 3038 | ||
3039 | if(hw->mac_type >= e1000_82543) { | 3039 | if (hw->mac_type >= e1000_82543) { |
3040 | status = E1000_READ_REG(hw, STATUS); | 3040 | status = E1000_READ_REG(hw, STATUS); |
3041 | if(status & E1000_STATUS_SPEED_1000) { | 3041 | if (status & E1000_STATUS_SPEED_1000) { |
3042 | *speed = SPEED_1000; | 3042 | *speed = SPEED_1000; |
3043 | DEBUGOUT("1000 Mbs, "); | 3043 | DEBUGOUT("1000 Mbs, "); |
3044 | } else if(status & E1000_STATUS_SPEED_100) { | 3044 | } else if (status & E1000_STATUS_SPEED_100) { |
3045 | *speed = SPEED_100; | 3045 | *speed = SPEED_100; |
3046 | DEBUGOUT("100 Mbs, "); | 3046 | DEBUGOUT("100 Mbs, "); |
3047 | } else { | 3047 | } else { |
@@ -3049,7 +3049,7 @@ e1000_get_speed_and_duplex(struct e1000_hw *hw, | |||
3049 | DEBUGOUT("10 Mbs, "); | 3049 | DEBUGOUT("10 Mbs, "); |
3050 | } | 3050 | } |
3051 | 3051 | ||
3052 | if(status & E1000_STATUS_FD) { | 3052 | if (status & E1000_STATUS_FD) { |
3053 | *duplex = FULL_DUPLEX; | 3053 | *duplex = FULL_DUPLEX; |
3054 | DEBUGOUT("Full Duplex\n"); | 3054 | DEBUGOUT("Full Duplex\n"); |
3055 | } else { | 3055 | } else { |
@@ -3066,18 +3066,18 @@ e1000_get_speed_and_duplex(struct e1000_hw *hw, | |||
3066 | * if it is operating at half duplex. Here we set the duplex settings to | 3066 | * if it is operating at half duplex. Here we set the duplex settings to |
3067 | * match the duplex in the link partner's capabilities. | 3067 | * match the duplex in the link partner's capabilities. |
3068 | */ | 3068 | */ |
3069 | if(hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { | 3069 | if (hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { |
3070 | ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data); | 3070 | ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data); |
3071 | if(ret_val) | 3071 | if (ret_val) |
3072 | return ret_val; | 3072 | return ret_val; |
3073 | 3073 | ||
3074 | if(!(phy_data & NWAY_ER_LP_NWAY_CAPS)) | 3074 | if (!(phy_data & NWAY_ER_LP_NWAY_CAPS)) |
3075 | *duplex = HALF_DUPLEX; | 3075 | *duplex = HALF_DUPLEX; |
3076 | else { | 3076 | else { |
3077 | ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data); | 3077 | ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data); |
3078 | if(ret_val) | 3078 | if (ret_val) |
3079 | return ret_val; | 3079 | return ret_val; |
3080 | if((*speed == SPEED_100 && !(phy_data & NWAY_LPAR_100TX_FD_CAPS)) || | 3080 | if ((*speed == SPEED_100 && !(phy_data & NWAY_LPAR_100TX_FD_CAPS)) || |
3081 | (*speed == SPEED_10 && !(phy_data & NWAY_LPAR_10T_FD_CAPS))) | 3081 | (*speed == SPEED_10 && !(phy_data & NWAY_LPAR_10T_FD_CAPS))) |
3082 | *duplex = HALF_DUPLEX; | 3082 | *duplex = HALF_DUPLEX; |
3083 | } | 3083 | } |
@@ -3118,17 +3118,17 @@ e1000_wait_autoneg(struct e1000_hw *hw) | |||
3118 | DEBUGOUT("Waiting for Auto-Neg to complete.\n"); | 3118 | DEBUGOUT("Waiting for Auto-Neg to complete.\n"); |
3119 | 3119 | ||
3120 | /* We will wait for autoneg to complete or 4.5 seconds to expire. */ | 3120 | /* We will wait for autoneg to complete or 4.5 seconds to expire. */ |
3121 | for(i = PHY_AUTO_NEG_TIME; i > 0; i--) { | 3121 | for (i = PHY_AUTO_NEG_TIME; i > 0; i--) { |
3122 | /* Read the MII Status Register and wait for Auto-Neg | 3122 | /* Read the MII Status Register and wait for Auto-Neg |
3123 | * Complete bit to be set. | 3123 | * Complete bit to be set. |
3124 | */ | 3124 | */ |
3125 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 3125 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
3126 | if(ret_val) | 3126 | if (ret_val) |
3127 | return ret_val; | 3127 | return ret_val; |
3128 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 3128 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
3129 | if(ret_val) | 3129 | if (ret_val) |
3130 | return ret_val; | 3130 | return ret_val; |
3131 | if(phy_data & MII_SR_AUTONEG_COMPLETE) { | 3131 | if (phy_data & MII_SR_AUTONEG_COMPLETE) { |
3132 | return E1000_SUCCESS; | 3132 | return E1000_SUCCESS; |
3133 | } | 3133 | } |
3134 | msec_delay(100); | 3134 | msec_delay(100); |
@@ -3201,14 +3201,16 @@ e1000_shift_out_mdi_bits(struct e1000_hw *hw, | |||
3201 | /* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */ | 3201 | /* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */ |
3202 | ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR); | 3202 | ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR); |
3203 | 3203 | ||
3204 | while(mask) { | 3204 | while (mask) { |
3205 | /* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and | 3205 | /* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and |
3206 | * then raising and lowering the Management Data Clock. A "0" is | 3206 | * then raising and lowering the Management Data Clock. A "0" is |
3207 | * shifted out to the PHY by setting the MDIO bit to "0" and then | 3207 | * shifted out to the PHY by setting the MDIO bit to "0" and then |
3208 | * raising and lowering the clock. | 3208 | * raising and lowering the clock. |
3209 | */ | 3209 | */ |
3210 | if(data & mask) ctrl |= E1000_CTRL_MDIO; | 3210 | if (data & mask) |
3211 | else ctrl &= ~E1000_CTRL_MDIO; | 3211 | ctrl |= E1000_CTRL_MDIO; |
3212 | else | ||
3213 | ctrl &= ~E1000_CTRL_MDIO; | ||
3212 | 3214 | ||
3213 | E1000_WRITE_REG(hw, CTRL, ctrl); | 3215 | E1000_WRITE_REG(hw, CTRL, ctrl); |
3214 | E1000_WRITE_FLUSH(hw); | 3216 | E1000_WRITE_FLUSH(hw); |
@@ -3259,12 +3261,13 @@ e1000_shift_in_mdi_bits(struct e1000_hw *hw) | |||
3259 | e1000_raise_mdi_clk(hw, &ctrl); | 3261 | e1000_raise_mdi_clk(hw, &ctrl); |
3260 | e1000_lower_mdi_clk(hw, &ctrl); | 3262 | e1000_lower_mdi_clk(hw, &ctrl); |
3261 | 3263 | ||
3262 | for(data = 0, i = 0; i < 16; i++) { | 3264 | for (data = 0, i = 0; i < 16; i++) { |
3263 | data = data << 1; | 3265 | data = data << 1; |
3264 | e1000_raise_mdi_clk(hw, &ctrl); | 3266 | e1000_raise_mdi_clk(hw, &ctrl); |
3265 | ctrl = E1000_READ_REG(hw, CTRL); | 3267 | ctrl = E1000_READ_REG(hw, CTRL); |
3266 | /* Check to see if we shifted in a "1". */ | 3268 | /* Check to see if we shifted in a "1". */ |
3267 | if(ctrl & E1000_CTRL_MDIO) data |= 1; | 3269 | if (ctrl & E1000_CTRL_MDIO) |
3270 | data |= 1; | ||
3268 | e1000_lower_mdi_clk(hw, &ctrl); | 3271 | e1000_lower_mdi_clk(hw, &ctrl); |
3269 | } | 3272 | } |
3270 | 3273 | ||
@@ -3290,7 +3293,7 @@ e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask) | |||
3290 | if (!hw->swfw_sync_present) | 3293 | if (!hw->swfw_sync_present) |
3291 | return e1000_get_hw_eeprom_semaphore(hw); | 3294 | return e1000_get_hw_eeprom_semaphore(hw); |
3292 | 3295 | ||
3293 | while(timeout) { | 3296 | while (timeout) { |
3294 | if (e1000_get_hw_eeprom_semaphore(hw)) | 3297 | if (e1000_get_hw_eeprom_semaphore(hw)) |
3295 | return -E1000_ERR_SWFW_SYNC; | 3298 | return -E1000_ERR_SWFW_SYNC; |
3296 | 3299 | ||
@@ -3379,7 +3382,7 @@ e1000_read_phy_reg(struct e1000_hw *hw, | |||
3379 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { | 3382 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
3380 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, | 3383 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
3381 | (uint16_t)reg_addr); | 3384 | (uint16_t)reg_addr); |
3382 | if(ret_val) { | 3385 | if (ret_val) { |
3383 | e1000_swfw_sync_release(hw, swfw); | 3386 | e1000_swfw_sync_release(hw, swfw); |
3384 | return ret_val; | 3387 | return ret_val; |
3385 | } | 3388 | } |
@@ -3424,12 +3427,12 @@ e1000_read_phy_reg_ex(struct e1000_hw *hw, | |||
3424 | 3427 | ||
3425 | DEBUGFUNC("e1000_read_phy_reg_ex"); | 3428 | DEBUGFUNC("e1000_read_phy_reg_ex"); |
3426 | 3429 | ||
3427 | if(reg_addr > MAX_PHY_REG_ADDRESS) { | 3430 | if (reg_addr > MAX_PHY_REG_ADDRESS) { |
3428 | DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); | 3431 | DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); |
3429 | return -E1000_ERR_PARAM; | 3432 | return -E1000_ERR_PARAM; |
3430 | } | 3433 | } |
3431 | 3434 | ||
3432 | if(hw->mac_type > e1000_82543) { | 3435 | if (hw->mac_type > e1000_82543) { |
3433 | /* Set up Op-code, Phy Address, and register address in the MDI | 3436 | /* Set up Op-code, Phy Address, and register address in the MDI |
3434 | * Control register. The MAC will take care of interfacing with the | 3437 | * Control register. The MAC will take care of interfacing with the |
3435 | * PHY to retrieve the desired data. | 3438 | * PHY to retrieve the desired data. |
@@ -3441,16 +3444,16 @@ e1000_read_phy_reg_ex(struct e1000_hw *hw, | |||
3441 | E1000_WRITE_REG(hw, MDIC, mdic); | 3444 | E1000_WRITE_REG(hw, MDIC, mdic); |
3442 | 3445 | ||
3443 | /* Poll the ready bit to see if the MDI read completed */ | 3446 | /* Poll the ready bit to see if the MDI read completed */ |
3444 | for(i = 0; i < 64; i++) { | 3447 | for (i = 0; i < 64; i++) { |
3445 | udelay(50); | 3448 | udelay(50); |
3446 | mdic = E1000_READ_REG(hw, MDIC); | 3449 | mdic = E1000_READ_REG(hw, MDIC); |
3447 | if(mdic & E1000_MDIC_READY) break; | 3450 | if (mdic & E1000_MDIC_READY) break; |
3448 | } | 3451 | } |
3449 | if(!(mdic & E1000_MDIC_READY)) { | 3452 | if (!(mdic & E1000_MDIC_READY)) { |
3450 | DEBUGOUT("MDI Read did not complete\n"); | 3453 | DEBUGOUT("MDI Read did not complete\n"); |
3451 | return -E1000_ERR_PHY; | 3454 | return -E1000_ERR_PHY; |
3452 | } | 3455 | } |
3453 | if(mdic & E1000_MDIC_ERROR) { | 3456 | if (mdic & E1000_MDIC_ERROR) { |
3454 | DEBUGOUT("MDI Error\n"); | 3457 | DEBUGOUT("MDI Error\n"); |
3455 | return -E1000_ERR_PHY; | 3458 | return -E1000_ERR_PHY; |
3456 | } | 3459 | } |
@@ -3519,7 +3522,7 @@ e1000_write_phy_reg(struct e1000_hw *hw, | |||
3519 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { | 3522 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
3520 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, | 3523 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
3521 | (uint16_t)reg_addr); | 3524 | (uint16_t)reg_addr); |
3522 | if(ret_val) { | 3525 | if (ret_val) { |
3523 | e1000_swfw_sync_release(hw, swfw); | 3526 | e1000_swfw_sync_release(hw, swfw); |
3524 | return ret_val; | 3527 | return ret_val; |
3525 | } | 3528 | } |
@@ -3564,12 +3567,12 @@ e1000_write_phy_reg_ex(struct e1000_hw *hw, | |||
3564 | 3567 | ||
3565 | DEBUGFUNC("e1000_write_phy_reg_ex"); | 3568 | DEBUGFUNC("e1000_write_phy_reg_ex"); |
3566 | 3569 | ||
3567 | if(reg_addr > MAX_PHY_REG_ADDRESS) { | 3570 | if (reg_addr > MAX_PHY_REG_ADDRESS) { |
3568 | DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); | 3571 | DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); |
3569 | return -E1000_ERR_PARAM; | 3572 | return -E1000_ERR_PARAM; |
3570 | } | 3573 | } |
3571 | 3574 | ||
3572 | if(hw->mac_type > e1000_82543) { | 3575 | if (hw->mac_type > e1000_82543) { |
3573 | /* Set up Op-code, Phy Address, register address, and data intended | 3576 | /* Set up Op-code, Phy Address, register address, and data intended |
3574 | * for the PHY register in the MDI Control register. The MAC will take | 3577 | * for the PHY register in the MDI Control register. The MAC will take |
3575 | * care of interfacing with the PHY to send the desired data. | 3578 | * care of interfacing with the PHY to send the desired data. |
@@ -3582,12 +3585,12 @@ e1000_write_phy_reg_ex(struct e1000_hw *hw, | |||
3582 | E1000_WRITE_REG(hw, MDIC, mdic); | 3585 | E1000_WRITE_REG(hw, MDIC, mdic); |
3583 | 3586 | ||
3584 | /* Poll the ready bit to see if the MDI read completed */ | 3587 | /* Poll the ready bit to see if the MDI read completed */ |
3585 | for(i = 0; i < 640; i++) { | 3588 | for (i = 0; i < 641; i++) { |
3586 | udelay(5); | 3589 | udelay(5); |
3587 | mdic = E1000_READ_REG(hw, MDIC); | 3590 | mdic = E1000_READ_REG(hw, MDIC); |
3588 | if(mdic & E1000_MDIC_READY) break; | 3591 | if (mdic & E1000_MDIC_READY) break; |
3589 | } | 3592 | } |
3590 | if(!(mdic & E1000_MDIC_READY)) { | 3593 | if (!(mdic & E1000_MDIC_READY)) { |
3591 | DEBUGOUT("MDI Write did not complete\n"); | 3594 | DEBUGOUT("MDI Write did not complete\n"); |
3592 | return -E1000_ERR_PHY; | 3595 | return -E1000_ERR_PHY; |
3593 | } | 3596 | } |
@@ -3699,7 +3702,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
3699 | 3702 | ||
3700 | DEBUGOUT("Resetting Phy...\n"); | 3703 | DEBUGOUT("Resetting Phy...\n"); |
3701 | 3704 | ||
3702 | if(hw->mac_type > e1000_82543) { | 3705 | if (hw->mac_type > e1000_82543) { |
3703 | if ((hw->mac_type == e1000_80003es2lan) && | 3706 | if ((hw->mac_type == e1000_80003es2lan) && |
3704 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { | 3707 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { |
3705 | swfw = E1000_SWFW_PHY1_SM; | 3708 | swfw = E1000_SWFW_PHY1_SM; |
@@ -3747,7 +3750,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
3747 | } | 3750 | } |
3748 | udelay(150); | 3751 | udelay(150); |
3749 | 3752 | ||
3750 | if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { | 3753 | if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
3751 | /* Configure activity LED after PHY reset */ | 3754 | /* Configure activity LED after PHY reset */ |
3752 | led_ctrl = E1000_READ_REG(hw, LEDCTL); | 3755 | led_ctrl = E1000_READ_REG(hw, LEDCTL); |
3753 | led_ctrl &= IGP_ACTIVITY_LED_MASK; | 3756 | led_ctrl &= IGP_ACTIVITY_LED_MASK; |
@@ -3757,14 +3760,13 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
3757 | 3760 | ||
3758 | /* Wait for FW to finish PHY configuration. */ | 3761 | /* Wait for FW to finish PHY configuration. */ |
3759 | ret_val = e1000_get_phy_cfg_done(hw); | 3762 | ret_val = e1000_get_phy_cfg_done(hw); |
3763 | if (ret_val != E1000_SUCCESS) | ||
3764 | return ret_val; | ||
3760 | e1000_release_software_semaphore(hw); | 3765 | e1000_release_software_semaphore(hw); |
3761 | 3766 | ||
3762 | if ((hw->mac_type == e1000_ich8lan) && | 3767 | if ((hw->mac_type == e1000_ich8lan) && (hw->phy_type == e1000_phy_igp_3)) |
3763 | (hw->phy_type == e1000_phy_igp_3)) { | 3768 | ret_val = e1000_init_lcd_from_nvm(hw); |
3764 | ret_val = e1000_init_lcd_from_nvm(hw); | 3769 | |
3765 | if (ret_val) | ||
3766 | return ret_val; | ||
3767 | } | ||
3768 | return ret_val; | 3770 | return ret_val; |
3769 | } | 3771 | } |
3770 | 3772 | ||
@@ -3795,25 +3797,25 @@ e1000_phy_reset(struct e1000_hw *hw) | |||
3795 | case e1000_82572: | 3797 | case e1000_82572: |
3796 | case e1000_ich8lan: | 3798 | case e1000_ich8lan: |
3797 | ret_val = e1000_phy_hw_reset(hw); | 3799 | ret_val = e1000_phy_hw_reset(hw); |
3798 | if(ret_val) | 3800 | if (ret_val) |
3799 | return ret_val; | 3801 | return ret_val; |
3800 | 3802 | ||
3801 | break; | 3803 | break; |
3802 | default: | 3804 | default: |
3803 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); | 3805 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
3804 | if(ret_val) | 3806 | if (ret_val) |
3805 | return ret_val; | 3807 | return ret_val; |
3806 | 3808 | ||
3807 | phy_data |= MII_CR_RESET; | 3809 | phy_data |= MII_CR_RESET; |
3808 | ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); | 3810 | ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); |
3809 | if(ret_val) | 3811 | if (ret_val) |
3810 | return ret_val; | 3812 | return ret_val; |
3811 | 3813 | ||
3812 | udelay(1); | 3814 | udelay(1); |
3813 | break; | 3815 | break; |
3814 | } | 3816 | } |
3815 | 3817 | ||
3816 | if(hw->phy_type == e1000_phy_igp || hw->phy_type == e1000_phy_igp_2) | 3818 | if (hw->phy_type == e1000_phy_igp || hw->phy_type == e1000_phy_igp_2) |
3817 | e1000_phy_init_script(hw); | 3819 | e1000_phy_init_script(hw); |
3818 | 3820 | ||
3819 | return E1000_SUCCESS; | 3821 | return E1000_SUCCESS; |
@@ -3891,8 +3893,8 @@ e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw) | |||
3891 | if (hw->kmrn_lock_loss_workaround_disabled) | 3893 | if (hw->kmrn_lock_loss_workaround_disabled) |
3892 | return E1000_SUCCESS; | 3894 | return E1000_SUCCESS; |
3893 | 3895 | ||
3894 | /* Make sure link is up before proceeding. If not just return. | 3896 | /* Make sure link is up before proceeding. If not just return. |
3895 | * Attempting this while link is negotiating fouls up link | 3897 | * Attempting this while link is negotiating fouled up link |
3896 | * stability */ | 3898 | * stability */ |
3897 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 3899 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
3898 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 3900 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
@@ -3969,34 +3971,34 @@ e1000_detect_gig_phy(struct e1000_hw *hw) | |||
3969 | hw->phy_id = (uint32_t) (phy_id_high << 16); | 3971 | hw->phy_id = (uint32_t) (phy_id_high << 16); |
3970 | udelay(20); | 3972 | udelay(20); |
3971 | ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low); | 3973 | ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low); |
3972 | if(ret_val) | 3974 | if (ret_val) |
3973 | return ret_val; | 3975 | return ret_val; |
3974 | 3976 | ||
3975 | hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK); | 3977 | hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK); |
3976 | hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK; | 3978 | hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK; |
3977 | 3979 | ||
3978 | switch(hw->mac_type) { | 3980 | switch (hw->mac_type) { |
3979 | case e1000_82543: | 3981 | case e1000_82543: |
3980 | if(hw->phy_id == M88E1000_E_PHY_ID) match = TRUE; | 3982 | if (hw->phy_id == M88E1000_E_PHY_ID) match = TRUE; |
3981 | break; | 3983 | break; |
3982 | case e1000_82544: | 3984 | case e1000_82544: |
3983 | if(hw->phy_id == M88E1000_I_PHY_ID) match = TRUE; | 3985 | if (hw->phy_id == M88E1000_I_PHY_ID) match = TRUE; |
3984 | break; | 3986 | break; |
3985 | case e1000_82540: | 3987 | case e1000_82540: |
3986 | case e1000_82545: | 3988 | case e1000_82545: |
3987 | case e1000_82545_rev_3: | 3989 | case e1000_82545_rev_3: |
3988 | case e1000_82546: | 3990 | case e1000_82546: |
3989 | case e1000_82546_rev_3: | 3991 | case e1000_82546_rev_3: |
3990 | if(hw->phy_id == M88E1011_I_PHY_ID) match = TRUE; | 3992 | if (hw->phy_id == M88E1011_I_PHY_ID) match = TRUE; |
3991 | break; | 3993 | break; |
3992 | case e1000_82541: | 3994 | case e1000_82541: |
3993 | case e1000_82541_rev_2: | 3995 | case e1000_82541_rev_2: |
3994 | case e1000_82547: | 3996 | case e1000_82547: |
3995 | case e1000_82547_rev_2: | 3997 | case e1000_82547_rev_2: |
3996 | if(hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE; | 3998 | if (hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE; |
3997 | break; | 3999 | break; |
3998 | case e1000_82573: | 4000 | case e1000_82573: |
3999 | if(hw->phy_id == M88E1111_I_PHY_ID) match = TRUE; | 4001 | if (hw->phy_id == M88E1111_I_PHY_ID) match = TRUE; |
4000 | break; | 4002 | break; |
4001 | case e1000_80003es2lan: | 4003 | case e1000_80003es2lan: |
4002 | if (hw->phy_id == GG82563_E_PHY_ID) match = TRUE; | 4004 | if (hw->phy_id == GG82563_E_PHY_ID) match = TRUE; |
@@ -4035,14 +4037,14 @@ e1000_phy_reset_dsp(struct e1000_hw *hw) | |||
4035 | do { | 4037 | do { |
4036 | if (hw->phy_type != e1000_phy_gg82563) { | 4038 | if (hw->phy_type != e1000_phy_gg82563) { |
4037 | ret_val = e1000_write_phy_reg(hw, 29, 0x001d); | 4039 | ret_val = e1000_write_phy_reg(hw, 29, 0x001d); |
4038 | if(ret_val) break; | 4040 | if (ret_val) break; |
4039 | } | 4041 | } |
4040 | ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); | 4042 | ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); |
4041 | if(ret_val) break; | 4043 | if (ret_val) break; |
4042 | ret_val = e1000_write_phy_reg(hw, 30, 0x0000); | 4044 | ret_val = e1000_write_phy_reg(hw, 30, 0x0000); |
4043 | if(ret_val) break; | 4045 | if (ret_val) break; |
4044 | ret_val = E1000_SUCCESS; | 4046 | ret_val = E1000_SUCCESS; |
4045 | } while(0); | 4047 | } while (0); |
4046 | 4048 | ||
4047 | return ret_val; | 4049 | return ret_val; |
4048 | } | 4050 | } |
@@ -4053,7 +4055,7 @@ e1000_phy_reset_dsp(struct e1000_hw *hw) | |||
4053 | * hw - Struct containing variables accessed by shared code | 4055 | * hw - Struct containing variables accessed by shared code |
4054 | * phy_info - PHY information structure | 4056 | * phy_info - PHY information structure |
4055 | ******************************************************************************/ | 4057 | ******************************************************************************/ |
4056 | static int32_t | 4058 | int32_t |
4057 | e1000_phy_igp_get_info(struct e1000_hw *hw, | 4059 | e1000_phy_igp_get_info(struct e1000_hw *hw, |
4058 | struct e1000_phy_info *phy_info) | 4060 | struct e1000_phy_info *phy_info) |
4059 | { | 4061 | { |
@@ -4074,23 +4076,23 @@ e1000_phy_igp_get_info(struct e1000_hw *hw, | |||
4074 | 4076 | ||
4075 | /* Check polarity status */ | 4077 | /* Check polarity status */ |
4076 | ret_val = e1000_check_polarity(hw, &polarity); | 4078 | ret_val = e1000_check_polarity(hw, &polarity); |
4077 | if(ret_val) | 4079 | if (ret_val) |
4078 | return ret_val; | 4080 | return ret_val; |
4079 | 4081 | ||
4080 | phy_info->cable_polarity = polarity; | 4082 | phy_info->cable_polarity = polarity; |
4081 | 4083 | ||
4082 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data); | 4084 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data); |
4083 | if(ret_val) | 4085 | if (ret_val) |
4084 | return ret_val; | 4086 | return ret_val; |
4085 | 4087 | ||
4086 | phy_info->mdix_mode = (phy_data & IGP01E1000_PSSR_MDIX) >> | 4088 | phy_info->mdix_mode = (phy_data & IGP01E1000_PSSR_MDIX) >> |
4087 | IGP01E1000_PSSR_MDIX_SHIFT; | 4089 | IGP01E1000_PSSR_MDIX_SHIFT; |
4088 | 4090 | ||
4089 | if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == | 4091 | if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
4090 | IGP01E1000_PSSR_SPEED_1000MBPS) { | 4092 | IGP01E1000_PSSR_SPEED_1000MBPS) { |
4091 | /* Local/Remote Receiver Information are only valid at 1000 Mbps */ | 4093 | /* Local/Remote Receiver Information are only valid at 1000 Mbps */ |
4092 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); | 4094 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
4093 | if(ret_val) | 4095 | if (ret_val) |
4094 | return ret_val; | 4096 | return ret_val; |
4095 | 4097 | ||
4096 | phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> | 4098 | phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
@@ -4100,19 +4102,19 @@ e1000_phy_igp_get_info(struct e1000_hw *hw, | |||
4100 | 4102 | ||
4101 | /* Get cable length */ | 4103 | /* Get cable length */ |
4102 | ret_val = e1000_get_cable_length(hw, &min_length, &max_length); | 4104 | ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
4103 | if(ret_val) | 4105 | if (ret_val) |
4104 | return ret_val; | 4106 | return ret_val; |
4105 | 4107 | ||
4106 | /* Translate to old method */ | 4108 | /* Translate to old method */ |
4107 | average = (max_length + min_length) / 2; | 4109 | average = (max_length + min_length) / 2; |
4108 | 4110 | ||
4109 | if(average <= e1000_igp_cable_length_50) | 4111 | if (average <= e1000_igp_cable_length_50) |
4110 | phy_info->cable_length = e1000_cable_length_50; | 4112 | phy_info->cable_length = e1000_cable_length_50; |
4111 | else if(average <= e1000_igp_cable_length_80) | 4113 | else if (average <= e1000_igp_cable_length_80) |
4112 | phy_info->cable_length = e1000_cable_length_50_80; | 4114 | phy_info->cable_length = e1000_cable_length_50_80; |
4113 | else if(average <= e1000_igp_cable_length_110) | 4115 | else if (average <= e1000_igp_cable_length_110) |
4114 | phy_info->cable_length = e1000_cable_length_80_110; | 4116 | phy_info->cable_length = e1000_cable_length_80_110; |
4115 | else if(average <= e1000_igp_cable_length_140) | 4117 | else if (average <= e1000_igp_cable_length_140) |
4116 | phy_info->cable_length = e1000_cable_length_110_140; | 4118 | phy_info->cable_length = e1000_cable_length_110_140; |
4117 | else | 4119 | else |
4118 | phy_info->cable_length = e1000_cable_length_140; | 4120 | phy_info->cable_length = e1000_cable_length_140; |
@@ -4188,7 +4190,7 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, | |||
4188 | phy_info->downshift = (e1000_downshift)hw->speed_downgraded; | 4190 | phy_info->downshift = (e1000_downshift)hw->speed_downgraded; |
4189 | 4191 | ||
4190 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); | 4192 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
4191 | if(ret_val) | 4193 | if (ret_val) |
4192 | return ret_val; | 4194 | return ret_val; |
4193 | 4195 | ||
4194 | phy_info->extended_10bt_distance = | 4196 | phy_info->extended_10bt_distance = |
@@ -4200,12 +4202,12 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, | |||
4200 | 4202 | ||
4201 | /* Check polarity status */ | 4203 | /* Check polarity status */ |
4202 | ret_val = e1000_check_polarity(hw, &polarity); | 4204 | ret_val = e1000_check_polarity(hw, &polarity); |
4203 | if(ret_val) | 4205 | if (ret_val) |
4204 | return ret_val; | 4206 | return ret_val; |
4205 | phy_info->cable_polarity = polarity; | 4207 | phy_info->cable_polarity = polarity; |
4206 | 4208 | ||
4207 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); | 4209 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
4208 | if(ret_val) | 4210 | if (ret_val) |
4209 | return ret_val; | 4211 | return ret_val; |
4210 | 4212 | ||
4211 | phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX) >> | 4213 | phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX) >> |
@@ -4228,7 +4230,7 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, | |||
4228 | } | 4230 | } |
4229 | 4231 | ||
4230 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); | 4232 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
4231 | if(ret_val) | 4233 | if (ret_val) |
4232 | return ret_val; | 4234 | return ret_val; |
4233 | 4235 | ||
4234 | phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> | 4236 | phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
@@ -4265,20 +4267,20 @@ e1000_phy_get_info(struct e1000_hw *hw, | |||
4265 | phy_info->local_rx = e1000_1000t_rx_status_undefined; | 4267 | phy_info->local_rx = e1000_1000t_rx_status_undefined; |
4266 | phy_info->remote_rx = e1000_1000t_rx_status_undefined; | 4268 | phy_info->remote_rx = e1000_1000t_rx_status_undefined; |
4267 | 4269 | ||
4268 | if(hw->media_type != e1000_media_type_copper) { | 4270 | if (hw->media_type != e1000_media_type_copper) { |
4269 | DEBUGOUT("PHY info is only valid for copper media\n"); | 4271 | DEBUGOUT("PHY info is only valid for copper media\n"); |
4270 | return -E1000_ERR_CONFIG; | 4272 | return -E1000_ERR_CONFIG; |
4271 | } | 4273 | } |
4272 | 4274 | ||
4273 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 4275 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
4274 | if(ret_val) | 4276 | if (ret_val) |
4275 | return ret_val; | 4277 | return ret_val; |
4276 | 4278 | ||
4277 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | 4279 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
4278 | if(ret_val) | 4280 | if (ret_val) |
4279 | return ret_val; | 4281 | return ret_val; |
4280 | 4282 | ||
4281 | if((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) { | 4283 | if ((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) { |
4282 | DEBUGOUT("PHY info is only valid if link is up\n"); | 4284 | DEBUGOUT("PHY info is only valid if link is up\n"); |
4283 | return -E1000_ERR_CONFIG; | 4285 | return -E1000_ERR_CONFIG; |
4284 | } | 4286 | } |
@@ -4298,7 +4300,7 @@ e1000_validate_mdi_setting(struct e1000_hw *hw) | |||
4298 | { | 4300 | { |
4299 | DEBUGFUNC("e1000_validate_mdi_settings"); | 4301 | DEBUGFUNC("e1000_validate_mdi_settings"); |
4300 | 4302 | ||
4301 | if(!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) { | 4303 | if (!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) { |
4302 | DEBUGOUT("Invalid MDI setting detected\n"); | 4304 | DEBUGOUT("Invalid MDI setting detected\n"); |
4303 | hw->mdix = 1; | 4305 | hw->mdix = 1; |
4304 | return -E1000_ERR_CONFIG; | 4306 | return -E1000_ERR_CONFIG; |
@@ -4345,7 +4347,7 @@ e1000_init_eeprom_params(struct e1000_hw *hw) | |||
4345 | eeprom->type = e1000_eeprom_microwire; | 4347 | eeprom->type = e1000_eeprom_microwire; |
4346 | eeprom->opcode_bits = 3; | 4348 | eeprom->opcode_bits = 3; |
4347 | eeprom->delay_usec = 50; | 4349 | eeprom->delay_usec = 50; |
4348 | if(eecd & E1000_EECD_SIZE) { | 4350 | if (eecd & E1000_EECD_SIZE) { |
4349 | eeprom->word_size = 256; | 4351 | eeprom->word_size = 256; |
4350 | eeprom->address_bits = 8; | 4352 | eeprom->address_bits = 8; |
4351 | } else { | 4353 | } else { |
@@ -4413,7 +4415,7 @@ e1000_init_eeprom_params(struct e1000_hw *hw) | |||
4413 | } | 4415 | } |
4414 | eeprom->use_eerd = TRUE; | 4416 | eeprom->use_eerd = TRUE; |
4415 | eeprom->use_eewr = TRUE; | 4417 | eeprom->use_eewr = TRUE; |
4416 | if(e1000_is_onboard_nvm_eeprom(hw) == FALSE) { | 4418 | if (e1000_is_onboard_nvm_eeprom(hw) == FALSE) { |
4417 | eeprom->type = e1000_eeprom_flash; | 4419 | eeprom->type = e1000_eeprom_flash; |
4418 | eeprom->word_size = 2048; | 4420 | eeprom->word_size = 2048; |
4419 | 4421 | ||
@@ -4474,17 +4476,17 @@ e1000_init_eeprom_params(struct e1000_hw *hw) | |||
4474 | /* eeprom_size will be an enum [0..8] that maps to eeprom sizes 128B to | 4476 | /* eeprom_size will be an enum [0..8] that maps to eeprom sizes 128B to |
4475 | * 32KB (incremented by powers of 2). | 4477 | * 32KB (incremented by powers of 2). |
4476 | */ | 4478 | */ |
4477 | if(hw->mac_type <= e1000_82547_rev_2) { | 4479 | if (hw->mac_type <= e1000_82547_rev_2) { |
4478 | /* Set to default value for initial eeprom read. */ | 4480 | /* Set to default value for initial eeprom read. */ |
4479 | eeprom->word_size = 64; | 4481 | eeprom->word_size = 64; |
4480 | ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size); | 4482 | ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size); |
4481 | if(ret_val) | 4483 | if (ret_val) |
4482 | return ret_val; | 4484 | return ret_val; |
4483 | eeprom_size = (eeprom_size & EEPROM_SIZE_MASK) >> EEPROM_SIZE_SHIFT; | 4485 | eeprom_size = (eeprom_size & EEPROM_SIZE_MASK) >> EEPROM_SIZE_SHIFT; |
4484 | /* 256B eeprom size was not supported in earlier hardware, so we | 4486 | /* 256B eeprom size was not supported in earlier hardware, so we |
4485 | * bump eeprom_size up one to ensure that "1" (which maps to 256B) | 4487 | * bump eeprom_size up one to ensure that "1" (which maps to 256B) |
4486 | * is never the result used in the shifting logic below. */ | 4488 | * is never the result used in the shifting logic below. */ |
4487 | if(eeprom_size) | 4489 | if (eeprom_size) |
4488 | eeprom_size++; | 4490 | eeprom_size++; |
4489 | } else { | 4491 | } else { |
4490 | eeprom_size = (uint16_t)((eecd & E1000_EECD_SIZE_EX_MASK) >> | 4492 | eeprom_size = (uint16_t)((eecd & E1000_EECD_SIZE_EX_MASK) >> |
@@ -4569,7 +4571,7 @@ e1000_shift_out_ee_bits(struct e1000_hw *hw, | |||
4569 | */ | 4571 | */ |
4570 | eecd &= ~E1000_EECD_DI; | 4572 | eecd &= ~E1000_EECD_DI; |
4571 | 4573 | ||
4572 | if(data & mask) | 4574 | if (data & mask) |
4573 | eecd |= E1000_EECD_DI; | 4575 | eecd |= E1000_EECD_DI; |
4574 | 4576 | ||
4575 | E1000_WRITE_REG(hw, EECD, eecd); | 4577 | E1000_WRITE_REG(hw, EECD, eecd); |
@@ -4582,7 +4584,7 @@ e1000_shift_out_ee_bits(struct e1000_hw *hw, | |||
4582 | 4584 | ||
4583 | mask = mask >> 1; | 4585 | mask = mask >> 1; |
4584 | 4586 | ||
4585 | } while(mask); | 4587 | } while (mask); |
4586 | 4588 | ||
4587 | /* We leave the "DI" bit set to "0" when we leave this routine. */ | 4589 | /* We leave the "DI" bit set to "0" when we leave this routine. */ |
4588 | eecd &= ~E1000_EECD_DI; | 4590 | eecd &= ~E1000_EECD_DI; |
@@ -4614,14 +4616,14 @@ e1000_shift_in_ee_bits(struct e1000_hw *hw, | |||
4614 | eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); | 4616 | eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); |
4615 | data = 0; | 4617 | data = 0; |
4616 | 4618 | ||
4617 | for(i = 0; i < count; i++) { | 4619 | for (i = 0; i < count; i++) { |
4618 | data = data << 1; | 4620 | data = data << 1; |
4619 | e1000_raise_ee_clk(hw, &eecd); | 4621 | e1000_raise_ee_clk(hw, &eecd); |
4620 | 4622 | ||
4621 | eecd = E1000_READ_REG(hw, EECD); | 4623 | eecd = E1000_READ_REG(hw, EECD); |
4622 | 4624 | ||
4623 | eecd &= ~(E1000_EECD_DI); | 4625 | eecd &= ~(E1000_EECD_DI); |
4624 | if(eecd & E1000_EECD_DO) | 4626 | if (eecd & E1000_EECD_DO) |
4625 | data |= 1; | 4627 | data |= 1; |
4626 | 4628 | ||
4627 | e1000_lower_ee_clk(hw, &eecd); | 4629 | e1000_lower_ee_clk(hw, &eecd); |
@@ -4652,17 +4654,17 @@ e1000_acquire_eeprom(struct e1000_hw *hw) | |||
4652 | 4654 | ||
4653 | if (hw->mac_type != e1000_82573) { | 4655 | if (hw->mac_type != e1000_82573) { |
4654 | /* Request EEPROM Access */ | 4656 | /* Request EEPROM Access */ |
4655 | if(hw->mac_type > e1000_82544) { | 4657 | if (hw->mac_type > e1000_82544) { |
4656 | eecd |= E1000_EECD_REQ; | 4658 | eecd |= E1000_EECD_REQ; |
4657 | E1000_WRITE_REG(hw, EECD, eecd); | 4659 | E1000_WRITE_REG(hw, EECD, eecd); |
4658 | eecd = E1000_READ_REG(hw, EECD); | 4660 | eecd = E1000_READ_REG(hw, EECD); |
4659 | while((!(eecd & E1000_EECD_GNT)) && | 4661 | while ((!(eecd & E1000_EECD_GNT)) && |
4660 | (i < E1000_EEPROM_GRANT_ATTEMPTS)) { | 4662 | (i < E1000_EEPROM_GRANT_ATTEMPTS)) { |
4661 | i++; | 4663 | i++; |
4662 | udelay(5); | 4664 | udelay(5); |
4663 | eecd = E1000_READ_REG(hw, EECD); | 4665 | eecd = E1000_READ_REG(hw, EECD); |
4664 | } | 4666 | } |
4665 | if(!(eecd & E1000_EECD_GNT)) { | 4667 | if (!(eecd & E1000_EECD_GNT)) { |
4666 | eecd &= ~E1000_EECD_REQ; | 4668 | eecd &= ~E1000_EECD_REQ; |
4667 | E1000_WRITE_REG(hw, EECD, eecd); | 4669 | E1000_WRITE_REG(hw, EECD, eecd); |
4668 | DEBUGOUT("Could not acquire EEPROM grant\n"); | 4670 | DEBUGOUT("Could not acquire EEPROM grant\n"); |
@@ -4705,7 +4707,7 @@ e1000_standby_eeprom(struct e1000_hw *hw) | |||
4705 | 4707 | ||
4706 | eecd = E1000_READ_REG(hw, EECD); | 4708 | eecd = E1000_READ_REG(hw, EECD); |
4707 | 4709 | ||
4708 | if(eeprom->type == e1000_eeprom_microwire) { | 4710 | if (eeprom->type == e1000_eeprom_microwire) { |
4709 | eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); | 4711 | eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); |
4710 | E1000_WRITE_REG(hw, EECD, eecd); | 4712 | E1000_WRITE_REG(hw, EECD, eecd); |
4711 | E1000_WRITE_FLUSH(hw); | 4713 | E1000_WRITE_FLUSH(hw); |
@@ -4728,7 +4730,7 @@ e1000_standby_eeprom(struct e1000_hw *hw) | |||
4728 | E1000_WRITE_REG(hw, EECD, eecd); | 4730 | E1000_WRITE_REG(hw, EECD, eecd); |
4729 | E1000_WRITE_FLUSH(hw); | 4731 | E1000_WRITE_FLUSH(hw); |
4730 | udelay(eeprom->delay_usec); | 4732 | udelay(eeprom->delay_usec); |
4731 | } else if(eeprom->type == e1000_eeprom_spi) { | 4733 | } else if (eeprom->type == e1000_eeprom_spi) { |
4732 | /* Toggle CS to flush commands */ | 4734 | /* Toggle CS to flush commands */ |
4733 | eecd |= E1000_EECD_CS; | 4735 | eecd |= E1000_EECD_CS; |
4734 | E1000_WRITE_REG(hw, EECD, eecd); | 4736 | E1000_WRITE_REG(hw, EECD, eecd); |
@@ -4762,7 +4764,7 @@ e1000_release_eeprom(struct e1000_hw *hw) | |||
4762 | E1000_WRITE_REG(hw, EECD, eecd); | 4764 | E1000_WRITE_REG(hw, EECD, eecd); |
4763 | 4765 | ||
4764 | udelay(hw->eeprom.delay_usec); | 4766 | udelay(hw->eeprom.delay_usec); |
4765 | } else if(hw->eeprom.type == e1000_eeprom_microwire) { | 4767 | } else if (hw->eeprom.type == e1000_eeprom_microwire) { |
4766 | /* cleanup eeprom */ | 4768 | /* cleanup eeprom */ |
4767 | 4769 | ||
4768 | /* CS on Microwire is active-high */ | 4770 | /* CS on Microwire is active-high */ |
@@ -4784,7 +4786,7 @@ e1000_release_eeprom(struct e1000_hw *hw) | |||
4784 | } | 4786 | } |
4785 | 4787 | ||
4786 | /* Stop requesting EEPROM access */ | 4788 | /* Stop requesting EEPROM access */ |
4787 | if(hw->mac_type > e1000_82544) { | 4789 | if (hw->mac_type > e1000_82544) { |
4788 | eecd &= ~E1000_EECD_REQ; | 4790 | eecd &= ~E1000_EECD_REQ; |
4789 | E1000_WRITE_REG(hw, EECD, eecd); | 4791 | E1000_WRITE_REG(hw, EECD, eecd); |
4790 | } | 4792 | } |
@@ -4822,12 +4824,12 @@ e1000_spi_eeprom_ready(struct e1000_hw *hw) | |||
4822 | retry_count += 5; | 4824 | retry_count += 5; |
4823 | 4825 | ||
4824 | e1000_standby_eeprom(hw); | 4826 | e1000_standby_eeprom(hw); |
4825 | } while(retry_count < EEPROM_MAX_RETRY_SPI); | 4827 | } while (retry_count < EEPROM_MAX_RETRY_SPI); |
4826 | 4828 | ||
4827 | /* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and | 4829 | /* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and |
4828 | * only 0-5mSec on 5V devices) | 4830 | * only 0-5mSec on 5V devices) |
4829 | */ | 4831 | */ |
4830 | if(retry_count >= EEPROM_MAX_RETRY_SPI) { | 4832 | if (retry_count >= EEPROM_MAX_RETRY_SPI) { |
4831 | DEBUGOUT("SPI EEPROM Status error\n"); | 4833 | DEBUGOUT("SPI EEPROM Status error\n"); |
4832 | return -E1000_ERR_EEPROM; | 4834 | return -E1000_ERR_EEPROM; |
4833 | } | 4835 | } |
@@ -4858,7 +4860,7 @@ e1000_read_eeprom(struct e1000_hw *hw, | |||
4858 | /* A check for invalid values: offset too large, too many words, and not | 4860 | /* A check for invalid values: offset too large, too many words, and not |
4859 | * enough words. | 4861 | * enough words. |
4860 | */ | 4862 | */ |
4861 | if((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) || | 4863 | if ((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) || |
4862 | (words == 0)) { | 4864 | (words == 0)) { |
4863 | DEBUGOUT("\"words\" parameter out of bounds\n"); | 4865 | DEBUGOUT("\"words\" parameter out of bounds\n"); |
4864 | return -E1000_ERR_EEPROM; | 4866 | return -E1000_ERR_EEPROM; |
@@ -4866,7 +4868,7 @@ e1000_read_eeprom(struct e1000_hw *hw, | |||
4866 | 4868 | ||
4867 | /* FLASH reads without acquiring the semaphore are safe */ | 4869 | /* FLASH reads without acquiring the semaphore are safe */ |
4868 | if (e1000_is_onboard_nvm_eeprom(hw) == TRUE && | 4870 | if (e1000_is_onboard_nvm_eeprom(hw) == TRUE && |
4869 | hw->eeprom.use_eerd == FALSE) { | 4871 | hw->eeprom.use_eerd == FALSE) { |
4870 | switch (hw->mac_type) { | 4872 | switch (hw->mac_type) { |
4871 | case e1000_80003es2lan: | 4873 | case e1000_80003es2lan: |
4872 | break; | 4874 | break; |
@@ -4893,7 +4895,7 @@ e1000_read_eeprom(struct e1000_hw *hw, | |||
4893 | uint16_t word_in; | 4895 | uint16_t word_in; |
4894 | uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; | 4896 | uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; |
4895 | 4897 | ||
4896 | if(e1000_spi_eeprom_ready(hw)) { | 4898 | if (e1000_spi_eeprom_ready(hw)) { |
4897 | e1000_release_eeprom(hw); | 4899 | e1000_release_eeprom(hw); |
4898 | return -E1000_ERR_EEPROM; | 4900 | return -E1000_ERR_EEPROM; |
4899 | } | 4901 | } |
@@ -4901,7 +4903,7 @@ e1000_read_eeprom(struct e1000_hw *hw, | |||
4901 | e1000_standby_eeprom(hw); | 4903 | e1000_standby_eeprom(hw); |
4902 | 4904 | ||
4903 | /* Some SPI eeproms use the 8th address bit embedded in the opcode */ | 4905 | /* Some SPI eeproms use the 8th address bit embedded in the opcode */ |
4904 | if((eeprom->address_bits == 8) && (offset >= 128)) | 4906 | if ((eeprom->address_bits == 8) && (offset >= 128)) |
4905 | read_opcode |= EEPROM_A8_OPCODE_SPI; | 4907 | read_opcode |= EEPROM_A8_OPCODE_SPI; |
4906 | 4908 | ||
4907 | /* Send the READ command (opcode + addr) */ | 4909 | /* Send the READ command (opcode + addr) */ |
@@ -4917,7 +4919,7 @@ e1000_read_eeprom(struct e1000_hw *hw, | |||
4917 | word_in = e1000_shift_in_ee_bits(hw, 16); | 4919 | word_in = e1000_shift_in_ee_bits(hw, 16); |
4918 | data[i] = (word_in >> 8) | (word_in << 8); | 4920 | data[i] = (word_in >> 8) | (word_in << 8); |
4919 | } | 4921 | } |
4920 | } else if(eeprom->type == e1000_eeprom_microwire) { | 4922 | } else if (eeprom->type == e1000_eeprom_microwire) { |
4921 | for (i = 0; i < words; i++) { | 4923 | for (i = 0; i < words; i++) { |
4922 | /* Send the READ command (opcode + addr) */ | 4924 | /* Send the READ command (opcode + addr) */ |
4923 | e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE, | 4925 | e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE, |
@@ -4962,7 +4964,7 @@ e1000_read_eeprom_eerd(struct e1000_hw *hw, | |||
4962 | E1000_WRITE_REG(hw, EERD, eerd); | 4964 | E1000_WRITE_REG(hw, EERD, eerd); |
4963 | error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_READ); | 4965 | error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_READ); |
4964 | 4966 | ||
4965 | if(error) { | 4967 | if (error) { |
4966 | break; | 4968 | break; |
4967 | } | 4969 | } |
4968 | data[i] = (E1000_READ_REG(hw, EERD) >> E1000_EEPROM_RW_REG_DATA); | 4970 | data[i] = (E1000_READ_REG(hw, EERD) >> E1000_EEPROM_RW_REG_DATA); |
@@ -4999,7 +5001,7 @@ e1000_write_eeprom_eewr(struct e1000_hw *hw, | |||
4999 | E1000_EEPROM_RW_REG_START; | 5001 | E1000_EEPROM_RW_REG_START; |
5000 | 5002 | ||
5001 | error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); | 5003 | error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); |
5002 | if(error) { | 5004 | if (error) { |
5003 | break; | 5005 | break; |
5004 | } | 5006 | } |
5005 | 5007 | ||
@@ -5007,7 +5009,7 @@ e1000_write_eeprom_eewr(struct e1000_hw *hw, | |||
5007 | 5009 | ||
5008 | error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); | 5010 | error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); |
5009 | 5011 | ||
5010 | if(error) { | 5012 | if (error) { |
5011 | break; | 5013 | break; |
5012 | } | 5014 | } |
5013 | } | 5015 | } |
@@ -5028,13 +5030,13 @@ e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd) | |||
5028 | uint32_t i, reg = 0; | 5030 | uint32_t i, reg = 0; |
5029 | int32_t done = E1000_ERR_EEPROM; | 5031 | int32_t done = E1000_ERR_EEPROM; |
5030 | 5032 | ||
5031 | for(i = 0; i < attempts; i++) { | 5033 | for (i = 0; i < attempts; i++) { |
5032 | if(eerd == E1000_EEPROM_POLL_READ) | 5034 | if (eerd == E1000_EEPROM_POLL_READ) |
5033 | reg = E1000_READ_REG(hw, EERD); | 5035 | reg = E1000_READ_REG(hw, EERD); |
5034 | else | 5036 | else |
5035 | reg = E1000_READ_REG(hw, EEWR); | 5037 | reg = E1000_READ_REG(hw, EEWR); |
5036 | 5038 | ||
5037 | if(reg & E1000_EEPROM_RW_REG_DONE) { | 5039 | if (reg & E1000_EEPROM_RW_REG_DONE) { |
5038 | done = E1000_SUCCESS; | 5040 | done = E1000_SUCCESS; |
5039 | break; | 5041 | break; |
5040 | } | 5042 | } |
@@ -5066,7 +5068,7 @@ e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw) | |||
5066 | eecd = ((eecd >> 15) & 0x03); | 5068 | eecd = ((eecd >> 15) & 0x03); |
5067 | 5069 | ||
5068 | /* If both bits are set, device is Flash type */ | 5070 | /* If both bits are set, device is Flash type */ |
5069 | if(eecd == 0x03) { | 5071 | if (eecd == 0x03) { |
5070 | return FALSE; | 5072 | return FALSE; |
5071 | } | 5073 | } |
5072 | } | 5074 | } |
@@ -5131,7 +5133,7 @@ e1000_validate_eeprom_checksum(struct e1000_hw *hw) | |||
5131 | checksum += eeprom_data; | 5133 | checksum += eeprom_data; |
5132 | } | 5134 | } |
5133 | 5135 | ||
5134 | if(checksum == (uint16_t) EEPROM_SUM) | 5136 | if (checksum == (uint16_t) EEPROM_SUM) |
5135 | return E1000_SUCCESS; | 5137 | return E1000_SUCCESS; |
5136 | else { | 5138 | else { |
5137 | DEBUGOUT("EEPROM Checksum Invalid\n"); | 5139 | DEBUGOUT("EEPROM Checksum Invalid\n"); |
@@ -5156,15 +5158,15 @@ e1000_update_eeprom_checksum(struct e1000_hw *hw) | |||
5156 | 5158 | ||
5157 | DEBUGFUNC("e1000_update_eeprom_checksum"); | 5159 | DEBUGFUNC("e1000_update_eeprom_checksum"); |
5158 | 5160 | ||
5159 | for(i = 0; i < EEPROM_CHECKSUM_REG; i++) { | 5161 | for (i = 0; i < EEPROM_CHECKSUM_REG; i++) { |
5160 | if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { | 5162 | if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { |
5161 | DEBUGOUT("EEPROM Read Error\n"); | 5163 | DEBUGOUT("EEPROM Read Error\n"); |
5162 | return -E1000_ERR_EEPROM; | 5164 | return -E1000_ERR_EEPROM; |
5163 | } | 5165 | } |
5164 | checksum += eeprom_data; | 5166 | checksum += eeprom_data; |
5165 | } | 5167 | } |
5166 | checksum = (uint16_t) EEPROM_SUM - checksum; | 5168 | checksum = (uint16_t) EEPROM_SUM - checksum; |
5167 | if(e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) { | 5169 | if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) { |
5168 | DEBUGOUT("EEPROM Write Error\n"); | 5170 | DEBUGOUT("EEPROM Write Error\n"); |
5169 | return -E1000_ERR_EEPROM; | 5171 | return -E1000_ERR_EEPROM; |
5170 | } else if (hw->eeprom.type == e1000_eeprom_flash) { | 5172 | } else if (hw->eeprom.type == e1000_eeprom_flash) { |
@@ -5206,14 +5208,14 @@ e1000_write_eeprom(struct e1000_hw *hw, | |||
5206 | /* A check for invalid values: offset too large, too many words, and not | 5208 | /* A check for invalid values: offset too large, too many words, and not |
5207 | * enough words. | 5209 | * enough words. |
5208 | */ | 5210 | */ |
5209 | if((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) || | 5211 | if ((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) || |
5210 | (words == 0)) { | 5212 | (words == 0)) { |
5211 | DEBUGOUT("\"words\" parameter out of bounds\n"); | 5213 | DEBUGOUT("\"words\" parameter out of bounds\n"); |
5212 | return -E1000_ERR_EEPROM; | 5214 | return -E1000_ERR_EEPROM; |
5213 | } | 5215 | } |
5214 | 5216 | ||
5215 | /* 82573 writes only through eewr */ | 5217 | /* 82573 writes only through eewr */ |
5216 | if(eeprom->use_eewr == TRUE) | 5218 | if (eeprom->use_eewr == TRUE) |
5217 | return e1000_write_eeprom_eewr(hw, offset, words, data); | 5219 | return e1000_write_eeprom_eewr(hw, offset, words, data); |
5218 | 5220 | ||
5219 | if (eeprom->type == e1000_eeprom_ich8) | 5221 | if (eeprom->type == e1000_eeprom_ich8) |
@@ -5223,7 +5225,7 @@ e1000_write_eeprom(struct e1000_hw *hw, | |||
5223 | if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) | 5225 | if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
5224 | return -E1000_ERR_EEPROM; | 5226 | return -E1000_ERR_EEPROM; |
5225 | 5227 | ||
5226 | if(eeprom->type == e1000_eeprom_microwire) { | 5228 | if (eeprom->type == e1000_eeprom_microwire) { |
5227 | status = e1000_write_eeprom_microwire(hw, offset, words, data); | 5229 | status = e1000_write_eeprom_microwire(hw, offset, words, data); |
5228 | } else { | 5230 | } else { |
5229 | status = e1000_write_eeprom_spi(hw, offset, words, data); | 5231 | status = e1000_write_eeprom_spi(hw, offset, words, data); |
@@ -5259,7 +5261,7 @@ e1000_write_eeprom_spi(struct e1000_hw *hw, | |||
5259 | while (widx < words) { | 5261 | while (widx < words) { |
5260 | uint8_t write_opcode = EEPROM_WRITE_OPCODE_SPI; | 5262 | uint8_t write_opcode = EEPROM_WRITE_OPCODE_SPI; |
5261 | 5263 | ||
5262 | if(e1000_spi_eeprom_ready(hw)) return -E1000_ERR_EEPROM; | 5264 | if (e1000_spi_eeprom_ready(hw)) return -E1000_ERR_EEPROM; |
5263 | 5265 | ||
5264 | e1000_standby_eeprom(hw); | 5266 | e1000_standby_eeprom(hw); |
5265 | 5267 | ||
@@ -5270,7 +5272,7 @@ e1000_write_eeprom_spi(struct e1000_hw *hw, | |||
5270 | e1000_standby_eeprom(hw); | 5272 | e1000_standby_eeprom(hw); |
5271 | 5273 | ||
5272 | /* Some SPI eeproms use the 8th address bit embedded in the opcode */ | 5274 | /* Some SPI eeproms use the 8th address bit embedded in the opcode */ |
5273 | if((eeprom->address_bits == 8) && (offset >= 128)) | 5275 | if ((eeprom->address_bits == 8) && (offset >= 128)) |
5274 | write_opcode |= EEPROM_A8_OPCODE_SPI; | 5276 | write_opcode |= EEPROM_A8_OPCODE_SPI; |
5275 | 5277 | ||
5276 | /* Send the Write command (8-bit opcode + addr) */ | 5278 | /* Send the Write command (8-bit opcode + addr) */ |
@@ -5292,7 +5294,7 @@ e1000_write_eeprom_spi(struct e1000_hw *hw, | |||
5292 | * operation, while the smaller eeproms are capable of an 8-byte | 5294 | * operation, while the smaller eeproms are capable of an 8-byte |
5293 | * PAGE WRITE operation. Break the inner loop to pass new address | 5295 | * PAGE WRITE operation. Break the inner loop to pass new address |
5294 | */ | 5296 | */ |
5295 | if((((offset + widx)*2) % eeprom->page_size) == 0) { | 5297 | if ((((offset + widx)*2) % eeprom->page_size) == 0) { |
5296 | e1000_standby_eeprom(hw); | 5298 | e1000_standby_eeprom(hw); |
5297 | break; | 5299 | break; |
5298 | } | 5300 | } |
@@ -5358,12 +5360,12 @@ e1000_write_eeprom_microwire(struct e1000_hw *hw, | |||
5358 | * signal that the command has been completed by raising the DO signal. | 5360 | * signal that the command has been completed by raising the DO signal. |
5359 | * If DO does not go high in 10 milliseconds, then error out. | 5361 | * If DO does not go high in 10 milliseconds, then error out. |
5360 | */ | 5362 | */ |
5361 | for(i = 0; i < 200; i++) { | 5363 | for (i = 0; i < 200; i++) { |
5362 | eecd = E1000_READ_REG(hw, EECD); | 5364 | eecd = E1000_READ_REG(hw, EECD); |
5363 | if(eecd & E1000_EECD_DO) break; | 5365 | if (eecd & E1000_EECD_DO) break; |
5364 | udelay(50); | 5366 | udelay(50); |
5365 | } | 5367 | } |
5366 | if(i == 200) { | 5368 | if (i == 200) { |
5367 | DEBUGOUT("EEPROM Write did not complete\n"); | 5369 | DEBUGOUT("EEPROM Write did not complete\n"); |
5368 | return -E1000_ERR_EEPROM; | 5370 | return -E1000_ERR_EEPROM; |
5369 | } | 5371 | } |
@@ -5569,7 +5571,7 @@ e1000_read_part_num(struct e1000_hw *hw, | |||
5569 | DEBUGFUNC("e1000_read_part_num"); | 5571 | DEBUGFUNC("e1000_read_part_num"); |
5570 | 5572 | ||
5571 | /* Get word 0 from EEPROM */ | 5573 | /* Get word 0 from EEPROM */ |
5572 | if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { | 5574 | if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { |
5573 | DEBUGOUT("EEPROM Read Error\n"); | 5575 | DEBUGOUT("EEPROM Read Error\n"); |
5574 | return -E1000_ERR_EEPROM; | 5576 | return -E1000_ERR_EEPROM; |
5575 | } | 5577 | } |
@@ -5577,7 +5579,7 @@ e1000_read_part_num(struct e1000_hw *hw, | |||
5577 | *part_num = (uint32_t) (eeprom_data << 16); | 5579 | *part_num = (uint32_t) (eeprom_data << 16); |
5578 | 5580 | ||
5579 | /* Get word 1 from EEPROM */ | 5581 | /* Get word 1 from EEPROM */ |
5580 | if(e1000_read_eeprom(hw, ++offset, 1, &eeprom_data) < 0) { | 5582 | if (e1000_read_eeprom(hw, ++offset, 1, &eeprom_data) < 0) { |
5581 | DEBUGOUT("EEPROM Read Error\n"); | 5583 | DEBUGOUT("EEPROM Read Error\n"); |
5582 | return -E1000_ERR_EEPROM; | 5584 | return -E1000_ERR_EEPROM; |
5583 | } | 5585 | } |
@@ -5601,9 +5603,9 @@ e1000_read_mac_addr(struct e1000_hw * hw) | |||
5601 | 5603 | ||
5602 | DEBUGFUNC("e1000_read_mac_addr"); | 5604 | DEBUGFUNC("e1000_read_mac_addr"); |
5603 | 5605 | ||
5604 | for(i = 0; i < NODE_ADDRESS_SIZE; i += 2) { | 5606 | for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) { |
5605 | offset = i >> 1; | 5607 | offset = i >> 1; |
5606 | if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { | 5608 | if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { |
5607 | DEBUGOUT("EEPROM Read Error\n"); | 5609 | DEBUGOUT("EEPROM Read Error\n"); |
5608 | return -E1000_ERR_EEPROM; | 5610 | return -E1000_ERR_EEPROM; |
5609 | } | 5611 | } |
@@ -5618,12 +5620,12 @@ e1000_read_mac_addr(struct e1000_hw * hw) | |||
5618 | case e1000_82546_rev_3: | 5620 | case e1000_82546_rev_3: |
5619 | case e1000_82571: | 5621 | case e1000_82571: |
5620 | case e1000_80003es2lan: | 5622 | case e1000_80003es2lan: |
5621 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) | 5623 | if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) |
5622 | hw->perm_mac_addr[5] ^= 0x01; | 5624 | hw->perm_mac_addr[5] ^= 0x01; |
5623 | break; | 5625 | break; |
5624 | } | 5626 | } |
5625 | 5627 | ||
5626 | for(i = 0; i < NODE_ADDRESS_SIZE; i++) | 5628 | for (i = 0; i < NODE_ADDRESS_SIZE; i++) |
5627 | hw->mac_addr[i] = hw->perm_mac_addr[i]; | 5629 | hw->mac_addr[i] = hw->perm_mac_addr[i]; |
5628 | return E1000_SUCCESS; | 5630 | return E1000_SUCCESS; |
5629 | } | 5631 | } |
@@ -5662,7 +5664,7 @@ e1000_init_rx_addrs(struct e1000_hw *hw) | |||
5662 | 5664 | ||
5663 | /* Zero out the other 15 receive addresses. */ | 5665 | /* Zero out the other 15 receive addresses. */ |
5664 | DEBUGOUT("Clearing RAR[1-15]\n"); | 5666 | DEBUGOUT("Clearing RAR[1-15]\n"); |
5665 | for(i = 1; i < rar_num; i++) { | 5667 | for (i = 1; i < rar_num; i++) { |
5666 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); | 5668 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
5667 | E1000_WRITE_FLUSH(hw); | 5669 | E1000_WRITE_FLUSH(hw); |
5668 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); | 5670 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
@@ -5713,7 +5715,7 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, | |||
5713 | if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE)) | 5715 | if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE)) |
5714 | num_rar_entry -= 1; | 5716 | num_rar_entry -= 1; |
5715 | 5717 | ||
5716 | for(i = rar_used_count; i < num_rar_entry; i++) { | 5718 | for (i = rar_used_count; i < num_rar_entry; i++) { |
5717 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); | 5719 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
5718 | E1000_WRITE_FLUSH(hw); | 5720 | E1000_WRITE_FLUSH(hw); |
5719 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); | 5721 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
@@ -5725,13 +5727,13 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, | |||
5725 | num_mta_entry = E1000_NUM_MTA_REGISTERS; | 5727 | num_mta_entry = E1000_NUM_MTA_REGISTERS; |
5726 | if (hw->mac_type == e1000_ich8lan) | 5728 | if (hw->mac_type == e1000_ich8lan) |
5727 | num_mta_entry = E1000_NUM_MTA_REGISTERS_ICH8LAN; | 5729 | num_mta_entry = E1000_NUM_MTA_REGISTERS_ICH8LAN; |
5728 | for(i = 0; i < num_mta_entry; i++) { | 5730 | for (i = 0; i < num_mta_entry; i++) { |
5729 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); | 5731 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
5730 | E1000_WRITE_FLUSH(hw); | 5732 | E1000_WRITE_FLUSH(hw); |
5731 | } | 5733 | } |
5732 | 5734 | ||
5733 | /* Add the new addresses */ | 5735 | /* Add the new addresses */ |
5734 | for(i = 0; i < mc_addr_count; i++) { | 5736 | for (i = 0; i < mc_addr_count; i++) { |
5735 | DEBUGOUT(" Adding the multicast addresses:\n"); | 5737 | DEBUGOUT(" Adding the multicast addresses:\n"); |
5736 | DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X\n", i, | 5738 | DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X\n", i, |
5737 | mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad)], | 5739 | mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad)], |
@@ -5863,7 +5865,7 @@ e1000_mta_set(struct e1000_hw *hw, | |||
5863 | * in the MTA, save off the previous entry before writing and | 5865 | * in the MTA, save off the previous entry before writing and |
5864 | * restore the old value after writing. | 5866 | * restore the old value after writing. |
5865 | */ | 5867 | */ |
5866 | if((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) { | 5868 | if ((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) { |
5867 | temp = E1000_READ_REG_ARRAY(hw, MTA, (hash_reg - 1)); | 5869 | temp = E1000_READ_REG_ARRAY(hw, MTA, (hash_reg - 1)); |
5868 | E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); | 5870 | E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); |
5869 | E1000_WRITE_FLUSH(hw); | 5871 | E1000_WRITE_FLUSH(hw); |
@@ -6013,7 +6015,7 @@ e1000_id_led_init(struct e1000_hw * hw) | |||
6013 | 6015 | ||
6014 | DEBUGFUNC("e1000_id_led_init"); | 6016 | DEBUGFUNC("e1000_id_led_init"); |
6015 | 6017 | ||
6016 | if(hw->mac_type < e1000_82540) { | 6018 | if (hw->mac_type < e1000_82540) { |
6017 | /* Nothing to do */ | 6019 | /* Nothing to do */ |
6018 | return E1000_SUCCESS; | 6020 | return E1000_SUCCESS; |
6019 | } | 6021 | } |
@@ -6023,7 +6025,7 @@ e1000_id_led_init(struct e1000_hw * hw) | |||
6023 | hw->ledctl_mode1 = hw->ledctl_default; | 6025 | hw->ledctl_mode1 = hw->ledctl_default; |
6024 | hw->ledctl_mode2 = hw->ledctl_default; | 6026 | hw->ledctl_mode2 = hw->ledctl_default; |
6025 | 6027 | ||
6026 | if(e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) { | 6028 | if (e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) { |
6027 | DEBUGOUT("EEPROM Read Error\n"); | 6029 | DEBUGOUT("EEPROM Read Error\n"); |
6028 | return -E1000_ERR_EEPROM; | 6030 | return -E1000_ERR_EEPROM; |
6029 | } | 6031 | } |
@@ -6040,7 +6042,7 @@ e1000_id_led_init(struct e1000_hw * hw) | |||
6040 | } | 6042 | } |
6041 | for (i = 0; i < 4; i++) { | 6043 | for (i = 0; i < 4; i++) { |
6042 | temp = (eeprom_data >> (i << 2)) & led_mask; | 6044 | temp = (eeprom_data >> (i << 2)) & led_mask; |
6043 | switch(temp) { | 6045 | switch (temp) { |
6044 | case ID_LED_ON1_DEF2: | 6046 | case ID_LED_ON1_DEF2: |
6045 | case ID_LED_ON1_ON2: | 6047 | case ID_LED_ON1_ON2: |
6046 | case ID_LED_ON1_OFF2: | 6048 | case ID_LED_ON1_OFF2: |
@@ -6057,7 +6059,7 @@ e1000_id_led_init(struct e1000_hw * hw) | |||
6057 | /* Do nothing */ | 6059 | /* Do nothing */ |
6058 | break; | 6060 | break; |
6059 | } | 6061 | } |
6060 | switch(temp) { | 6062 | switch (temp) { |
6061 | case ID_LED_DEF1_ON2: | 6063 | case ID_LED_DEF1_ON2: |
6062 | case ID_LED_ON1_ON2: | 6064 | case ID_LED_ON1_ON2: |
6063 | case ID_LED_OFF1_ON2: | 6065 | case ID_LED_OFF1_ON2: |
@@ -6091,7 +6093,7 @@ e1000_setup_led(struct e1000_hw *hw) | |||
6091 | 6093 | ||
6092 | DEBUGFUNC("e1000_setup_led"); | 6094 | DEBUGFUNC("e1000_setup_led"); |
6093 | 6095 | ||
6094 | switch(hw->mac_type) { | 6096 | switch (hw->mac_type) { |
6095 | case e1000_82542_rev2_0: | 6097 | case e1000_82542_rev2_0: |
6096 | case e1000_82542_rev2_1: | 6098 | case e1000_82542_rev2_1: |
6097 | case e1000_82543: | 6099 | case e1000_82543: |
@@ -6105,16 +6107,16 @@ e1000_setup_led(struct e1000_hw *hw) | |||
6105 | /* Turn off PHY Smart Power Down (if enabled) */ | 6107 | /* Turn off PHY Smart Power Down (if enabled) */ |
6106 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, | 6108 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, |
6107 | &hw->phy_spd_default); | 6109 | &hw->phy_spd_default); |
6108 | if(ret_val) | 6110 | if (ret_val) |
6109 | return ret_val; | 6111 | return ret_val; |
6110 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, | 6112 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
6111 | (uint16_t)(hw->phy_spd_default & | 6113 | (uint16_t)(hw->phy_spd_default & |
6112 | ~IGP01E1000_GMII_SPD)); | 6114 | ~IGP01E1000_GMII_SPD)); |
6113 | if(ret_val) | 6115 | if (ret_val) |
6114 | return ret_val; | 6116 | return ret_val; |
6115 | /* Fall Through */ | 6117 | /* Fall Through */ |
6116 | default: | 6118 | default: |
6117 | if(hw->media_type == e1000_media_type_fiber) { | 6119 | if (hw->media_type == e1000_media_type_fiber) { |
6118 | ledctl = E1000_READ_REG(hw, LEDCTL); | 6120 | ledctl = E1000_READ_REG(hw, LEDCTL); |
6119 | /* Save current LEDCTL settings */ | 6121 | /* Save current LEDCTL settings */ |
6120 | hw->ledctl_default = ledctl; | 6122 | hw->ledctl_default = ledctl; |
@@ -6125,7 +6127,7 @@ e1000_setup_led(struct e1000_hw *hw) | |||
6125 | ledctl |= (E1000_LEDCTL_MODE_LED_OFF << | 6127 | ledctl |= (E1000_LEDCTL_MODE_LED_OFF << |
6126 | E1000_LEDCTL_LED0_MODE_SHIFT); | 6128 | E1000_LEDCTL_LED0_MODE_SHIFT); |
6127 | E1000_WRITE_REG(hw, LEDCTL, ledctl); | 6129 | E1000_WRITE_REG(hw, LEDCTL, ledctl); |
6128 | } else if(hw->media_type == e1000_media_type_copper) | 6130 | } else if (hw->media_type == e1000_media_type_copper) |
6129 | E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); | 6131 | E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); |
6130 | break; | 6132 | break; |
6131 | } | 6133 | } |
@@ -6133,6 +6135,7 @@ e1000_setup_led(struct e1000_hw *hw) | |||
6133 | return E1000_SUCCESS; | 6135 | return E1000_SUCCESS; |
6134 | } | 6136 | } |
6135 | 6137 | ||
6138 | |||
6136 | /****************************************************************************** | 6139 | /****************************************************************************** |
6137 | * Used on 82571 and later Si that has LED blink bits. | 6140 | * Used on 82571 and later Si that has LED blink bits. |
6138 | * Callers must use their own timer and should have already called | 6141 | * Callers must use their own timer and should have already called |
@@ -6183,7 +6186,7 @@ e1000_cleanup_led(struct e1000_hw *hw) | |||
6183 | 6186 | ||
6184 | DEBUGFUNC("e1000_cleanup_led"); | 6187 | DEBUGFUNC("e1000_cleanup_led"); |
6185 | 6188 | ||
6186 | switch(hw->mac_type) { | 6189 | switch (hw->mac_type) { |
6187 | case e1000_82542_rev2_0: | 6190 | case e1000_82542_rev2_0: |
6188 | case e1000_82542_rev2_1: | 6191 | case e1000_82542_rev2_1: |
6189 | case e1000_82543: | 6192 | case e1000_82543: |
@@ -6197,7 +6200,7 @@ e1000_cleanup_led(struct e1000_hw *hw) | |||
6197 | /* Turn on PHY Smart Power Down (if previously enabled) */ | 6200 | /* Turn on PHY Smart Power Down (if previously enabled) */ |
6198 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, | 6201 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
6199 | hw->phy_spd_default); | 6202 | hw->phy_spd_default); |
6200 | if(ret_val) | 6203 | if (ret_val) |
6201 | return ret_val; | 6204 | return ret_val; |
6202 | /* Fall Through */ | 6205 | /* Fall Through */ |
6203 | default: | 6206 | default: |
@@ -6225,7 +6228,7 @@ e1000_led_on(struct e1000_hw *hw) | |||
6225 | 6228 | ||
6226 | DEBUGFUNC("e1000_led_on"); | 6229 | DEBUGFUNC("e1000_led_on"); |
6227 | 6230 | ||
6228 | switch(hw->mac_type) { | 6231 | switch (hw->mac_type) { |
6229 | case e1000_82542_rev2_0: | 6232 | case e1000_82542_rev2_0: |
6230 | case e1000_82542_rev2_1: | 6233 | case e1000_82542_rev2_1: |
6231 | case e1000_82543: | 6234 | case e1000_82543: |
@@ -6234,7 +6237,7 @@ e1000_led_on(struct e1000_hw *hw) | |||
6234 | ctrl |= E1000_CTRL_SWDPIO0; | 6237 | ctrl |= E1000_CTRL_SWDPIO0; |
6235 | break; | 6238 | break; |
6236 | case e1000_82544: | 6239 | case e1000_82544: |
6237 | if(hw->media_type == e1000_media_type_fiber) { | 6240 | if (hw->media_type == e1000_media_type_fiber) { |
6238 | /* Set SW Defineable Pin 0 to turn on the LED */ | 6241 | /* Set SW Defineable Pin 0 to turn on the LED */ |
6239 | ctrl |= E1000_CTRL_SWDPIN0; | 6242 | ctrl |= E1000_CTRL_SWDPIN0; |
6240 | ctrl |= E1000_CTRL_SWDPIO0; | 6243 | ctrl |= E1000_CTRL_SWDPIO0; |
@@ -6245,7 +6248,7 @@ e1000_led_on(struct e1000_hw *hw) | |||
6245 | } | 6248 | } |
6246 | break; | 6249 | break; |
6247 | default: | 6250 | default: |
6248 | if(hw->media_type == e1000_media_type_fiber) { | 6251 | if (hw->media_type == e1000_media_type_fiber) { |
6249 | /* Clear SW Defineable Pin 0 to turn on the LED */ | 6252 | /* Clear SW Defineable Pin 0 to turn on the LED */ |
6250 | ctrl &= ~E1000_CTRL_SWDPIN0; | 6253 | ctrl &= ~E1000_CTRL_SWDPIN0; |
6251 | ctrl |= E1000_CTRL_SWDPIO0; | 6254 | ctrl |= E1000_CTRL_SWDPIO0; |
@@ -6276,7 +6279,7 @@ e1000_led_off(struct e1000_hw *hw) | |||
6276 | 6279 | ||
6277 | DEBUGFUNC("e1000_led_off"); | 6280 | DEBUGFUNC("e1000_led_off"); |
6278 | 6281 | ||
6279 | switch(hw->mac_type) { | 6282 | switch (hw->mac_type) { |
6280 | case e1000_82542_rev2_0: | 6283 | case e1000_82542_rev2_0: |
6281 | case e1000_82542_rev2_1: | 6284 | case e1000_82542_rev2_1: |
6282 | case e1000_82543: | 6285 | case e1000_82543: |
@@ -6285,7 +6288,7 @@ e1000_led_off(struct e1000_hw *hw) | |||
6285 | ctrl |= E1000_CTRL_SWDPIO0; | 6288 | ctrl |= E1000_CTRL_SWDPIO0; |
6286 | break; | 6289 | break; |
6287 | case e1000_82544: | 6290 | case e1000_82544: |
6288 | if(hw->media_type == e1000_media_type_fiber) { | 6291 | if (hw->media_type == e1000_media_type_fiber) { |
6289 | /* Clear SW Defineable Pin 0 to turn off the LED */ | 6292 | /* Clear SW Defineable Pin 0 to turn off the LED */ |
6290 | ctrl &= ~E1000_CTRL_SWDPIN0; | 6293 | ctrl &= ~E1000_CTRL_SWDPIN0; |
6291 | ctrl |= E1000_CTRL_SWDPIO0; | 6294 | ctrl |= E1000_CTRL_SWDPIO0; |
@@ -6296,7 +6299,7 @@ e1000_led_off(struct e1000_hw *hw) | |||
6296 | } | 6299 | } |
6297 | break; | 6300 | break; |
6298 | default: | 6301 | default: |
6299 | if(hw->media_type == e1000_media_type_fiber) { | 6302 | if (hw->media_type == e1000_media_type_fiber) { |
6300 | /* Set SW Defineable Pin 0 to turn off the LED */ | 6303 | /* Set SW Defineable Pin 0 to turn off the LED */ |
6301 | ctrl |= E1000_CTRL_SWDPIN0; | 6304 | ctrl |= E1000_CTRL_SWDPIN0; |
6302 | ctrl |= E1000_CTRL_SWDPIO0; | 6305 | ctrl |= E1000_CTRL_SWDPIO0; |
@@ -6320,7 +6323,7 @@ e1000_led_off(struct e1000_hw *hw) | |||
6320 | * | 6323 | * |
6321 | * hw - Struct containing variables accessed by shared code | 6324 | * hw - Struct containing variables accessed by shared code |
6322 | *****************************************************************************/ | 6325 | *****************************************************************************/ |
6323 | static void | 6326 | void |
6324 | e1000_clear_hw_cntrs(struct e1000_hw *hw) | 6327 | e1000_clear_hw_cntrs(struct e1000_hw *hw) |
6325 | { | 6328 | { |
6326 | volatile uint32_t temp; | 6329 | volatile uint32_t temp; |
@@ -6383,7 +6386,7 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw) | |||
6383 | temp = E1000_READ_REG(hw, MPTC); | 6386 | temp = E1000_READ_REG(hw, MPTC); |
6384 | temp = E1000_READ_REG(hw, BPTC); | 6387 | temp = E1000_READ_REG(hw, BPTC); |
6385 | 6388 | ||
6386 | if(hw->mac_type < e1000_82543) return; | 6389 | if (hw->mac_type < e1000_82543) return; |
6387 | 6390 | ||
6388 | temp = E1000_READ_REG(hw, ALGNERRC); | 6391 | temp = E1000_READ_REG(hw, ALGNERRC); |
6389 | temp = E1000_READ_REG(hw, RXERRC); | 6392 | temp = E1000_READ_REG(hw, RXERRC); |
@@ -6392,13 +6395,13 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw) | |||
6392 | temp = E1000_READ_REG(hw, TSCTC); | 6395 | temp = E1000_READ_REG(hw, TSCTC); |
6393 | temp = E1000_READ_REG(hw, TSCTFC); | 6396 | temp = E1000_READ_REG(hw, TSCTFC); |
6394 | 6397 | ||
6395 | if(hw->mac_type <= e1000_82544) return; | 6398 | if (hw->mac_type <= e1000_82544) return; |
6396 | 6399 | ||
6397 | temp = E1000_READ_REG(hw, MGTPRC); | 6400 | temp = E1000_READ_REG(hw, MGTPRC); |
6398 | temp = E1000_READ_REG(hw, MGTPDC); | 6401 | temp = E1000_READ_REG(hw, MGTPDC); |
6399 | temp = E1000_READ_REG(hw, MGTPTC); | 6402 | temp = E1000_READ_REG(hw, MGTPTC); |
6400 | 6403 | ||
6401 | if(hw->mac_type <= e1000_82547_rev_2) return; | 6404 | if (hw->mac_type <= e1000_82547_rev_2) return; |
6402 | 6405 | ||
6403 | temp = E1000_READ_REG(hw, IAC); | 6406 | temp = E1000_READ_REG(hw, IAC); |
6404 | temp = E1000_READ_REG(hw, ICRXOC); | 6407 | temp = E1000_READ_REG(hw, ICRXOC); |
@@ -6429,8 +6432,8 @@ e1000_reset_adaptive(struct e1000_hw *hw) | |||
6429 | { | 6432 | { |
6430 | DEBUGFUNC("e1000_reset_adaptive"); | 6433 | DEBUGFUNC("e1000_reset_adaptive"); |
6431 | 6434 | ||
6432 | if(hw->adaptive_ifs) { | 6435 | if (hw->adaptive_ifs) { |
6433 | if(!hw->ifs_params_forced) { | 6436 | if (!hw->ifs_params_forced) { |
6434 | hw->current_ifs_val = 0; | 6437 | hw->current_ifs_val = 0; |
6435 | hw->ifs_min_val = IFS_MIN; | 6438 | hw->ifs_min_val = IFS_MIN; |
6436 | hw->ifs_max_val = IFS_MAX; | 6439 | hw->ifs_max_val = IFS_MAX; |
@@ -6457,12 +6460,12 @@ e1000_update_adaptive(struct e1000_hw *hw) | |||
6457 | { | 6460 | { |
6458 | DEBUGFUNC("e1000_update_adaptive"); | 6461 | DEBUGFUNC("e1000_update_adaptive"); |
6459 | 6462 | ||
6460 | if(hw->adaptive_ifs) { | 6463 | if (hw->adaptive_ifs) { |
6461 | if((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) { | 6464 | if ((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) { |
6462 | if(hw->tx_packet_delta > MIN_NUM_XMITS) { | 6465 | if (hw->tx_packet_delta > MIN_NUM_XMITS) { |
6463 | hw->in_ifs_mode = TRUE; | 6466 | hw->in_ifs_mode = TRUE; |
6464 | if(hw->current_ifs_val < hw->ifs_max_val) { | 6467 | if (hw->current_ifs_val < hw->ifs_max_val) { |
6465 | if(hw->current_ifs_val == 0) | 6468 | if (hw->current_ifs_val == 0) |
6466 | hw->current_ifs_val = hw->ifs_min_val; | 6469 | hw->current_ifs_val = hw->ifs_min_val; |
6467 | else | 6470 | else |
6468 | hw->current_ifs_val += hw->ifs_step_size; | 6471 | hw->current_ifs_val += hw->ifs_step_size; |
@@ -6470,7 +6473,7 @@ e1000_update_adaptive(struct e1000_hw *hw) | |||
6470 | } | 6473 | } |
6471 | } | 6474 | } |
6472 | } else { | 6475 | } else { |
6473 | if(hw->in_ifs_mode && (hw->tx_packet_delta <= MIN_NUM_XMITS)) { | 6476 | if (hw->in_ifs_mode && (hw->tx_packet_delta <= MIN_NUM_XMITS)) { |
6474 | hw->current_ifs_val = 0; | 6477 | hw->current_ifs_val = 0; |
6475 | hw->in_ifs_mode = FALSE; | 6478 | hw->in_ifs_mode = FALSE; |
6476 | E1000_WRITE_REG(hw, AIT, 0); | 6479 | E1000_WRITE_REG(hw, AIT, 0); |
@@ -6517,46 +6520,46 @@ e1000_tbi_adjust_stats(struct e1000_hw *hw, | |||
6517 | * This could be simplified if all environments supported | 6520 | * This could be simplified if all environments supported |
6518 | * 64-bit integers. | 6521 | * 64-bit integers. |
6519 | */ | 6522 | */ |
6520 | if(carry_bit && ((stats->gorcl & 0x80000000) == 0)) | 6523 | if (carry_bit && ((stats->gorcl & 0x80000000) == 0)) |
6521 | stats->gorch++; | 6524 | stats->gorch++; |
6522 | /* Is this a broadcast or multicast? Check broadcast first, | 6525 | /* Is this a broadcast or multicast? Check broadcast first, |
6523 | * since the test for a multicast frame will test positive on | 6526 | * since the test for a multicast frame will test positive on |
6524 | * a broadcast frame. | 6527 | * a broadcast frame. |
6525 | */ | 6528 | */ |
6526 | if((mac_addr[0] == (uint8_t) 0xff) && (mac_addr[1] == (uint8_t) 0xff)) | 6529 | if ((mac_addr[0] == (uint8_t) 0xff) && (mac_addr[1] == (uint8_t) 0xff)) |
6527 | /* Broadcast packet */ | 6530 | /* Broadcast packet */ |
6528 | stats->bprc++; | 6531 | stats->bprc++; |
6529 | else if(*mac_addr & 0x01) | 6532 | else if (*mac_addr & 0x01) |
6530 | /* Multicast packet */ | 6533 | /* Multicast packet */ |
6531 | stats->mprc++; | 6534 | stats->mprc++; |
6532 | 6535 | ||
6533 | if(frame_len == hw->max_frame_size) { | 6536 | if (frame_len == hw->max_frame_size) { |
6534 | /* In this case, the hardware has overcounted the number of | 6537 | /* In this case, the hardware has overcounted the number of |
6535 | * oversize frames. | 6538 | * oversize frames. |
6536 | */ | 6539 | */ |
6537 | if(stats->roc > 0) | 6540 | if (stats->roc > 0) |
6538 | stats->roc--; | 6541 | stats->roc--; |
6539 | } | 6542 | } |
6540 | 6543 | ||
6541 | /* Adjust the bin counters when the extra byte put the frame in the | 6544 | /* Adjust the bin counters when the extra byte put the frame in the |
6542 | * wrong bin. Remember that the frame_len was adjusted above. | 6545 | * wrong bin. Remember that the frame_len was adjusted above. |
6543 | */ | 6546 | */ |
6544 | if(frame_len == 64) { | 6547 | if (frame_len == 64) { |
6545 | stats->prc64++; | 6548 | stats->prc64++; |
6546 | stats->prc127--; | 6549 | stats->prc127--; |
6547 | } else if(frame_len == 127) { | 6550 | } else if (frame_len == 127) { |
6548 | stats->prc127++; | 6551 | stats->prc127++; |
6549 | stats->prc255--; | 6552 | stats->prc255--; |
6550 | } else if(frame_len == 255) { | 6553 | } else if (frame_len == 255) { |
6551 | stats->prc255++; | 6554 | stats->prc255++; |
6552 | stats->prc511--; | 6555 | stats->prc511--; |
6553 | } else if(frame_len == 511) { | 6556 | } else if (frame_len == 511) { |
6554 | stats->prc511++; | 6557 | stats->prc511++; |
6555 | stats->prc1023--; | 6558 | stats->prc1023--; |
6556 | } else if(frame_len == 1023) { | 6559 | } else if (frame_len == 1023) { |
6557 | stats->prc1023++; | 6560 | stats->prc1023++; |
6558 | stats->prc1522--; | 6561 | stats->prc1522--; |
6559 | } else if(frame_len == 1522) { | 6562 | } else if (frame_len == 1522) { |
6560 | stats->prc1522++; | 6563 | stats->prc1522++; |
6561 | } | 6564 | } |
6562 | } | 6565 | } |
@@ -6596,10 +6599,10 @@ e1000_get_bus_info(struct e1000_hw *hw) | |||
6596 | hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? | 6599 | hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? |
6597 | e1000_bus_type_pcix : e1000_bus_type_pci; | 6600 | e1000_bus_type_pcix : e1000_bus_type_pci; |
6598 | 6601 | ||
6599 | if(hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) { | 6602 | if (hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) { |
6600 | hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ? | 6603 | hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ? |
6601 | e1000_bus_speed_66 : e1000_bus_speed_120; | 6604 | e1000_bus_speed_66 : e1000_bus_speed_120; |
6602 | } else if(hw->bus_type == e1000_bus_type_pci) { | 6605 | } else if (hw->bus_type == e1000_bus_type_pci) { |
6603 | hw->bus_speed = (status & E1000_STATUS_PCI66) ? | 6606 | hw->bus_speed = (status & E1000_STATUS_PCI66) ? |
6604 | e1000_bus_speed_66 : e1000_bus_speed_33; | 6607 | e1000_bus_speed_66 : e1000_bus_speed_33; |
6605 | } else { | 6608 | } else { |
@@ -6694,11 +6697,11 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6694 | *min_length = *max_length = 0; | 6697 | *min_length = *max_length = 0; |
6695 | 6698 | ||
6696 | /* Use old method for Phy older than IGP */ | 6699 | /* Use old method for Phy older than IGP */ |
6697 | if(hw->phy_type == e1000_phy_m88) { | 6700 | if (hw->phy_type == e1000_phy_m88) { |
6698 | 6701 | ||
6699 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, | 6702 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
6700 | &phy_data); | 6703 | &phy_data); |
6701 | if(ret_val) | 6704 | if (ret_val) |
6702 | return ret_val; | 6705 | return ret_val; |
6703 | cable_length = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >> | 6706 | cable_length = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >> |
6704 | M88E1000_PSSR_CABLE_LENGTH_SHIFT; | 6707 | M88E1000_PSSR_CABLE_LENGTH_SHIFT; |
@@ -6757,7 +6760,7 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6757 | return -E1000_ERR_PHY; | 6760 | return -E1000_ERR_PHY; |
6758 | break; | 6761 | break; |
6759 | } | 6762 | } |
6760 | } else if(hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ | 6763 | } else if (hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ |
6761 | uint16_t cur_agc_value; | 6764 | uint16_t cur_agc_value; |
6762 | uint16_t min_agc_value = IGP01E1000_AGC_LENGTH_TABLE_SIZE; | 6765 | uint16_t min_agc_value = IGP01E1000_AGC_LENGTH_TABLE_SIZE; |
6763 | uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = | 6766 | uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = |
@@ -6766,10 +6769,10 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6766 | IGP01E1000_PHY_AGC_C, | 6769 | IGP01E1000_PHY_AGC_C, |
6767 | IGP01E1000_PHY_AGC_D}; | 6770 | IGP01E1000_PHY_AGC_D}; |
6768 | /* Read the AGC registers for all channels */ | 6771 | /* Read the AGC registers for all channels */ |
6769 | for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { | 6772 | for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
6770 | 6773 | ||
6771 | ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); | 6774 | ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); |
6772 | if(ret_val) | 6775 | if (ret_val) |
6773 | return ret_val; | 6776 | return ret_val; |
6774 | 6777 | ||
6775 | cur_agc_value = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT; | 6778 | cur_agc_value = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT; |
@@ -6819,7 +6822,7 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6819 | if (ret_val) | 6822 | if (ret_val) |
6820 | return ret_val; | 6823 | return ret_val; |
6821 | 6824 | ||
6822 | /* Getting bits 15:9, which represent the combination of course and | 6825 | /* Getting bits 15:9, which represent the combination of course and |
6823 | * fine gain values. The result is a number that can be put into | 6826 | * fine gain values. The result is a number that can be put into |
6824 | * the lookup table to obtain the approximate cable length. */ | 6827 | * the lookup table to obtain the approximate cable length. */ |
6825 | cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & | 6828 | cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & |
@@ -6884,7 +6887,7 @@ e1000_check_polarity(struct e1000_hw *hw, | |||
6884 | /* return the Polarity bit in the Status register. */ | 6887 | /* return the Polarity bit in the Status register. */ |
6885 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, | 6888 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
6886 | &phy_data); | 6889 | &phy_data); |
6887 | if(ret_val) | 6890 | if (ret_val) |
6888 | return ret_val; | 6891 | return ret_val; |
6889 | *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY) >> | 6892 | *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY) >> |
6890 | M88E1000_PSSR_REV_POLARITY_SHIFT; | 6893 | M88E1000_PSSR_REV_POLARITY_SHIFT; |
@@ -6894,18 +6897,18 @@ e1000_check_polarity(struct e1000_hw *hw, | |||
6894 | /* Read the Status register to check the speed */ | 6897 | /* Read the Status register to check the speed */ |
6895 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, | 6898 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, |
6896 | &phy_data); | 6899 | &phy_data); |
6897 | if(ret_val) | 6900 | if (ret_val) |
6898 | return ret_val; | 6901 | return ret_val; |
6899 | 6902 | ||
6900 | /* If speed is 1000 Mbps, must read the IGP01E1000_PHY_PCS_INIT_REG to | 6903 | /* If speed is 1000 Mbps, must read the IGP01E1000_PHY_PCS_INIT_REG to |
6901 | * find the polarity status */ | 6904 | * find the polarity status */ |
6902 | if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == | 6905 | if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
6903 | IGP01E1000_PSSR_SPEED_1000MBPS) { | 6906 | IGP01E1000_PSSR_SPEED_1000MBPS) { |
6904 | 6907 | ||
6905 | /* Read the GIG initialization PCS register (0x00B4) */ | 6908 | /* Read the GIG initialization PCS register (0x00B4) */ |
6906 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG, | 6909 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG, |
6907 | &phy_data); | 6910 | &phy_data); |
6908 | if(ret_val) | 6911 | if (ret_val) |
6909 | return ret_val; | 6912 | return ret_val; |
6910 | 6913 | ||
6911 | /* Check the polarity bits */ | 6914 | /* Check the polarity bits */ |
@@ -6954,7 +6957,7 @@ e1000_check_downshift(struct e1000_hw *hw) | |||
6954 | hw->phy_type == e1000_phy_igp_2) { | 6957 | hw->phy_type == e1000_phy_igp_2) { |
6955 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, | 6958 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, |
6956 | &phy_data); | 6959 | &phy_data); |
6957 | if(ret_val) | 6960 | if (ret_val) |
6958 | return ret_val; | 6961 | return ret_val; |
6959 | 6962 | ||
6960 | hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; | 6963 | hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; |
@@ -6962,7 +6965,7 @@ e1000_check_downshift(struct e1000_hw *hw) | |||
6962 | (hw->phy_type == e1000_phy_gg82563)) { | 6965 | (hw->phy_type == e1000_phy_gg82563)) { |
6963 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, | 6966 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
6964 | &phy_data); | 6967 | &phy_data); |
6965 | if(ret_val) | 6968 | if (ret_val) |
6966 | return ret_val; | 6969 | return ret_val; |
6967 | 6970 | ||
6968 | hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> | 6971 | hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> |
@@ -7002,42 +7005,42 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw, | |||
7002 | 7005 | ||
7003 | DEBUGFUNC("e1000_config_dsp_after_link_change"); | 7006 | DEBUGFUNC("e1000_config_dsp_after_link_change"); |
7004 | 7007 | ||
7005 | if(hw->phy_type != e1000_phy_igp) | 7008 | if (hw->phy_type != e1000_phy_igp) |
7006 | return E1000_SUCCESS; | 7009 | return E1000_SUCCESS; |
7007 | 7010 | ||
7008 | if(link_up) { | 7011 | if (link_up) { |
7009 | ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); | 7012 | ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
7010 | if(ret_val) { | 7013 | if (ret_val) { |
7011 | DEBUGOUT("Error getting link speed and duplex\n"); | 7014 | DEBUGOUT("Error getting link speed and duplex\n"); |
7012 | return ret_val; | 7015 | return ret_val; |
7013 | } | 7016 | } |
7014 | 7017 | ||
7015 | if(speed == SPEED_1000) { | 7018 | if (speed == SPEED_1000) { |
7016 | 7019 | ||
7017 | ret_val = e1000_get_cable_length(hw, &min_length, &max_length); | 7020 | ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
7018 | if (ret_val) | 7021 | if (ret_val) |
7019 | return ret_val; | 7022 | return ret_val; |
7020 | 7023 | ||
7021 | if((hw->dsp_config_state == e1000_dsp_config_enabled) && | 7024 | if ((hw->dsp_config_state == e1000_dsp_config_enabled) && |
7022 | min_length >= e1000_igp_cable_length_50) { | 7025 | min_length >= e1000_igp_cable_length_50) { |
7023 | 7026 | ||
7024 | for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { | 7027 | for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
7025 | ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], | 7028 | ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], |
7026 | &phy_data); | 7029 | &phy_data); |
7027 | if(ret_val) | 7030 | if (ret_val) |
7028 | return ret_val; | 7031 | return ret_val; |
7029 | 7032 | ||
7030 | phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; | 7033 | phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; |
7031 | 7034 | ||
7032 | ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i], | 7035 | ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i], |
7033 | phy_data); | 7036 | phy_data); |
7034 | if(ret_val) | 7037 | if (ret_val) |
7035 | return ret_val; | 7038 | return ret_val; |
7036 | } | 7039 | } |
7037 | hw->dsp_config_state = e1000_dsp_config_activated; | 7040 | hw->dsp_config_state = e1000_dsp_config_activated; |
7038 | } | 7041 | } |
7039 | 7042 | ||
7040 | if((hw->ffe_config_state == e1000_ffe_config_enabled) && | 7043 | if ((hw->ffe_config_state == e1000_ffe_config_enabled) && |
7041 | (min_length < e1000_igp_cable_length_50)) { | 7044 | (min_length < e1000_igp_cable_length_50)) { |
7042 | 7045 | ||
7043 | uint16_t ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20; | 7046 | uint16_t ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20; |
@@ -7046,70 +7049,70 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw, | |||
7046 | /* clear previous idle error counts */ | 7049 | /* clear previous idle error counts */ |
7047 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, | 7050 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, |
7048 | &phy_data); | 7051 | &phy_data); |
7049 | if(ret_val) | 7052 | if (ret_val) |
7050 | return ret_val; | 7053 | return ret_val; |
7051 | 7054 | ||
7052 | for(i = 0; i < ffe_idle_err_timeout; i++) { | 7055 | for (i = 0; i < ffe_idle_err_timeout; i++) { |
7053 | udelay(1000); | 7056 | udelay(1000); |
7054 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, | 7057 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, |
7055 | &phy_data); | 7058 | &phy_data); |
7056 | if(ret_val) | 7059 | if (ret_val) |
7057 | return ret_val; | 7060 | return ret_val; |
7058 | 7061 | ||
7059 | idle_errs += (phy_data & SR_1000T_IDLE_ERROR_CNT); | 7062 | idle_errs += (phy_data & SR_1000T_IDLE_ERROR_CNT); |
7060 | if(idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) { | 7063 | if (idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) { |
7061 | hw->ffe_config_state = e1000_ffe_config_active; | 7064 | hw->ffe_config_state = e1000_ffe_config_active; |
7062 | 7065 | ||
7063 | ret_val = e1000_write_phy_reg(hw, | 7066 | ret_val = e1000_write_phy_reg(hw, |
7064 | IGP01E1000_PHY_DSP_FFE, | 7067 | IGP01E1000_PHY_DSP_FFE, |
7065 | IGP01E1000_PHY_DSP_FFE_CM_CP); | 7068 | IGP01E1000_PHY_DSP_FFE_CM_CP); |
7066 | if(ret_val) | 7069 | if (ret_val) |
7067 | return ret_val; | 7070 | return ret_val; |
7068 | break; | 7071 | break; |
7069 | } | 7072 | } |
7070 | 7073 | ||
7071 | if(idle_errs) | 7074 | if (idle_errs) |
7072 | ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_100; | 7075 | ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_100; |
7073 | } | 7076 | } |
7074 | } | 7077 | } |
7075 | } | 7078 | } |
7076 | } else { | 7079 | } else { |
7077 | if(hw->dsp_config_state == e1000_dsp_config_activated) { | 7080 | if (hw->dsp_config_state == e1000_dsp_config_activated) { |
7078 | /* Save off the current value of register 0x2F5B to be restored at | 7081 | /* Save off the current value of register 0x2F5B to be restored at |
7079 | * the end of the routines. */ | 7082 | * the end of the routines. */ |
7080 | ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); | 7083 | ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
7081 | 7084 | ||
7082 | if(ret_val) | 7085 | if (ret_val) |
7083 | return ret_val; | 7086 | return ret_val; |
7084 | 7087 | ||
7085 | /* Disable the PHY transmitter */ | 7088 | /* Disable the PHY transmitter */ |
7086 | ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); | 7089 | ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
7087 | 7090 | ||
7088 | if(ret_val) | 7091 | if (ret_val) |
7089 | return ret_val; | 7092 | return ret_val; |
7090 | 7093 | ||
7091 | msec_delay_irq(20); | 7094 | msec_delay_irq(20); |
7092 | 7095 | ||
7093 | ret_val = e1000_write_phy_reg(hw, 0x0000, | 7096 | ret_val = e1000_write_phy_reg(hw, 0x0000, |
7094 | IGP01E1000_IEEE_FORCE_GIGA); | 7097 | IGP01E1000_IEEE_FORCE_GIGA); |
7095 | if(ret_val) | 7098 | if (ret_val) |
7096 | return ret_val; | 7099 | return ret_val; |
7097 | for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { | 7100 | for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
7098 | ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], &phy_data); | 7101 | ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], &phy_data); |
7099 | if(ret_val) | 7102 | if (ret_val) |
7100 | return ret_val; | 7103 | return ret_val; |
7101 | 7104 | ||
7102 | phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; | 7105 | phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; |
7103 | phy_data |= IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS; | 7106 | phy_data |= IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS; |
7104 | 7107 | ||
7105 | ret_val = e1000_write_phy_reg(hw,dsp_reg_array[i], phy_data); | 7108 | ret_val = e1000_write_phy_reg(hw,dsp_reg_array[i], phy_data); |
7106 | if(ret_val) | 7109 | if (ret_val) |
7107 | return ret_val; | 7110 | return ret_val; |
7108 | } | 7111 | } |
7109 | 7112 | ||
7110 | ret_val = e1000_write_phy_reg(hw, 0x0000, | 7113 | ret_val = e1000_write_phy_reg(hw, 0x0000, |
7111 | IGP01E1000_IEEE_RESTART_AUTONEG); | 7114 | IGP01E1000_IEEE_RESTART_AUTONEG); |
7112 | if(ret_val) | 7115 | if (ret_val) |
7113 | return ret_val; | 7116 | return ret_val; |
7114 | 7117 | ||
7115 | msec_delay_irq(20); | 7118 | msec_delay_irq(20); |
@@ -7117,40 +7120,40 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw, | |||
7117 | /* Now enable the transmitter */ | 7120 | /* Now enable the transmitter */ |
7118 | ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); | 7121 | ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
7119 | 7122 | ||
7120 | if(ret_val) | 7123 | if (ret_val) |
7121 | return ret_val; | 7124 | return ret_val; |
7122 | 7125 | ||
7123 | hw->dsp_config_state = e1000_dsp_config_enabled; | 7126 | hw->dsp_config_state = e1000_dsp_config_enabled; |
7124 | } | 7127 | } |
7125 | 7128 | ||
7126 | if(hw->ffe_config_state == e1000_ffe_config_active) { | 7129 | if (hw->ffe_config_state == e1000_ffe_config_active) { |
7127 | /* Save off the current value of register 0x2F5B to be restored at | 7130 | /* Save off the current value of register 0x2F5B to be restored at |
7128 | * the end of the routines. */ | 7131 | * the end of the routines. */ |
7129 | ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); | 7132 | ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
7130 | 7133 | ||
7131 | if(ret_val) | 7134 | if (ret_val) |
7132 | return ret_val; | 7135 | return ret_val; |
7133 | 7136 | ||
7134 | /* Disable the PHY transmitter */ | 7137 | /* Disable the PHY transmitter */ |
7135 | ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); | 7138 | ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
7136 | 7139 | ||
7137 | if(ret_val) | 7140 | if (ret_val) |
7138 | return ret_val; | 7141 | return ret_val; |
7139 | 7142 | ||
7140 | msec_delay_irq(20); | 7143 | msec_delay_irq(20); |
7141 | 7144 | ||
7142 | ret_val = e1000_write_phy_reg(hw, 0x0000, | 7145 | ret_val = e1000_write_phy_reg(hw, 0x0000, |
7143 | IGP01E1000_IEEE_FORCE_GIGA); | 7146 | IGP01E1000_IEEE_FORCE_GIGA); |
7144 | if(ret_val) | 7147 | if (ret_val) |
7145 | return ret_val; | 7148 | return ret_val; |
7146 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE, | 7149 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE, |
7147 | IGP01E1000_PHY_DSP_FFE_DEFAULT); | 7150 | IGP01E1000_PHY_DSP_FFE_DEFAULT); |
7148 | if(ret_val) | 7151 | if (ret_val) |
7149 | return ret_val; | 7152 | return ret_val; |
7150 | 7153 | ||
7151 | ret_val = e1000_write_phy_reg(hw, 0x0000, | 7154 | ret_val = e1000_write_phy_reg(hw, 0x0000, |
7152 | IGP01E1000_IEEE_RESTART_AUTONEG); | 7155 | IGP01E1000_IEEE_RESTART_AUTONEG); |
7153 | if(ret_val) | 7156 | if (ret_val) |
7154 | return ret_val; | 7157 | return ret_val; |
7155 | 7158 | ||
7156 | msec_delay_irq(20); | 7159 | msec_delay_irq(20); |
@@ -7158,7 +7161,7 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw, | |||
7158 | /* Now enable the transmitter */ | 7161 | /* Now enable the transmitter */ |
7159 | ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); | 7162 | ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
7160 | 7163 | ||
7161 | if(ret_val) | 7164 | if (ret_val) |
7162 | return ret_val; | 7165 | return ret_val; |
7163 | 7166 | ||
7164 | hw->ffe_config_state = e1000_ffe_config_enabled; | 7167 | hw->ffe_config_state = e1000_ffe_config_enabled; |
@@ -7183,20 +7186,20 @@ e1000_set_phy_mode(struct e1000_hw *hw) | |||
7183 | 7186 | ||
7184 | DEBUGFUNC("e1000_set_phy_mode"); | 7187 | DEBUGFUNC("e1000_set_phy_mode"); |
7185 | 7188 | ||
7186 | if((hw->mac_type == e1000_82545_rev_3) && | 7189 | if ((hw->mac_type == e1000_82545_rev_3) && |
7187 | (hw->media_type == e1000_media_type_copper)) { | 7190 | (hw->media_type == e1000_media_type_copper)) { |
7188 | ret_val = e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, 1, &eeprom_data); | 7191 | ret_val = e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, 1, &eeprom_data); |
7189 | if(ret_val) { | 7192 | if (ret_val) { |
7190 | return ret_val; | 7193 | return ret_val; |
7191 | } | 7194 | } |
7192 | 7195 | ||
7193 | if((eeprom_data != EEPROM_RESERVED_WORD) && | 7196 | if ((eeprom_data != EEPROM_RESERVED_WORD) && |
7194 | (eeprom_data & EEPROM_PHY_CLASS_A)) { | 7197 | (eeprom_data & EEPROM_PHY_CLASS_A)) { |
7195 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x000B); | 7198 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x000B); |
7196 | if(ret_val) | 7199 | if (ret_val) |
7197 | return ret_val; | 7200 | return ret_val; |
7198 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x8104); | 7201 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x8104); |
7199 | if(ret_val) | 7202 | if (ret_val) |
7200 | return ret_val; | 7203 | return ret_val; |
7201 | 7204 | ||
7202 | hw->phy_reset_disable = FALSE; | 7205 | hw->phy_reset_disable = FALSE; |
@@ -7247,16 +7250,16 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw, | |||
7247 | phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); | 7250 | phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); |
7248 | } else { | 7251 | } else { |
7249 | ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); | 7252 | ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
7250 | if(ret_val) | 7253 | if (ret_val) |
7251 | return ret_val; | 7254 | return ret_val; |
7252 | } | 7255 | } |
7253 | 7256 | ||
7254 | if(!active) { | 7257 | if (!active) { |
7255 | if(hw->mac_type == e1000_82541_rev_2 || | 7258 | if (hw->mac_type == e1000_82541_rev_2 || |
7256 | hw->mac_type == e1000_82547_rev_2) { | 7259 | hw->mac_type == e1000_82547_rev_2) { |
7257 | phy_data &= ~IGP01E1000_GMII_FLEX_SPD; | 7260 | phy_data &= ~IGP01E1000_GMII_FLEX_SPD; |
7258 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); | 7261 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); |
7259 | if(ret_val) | 7262 | if (ret_val) |
7260 | return ret_val; | 7263 | return ret_val; |
7261 | } else { | 7264 | } else { |
7262 | if (hw->mac_type == e1000_ich8lan) { | 7265 | if (hw->mac_type == e1000_ich8lan) { |
@@ -7278,13 +7281,13 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw, | |||
7278 | if (hw->smart_speed == e1000_smart_speed_on) { | 7281 | if (hw->smart_speed == e1000_smart_speed_on) { |
7279 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, | 7282 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
7280 | &phy_data); | 7283 | &phy_data); |
7281 | if(ret_val) | 7284 | if (ret_val) |
7282 | return ret_val; | 7285 | return ret_val; |
7283 | 7286 | ||
7284 | phy_data |= IGP01E1000_PSCFR_SMART_SPEED; | 7287 | phy_data |= IGP01E1000_PSCFR_SMART_SPEED; |
7285 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, | 7288 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
7286 | phy_data); | 7289 | phy_data); |
7287 | if(ret_val) | 7290 | if (ret_val) |
7288 | return ret_val; | 7291 | return ret_val; |
7289 | } else if (hw->smart_speed == e1000_smart_speed_off) { | 7292 | } else if (hw->smart_speed == e1000_smart_speed_off) { |
7290 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, | 7293 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
@@ -7295,19 +7298,19 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw, | |||
7295 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; | 7298 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
7296 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, | 7299 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
7297 | phy_data); | 7300 | phy_data); |
7298 | if(ret_val) | 7301 | if (ret_val) |
7299 | return ret_val; | 7302 | return ret_val; |
7300 | } | 7303 | } |
7301 | 7304 | ||
7302 | } else if((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) || | 7305 | } else if ((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) || |
7303 | (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL ) || | 7306 | (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL ) || |
7304 | (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { | 7307 | (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { |
7305 | 7308 | ||
7306 | if(hw->mac_type == e1000_82541_rev_2 || | 7309 | if (hw->mac_type == e1000_82541_rev_2 || |
7307 | hw->mac_type == e1000_82547_rev_2) { | 7310 | hw->mac_type == e1000_82547_rev_2) { |
7308 | phy_data |= IGP01E1000_GMII_FLEX_SPD; | 7311 | phy_data |= IGP01E1000_GMII_FLEX_SPD; |
7309 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); | 7312 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); |
7310 | if(ret_val) | 7313 | if (ret_val) |
7311 | return ret_val; | 7314 | return ret_val; |
7312 | } else { | 7315 | } else { |
7313 | if (hw->mac_type == e1000_ich8lan) { | 7316 | if (hw->mac_type == e1000_ich8lan) { |
@@ -7324,12 +7327,12 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw, | |||
7324 | 7327 | ||
7325 | /* When LPLU is enabled we should disable SmartSpeed */ | 7328 | /* When LPLU is enabled we should disable SmartSpeed */ |
7326 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); | 7329 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); |
7327 | if(ret_val) | 7330 | if (ret_val) |
7328 | return ret_val; | 7331 | return ret_val; |
7329 | 7332 | ||
7330 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; | 7333 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
7331 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data); | 7334 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data); |
7332 | if(ret_val) | 7335 | if (ret_val) |
7333 | return ret_val; | 7336 | return ret_val; |
7334 | 7337 | ||
7335 | } | 7338 | } |
@@ -7359,14 +7362,14 @@ e1000_set_d0_lplu_state(struct e1000_hw *hw, | |||
7359 | uint16_t phy_data; | 7362 | uint16_t phy_data; |
7360 | DEBUGFUNC("e1000_set_d0_lplu_state"); | 7363 | DEBUGFUNC("e1000_set_d0_lplu_state"); |
7361 | 7364 | ||
7362 | if(hw->mac_type <= e1000_82547_rev_2) | 7365 | if (hw->mac_type <= e1000_82547_rev_2) |
7363 | return E1000_SUCCESS; | 7366 | return E1000_SUCCESS; |
7364 | 7367 | ||
7365 | if (hw->mac_type == e1000_ich8lan) { | 7368 | if (hw->mac_type == e1000_ich8lan) { |
7366 | phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); | 7369 | phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); |
7367 | } else { | 7370 | } else { |
7368 | ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); | 7371 | ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
7369 | if(ret_val) | 7372 | if (ret_val) |
7370 | return ret_val; | 7373 | return ret_val; |
7371 | } | 7374 | } |
7372 | 7375 | ||
@@ -7388,13 +7391,13 @@ e1000_set_d0_lplu_state(struct e1000_hw *hw, | |||
7388 | if (hw->smart_speed == e1000_smart_speed_on) { | 7391 | if (hw->smart_speed == e1000_smart_speed_on) { |
7389 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, | 7392 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
7390 | &phy_data); | 7393 | &phy_data); |
7391 | if(ret_val) | 7394 | if (ret_val) |
7392 | return ret_val; | 7395 | return ret_val; |
7393 | 7396 | ||
7394 | phy_data |= IGP01E1000_PSCFR_SMART_SPEED; | 7397 | phy_data |= IGP01E1000_PSCFR_SMART_SPEED; |
7395 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, | 7398 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
7396 | phy_data); | 7399 | phy_data); |
7397 | if(ret_val) | 7400 | if (ret_val) |
7398 | return ret_val; | 7401 | return ret_val; |
7399 | } else if (hw->smart_speed == e1000_smart_speed_off) { | 7402 | } else if (hw->smart_speed == e1000_smart_speed_off) { |
7400 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, | 7403 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
@@ -7405,7 +7408,7 @@ e1000_set_d0_lplu_state(struct e1000_hw *hw, | |||
7405 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; | 7408 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
7406 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, | 7409 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
7407 | phy_data); | 7410 | phy_data); |
7408 | if(ret_val) | 7411 | if (ret_val) |
7409 | return ret_val; | 7412 | return ret_val; |
7410 | } | 7413 | } |
7411 | 7414 | ||
@@ -7424,12 +7427,12 @@ e1000_set_d0_lplu_state(struct e1000_hw *hw, | |||
7424 | 7427 | ||
7425 | /* When LPLU is enabled we should disable SmartSpeed */ | 7428 | /* When LPLU is enabled we should disable SmartSpeed */ |
7426 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); | 7429 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); |
7427 | if(ret_val) | 7430 | if (ret_val) |
7428 | return ret_val; | 7431 | return ret_val; |
7429 | 7432 | ||
7430 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; | 7433 | phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
7431 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data); | 7434 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data); |
7432 | if(ret_val) | 7435 | if (ret_val) |
7433 | return ret_val; | 7436 | return ret_val; |
7434 | 7437 | ||
7435 | } | 7438 | } |
@@ -7450,7 +7453,7 @@ e1000_set_vco_speed(struct e1000_hw *hw) | |||
7450 | 7453 | ||
7451 | DEBUGFUNC("e1000_set_vco_speed"); | 7454 | DEBUGFUNC("e1000_set_vco_speed"); |
7452 | 7455 | ||
7453 | switch(hw->mac_type) { | 7456 | switch (hw->mac_type) { |
7454 | case e1000_82545_rev_3: | 7457 | case e1000_82545_rev_3: |
7455 | case e1000_82546_rev_3: | 7458 | case e1000_82546_rev_3: |
7456 | break; | 7459 | break; |
@@ -7461,39 +7464,39 @@ e1000_set_vco_speed(struct e1000_hw *hw) | |||
7461 | /* Set PHY register 30, page 5, bit 8 to 0 */ | 7464 | /* Set PHY register 30, page 5, bit 8 to 0 */ |
7462 | 7465 | ||
7463 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, &default_page); | 7466 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, &default_page); |
7464 | if(ret_val) | 7467 | if (ret_val) |
7465 | return ret_val; | 7468 | return ret_val; |
7466 | 7469 | ||
7467 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005); | 7470 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005); |
7468 | if(ret_val) | 7471 | if (ret_val) |
7469 | return ret_val; | 7472 | return ret_val; |
7470 | 7473 | ||
7471 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); | 7474 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); |
7472 | if(ret_val) | 7475 | if (ret_val) |
7473 | return ret_val; | 7476 | return ret_val; |
7474 | 7477 | ||
7475 | phy_data &= ~M88E1000_PHY_VCO_REG_BIT8; | 7478 | phy_data &= ~M88E1000_PHY_VCO_REG_BIT8; |
7476 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); | 7479 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); |
7477 | if(ret_val) | 7480 | if (ret_val) |
7478 | return ret_val; | 7481 | return ret_val; |
7479 | 7482 | ||
7480 | /* Set PHY register 30, page 4, bit 11 to 1 */ | 7483 | /* Set PHY register 30, page 4, bit 11 to 1 */ |
7481 | 7484 | ||
7482 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004); | 7485 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004); |
7483 | if(ret_val) | 7486 | if (ret_val) |
7484 | return ret_val; | 7487 | return ret_val; |
7485 | 7488 | ||
7486 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); | 7489 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); |
7487 | if(ret_val) | 7490 | if (ret_val) |
7488 | return ret_val; | 7491 | return ret_val; |
7489 | 7492 | ||
7490 | phy_data |= M88E1000_PHY_VCO_REG_BIT11; | 7493 | phy_data |= M88E1000_PHY_VCO_REG_BIT11; |
7491 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); | 7494 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); |
7492 | if(ret_val) | 7495 | if (ret_val) |
7493 | return ret_val; | 7496 | return ret_val; |
7494 | 7497 | ||
7495 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, default_page); | 7498 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, default_page); |
7496 | if(ret_val) | 7499 | if (ret_val) |
7497 | return ret_val; | 7500 | return ret_val; |
7498 | 7501 | ||
7499 | return E1000_SUCCESS; | 7502 | return E1000_SUCCESS; |
@@ -7572,7 +7575,7 @@ e1000_mng_host_if_write(struct e1000_hw * hw, uint8_t *buffer, | |||
7572 | { | 7575 | { |
7573 | uint8_t *tmp; | 7576 | uint8_t *tmp; |
7574 | uint8_t *bufptr = buffer; | 7577 | uint8_t *bufptr = buffer; |
7575 | uint32_t data; | 7578 | uint32_t data = 0; |
7576 | uint16_t remaining, i, j, prev_bytes; | 7579 | uint16_t remaining, i, j, prev_bytes; |
7577 | 7580 | ||
7578 | /* sum = only sum of the data and it is not checksum */ | 7581 | /* sum = only sum of the data and it is not checksum */ |
@@ -7652,7 +7655,7 @@ e1000_mng_write_cmd_header(struct e1000_hw * hw, | |||
7652 | 7655 | ||
7653 | buffer = (uint8_t *) hdr; | 7656 | buffer = (uint8_t *) hdr; |
7654 | i = length; | 7657 | i = length; |
7655 | while(i--) | 7658 | while (i--) |
7656 | sum += buffer[i]; | 7659 | sum += buffer[i]; |
7657 | 7660 | ||
7658 | hdr->checksum = 0 - sum; | 7661 | hdr->checksum = 0 - sum; |
@@ -7675,8 +7678,7 @@ e1000_mng_write_cmd_header(struct e1000_hw * hw, | |||
7675 | * returns - E1000_SUCCESS for success. | 7678 | * returns - E1000_SUCCESS for success. |
7676 | ****************************************************************************/ | 7679 | ****************************************************************************/ |
7677 | static int32_t | 7680 | static int32_t |
7678 | e1000_mng_write_commit( | 7681 | e1000_mng_write_commit(struct e1000_hw * hw) |
7679 | struct e1000_hw * hw) | ||
7680 | { | 7682 | { |
7681 | uint32_t hicr; | 7683 | uint32_t hicr; |
7682 | 7684 | ||
@@ -7848,31 +7850,31 @@ e1000_polarity_reversal_workaround(struct e1000_hw *hw) | |||
7848 | /* Disable the transmitter on the PHY */ | 7850 | /* Disable the transmitter on the PHY */ |
7849 | 7851 | ||
7850 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); | 7852 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); |
7851 | if(ret_val) | 7853 | if (ret_val) |
7852 | return ret_val; | 7854 | return ret_val; |
7853 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF); | 7855 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF); |
7854 | if(ret_val) | 7856 | if (ret_val) |
7855 | return ret_val; | 7857 | return ret_val; |
7856 | 7858 | ||
7857 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); | 7859 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); |
7858 | if(ret_val) | 7860 | if (ret_val) |
7859 | return ret_val; | 7861 | return ret_val; |
7860 | 7862 | ||
7861 | /* This loop will early-out if the NO link condition has been met. */ | 7863 | /* This loop will early-out if the NO link condition has been met. */ |
7862 | for(i = PHY_FORCE_TIME; i > 0; i--) { | 7864 | for (i = PHY_FORCE_TIME; i > 0; i--) { |
7863 | /* Read the MII Status Register and wait for Link Status bit | 7865 | /* Read the MII Status Register and wait for Link Status bit |
7864 | * to be clear. | 7866 | * to be clear. |
7865 | */ | 7867 | */ |
7866 | 7868 | ||
7867 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 7869 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
7868 | if(ret_val) | 7870 | if (ret_val) |
7869 | return ret_val; | 7871 | return ret_val; |
7870 | 7872 | ||
7871 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 7873 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
7872 | if(ret_val) | 7874 | if (ret_val) |
7873 | return ret_val; | 7875 | return ret_val; |
7874 | 7876 | ||
7875 | if((mii_status_reg & ~MII_SR_LINK_STATUS) == 0) break; | 7877 | if ((mii_status_reg & ~MII_SR_LINK_STATUS) == 0) break; |
7876 | msec_delay_irq(100); | 7878 | msec_delay_irq(100); |
7877 | } | 7879 | } |
7878 | 7880 | ||
@@ -7882,40 +7884,40 @@ e1000_polarity_reversal_workaround(struct e1000_hw *hw) | |||
7882 | /* Now we will re-enable th transmitter on the PHY */ | 7884 | /* Now we will re-enable th transmitter on the PHY */ |
7883 | 7885 | ||
7884 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); | 7886 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); |
7885 | if(ret_val) | 7887 | if (ret_val) |
7886 | return ret_val; | 7888 | return ret_val; |
7887 | msec_delay_irq(50); | 7889 | msec_delay_irq(50); |
7888 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0); | 7890 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0); |
7889 | if(ret_val) | 7891 | if (ret_val) |
7890 | return ret_val; | 7892 | return ret_val; |
7891 | msec_delay_irq(50); | 7893 | msec_delay_irq(50); |
7892 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00); | 7894 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00); |
7893 | if(ret_val) | 7895 | if (ret_val) |
7894 | return ret_val; | 7896 | return ret_val; |
7895 | msec_delay_irq(50); | 7897 | msec_delay_irq(50); |
7896 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000); | 7898 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000); |
7897 | if(ret_val) | 7899 | if (ret_val) |
7898 | return ret_val; | 7900 | return ret_val; |
7899 | 7901 | ||
7900 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); | 7902 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); |
7901 | if(ret_val) | 7903 | if (ret_val) |
7902 | return ret_val; | 7904 | return ret_val; |
7903 | 7905 | ||
7904 | /* This loop will early-out if the link condition has been met. */ | 7906 | /* This loop will early-out if the link condition has been met. */ |
7905 | for(i = PHY_FORCE_TIME; i > 0; i--) { | 7907 | for (i = PHY_FORCE_TIME; i > 0; i--) { |
7906 | /* Read the MII Status Register and wait for Link Status bit | 7908 | /* Read the MII Status Register and wait for Link Status bit |
7907 | * to be set. | 7909 | * to be set. |
7908 | */ | 7910 | */ |
7909 | 7911 | ||
7910 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 7912 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
7911 | if(ret_val) | 7913 | if (ret_val) |
7912 | return ret_val; | 7914 | return ret_val; |
7913 | 7915 | ||
7914 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); | 7916 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
7915 | if(ret_val) | 7917 | if (ret_val) |
7916 | return ret_val; | 7918 | return ret_val; |
7917 | 7919 | ||
7918 | if(mii_status_reg & MII_SR_LINK_STATUS) break; | 7920 | if (mii_status_reg & MII_SR_LINK_STATUS) break; |
7919 | msec_delay_irq(100); | 7921 | msec_delay_irq(100); |
7920 | } | 7922 | } |
7921 | return E1000_SUCCESS; | 7923 | return E1000_SUCCESS; |
@@ -7994,15 +7996,15 @@ e1000_disable_pciex_master(struct e1000_hw *hw) | |||
7994 | 7996 | ||
7995 | e1000_set_pci_express_master_disable(hw); | 7997 | e1000_set_pci_express_master_disable(hw); |
7996 | 7998 | ||
7997 | while(timeout) { | 7999 | while (timeout) { |
7998 | if(!(E1000_READ_REG(hw, STATUS) & E1000_STATUS_GIO_MASTER_ENABLE)) | 8000 | if (!(E1000_READ_REG(hw, STATUS) & E1000_STATUS_GIO_MASTER_ENABLE)) |
7999 | break; | 8001 | break; |
8000 | else | 8002 | else |
8001 | udelay(100); | 8003 | udelay(100); |
8002 | timeout--; | 8004 | timeout--; |
8003 | } | 8005 | } |
8004 | 8006 | ||
8005 | if(!timeout) { | 8007 | if (!timeout) { |
8006 | DEBUGOUT("Master requests are pending.\n"); | 8008 | DEBUGOUT("Master requests are pending.\n"); |
8007 | return -E1000_ERR_MASTER_REQUESTS_PENDING; | 8009 | return -E1000_ERR_MASTER_REQUESTS_PENDING; |
8008 | } | 8010 | } |
@@ -8043,7 +8045,7 @@ e1000_get_auto_rd_done(struct e1000_hw *hw) | |||
8043 | timeout--; | 8045 | timeout--; |
8044 | } | 8046 | } |
8045 | 8047 | ||
8046 | if(!timeout) { | 8048 | if (!timeout) { |
8047 | DEBUGOUT("Auto read by HW from EEPROM has not completed.\n"); | 8049 | DEBUGOUT("Auto read by HW from EEPROM has not completed.\n"); |
8048 | return -E1000_ERR_RESET; | 8050 | return -E1000_ERR_RESET; |
8049 | } | 8051 | } |
@@ -8124,7 +8126,7 @@ e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw) | |||
8124 | 8126 | ||
8125 | DEBUGFUNC("e1000_get_hw_eeprom_semaphore"); | 8127 | DEBUGFUNC("e1000_get_hw_eeprom_semaphore"); |
8126 | 8128 | ||
8127 | if(!hw->eeprom_semaphore_present) | 8129 | if (!hw->eeprom_semaphore_present) |
8128 | return E1000_SUCCESS; | 8130 | return E1000_SUCCESS; |
8129 | 8131 | ||
8130 | if (hw->mac_type == e1000_80003es2lan) { | 8132 | if (hw->mac_type == e1000_80003es2lan) { |
@@ -8135,20 +8137,20 @@ e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw) | |||
8135 | 8137 | ||
8136 | /* Get the FW semaphore. */ | 8138 | /* Get the FW semaphore. */ |
8137 | timeout = hw->eeprom.word_size + 1; | 8139 | timeout = hw->eeprom.word_size + 1; |
8138 | while(timeout) { | 8140 | while (timeout) { |
8139 | swsm = E1000_READ_REG(hw, SWSM); | 8141 | swsm = E1000_READ_REG(hw, SWSM); |
8140 | swsm |= E1000_SWSM_SWESMBI; | 8142 | swsm |= E1000_SWSM_SWESMBI; |
8141 | E1000_WRITE_REG(hw, SWSM, swsm); | 8143 | E1000_WRITE_REG(hw, SWSM, swsm); |
8142 | /* if we managed to set the bit we got the semaphore. */ | 8144 | /* if we managed to set the bit we got the semaphore. */ |
8143 | swsm = E1000_READ_REG(hw, SWSM); | 8145 | swsm = E1000_READ_REG(hw, SWSM); |
8144 | if(swsm & E1000_SWSM_SWESMBI) | 8146 | if (swsm & E1000_SWSM_SWESMBI) |
8145 | break; | 8147 | break; |
8146 | 8148 | ||
8147 | udelay(50); | 8149 | udelay(50); |
8148 | timeout--; | 8150 | timeout--; |
8149 | } | 8151 | } |
8150 | 8152 | ||
8151 | if(!timeout) { | 8153 | if (!timeout) { |
8152 | /* Release semaphores */ | 8154 | /* Release semaphores */ |
8153 | e1000_put_hw_eeprom_semaphore(hw); | 8155 | e1000_put_hw_eeprom_semaphore(hw); |
8154 | DEBUGOUT("Driver can't access the Eeprom - SWESMBI bit is set.\n"); | 8156 | DEBUGOUT("Driver can't access the Eeprom - SWESMBI bit is set.\n"); |
@@ -8173,7 +8175,7 @@ e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) | |||
8173 | 8175 | ||
8174 | DEBUGFUNC("e1000_put_hw_eeprom_semaphore"); | 8176 | DEBUGFUNC("e1000_put_hw_eeprom_semaphore"); |
8175 | 8177 | ||
8176 | if(!hw->eeprom_semaphore_present) | 8178 | if (!hw->eeprom_semaphore_present) |
8177 | return; | 8179 | return; |
8178 | 8180 | ||
8179 | swsm = E1000_READ_REG(hw, SWSM); | 8181 | swsm = E1000_READ_REG(hw, SWSM); |
@@ -8206,16 +8208,16 @@ e1000_get_software_semaphore(struct e1000_hw *hw) | |||
8206 | if (hw->mac_type != e1000_80003es2lan) | 8208 | if (hw->mac_type != e1000_80003es2lan) |
8207 | return E1000_SUCCESS; | 8209 | return E1000_SUCCESS; |
8208 | 8210 | ||
8209 | while(timeout) { | 8211 | while (timeout) { |
8210 | swsm = E1000_READ_REG(hw, SWSM); | 8212 | swsm = E1000_READ_REG(hw, SWSM); |
8211 | /* If SMBI bit cleared, it is now set and we hold the semaphore */ | 8213 | /* If SMBI bit cleared, it is now set and we hold the semaphore */ |
8212 | if(!(swsm & E1000_SWSM_SMBI)) | 8214 | if (!(swsm & E1000_SWSM_SMBI)) |
8213 | break; | 8215 | break; |
8214 | msec_delay_irq(1); | 8216 | msec_delay_irq(1); |
8215 | timeout--; | 8217 | timeout--; |
8216 | } | 8218 | } |
8217 | 8219 | ||
8218 | if(!timeout) { | 8220 | if (!timeout) { |
8219 | DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); | 8221 | DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); |
8220 | return -E1000_ERR_RESET; | 8222 | return -E1000_ERR_RESET; |
8221 | } | 8223 | } |
@@ -8291,7 +8293,7 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw) | |||
8291 | case e1000_82573: | 8293 | case e1000_82573: |
8292 | case e1000_80003es2lan: | 8294 | case e1000_80003es2lan: |
8293 | fwsm = E1000_READ_REG(hw, FWSM); | 8295 | fwsm = E1000_READ_REG(hw, FWSM); |
8294 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) | 8296 | if ((fwsm & E1000_FWSM_MODE_MASK) != 0) |
8295 | return TRUE; | 8297 | return TRUE; |
8296 | break; | 8298 | break; |
8297 | case e1000_ich8lan: | 8299 | case e1000_ich8lan: |
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index 375b95518c31..4f74242746fa 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -336,9 +336,9 @@ uint32_t e1000_enable_mng_pass_thru(struct e1000_hw *hw); | |||
336 | #define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8 /* Host Interface data length */ | 336 | #define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8 /* Host Interface data length */ |
337 | 337 | ||
338 | #define E1000_MNG_DHCP_COMMAND_TIMEOUT 10 /* Time in ms to process MNG command */ | 338 | #define E1000_MNG_DHCP_COMMAND_TIMEOUT 10 /* Time in ms to process MNG command */ |
339 | #define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 /* Cookie offset */ | 339 | #define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 /* Cookie offset */ |
340 | #define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 /* Cookie length */ | 340 | #define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 /* Cookie length */ |
341 | #define E1000_MNG_IAMT_MODE 0x3 | 341 | #define E1000_MNG_IAMT_MODE 0x3 |
342 | #define E1000_MNG_ICH_IAMT_MODE 0x2 | 342 | #define E1000_MNG_ICH_IAMT_MODE 0x2 |
343 | #define E1000_IAMT_SIGNATURE 0x544D4149 /* Intel(R) Active Management Technology signature */ | 343 | #define E1000_IAMT_SIGNATURE 0x544D4149 /* Intel(R) Active Management Technology signature */ |
344 | 344 | ||
@@ -385,7 +385,7 @@ struct e1000_host_mng_dhcp_cookie{ | |||
385 | #endif | 385 | #endif |
386 | 386 | ||
387 | int32_t e1000_mng_write_dhcp_info(struct e1000_hw *hw, uint8_t *buffer, | 387 | int32_t e1000_mng_write_dhcp_info(struct e1000_hw *hw, uint8_t *buffer, |
388 | uint16_t length); | 388 | uint16_t length); |
389 | boolean_t e1000_check_mng_mode(struct e1000_hw *hw); | 389 | boolean_t e1000_check_mng_mode(struct e1000_hw *hw); |
390 | boolean_t e1000_enable_tx_pkt_filtering(struct e1000_hw *hw); | 390 | boolean_t e1000_enable_tx_pkt_filtering(struct e1000_hw *hw); |
391 | 391 | ||
@@ -523,7 +523,7 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); | |||
523 | 523 | ||
524 | 524 | ||
525 | /* 802.1q VLAN Packet Sizes */ | 525 | /* 802.1q VLAN Packet Sizes */ |
526 | #define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMAed) */ | 526 | #define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMAed) */ |
527 | 527 | ||
528 | /* Ethertype field values */ | 528 | /* Ethertype field values */ |
529 | #define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */ | 529 | #define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */ |
@@ -697,6 +697,7 @@ union e1000_rx_desc_packet_split { | |||
697 | E1000_RXDEXT_STATERR_CXE | \ | 697 | E1000_RXDEXT_STATERR_CXE | \ |
698 | E1000_RXDEXT_STATERR_RXE) | 698 | E1000_RXDEXT_STATERR_RXE) |
699 | 699 | ||
700 | |||
700 | /* Transmit Descriptor */ | 701 | /* Transmit Descriptor */ |
701 | struct e1000_tx_desc { | 702 | struct e1000_tx_desc { |
702 | uint64_t buffer_addr; /* Address of the descriptor's data buffer */ | 703 | uint64_t buffer_addr; /* Address of the descriptor's data buffer */ |
@@ -2086,7 +2087,7 @@ struct e1000_hw { | |||
2086 | #define E1000_MANC_EN_IP_ADDR_FILTER 0x00400000 /* Enable IP address | 2087 | #define E1000_MANC_EN_IP_ADDR_FILTER 0x00400000 /* Enable IP address |
2087 | * filtering */ | 2088 | * filtering */ |
2088 | #define E1000_MANC_EN_XSUM_FILTER 0x00800000 /* Enable checksum filtering */ | 2089 | #define E1000_MANC_EN_XSUM_FILTER 0x00800000 /* Enable checksum filtering */ |
2089 | #define E1000_MANC_BR_EN 0x01000000 /* Enable broadcast filtering */ | 2090 | #define E1000_MANC_BR_EN 0x01000000 /* Enable broadcast filtering */ |
2090 | #define E1000_MANC_SMB_REQ 0x01000000 /* SMBus Request */ | 2091 | #define E1000_MANC_SMB_REQ 0x01000000 /* SMBus Request */ |
2091 | #define E1000_MANC_SMB_GNT 0x02000000 /* SMBus Grant */ | 2092 | #define E1000_MANC_SMB_GNT 0x02000000 /* SMBus Grant */ |
2092 | #define E1000_MANC_SMB_CLK_IN 0x04000000 /* SMBus Clock In */ | 2093 | #define E1000_MANC_SMB_CLK_IN 0x04000000 /* SMBus Clock In */ |
@@ -2172,7 +2173,7 @@ struct e1000_host_command_info { | |||
2172 | 2173 | ||
2173 | #define E1000_MDALIGN 4096 | 2174 | #define E1000_MDALIGN 4096 |
2174 | 2175 | ||
2175 | /* PCI-Ex registers */ | 2176 | /* PCI-Ex registers*/ |
2176 | 2177 | ||
2177 | /* PCI-Ex Control Register */ | 2178 | /* PCI-Ex Control Register */ |
2178 | #define E1000_GCR_RXD_NO_SNOOP 0x00000001 | 2179 | #define E1000_GCR_RXD_NO_SNOOP 0x00000001 |
@@ -2224,7 +2225,7 @@ struct e1000_host_command_info { | |||
2224 | #define EEPROM_EWDS_OPCODE_MICROWIRE 0x10 /* EEPROM erast/write disable */ | 2225 | #define EEPROM_EWDS_OPCODE_MICROWIRE 0x10 /* EEPROM erast/write disable */ |
2225 | 2226 | ||
2226 | /* EEPROM Commands - SPI */ | 2227 | /* EEPROM Commands - SPI */ |
2227 | #define EEPROM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */ | 2228 | #define EEPROM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */ |
2228 | #define EEPROM_READ_OPCODE_SPI 0x03 /* EEPROM read opcode */ | 2229 | #define EEPROM_READ_OPCODE_SPI 0x03 /* EEPROM read opcode */ |
2229 | #define EEPROM_WRITE_OPCODE_SPI 0x02 /* EEPROM write opcode */ | 2230 | #define EEPROM_WRITE_OPCODE_SPI 0x02 /* EEPROM write opcode */ |
2230 | #define EEPROM_A8_OPCODE_SPI 0x08 /* opcode bit-3 = address bit-8 */ | 2231 | #define EEPROM_A8_OPCODE_SPI 0x08 /* opcode bit-3 = address bit-8 */ |
@@ -3082,10 +3083,10 @@ struct e1000_host_command_info { | |||
3082 | 3083 | ||
3083 | /* DSP Distance Register (Page 5, Register 26) */ | 3084 | /* DSP Distance Register (Page 5, Register 26) */ |
3084 | #define GG82563_DSPD_CABLE_LENGTH 0x0007 /* 0 = <50M; | 3085 | #define GG82563_DSPD_CABLE_LENGTH 0x0007 /* 0 = <50M; |
3085 | 1 = 50-80M; | 3086 | 1 = 50-80M; |
3086 | 2 = 80-110M; | 3087 | 2 = 80-110M; |
3087 | 3 = 110-140M; | 3088 | 3 = 110-140M; |
3088 | 4 = >140M */ | 3089 | 4 = >140M */ |
3089 | 3090 | ||
3090 | /* Kumeran Mode Control Register (Page 193, Register 16) */ | 3091 | /* Kumeran Mode Control Register (Page 193, Register 16) */ |
3091 | #define GG82563_KMCR_PHY_LEDS_EN 0x0020 /* 1=PHY LEDs, 0=Kumeran Inband LEDs */ | 3092 | #define GG82563_KMCR_PHY_LEDS_EN 0x0020 /* 1=PHY LEDs, 0=Kumeran Inband LEDs */ |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 0cf9ff2462ba..610a0cdbb68b 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2439,10 +2439,9 @@ e1000_watchdog(unsigned long data) | |||
2439 | * disable receives in the ISR and | 2439 | * disable receives in the ISR and |
2440 | * reset device here in the watchdog | 2440 | * reset device here in the watchdog |
2441 | */ | 2441 | */ |
2442 | if (adapter->hw.mac_type == e1000_80003es2lan) { | 2442 | if (adapter->hw.mac_type == e1000_80003es2lan) |
2443 | /* reset device */ | 2443 | /* reset device */ |
2444 | schedule_work(&adapter->reset_task); | 2444 | schedule_work(&adapter->reset_task); |
2445 | } | ||
2446 | } | 2445 | } |
2447 | 2446 | ||
2448 | e1000_smartspeed(adapter); | 2447 | e1000_smartspeed(adapter); |
@@ -3677,7 +3676,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3677 | E1000_DBG("%s: Receive packet consumed multiple" | 3676 | E1000_DBG("%s: Receive packet consumed multiple" |
3678 | " buffers\n", netdev->name); | 3677 | " buffers\n", netdev->name); |
3679 | /* recycle */ | 3678 | /* recycle */ |
3680 | buffer_info-> skb = skb; | 3679 | buffer_info->skb = skb; |
3681 | goto next_desc; | 3680 | goto next_desc; |
3682 | } | 3681 | } |
3683 | 3682 | ||