diff options
Diffstat (limited to 'drivers/net/e1000e/ich8lan.c')
-rw-r--r-- | drivers/net/e1000e/ich8lan.c | 391 |
1 files changed, 204 insertions, 187 deletions
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 8b5e157e9c87..b2507d93de99 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -83,6 +83,8 @@ | |||
83 | 83 | ||
84 | 84 | ||
85 | #define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */ | 85 | #define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */ |
86 | /* FW established a valid mode */ | ||
87 | #define E1000_ICH_FWSM_FW_VALID 0x00008000 | ||
86 | 88 | ||
87 | #define E1000_ICH_MNG_IAMT_MODE 0x2 | 89 | #define E1000_ICH_MNG_IAMT_MODE 0x2 |
88 | 90 | ||
@@ -259,6 +261,7 @@ static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val) | |||
259 | static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | 261 | static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) |
260 | { | 262 | { |
261 | struct e1000_phy_info *phy = &hw->phy; | 263 | struct e1000_phy_info *phy = &hw->phy; |
264 | u32 ctrl; | ||
262 | s32 ret_val = 0; | 265 | s32 ret_val = 0; |
263 | 266 | ||
264 | phy->addr = 1; | 267 | phy->addr = 1; |
@@ -274,6 +277,33 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
274 | phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; | 277 | phy->ops.power_down = e1000_power_down_phy_copper_ich8lan; |
275 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 278 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
276 | 279 | ||
280 | if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { | ||
281 | /* | ||
282 | * The MAC-PHY interconnect may still be in SMBus mode | ||
283 | * after Sx->S0. Toggle the LANPHYPC Value bit to force | ||
284 | * the interconnect to PCIe mode, but only if there is no | ||
285 | * firmware present otherwise firmware will have done it. | ||
286 | */ | ||
287 | ctrl = er32(CTRL); | ||
288 | ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; | ||
289 | ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; | ||
290 | ew32(CTRL, ctrl); | ||
291 | udelay(10); | ||
292 | ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; | ||
293 | ew32(CTRL, ctrl); | ||
294 | msleep(50); | ||
295 | } | ||
296 | |||
297 | /* | ||
298 | * Reset the PHY before any acccess to it. Doing so, ensures that | ||
299 | * the PHY is in a known good state before we read/write PHY registers. | ||
300 | * The generic reset is sufficient here, because we haven't determined | ||
301 | * the PHY type yet. | ||
302 | */ | ||
303 | ret_val = e1000e_phy_hw_reset_generic(hw); | ||
304 | if (ret_val) | ||
305 | goto out; | ||
306 | |||
277 | phy->id = e1000_phy_unknown; | 307 | phy->id = e1000_phy_unknown; |
278 | ret_val = e1000e_get_phy_id(hw); | 308 | ret_val = e1000e_get_phy_id(hw); |
279 | if (ret_val) | 309 | if (ret_val) |
@@ -300,6 +330,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
300 | phy->ops.get_cable_length = e1000_get_cable_length_82577; | 330 | phy->ops.get_cable_length = e1000_get_cable_length_82577; |
301 | phy->ops.get_info = e1000_get_phy_info_82577; | 331 | phy->ops.get_info = e1000_get_phy_info_82577; |
302 | phy->ops.commit = e1000e_phy_sw_reset; | 332 | phy->ops.commit = e1000e_phy_sw_reset; |
333 | break; | ||
303 | case e1000_phy_82578: | 334 | case e1000_phy_82578: |
304 | phy->ops.check_polarity = e1000_check_polarity_m88; | 335 | phy->ops.check_polarity = e1000_check_polarity_m88; |
305 | phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88; | 336 | phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88; |
@@ -472,8 +503,10 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) | |||
472 | mac->rar_entry_count = E1000_ICH_RAR_ENTRIES; | 503 | mac->rar_entry_count = E1000_ICH_RAR_ENTRIES; |
473 | if (mac->type == e1000_ich8lan) | 504 | if (mac->type == e1000_ich8lan) |
474 | mac->rar_entry_count--; | 505 | mac->rar_entry_count--; |
475 | /* Set if manageability features are enabled. */ | 506 | /* FWSM register */ |
476 | mac->arc_subsystem_valid = true; | 507 | mac->has_fwsm = true; |
508 | /* ARC subsystem not supported */ | ||
509 | mac->arc_subsystem_valid = false; | ||
477 | /* Adaptive IFS supported */ | 510 | /* Adaptive IFS supported */ |
478 | mac->adaptive_ifs = true; | 511 | mac->adaptive_ifs = true; |
479 | 512 | ||
@@ -657,8 +690,6 @@ static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw) | |||
657 | static void e1000_release_nvm_ich8lan(struct e1000_hw *hw) | 690 | static void e1000_release_nvm_ich8lan(struct e1000_hw *hw) |
658 | { | 691 | { |
659 | mutex_unlock(&nvm_mutex); | 692 | mutex_unlock(&nvm_mutex); |
660 | |||
661 | return; | ||
662 | } | 693 | } |
663 | 694 | ||
664 | static DEFINE_MUTEX(swflag_mutex); | 695 | static DEFINE_MUTEX(swflag_mutex); |
@@ -737,8 +768,6 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) | |||
737 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 768 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
738 | 769 | ||
739 | mutex_unlock(&swflag_mutex); | 770 | mutex_unlock(&swflag_mutex); |
740 | |||
741 | return; | ||
742 | } | 771 | } |
743 | 772 | ||
744 | /** | 773 | /** |
@@ -785,11 +814,16 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) | |||
785 | **/ | 814 | **/ |
786 | static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) | 815 | static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) |
787 | { | 816 | { |
817 | struct e1000_adapter *adapter = hw->adapter; | ||
788 | struct e1000_phy_info *phy = &hw->phy; | 818 | struct e1000_phy_info *phy = &hw->phy; |
789 | u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; | 819 | u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; |
790 | s32 ret_val; | 820 | s32 ret_val = 0; |
791 | u16 word_addr, reg_data, reg_addr, phy_page = 0; | 821 | u16 word_addr, reg_data, reg_addr, phy_page = 0; |
792 | 822 | ||
823 | if (!(hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) && | ||
824 | !(hw->mac.type == e1000_pchlan)) | ||
825 | return ret_val; | ||
826 | |||
793 | ret_val = hw->phy.ops.acquire(hw); | 827 | ret_val = hw->phy.ops.acquire(hw); |
794 | if (ret_val) | 828 | if (ret_val) |
795 | return ret_val; | 829 | return ret_val; |
@@ -801,97 +835,87 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) | |||
801 | * Therefore, after each PHY reset, we will load the | 835 | * Therefore, after each PHY reset, we will load the |
802 | * configuration data out of the NVM manually. | 836 | * configuration data out of the NVM manually. |
803 | */ | 837 | */ |
804 | if ((hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) || | 838 | if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) || |
805 | (hw->mac.type == e1000_pchlan)) { | 839 | (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) || |
806 | struct e1000_adapter *adapter = hw->adapter; | 840 | (hw->mac.type == e1000_pchlan)) |
807 | 841 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; | |
808 | /* Check if SW needs to configure the PHY */ | 842 | else |
809 | if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) || | 843 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; |
810 | (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) || | ||
811 | (hw->mac.type == e1000_pchlan)) | ||
812 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; | ||
813 | else | ||
814 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; | ||
815 | 844 | ||
816 | data = er32(FEXTNVM); | 845 | data = er32(FEXTNVM); |
817 | if (!(data & sw_cfg_mask)) | 846 | if (!(data & sw_cfg_mask)) |
818 | goto out; | 847 | goto out; |
819 | 848 | ||
820 | /* Wait for basic configuration completes before proceeding */ | 849 | /* |
821 | e1000_lan_init_done_ich8lan(hw); | 850 | * Make sure HW does not configure LCD from PHY |
851 | * extended configuration before SW configuration | ||
852 | */ | ||
853 | data = er32(EXTCNF_CTRL); | ||
854 | if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) | ||
855 | goto out; | ||
856 | |||
857 | cnf_size = er32(EXTCNF_SIZE); | ||
858 | cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; | ||
859 | cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT; | ||
860 | if (!cnf_size) | ||
861 | goto out; | ||
862 | |||
863 | cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; | ||
864 | cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; | ||
822 | 865 | ||
866 | if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && | ||
867 | (hw->mac.type == e1000_pchlan)) { | ||
823 | /* | 868 | /* |
824 | * Make sure HW does not configure LCD from PHY | 869 | * HW configures the SMBus address and LEDs when the |
825 | * extended configuration before SW configuration | 870 | * OEM and LCD Write Enable bits are set in the NVM. |
871 | * When both NVM bits are cleared, SW will configure | ||
872 | * them instead. | ||
826 | */ | 873 | */ |
827 | data = er32(EXTCNF_CTRL); | 874 | data = er32(STRAP); |
828 | if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) | 875 | data &= E1000_STRAP_SMBUS_ADDRESS_MASK; |
876 | reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT; | ||
877 | reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID; | ||
878 | ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, | ||
879 | reg_data); | ||
880 | if (ret_val) | ||
829 | goto out; | 881 | goto out; |
830 | 882 | ||
831 | cnf_size = er32(EXTCNF_SIZE); | 883 | data = er32(LEDCTL); |
832 | cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; | 884 | ret_val = e1000_write_phy_reg_hv_locked(hw, HV_LED_CONFIG, |
833 | cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT; | 885 | (u16)data); |
834 | if (!cnf_size) | 886 | if (ret_val) |
835 | goto out; | 887 | goto out; |
888 | } | ||
836 | 889 | ||
837 | cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; | 890 | /* Configure LCD from extended configuration region. */ |
838 | cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; | ||
839 | |||
840 | if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && | ||
841 | (hw->mac.type == e1000_pchlan)) { | ||
842 | /* | ||
843 | * HW configures the SMBus address and LEDs when the | ||
844 | * OEM and LCD Write Enable bits are set in the NVM. | ||
845 | * When both NVM bits are cleared, SW will configure | ||
846 | * them instead. | ||
847 | */ | ||
848 | data = er32(STRAP); | ||
849 | data &= E1000_STRAP_SMBUS_ADDRESS_MASK; | ||
850 | reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT; | ||
851 | reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID; | ||
852 | ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, | ||
853 | reg_data); | ||
854 | if (ret_val) | ||
855 | goto out; | ||
856 | |||
857 | data = er32(LEDCTL); | ||
858 | ret_val = e1000_write_phy_reg_hv_locked(hw, | ||
859 | HV_LED_CONFIG, | ||
860 | (u16)data); | ||
861 | if (ret_val) | ||
862 | goto out; | ||
863 | } | ||
864 | /* Configure LCD from extended configuration region. */ | ||
865 | 891 | ||
866 | /* cnf_base_addr is in DWORD */ | 892 | /* cnf_base_addr is in DWORD */ |
867 | word_addr = (u16)(cnf_base_addr << 1); | 893 | word_addr = (u16)(cnf_base_addr << 1); |
868 | 894 | ||
869 | for (i = 0; i < cnf_size; i++) { | 895 | for (i = 0; i < cnf_size; i++) { |
870 | ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1, | 896 | ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1, |
871 | ®_data); | 897 | ®_data); |
872 | if (ret_val) | 898 | if (ret_val) |
873 | goto out; | 899 | goto out; |
874 | 900 | ||
875 | ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1), | 901 | ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1), |
876 | 1, ®_addr); | 902 | 1, ®_addr); |
877 | if (ret_val) | 903 | if (ret_val) |
878 | goto out; | 904 | goto out; |
879 | 905 | ||
880 | /* Save off the PHY page for future writes. */ | 906 | /* Save off the PHY page for future writes. */ |
881 | if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) { | 907 | if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) { |
882 | phy_page = reg_data; | 908 | phy_page = reg_data; |
883 | continue; | 909 | continue; |
884 | } | 910 | } |
885 | 911 | ||
886 | reg_addr &= PHY_REG_MASK; | 912 | reg_addr &= PHY_REG_MASK; |
887 | reg_addr |= phy_page; | 913 | reg_addr |= phy_page; |
888 | 914 | ||
889 | ret_val = phy->ops.write_reg_locked(hw, | 915 | ret_val = phy->ops.write_reg_locked(hw, (u32)reg_addr, |
890 | (u32)reg_addr, | 916 | reg_data); |
891 | reg_data); | 917 | if (ret_val) |
892 | if (ret_val) | 918 | goto out; |
893 | goto out; | ||
894 | } | ||
895 | } | 919 | } |
896 | 920 | ||
897 | out: | 921 | out: |
@@ -1229,30 +1253,26 @@ static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw) | |||
1229 | } | 1253 | } |
1230 | 1254 | ||
1231 | /** | 1255 | /** |
1232 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset | 1256 | * e1000_post_phy_reset_ich8lan - Perform steps required after a PHY reset |
1233 | * @hw: pointer to the HW structure | 1257 | * @hw: pointer to the HW structure |
1234 | * | ||
1235 | * Resets the PHY | ||
1236 | * This is a function pointer entry point called by drivers | ||
1237 | * or other shared routines. | ||
1238 | **/ | 1258 | **/ |
1239 | static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | 1259 | static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw) |
1240 | { | 1260 | { |
1241 | s32 ret_val = 0; | 1261 | s32 ret_val = 0; |
1242 | u16 reg; | 1262 | u16 reg; |
1243 | 1263 | ||
1244 | ret_val = e1000e_phy_hw_reset_generic(hw); | 1264 | if (e1000_check_reset_block(hw)) |
1245 | if (ret_val) | 1265 | goto out; |
1246 | return ret_val; | ||
1247 | |||
1248 | /* Allow time for h/w to get to a quiescent state after reset */ | ||
1249 | mdelay(10); | ||
1250 | 1266 | ||
1251 | /* Perform any necessary post-reset workarounds */ | 1267 | /* Perform any necessary post-reset workarounds */ |
1252 | if (hw->mac.type == e1000_pchlan) { | 1268 | switch (hw->mac.type) { |
1269 | case e1000_pchlan: | ||
1253 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | 1270 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); |
1254 | if (ret_val) | 1271 | if (ret_val) |
1255 | return ret_val; | 1272 | goto out; |
1273 | break; | ||
1274 | default: | ||
1275 | break; | ||
1256 | } | 1276 | } |
1257 | 1277 | ||
1258 | /* Dummy read to clear the phy wakeup bit after lcd reset */ | 1278 | /* Dummy read to clear the phy wakeup bit after lcd reset */ |
@@ -1265,11 +1285,32 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
1265 | goto out; | 1285 | goto out; |
1266 | 1286 | ||
1267 | /* Configure the LCD with the OEM bits in NVM */ | 1287 | /* Configure the LCD with the OEM bits in NVM */ |
1268 | if (hw->mac.type == e1000_pchlan) | 1288 | ret_val = e1000_oem_bits_config_ich8lan(hw, true); |
1269 | ret_val = e1000_oem_bits_config_ich8lan(hw, true); | ||
1270 | 1289 | ||
1271 | out: | 1290 | out: |
1272 | return 0; | 1291 | return ret_val; |
1292 | } | ||
1293 | |||
1294 | /** | ||
1295 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset | ||
1296 | * @hw: pointer to the HW structure | ||
1297 | * | ||
1298 | * Resets the PHY | ||
1299 | * This is a function pointer entry point called by drivers | ||
1300 | * or other shared routines. | ||
1301 | **/ | ||
1302 | static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | ||
1303 | { | ||
1304 | s32 ret_val = 0; | ||
1305 | |||
1306 | ret_val = e1000e_phy_hw_reset_generic(hw); | ||
1307 | if (ret_val) | ||
1308 | goto out; | ||
1309 | |||
1310 | ret_val = e1000_post_phy_reset_ich8lan(hw); | ||
1311 | |||
1312 | out: | ||
1313 | return ret_val; | ||
1273 | } | 1314 | } |
1274 | 1315 | ||
1275 | /** | 1316 | /** |
@@ -1622,7 +1663,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) | |||
1622 | /* Check if the flash descriptor is valid */ | 1663 | /* Check if the flash descriptor is valid */ |
1623 | if (hsfsts.hsf_status.fldesvalid == 0) { | 1664 | if (hsfsts.hsf_status.fldesvalid == 0) { |
1624 | e_dbg("Flash descriptor invalid. " | 1665 | e_dbg("Flash descriptor invalid. " |
1625 | "SW Sequencing must be used."); | 1666 | "SW Sequencing must be used.\n"); |
1626 | return -E1000_ERR_NVM; | 1667 | return -E1000_ERR_NVM; |
1627 | } | 1668 | } |
1628 | 1669 | ||
@@ -1671,7 +1712,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) | |||
1671 | hsfsts.hsf_status.flcdone = 1; | 1712 | hsfsts.hsf_status.flcdone = 1; |
1672 | ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); | 1713 | ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); |
1673 | } else { | 1714 | } else { |
1674 | e_dbg("Flash controller busy, cannot get access"); | 1715 | e_dbg("Flash controller busy, cannot get access\n"); |
1675 | } | 1716 | } |
1676 | } | 1717 | } |
1677 | 1718 | ||
@@ -1822,7 +1863,7 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset, | |||
1822 | continue; | 1863 | continue; |
1823 | } else if (hsfsts.hsf_status.flcdone == 0) { | 1864 | } else if (hsfsts.hsf_status.flcdone == 0) { |
1824 | e_dbg("Timeout error - flash cycle " | 1865 | e_dbg("Timeout error - flash cycle " |
1825 | "did not complete."); | 1866 | "did not complete.\n"); |
1826 | break; | 1867 | break; |
1827 | } | 1868 | } |
1828 | } | 1869 | } |
@@ -1908,18 +1949,14 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1908 | new_bank_offset = nvm->flash_bank_size; | 1949 | new_bank_offset = nvm->flash_bank_size; |
1909 | old_bank_offset = 0; | 1950 | old_bank_offset = 0; |
1910 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); | 1951 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); |
1911 | if (ret_val) { | 1952 | if (ret_val) |
1912 | nvm->ops.release(hw); | 1953 | goto release; |
1913 | goto out; | ||
1914 | } | ||
1915 | } else { | 1954 | } else { |
1916 | old_bank_offset = nvm->flash_bank_size; | 1955 | old_bank_offset = nvm->flash_bank_size; |
1917 | new_bank_offset = 0; | 1956 | new_bank_offset = 0; |
1918 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); | 1957 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); |
1919 | if (ret_val) { | 1958 | if (ret_val) |
1920 | nvm->ops.release(hw); | 1959 | goto release; |
1921 | goto out; | ||
1922 | } | ||
1923 | } | 1960 | } |
1924 | 1961 | ||
1925 | for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { | 1962 | for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { |
@@ -1975,8 +2012,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1975 | if (ret_val) { | 2012 | if (ret_val) { |
1976 | /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ | 2013 | /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ |
1977 | e_dbg("Flash commit failed.\n"); | 2014 | e_dbg("Flash commit failed.\n"); |
1978 | nvm->ops.release(hw); | 2015 | goto release; |
1979 | goto out; | ||
1980 | } | 2016 | } |
1981 | 2017 | ||
1982 | /* | 2018 | /* |
@@ -1987,18 +2023,15 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1987 | */ | 2023 | */ |
1988 | act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; | 2024 | act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; |
1989 | ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); | 2025 | ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); |
1990 | if (ret_val) { | 2026 | if (ret_val) |
1991 | nvm->ops.release(hw); | 2027 | goto release; |
1992 | goto out; | 2028 | |
1993 | } | ||
1994 | data &= 0xBFFF; | 2029 | data &= 0xBFFF; |
1995 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, | 2030 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, |
1996 | act_offset * 2 + 1, | 2031 | act_offset * 2 + 1, |
1997 | (u8)(data >> 8)); | 2032 | (u8)(data >> 8)); |
1998 | if (ret_val) { | 2033 | if (ret_val) |
1999 | nvm->ops.release(hw); | 2034 | goto release; |
2000 | goto out; | ||
2001 | } | ||
2002 | 2035 | ||
2003 | /* | 2036 | /* |
2004 | * And invalidate the previously valid segment by setting | 2037 | * And invalidate the previously valid segment by setting |
@@ -2008,10 +2041,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
2008 | */ | 2041 | */ |
2009 | act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; | 2042 | act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; |
2010 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); | 2043 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); |
2011 | if (ret_val) { | 2044 | if (ret_val) |
2012 | nvm->ops.release(hw); | 2045 | goto release; |
2013 | goto out; | ||
2014 | } | ||
2015 | 2046 | ||
2016 | /* Great! Everything worked, we can now clear the cached entries. */ | 2047 | /* Great! Everything worked, we can now clear the cached entries. */ |
2017 | for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { | 2048 | for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { |
@@ -2019,14 +2050,17 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
2019 | dev_spec->shadow_ram[i].value = 0xFFFF; | 2050 | dev_spec->shadow_ram[i].value = 0xFFFF; |
2020 | } | 2051 | } |
2021 | 2052 | ||
2053 | release: | ||
2022 | nvm->ops.release(hw); | 2054 | nvm->ops.release(hw); |
2023 | 2055 | ||
2024 | /* | 2056 | /* |
2025 | * Reload the EEPROM, or else modifications will not appear | 2057 | * Reload the EEPROM, or else modifications will not appear |
2026 | * until after the next adapter reset. | 2058 | * until after the next adapter reset. |
2027 | */ | 2059 | */ |
2028 | e1000e_reload_nvm(hw); | 2060 | if (!ret_val) { |
2029 | msleep(10); | 2061 | e1000e_reload_nvm(hw); |
2062 | msleep(10); | ||
2063 | } | ||
2030 | 2064 | ||
2031 | out: | 2065 | out: |
2032 | if (ret_val) | 2066 | if (ret_val) |
@@ -2487,9 +2521,8 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2487 | * on the last TLP read/write transaction when MAC is reset. | 2521 | * on the last TLP read/write transaction when MAC is reset. |
2488 | */ | 2522 | */ |
2489 | ret_val = e1000e_disable_pcie_master(hw); | 2523 | ret_val = e1000e_disable_pcie_master(hw); |
2490 | if (ret_val) { | 2524 | if (ret_val) |
2491 | e_dbg("PCI-E Master disable polling has failed.\n"); | 2525 | e_dbg("PCI-E Master disable polling has failed.\n"); |
2492 | } | ||
2493 | 2526 | ||
2494 | e_dbg("Masking off all interrupts\n"); | 2527 | e_dbg("Masking off all interrupts\n"); |
2495 | ew32(IMC, 0xffffffff); | 2528 | ew32(IMC, 0xffffffff); |
@@ -2528,14 +2561,8 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2528 | ctrl = er32(CTRL); | 2561 | ctrl = er32(CTRL); |
2529 | 2562 | ||
2530 | if (!e1000_check_reset_block(hw)) { | 2563 | if (!e1000_check_reset_block(hw)) { |
2531 | /* Clear PHY Reset Asserted bit */ | ||
2532 | if (hw->mac.type >= e1000_pchlan) { | ||
2533 | u32 status = er32(STATUS); | ||
2534 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
2535 | } | ||
2536 | |||
2537 | /* | 2564 | /* |
2538 | * PHY HW reset requires MAC CORE reset at the same | 2565 | * Full-chip reset requires MAC and PHY reset at the same |
2539 | * time to make sure the interface between MAC and the | 2566 | * time to make sure the interface between MAC and the |
2540 | * external PHY is reset. | 2567 | * external PHY is reset. |
2541 | */ | 2568 | */ |
@@ -2549,39 +2576,16 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2549 | if (!ret_val) | 2576 | if (!ret_val) |
2550 | e1000_release_swflag_ich8lan(hw); | 2577 | e1000_release_swflag_ich8lan(hw); |
2551 | 2578 | ||
2552 | /* Perform any necessary post-reset workarounds */ | 2579 | if (ctrl & E1000_CTRL_PHY_RST) { |
2553 | if (hw->mac.type == e1000_pchlan) | ||
2554 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | ||
2555 | |||
2556 | if (ctrl & E1000_CTRL_PHY_RST) | ||
2557 | ret_val = hw->phy.ops.get_cfg_done(hw); | 2580 | ret_val = hw->phy.ops.get_cfg_done(hw); |
2581 | if (ret_val) | ||
2582 | goto out; | ||
2558 | 2583 | ||
2559 | if (hw->mac.type >= e1000_ich10lan) { | 2584 | ret_val = e1000_post_phy_reset_ich8lan(hw); |
2560 | e1000_lan_init_done_ich8lan(hw); | ||
2561 | } else { | ||
2562 | ret_val = e1000e_get_auto_rd_done(hw); | ||
2563 | if (ret_val) { | ||
2564 | /* | ||
2565 | * When auto config read does not complete, do not | ||
2566 | * return with an error. This can happen in situations | ||
2567 | * where there is no eeprom and prevents getting link. | ||
2568 | */ | ||
2569 | e_dbg("Auto Read Done did not complete\n"); | ||
2570 | } | ||
2571 | } | ||
2572 | /* Dummy read to clear the phy wakeup bit after lcd reset */ | ||
2573 | if (hw->mac.type == e1000_pchlan) | ||
2574 | e1e_rphy(hw, BM_WUC, ®); | ||
2575 | |||
2576 | ret_val = e1000_sw_lcd_config_ich8lan(hw); | ||
2577 | if (ret_val) | ||
2578 | goto out; | ||
2579 | |||
2580 | if (hw->mac.type == e1000_pchlan) { | ||
2581 | ret_val = e1000_oem_bits_config_ich8lan(hw, true); | ||
2582 | if (ret_val) | 2585 | if (ret_val) |
2583 | goto out; | 2586 | goto out; |
2584 | } | 2587 | } |
2588 | |||
2585 | /* | 2589 | /* |
2586 | * For PCH, this write will make sure that any noise | 2590 | * For PCH, this write will make sure that any noise |
2587 | * will be detected as a CRC error and be dropped rather than show up | 2591 | * will be detected as a CRC error and be dropped rather than show up |
@@ -2748,8 +2752,6 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw) | |||
2748 | reg = er32(RFCTL); | 2752 | reg = er32(RFCTL); |
2749 | reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS); | 2753 | reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS); |
2750 | ew32(RFCTL, reg); | 2754 | ew32(RFCTL, reg); |
2751 | |||
2752 | return; | ||
2753 | } | 2755 | } |
2754 | 2756 | ||
2755 | /** | 2757 | /** |
@@ -2799,6 +2801,8 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw) | |||
2799 | ew32(FCTTV, hw->fc.pause_time); | 2801 | ew32(FCTTV, hw->fc.pause_time); |
2800 | if ((hw->phy.type == e1000_phy_82578) || | 2802 | if ((hw->phy.type == e1000_phy_82578) || |
2801 | (hw->phy.type == e1000_phy_82577)) { | 2803 | (hw->phy.type == e1000_phy_82577)) { |
2804 | ew32(FCRTV_PCH, hw->fc.refresh_time); | ||
2805 | |||
2802 | ret_val = hw->phy.ops.write_reg(hw, | 2806 | ret_val = hw->phy.ops.write_reg(hw, |
2803 | PHY_REG(BM_PORT_CTRL_PAGE, 27), | 2807 | PHY_REG(BM_PORT_CTRL_PAGE, 27), |
2804 | hw->fc.pause_time); | 2808 | hw->fc.pause_time); |
@@ -3127,8 +3131,6 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) | |||
3127 | default: | 3131 | default: |
3128 | break; | 3132 | break; |
3129 | } | 3133 | } |
3130 | |||
3131 | return; | ||
3132 | } | 3134 | } |
3133 | 3135 | ||
3134 | /** | 3136 | /** |
@@ -3265,33 +3267,50 @@ static s32 e1000_led_off_pchlan(struct e1000_hw *hw) | |||
3265 | } | 3267 | } |
3266 | 3268 | ||
3267 | /** | 3269 | /** |
3268 | * e1000_get_cfg_done_ich8lan - Read config done bit | 3270 | * e1000_get_cfg_done_ich8lan - Read config done bit after Full or PHY reset |
3269 | * @hw: pointer to the HW structure | 3271 | * @hw: pointer to the HW structure |
3270 | * | 3272 | * |
3271 | * Read the management control register for the config done bit for | 3273 | * Read appropriate register for the config done bit for completion status |
3272 | * completion status. NOTE: silicon which is EEPROM-less will fail trying | 3274 | * and configure the PHY through s/w for EEPROM-less parts. |
3273 | * to read the config done bit, so an error is *ONLY* logged and returns | 3275 | * |
3274 | * 0. If we were to return with error, EEPROM-less silicon | 3276 | * NOTE: some silicon which is EEPROM-less will fail trying to read the |
3275 | * would not be able to be reset or change link. | 3277 | * config done bit, so only an error is logged and continues. If we were |
3278 | * to return with error, EEPROM-less silicon would not be able to be reset | ||
3279 | * or change link. | ||
3276 | **/ | 3280 | **/ |
3277 | static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) | 3281 | static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) |
3278 | { | 3282 | { |
3283 | s32 ret_val = 0; | ||
3279 | u32 bank = 0; | 3284 | u32 bank = 0; |
3285 | u32 status; | ||
3280 | 3286 | ||
3281 | if (hw->mac.type >= e1000_pchlan) { | 3287 | e1000e_get_cfg_done(hw); |
3282 | u32 status = er32(STATUS); | ||
3283 | 3288 | ||
3284 | if (status & E1000_STATUS_PHYRA) | 3289 | /* Wait for indication from h/w that it has completed basic config */ |
3285 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | 3290 | if (hw->mac.type >= e1000_ich10lan) { |
3286 | else | 3291 | e1000_lan_init_done_ich8lan(hw); |
3287 | e_dbg("PHY Reset Asserted not set - needs delay\n"); | 3292 | } else { |
3293 | ret_val = e1000e_get_auto_rd_done(hw); | ||
3294 | if (ret_val) { | ||
3295 | /* | ||
3296 | * When auto config read does not complete, do not | ||
3297 | * return with an error. This can happen in situations | ||
3298 | * where there is no eeprom and prevents getting link. | ||
3299 | */ | ||
3300 | e_dbg("Auto Read Done did not complete\n"); | ||
3301 | ret_val = 0; | ||
3302 | } | ||
3288 | } | 3303 | } |
3289 | 3304 | ||
3290 | e1000e_get_cfg_done(hw); | 3305 | /* Clear PHY Reset Asserted bit */ |
3306 | status = er32(STATUS); | ||
3307 | if (status & E1000_STATUS_PHYRA) | ||
3308 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
3309 | else | ||
3310 | e_dbg("PHY Reset Asserted not set - needs delay\n"); | ||
3291 | 3311 | ||
3292 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ | 3312 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ |
3293 | if ((hw->mac.type != e1000_ich10lan) && | 3313 | if (hw->mac.type <= e1000_ich9lan) { |
3294 | (hw->mac.type != e1000_pchlan)) { | ||
3295 | if (((er32(EECD) & E1000_EECD_PRES) == 0) && | 3314 | if (((er32(EECD) & E1000_EECD_PRES) == 0) && |
3296 | (hw->phy.type == e1000_phy_igp_3)) { | 3315 | (hw->phy.type == e1000_phy_igp_3)) { |
3297 | e1000e_phy_init_script_igp3(hw); | 3316 | e1000e_phy_init_script_igp3(hw); |
@@ -3300,11 +3319,11 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) | |||
3300 | if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) { | 3319 | if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) { |
3301 | /* Maybe we should do a basic PHY config */ | 3320 | /* Maybe we should do a basic PHY config */ |
3302 | e_dbg("EEPROM not present\n"); | 3321 | e_dbg("EEPROM not present\n"); |
3303 | return -E1000_ERR_CONFIG; | 3322 | ret_val = -E1000_ERR_CONFIG; |
3304 | } | 3323 | } |
3305 | } | 3324 | } |
3306 | 3325 | ||
3307 | return 0; | 3326 | return ret_val; |
3308 | } | 3327 | } |
3309 | 3328 | ||
3310 | /** | 3329 | /** |
@@ -3320,8 +3339,6 @@ static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw) | |||
3320 | if (!(hw->mac.ops.check_mng_mode(hw) || | 3339 | if (!(hw->mac.ops.check_mng_mode(hw) || |
3321 | hw->phy.ops.check_reset_block(hw))) | 3340 | hw->phy.ops.check_reset_block(hw))) |
3322 | e1000_power_down_phy_copper(hw); | 3341 | e1000_power_down_phy_copper(hw); |
3323 | |||
3324 | return; | ||
3325 | } | 3342 | } |
3326 | 3343 | ||
3327 | /** | 3344 | /** |