61 #define ICH_FLASH_GFPREG 0x0000
62 #define ICH_FLASH_HSFSTS 0x0004
63 #define ICH_FLASH_HSFCTL 0x0006
64 #define ICH_FLASH_FADDR 0x0008
65 #define ICH_FLASH_FDATA0 0x0010
66 #define ICH_FLASH_PR0 0x0074
68 #define ICH_FLASH_READ_COMMAND_TIMEOUT 500
69 #define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500
70 #define ICH_FLASH_ERASE_COMMAND_TIMEOUT 3000000
71 #define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF
72 #define ICH_FLASH_CYCLE_REPEAT_COUNT 10
74 #define ICH_CYCLE_READ 0
75 #define ICH_CYCLE_WRITE 2
76 #define ICH_CYCLE_ERASE 3
78 #define FLASH_GFPREG_BASE_MASK 0x1FFF
79 #define FLASH_SECTOR_ADDR_SHIFT 12
81 #define ICH_FLASH_SEG_SIZE_256 256
82 #define ICH_FLASH_SEG_SIZE_4K 4096
83 #define ICH_FLASH_SEG_SIZE_8K 8192
84 #define ICH_FLASH_SEG_SIZE_64K 65536
87 #define E1000_ICH_FWSM_RSPCIPHY 0x00000040
89 #define E1000_ICH_FWSM_FW_VALID 0x00008000
91 #define E1000_ICH_MNG_IAMT_MODE 0x2
93 #define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \
94 (ID_LED_DEF1_OFF2 << 8) | \
95 (ID_LED_DEF1_ON2 << 4) | \
98 #define E1000_ICH_NVM_SIG_WORD 0x13
99 #define E1000_ICH_NVM_SIG_MASK 0xC000
100 #define E1000_ICH_NVM_VALID_SIG_MASK 0xC0
101 #define E1000_ICH_NVM_SIG_VALUE 0x80
103 #define E1000_ICH8_LAN_INIT_TIMEOUT 1500
105 #define E1000_FEXTNVM_SW_CONFIG 1
106 #define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27)
108 #define E1000_FEXTNVM3_PHY_CFG_COUNTER_MASK 0x0C000000
109 #define E1000_FEXTNVM3_PHY_CFG_COUNTER_50MSEC 0x08000000
111 #define E1000_FEXTNVM4_BEACON_DURATION_MASK 0x7
112 #define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7
113 #define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3
115 #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
117 #define E1000_ICH_RAR_ENTRIES 7
118 #define E1000_PCH2_RAR_ENTRIES 5
119 #define E1000_PCH_LPT_RAR_ENTRIES 12
121 #define PHY_PAGE_SHIFT 5
122 #define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \
123 ((reg) & MAX_PHY_REG_ADDRESS))
124 #define IGP3_KMRN_DIAG PHY_REG(770, 19)
125 #define IGP3_VR_CTRL PHY_REG(776, 18)
127 #define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002
128 #define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300
129 #define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200
131 #define HV_LED_CONFIG PHY_REG(768, 30)
133 #define SW_FLAG_TIMEOUT 1000
136 #define CV_SMB_CTRL PHY_REG(769, 23)
137 #define CV_SMB_CTRL_FORCE_SMBUS 0x0001
140 #define HV_SMB_ADDR PHY_REG(768, 26)
141 #define HV_SMB_ADDR_MASK 0x007F
142 #define HV_SMB_ADDR_PEC_EN 0x0200
143 #define HV_SMB_ADDR_VALID 0x0080
144 #define HV_SMB_ADDR_FREQ_MASK 0x1100
145 #define HV_SMB_ADDR_FREQ_LOW_SHIFT 8
146 #define HV_SMB_ADDR_FREQ_HIGH_SHIFT 12
149 #define HV_PM_CTRL PHY_REG(770, 17)
150 #define HV_PM_CTRL_PLL_STOP_IN_K1_GIGA 0x100
153 #define I82579_LPI_CTRL PHY_REG(772, 20)
154 #define I82579_LPI_CTRL_ENABLE_MASK 0x6000
155 #define I82579_LPI_CTRL_FORCE_PLL_LOCK_COUNT 0x80
158 #define I82579_EMI_ADDR 0x10
159 #define I82579_EMI_DATA 0x11
160 #define I82579_LPI_UPDATE_TIMER 0x4805
161 #define I82579_MSE_THRESHOLD 0x084F
162 #define I82579_MSE_LINK_DOWN 0x2411
163 #define I217_EEE_ADVERTISEMENT 0x8001
164 #define I217_EEE_LP_ABILITY 0x8002
165 #define I217_EEE_100_SUPPORTED (1 << 1)
168 #define I217_PROXY_CTRL BM_PHY_REG(BM_WUC_PAGE, 70)
169 #define I217_PROXY_CTRL_AUTO_DISABLE 0x0080
170 #define I217_SxCTRL PHY_REG(BM_PORT_CTRL_PAGE, 28)
171 #define I217_SxCTRL_ENABLE_LPI_RESET 0x1000
172 #define I217_CGFREG PHY_REG(772, 29)
173 #define I217_CGFREG_ENABLE_MTA_RESET 0x0002
174 #define I217_MEMPWR PHY_REG(772, 26)
175 #define I217_MEMPWR_DISABLE_SMB_RELEASE 0x0010
178 #define E1000_STRAP 0x0000C
179 #define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
180 #define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17
181 #define E1000_STRAP_SMT_FREQ_MASK 0x00003000
182 #define E1000_STRAP_SMT_FREQ_SHIFT 12
185 #define HV_OEM_BITS PHY_REG(768, 25)
186 #define HV_OEM_BITS_LPLU 0x0004
187 #define HV_OEM_BITS_GBE_DIS 0x0040
188 #define HV_OEM_BITS_RESTART_AN 0x0400
190 #define E1000_NVM_K1_CONFIG 0x1B
191 #define E1000_NVM_K1_ENABLE 0x1
194 #define HV_KMRN_MODE_CTRL PHY_REG(769, 16)
195 #define HV_KMRN_MDIO_SLOW 0x0400
198 #define HV_KMRN_FIFO_CTRLSTA PHY_REG(770, 16)
199 #define HV_KMRN_FIFO_CTRLSTA_PREAMBLE_MASK 0x7000
200 #define HV_KMRN_FIFO_CTRLSTA_PREAMBLE_SHIFT 12
257 static void e1000_clear_hw_cntrs_ich8lan(
struct e1000_hw *
hw);
258 static void e1000_initialize_hw_bits_ich8lan(
struct e1000_hw *
hw);
260 static s32 e1000_retry_write_flash_byte_ich8lan(
struct e1000_hw *
hw,
268 static s32 e1000_setup_copper_link_ich8lan(
struct e1000_hw *
hw);
269 static s32 e1000_kmrn_lock_loss_workaround_ich8lan(
struct e1000_hw *
hw);
280 static void e1000_power_down_phy_copper_ich8lan(
struct e1000_hw *
hw);
281 static void e1000_lan_init_done_ich8lan(
struct e1000_hw *
hw);
284 static bool e1000_check_mng_mode_ich8lan(
struct e1000_hw *
hw);
285 static bool e1000_check_mng_mode_pchlan(
struct e1000_hw *
hw);
289 static void e1000_gate_hw_phy_config_ich8lan(
struct e1000_hw *
hw,
bool gate);
311 #define er16flash(reg) __er16flash(hw, (reg))
312 #define er32flash(reg) __er32flash(hw, (reg))
313 #define ew16flash(reg, val) __ew16flash(hw, (reg), (val))
314 #define ew32flash(reg, val) __ew32flash(hw, (reg), (val))
326 static bool e1000_phy_is_accessible_pchlan(
struct e1000_hw *
hw)
333 for (retry_count = 0; retry_count < 2; retry_count++) {
334 ret_val = e1e_rphy_locked(hw,
PHY_ID1, &phy_reg);
335 if (ret_val || (phy_reg == 0xFFFF))
337 phy_id = (
u32)(phy_reg << 16);
339 ret_val = e1e_rphy_locked(hw,
PHY_ID2, &phy_reg);
340 if (ret_val || (phy_reg == 0xFFFF)) {
349 if (hw->
phy.id == phy_id)
361 hw->
phy.ops.release(hw);
362 ret_val = e1000_set_mdio_slow_mode_hv(hw);
365 hw->
phy.ops.acquire(hw);
377 static s32 e1000_init_phy_workarounds_pchlan(
struct e1000_hw *
hw)
383 ret_val = hw->
phy.ops.acquire(hw);
385 e_dbg(
"Failed to initialize PHY flow\n");
394 switch (hw->
mac.type) {
396 if (e1000_phy_is_accessible_pchlan(hw))
403 mac_reg =
er32(CTRL_EXT);
405 ew32(CTRL_EXT, mac_reg);
415 e1000_gate_hw_phy_config_ich8lan(hw,
true);
417 if (e1000_phy_is_accessible_pchlan(hw)) {
425 mac_reg =
er32(CTRL_EXT);
427 ew32(CTRL_EXT, mac_reg);
435 (fwsm & E1000_ICH_FWSM_FW_VALID))
438 if (hw->
phy.ops.check_reset_block(hw)) {
439 e_dbg(
"Required LANPHYPC toggle blocked by ME\n");
443 e_dbg(
"Toggling LANPHYPC\n");
446 mac_reg =
er32(FEXTNVM3);
449 ew32(FEXTNVM3, mac_reg);
467 }
while (!(
er32(CTRL_EXT) &
475 hw->
phy.ops.release(hw);
487 !(fwsm & E1000_ICH_FWSM_FW_VALID)) {
489 e1000_gate_hw_phy_config_ich8lan(hw,
false);
501 static s32 e1000_init_phy_params_pchlan(
struct e1000_hw *hw)
513 phy->
ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan;
514 phy->
ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan;
519 phy->
ops.power_down = e1000_power_down_phy_copper_ich8lan;
524 ret_val = e1000_init_phy_workarounds_pchlan(hw);
529 switch (hw->
mac.type) {
543 ret_val = e1000_set_mdio_slow_mode_hv(hw);
558 phy->
ops.force_speed_duplex =
584 static s32 e1000_init_phy_params_ich8lan(
struct e1000_hw *hw)
594 phy->
ops.power_down = e1000_power_down_phy_copper_ich8lan;
606 e_dbg(
"Cannot determine PHY addr. Erroring out\n");
665 static s32 e1000_init_nvm_params_ich8lan(
struct e1000_hw *hw)
669 u32 gfpreg, sector_base_addr, sector_end_addr;
674 e_dbg(
"ERROR: Flash registers not mapped\n");
688 sector_end_addr = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK) + 1;
698 << FLASH_SECTOR_ADDR_SHIFT;
721 static s32 e1000_init_mac_params_ich8lan(
struct e1000_hw *hw)
747 mac->
ops.check_mng_mode = e1000_check_mng_mode_ich8lan;
755 mac->
ops.cleanup_led = e1000_cleanup_led_ich8lan;
757 mac->
ops.led_on = e1000_led_on_ich8lan;
758 mac->
ops.led_off = e1000_led_off_ich8lan;
762 mac->
ops.rar_set = e1000_rar_set_pch2lan;
767 mac->
ops.check_mng_mode = e1000_check_mng_mode_pchlan;
769 mac->
ops.id_led_init = e1000_id_led_init_pchlan;
771 mac->
ops.setup_led = e1000_setup_led_pchlan;
773 mac->
ops.cleanup_led = e1000_cleanup_led_pchlan;
775 mac->
ops.led_on = e1000_led_on_pchlan;
776 mac->
ops.led_off = e1000_led_off_pchlan;
784 mac->
ops.rar_set = e1000_rar_set_pch_lpt;
796 (
er32(FWSM) & E1000_ICH_FWSM_FW_VALID))
797 e1000_gate_hw_phy_config_ich8lan(hw,
true);
809 static s32 e1000_set_eee_pchlan(
struct e1000_hw *hw)
834 ret_val = hw->
phy.ops.acquire(hw);
851 hw->
phy.ops.release(hw);
865 static s32 e1000_check_for_copper_link_ich8lan(
struct e1000_hw *hw)
891 ret_val = e1000_k1_gig_workaround_hv(hw, link);
904 switch (hw->
mac.type) {
906 ret_val = e1000_k1_workaround_lv(hw);
942 ret_val = e1000_set_eee_pchlan(hw);
958 mac->
ops.config_collision_dist(hw);
968 e_dbg(
"Error configuring flow control\n");
978 rc = e1000_init_mac_params_ich8lan(hw);
982 rc = e1000_init_nvm_params_ich8lan(hw);
986 switch (hw->
mac.type) {
990 rc = e1000_init_phy_params_ich8lan(hw);
995 rc = e1000_init_phy_params_pchlan(hw);
1022 (
er32(FWSM) & E1000_ICH_FWSM_FW_VALID))
1027 adapter->
hw.dev_spec.ich8lan.eee_disable =
true;
1040 static s32 e1000_acquire_nvm_ich8lan(
struct e1000_hw *hw)
1053 static void e1000_release_nvm_ich8lan(
struct e1000_hw *hw)
1065 static s32 e1000_acquire_swflag_ich8lan(
struct e1000_hw *hw)
1072 e_dbg(
"contention for Phy access\n");
1077 extcnf_ctrl =
er32(EXTCNF_CTRL);
1086 e_dbg(
"SW has already locked the resource.\n");
1094 ew32(EXTCNF_CTRL, extcnf_ctrl);
1097 extcnf_ctrl =
er32(EXTCNF_CTRL);
1106 e_dbg(
"Failed to acquire the semaphore, FW or HW has it: FWSM=0x%8.8x EXTCNF_CTRL=0x%8.8x)\n",
1107 er32(FWSM), extcnf_ctrl);
1109 ew32(EXTCNF_CTRL, extcnf_ctrl);
1128 static void e1000_release_swflag_ich8lan(
struct e1000_hw *hw)
1132 extcnf_ctrl =
er32(EXTCNF_CTRL);
1135 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
1136 ew32(EXTCNF_CTRL, extcnf_ctrl);
1138 e_dbg(
"Semaphore unexpectedly released by sw/fw/hw\n");
1152 static bool e1000_check_mng_mode_ich8lan(
struct e1000_hw *hw)
1157 return (fwsm & E1000_ICH_FWSM_FW_VALID) &&
1170 static bool e1000_check_mng_mode_pchlan(
struct e1000_hw *hw)
1175 return (fwsm & E1000_ICH_FWSM_FW_VALID) &&
1192 u32 rar_low, rar_high;
1198 rar_low = ((
u32)addr[0] |
1199 ((
u32)addr[1] << 8) |
1200 ((
u32)addr[2] << 16) | ((
u32)addr[3] << 24));
1202 rar_high = ((
u32)addr[4] | ((
u32)addr[5] << 8));
1205 if (rar_low || rar_high)
1211 ew32(RAH(index), rar_high);
1219 ret_val = e1000_acquire_swflag_ich8lan(hw);
1223 ew32(SHRAL(index - 1), rar_low);
1225 ew32(SHRAH(index - 1), rar_high);
1228 e1000_release_swflag_ich8lan(hw);
1231 if ((
er32(SHRAL(index - 1)) == rar_low) &&
1232 (
er32(SHRAH(index - 1)) == rar_high))
1235 e_dbg(
"SHRA[%d] might be locked by ME - FWSM=0x%8.8x\n",
1236 (index - 1),
er32(FWSM));
1240 e_dbg(
"Failed to write receive address at index %d\n", index);
1254 static void e1000_rar_set_pch_lpt(
struct e1000_hw *hw,
u8 *addr,
u32 index)
1256 u32 rar_low, rar_high;
1263 rar_low = ((
u32)addr[0] | ((
u32)addr[1] << 8) |
1264 ((
u32)addr[2] << 16) | ((
u32)addr[3] << 24));
1266 rar_high = ((
u32)addr[4] | ((
u32)addr[5] << 8));
1269 if (rar_low || rar_high)
1275 ew32(RAH(index), rar_high);
1292 if ((wlock_mac == 0) || (index <= wlock_mac)) {
1295 ret_val = e1000_acquire_swflag_ich8lan(hw);
1300 ew32(SHRAL_PCH_LPT(index - 1), rar_low);
1302 ew32(SHRAH_PCH_LPT(index - 1), rar_high);
1305 e1000_release_swflag_ich8lan(hw);
1308 if ((
er32(SHRAL_PCH_LPT(index - 1)) == rar_low) &&
1309 (
er32(SHRAH_PCH_LPT(index - 1)) == rar_high))
1315 e_dbg(
"Failed to write receive address at index %d\n", index);
1326 static s32 e1000_check_reset_block_ich8lan(
struct e1000_hw *hw)
1342 static s32 e1000_write_smbus_addr(
struct e1000_hw *hw)
1364 phy_data |= (freq & (1 << 0)) <<
1366 phy_data |= (freq & (1 << 1)) <<
1369 e_dbg(
"Unsupported SMB frequency in PHY\n");
1383 static s32 e1000_sw_lcd_config_ich8lan(
struct e1000_hw *hw)
1386 u32 i,
data, cnf_size, cnf_base_addr, sw_cfg_mask;
1397 switch (hw->
mac.type) {
1417 ret_val = hw->
phy.ops.acquire(hw);
1421 data =
er32(FEXTNVM);
1422 if (!(data & sw_cfg_mask))
1429 data =
er32(EXTCNF_CTRL);
1434 cnf_size =
er32(EXTCNF_SIZE);
1452 ret_val = e1000_write_smbus_addr(hw);
1456 data =
er32(LEDCTL);
1466 word_addr = (
u16)(cnf_base_addr << 1);
1468 for (i = 0; i < cnf_size; i++) {
1469 ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1,
1474 ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1),
1486 reg_addr |= phy_page;
1488 ret_val = e1e_wphy_locked(hw, (
u32)reg_addr, reg_data);
1494 hw->
phy.ops.release(hw);
1508 static s32 e1000_k1_gig_workaround_hv(
struct e1000_hw *hw,
bool link)
1518 ret_val = hw->
phy.ops.acquire(hw);
1541 ret_val = e1e_rphy_locked(hw,
HV_M_STATUS, &status_reg);
1556 ret_val = e1e_wphy_locked(hw,
PHY_REG(770, 19), 0x0100);
1562 ret_val = e1e_wphy_locked(hw,
PHY_REG(770, 19), 0x4100);
1570 hw->
phy.ops.release(hw);
1609 ctrl_ext =
er32(CTRL_EXT);
1620 ew32(CTRL_EXT, ctrl_ext);
1636 static s32 e1000_oem_bits_config_ich8lan(
struct e1000_hw *hw,
bool d0_state)
1645 ret_val = hw->
phy.ops.acquire(hw);
1650 mac_reg =
er32(EXTCNF_CTRL);
1651 if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE)
1655 mac_reg =
er32(FEXTNVM);
1661 ret_val = e1e_rphy_locked(hw,
HV_OEM_BITS, &oem_reg);
1674 if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE |
1685 !hw->
phy.ops.check_reset_block(hw))
1688 ret_val = e1e_wphy_locked(hw,
HV_OEM_BITS, oem_reg);
1691 hw->
phy.ops.release(hw);
1701 static s32 e1000_set_mdio_slow_mode_hv(
struct e1000_hw *hw)
1721 static s32 e1000_hv_phy_workarounds_ich8lan(
struct e1000_hw *hw)
1731 ret_val = e1000_set_mdio_slow_mode_hv(hw);
1737 ((hw->
phy.revision == 1) || (hw->
phy.revision == 2))) ||
1740 ret_val = e1e_wphy(hw,
PHY_REG(769, 25), 0x4431);
1755 if (hw->
phy.revision < 2) {
1762 ret_val = hw->
phy.ops.acquire(hw);
1768 hw->
phy.ops.release(hw);
1776 ret_val = e1000_k1_gig_workaround_hv(hw,
true);
1781 ret_val = hw->
phy.ops.acquire(hw);
1789 hw->
phy.ops.release(hw);
1804 ret_val = hw->
phy.ops.acquire(hw);
1812 for (i = 0; i < (hw->
mac.rar_entry_count + 4); i++) {
1815 (
u16)(mac_reg & 0xFFFF));
1817 (
u16)((mac_reg >> 16) & 0xFFFF));
1819 mac_reg =
er32(RAH(i));
1821 (
u16)(mac_reg & 0xFFFF));
1830 hw->
phy.ops.release(hw);
1850 e1e_rphy(hw,
PHY_REG(769, 20), &phy_reg);
1851 ret_val = e1e_wphy(hw,
PHY_REG(769, 20), phy_reg | (1 << 14));
1860 for (i = 0; i < (hw->
mac.rar_entry_count + 4); i++) {
1864 addr_high =
er32(RAH(i));
1868 mac_addr[0] = (addr_low & 0xFF);
1869 mac_addr[1] = ((addr_low >> 8) & 0xFF);
1870 mac_addr[2] = ((addr_low >> 16) & 0xFF);
1871 mac_addr[3] = ((addr_low >> 24) & 0xFF);
1872 mac_addr[4] = (addr_high & 0xFF);
1873 mac_addr[5] = ((addr_high >> 8) & 0xFF);
1882 mac_reg =
er32(FFLT_DBG);
1883 mac_reg &= ~(1 << 14);
1884 mac_reg |= (7 << 15);
1885 ew32(FFLT_DBG, mac_reg);
1887 mac_reg =
er32(RCTL);
1889 ew32(RCTL, mac_reg);
1906 data &= ~(0xF << 8);
1915 e1e_rphy(hw,
PHY_REG(769, 23), &data);
1916 data &= ~(0x7F << 5);
1917 data |= (0x37 << 5);
1918 ret_val = e1e_wphy(hw,
PHY_REG(769, 23), data);
1921 e1e_rphy(hw,
PHY_REG(769, 16), &data);
1923 ret_val = e1e_wphy(hw,
PHY_REG(769, 16), data);
1926 e1e_rphy(hw,
PHY_REG(776, 20), &data);
1927 data &= ~(0x3FF << 2);
1928 data |= (0x1A << 2);
1929 ret_val = e1e_wphy(hw,
PHY_REG(776, 20), data);
1932 ret_val = e1e_wphy(hw,
PHY_REG(776, 23), 0xF100);
1936 ret_val = e1e_wphy(hw,
HV_PM_CTRL, data | (1 << 10));
1941 mac_reg =
er32(FFLT_DBG);
1942 mac_reg &= ~(0xF << 14);
1943 ew32(FFLT_DBG, mac_reg);
1945 mac_reg =
er32(RCTL);
1947 ew32(RCTL, mac_reg);
1964 data &= ~(0xF << 8);
1973 e1e_rphy(hw,
PHY_REG(769, 23), &data);
1974 data &= ~(0x7F << 5);
1975 ret_val = e1e_wphy(hw,
PHY_REG(769, 23), data);
1978 e1e_rphy(hw,
PHY_REG(769, 16), &data);
1980 ret_val = e1e_wphy(hw,
PHY_REG(769, 16), data);
1983 e1e_rphy(hw,
PHY_REG(776, 20), &data);
1984 data &= ~(0x3FF << 2);
1986 ret_val = e1e_wphy(hw,
PHY_REG(776, 20), data);
1989 ret_val = e1e_wphy(hw,
PHY_REG(776, 23), 0x7E00);
1993 ret_val = e1e_wphy(hw,
HV_PM_CTRL, data & ~(1 << 10));
1999 return e1e_wphy(hw,
PHY_REG(769, 20), phy_reg & ~(1 << 14));
2006 static s32 e1000_lv_phy_workarounds_ich8lan(
struct e1000_hw *hw)
2014 ret_val = e1000_set_mdio_slow_mode_hv(hw);
2016 ret_val = hw->
phy.ops.acquire(hw);
2032 hw->
phy.ops.release(hw);
2043 static s32 e1000_k1_workaround_lv(
struct e1000_hw *hw)
2060 mac_reg =
er32(FEXTNVM4);
2073 ret_val = e1e_rphy(hw,
HV_PM_CTRL, &pm_phy_reg);
2077 ret_val = e1e_wphy(hw,
HV_PM_CTRL, pm_phy_reg);
2084 ew32(FEXTNVM4, mac_reg);
2099 static void e1000_gate_hw_phy_config_ich8lan(
struct e1000_hw *hw,
bool gate)
2106 extcnf_ctrl =
er32(EXTCNF_CTRL);
2113 ew32(EXTCNF_CTRL, extcnf_ctrl);
2123 static void e1000_lan_init_done_ich8lan(
struct e1000_hw *hw)
2132 }
while ((!data) && --loop);
2140 e_dbg(
"LAN_INIT_DONE not set, increase timeout\n");
2152 static s32 e1000_post_phy_reset_ich8lan(
struct e1000_hw *hw)
2157 if (hw->
phy.ops.check_reset_block(hw))
2164 switch (hw->
mac.type) {
2166 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
2171 ret_val = e1000_lv_phy_workarounds_ich8lan(hw);
2187 ret_val = e1000_sw_lcd_config_ich8lan(hw);
2192 ret_val = e1000_oem_bits_config_ich8lan(hw,
true);
2196 if (!(
er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
2198 e1000_gate_hw_phy_config_ich8lan(hw,
false);
2202 ret_val = hw->
phy.ops.acquire(hw);
2209 hw->
phy.ops.release(hw);
2223 static s32 e1000_phy_hw_reset_ich8lan(
struct e1000_hw *hw)
2229 !(
er32(FWSM) & E1000_ICH_FWSM_FW_VALID))
2230 e1000_gate_hw_phy_config_ich8lan(hw,
true);
2236 return e1000_post_phy_reset_ich8lan(hw);
2264 if (!hw->
phy.ops.check_reset_block(hw))
2283 static s32 e1000_set_d0_lplu_state_ich8lan(
struct e1000_hw *hw,
bool active)
2369 static s32 e1000_set_d3_lplu_state_ich8lan(
struct e1000_hw *hw,
bool active)
2450 static s32 e1000_valid_nvm_bank_detect_ich8lan(
struct e1000_hw *hw,
u32 *bank)
2459 switch (hw->
mac.type) {
2464 E1000_EECD_SEC1VAL_VALID_MASK) {
2472 e_dbg(
"Unable to determine valid NVM bank via EEC - reading flash signature\n");
2479 ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset,
2490 ret_val = e1000_read_flash_byte_ich8lan(hw, act_offset +
2495 if ((sig_byte & E1000_ICH_NVM_VALID_SIG_MASK) ==
2501 e_dbg(
"ERROR: No valid NVM bank present\n");
2527 e_dbg(
"nvm parameter(s) out of bounds\n");
2532 nvm->
ops.acquire(hw);
2534 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
2536 e_dbg(
"Could not detect valid bank, assuming bank 0\n");
2541 act_offset += offset;
2544 for (i = 0; i < words; i++) {
2545 if (dev_spec->
shadow_ram[offset+i].modified) {
2548 ret_val = e1000_read_flash_word_ich8lan(hw,
2557 nvm->
ops.release(hw);
2561 e_dbg(
"NVM read error: %d\n", ret_val);
2573 static s32 e1000_flash_cycle_init_ich8lan(
struct e1000_hw *hw)
2581 if (!hsfsts.hsf_status.fldesvalid) {
2582 e_dbg(
"Flash descriptor invalid. SW Sequencing must be used.\n");
2587 hsfsts.hsf_status.flcerr = 1;
2588 hsfsts.hsf_status.dael = 1;
2601 if (!hsfsts.hsf_status.flcinprog) {
2607 hsfsts.hsf_status.flcdone = 1;
2619 if (!hsfsts.hsf_status.flcinprog) {
2630 hsfsts.hsf_status.flcdone = 1;
2633 e_dbg(
"Flash controller busy, cannot get access\n");
2647 static s32 e1000_flash_cycle_ich8lan(
struct e1000_hw *hw,
u32 timeout)
2655 hsflctl.hsf_ctrl.flcgo = 1;
2661 if (hsfsts.hsf_status.flcdone)
2664 }
while (i++ < timeout);
2666 if (hsfsts.hsf_status.flcdone && !hsfsts.hsf_status.flcerr)
2681 static s32 e1000_read_flash_word_ich8lan(
struct e1000_hw *hw,
u32 offset,
2687 return e1000_read_flash_data_ich8lan(hw, offset, 2, data);
2698 static s32 e1000_read_flash_byte_ich8lan(
struct e1000_hw *hw,
u32 offset,
2704 ret_val = e1000_read_flash_data_ich8lan(hw, offset, 1, &word);
2722 static s32 e1000_read_flash_data_ich8lan(
struct e1000_hw *hw,
u32 offset,
2727 u32 flash_linear_addr;
2736 hw->
nvm.flash_base_addr;
2741 ret_val = e1000_flash_cycle_init_ich8lan(hw);
2747 hsflctl.hsf_ctrl.fldbcount = size - 1;
2753 ret_val = e1000_flash_cycle_ich8lan(hw,
2754 ICH_FLASH_READ_COMMAND_TIMEOUT);
2765 *data = (
u8)(flash_data & 0x000000FF);
2767 *data = (
u16)(flash_data & 0x0000FFFF);
2777 if (hsfsts.hsf_status.flcerr) {
2780 }
else if (!hsfsts.hsf_status.flcdone) {
2781 e_dbg(
"Timeout error - flash cycle did not complete.\n");
2808 e_dbg(
"nvm parameter(s) out of bounds\n");
2812 nvm->
ops.acquire(hw);
2814 for (i = 0; i < words; i++) {
2819 nvm->
ops.release(hw);
2835 static s32 e1000_update_nvm_checksum_ich8lan(
struct e1000_hw *hw)
2839 u32 i, act_offset, new_bank_offset, old_bank_offset, bank;
2850 nvm->
ops.acquire(hw);
2857 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
2859 e_dbg(
"Could not detect valid bank, assuming bank 0\n");
2865 old_bank_offset = 0;
2866 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
2871 new_bank_offset = 0;
2872 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
2886 ret_val = e1000_read_flash_word_ich8lan(hw, i +
2905 act_offset = (i + new_bank_offset) << 1;
2909 ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2916 ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2929 e_dbg(
"Flash commit failed.\n");
2940 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
2945 ret_val = e1000_retry_write_flash_byte_ich8lan(hw,
2958 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
2969 nvm->
ops.release(hw);
2976 nvm->
ops.reload(hw);
2982 e_dbg(
"NVM update error: %d\n", ret_val);
2995 static s32 e1000_validate_nvm_checksum_ich8lan(
struct e1000_hw *hw)
3006 ret_val = e1000_read_nvm(hw, 0x19, 1, &data);
3010 if (!(data & 0x40)) {
3012 ret_val = e1000_write_nvm(hw, 0x19, 1, &data);
3015 ret_val = e1000e_update_nvm_checksum(hw);
3040 nvm->
ops.acquire(hw);
3047 pr0.
range.limit = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK);
3048 pr0.
range.wpe =
true;
3061 nvm->
ops.release(hw);
3073 static s32 e1000_write_flash_data_ich8lan(
struct e1000_hw *hw,
u32 offset,
3078 u32 flash_linear_addr;
3083 if (size < 1 || size > 2 || data > size * 0xff ||
3088 hw->
nvm.flash_base_addr;
3093 ret_val = e1000_flash_cycle_init_ich8lan(hw);
3099 hsflctl.hsf_ctrl.fldbcount = size -1;
3106 flash_data = (
u32)data & 0x00FF;
3108 flash_data = (
u32)data;
3116 ret_val = e1000_flash_cycle_ich8lan(hw,
3128 if (hsfsts.hsf_status.flcerr)
3131 if (!hsfsts.hsf_status.flcdone) {
3132 e_dbg(
"Timeout error - flash cycle did not complete.\n");
3148 static s32 e1000_write_flash_byte_ich8lan(
struct e1000_hw *hw,
u32 offset,
3153 return e1000_write_flash_data_ich8lan(hw, offset, 1, word);
3165 static s32 e1000_retry_write_flash_byte_ich8lan(
struct e1000_hw *hw,
3169 u16 program_retries;
3171 ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte);
3175 for (program_retries = 0; program_retries < 100; program_retries++) {
3176 e_dbg(
"Retrying Byte %2.2X at offset %u\n", byte, offset);
3178 ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte);
3182 if (program_retries == 100)
3196 static s32 e1000_erase_flash_bank_ich8lan(
struct e1000_hw *hw,
u32 bank)
3201 u32 flash_linear_addr;
3223 switch (hsfsts.hsf_status.berasesz) {
3246 flash_linear_addr = hw->
nvm.flash_base_addr;
3247 flash_linear_addr += (bank) ? flash_bank_size : 0;
3249 for (j = 0; j < iteration ; j++) {
3252 ret_val = e1000_flash_cycle_init_ich8lan(hw);
3272 ret_val = e1000_flash_cycle_ich8lan(hw,
3283 if (hsfsts.hsf_status.flcerr)
3286 else if (!hsfsts.hsf_status.flcdone)
3303 static s32 e1000_valid_led_default_ich8lan(
struct e1000_hw *hw,
u16 *data)
3309 e_dbg(
"NVM Read Error\n");
3333 static s32 e1000_id_led_init_pchlan(
struct e1000_hw *hw)
3342 ret_val = hw->
nvm.ops.valid_led_default(hw, &data);
3350 for (i = 0; i < 4; i++) {
3399 static s32 e1000_get_bus_info_ich8lan(
struct e1000_hw *hw)
3425 static s32 e1000_reset_hw_ich8lan(
struct e1000_hw *hw)
3438 e_dbg(
"PCI-E Master disable polling has failed.\n");
3440 e_dbg(
"Masking off all interrupts\n");
3476 if (!hw->
phy.ops.check_reset_block(hw)) {
3490 e1000_gate_hw_phy_config_ich8lan(hw,
true);
3492 ret_val = e1000_acquire_swflag_ich8lan(hw);
3493 e_dbg(
"Issuing a global reset to ich8lan\n");
3500 reg =
er32(FEXTNVM3);
3503 ew32(FEXTNVM3, reg);
3510 ret_val = hw->
phy.ops.get_cfg_done(hw);
3514 ret_val = e1000_post_phy_reset_ich8lan(hw);
3525 ew32(CRC_OFFSET, 0x65656565);
3530 reg =
er32(KABGTXD);
3549 static s32 e1000_init_hw_ich8lan(
struct e1000_hw *hw)
3556 e1000_initialize_hw_bits_ich8lan(hw);
3559 ret_val = mac->
ops.id_led_init(hw);
3561 e_dbg(
"Error initializing identification LED\n");
3568 e_dbg(
"Zeroing the MTA\n");
3581 ret_val = e1000_phy_hw_reset_ich8lan(hw);
3587 ret_val = mac->
ops.setup_link(hw);
3590 txdctl =
er32(TXDCTL(0));
3595 ew32(TXDCTL(0), txdctl);
3596 txdctl =
er32(TXDCTL(1));
3601 ew32(TXDCTL(1), txdctl);
3613 ctrl_ext =
er32(CTRL_EXT);
3615 ew32(CTRL_EXT, ctrl_ext);
3623 e1000_clear_hw_cntrs_ich8lan(hw);
3634 static void e1000_initialize_hw_bits_ich8lan(
struct e1000_hw *hw)
3639 reg =
er32(CTRL_EXT);
3644 ew32(CTRL_EXT, reg);
3647 reg =
er32(TXDCTL(0));
3649 ew32(TXDCTL(0), reg);
3652 reg =
er32(TXDCTL(1));
3654 ew32(TXDCTL(1), reg);
3657 reg =
er32(TARC(0));
3659 reg |= (1 << 28) | (1 << 29);
3660 reg |= (1 << 23) | (1 << 24) | (1 << 26) | (1 << 27);
3664 reg =
er32(TARC(1));
3669 reg |= (1 << 24) | (1 << 26) | (1 << 30);
3705 static s32 e1000_setup_link_ich8lan(
struct e1000_hw *hw)
3709 if (hw->
phy.ops.check_reset_block(hw))
3729 hw->
fc.current_mode = hw->
fc.requested_mode;
3731 e_dbg(
"After fix-ups FlowControl is now = %x\n",
3732 hw->
fc.current_mode);
3735 ret_val = hw->
mac.ops.setup_physical_interface(hw);
3739 ew32(FCTTV, hw->
fc.pause_time);
3744 ew32(FCRTV_PCH, hw->
fc.refresh_time);
3763 static s32 e1000_setup_copper_link_ich8lan(
struct e1000_hw *hw)
3792 switch (hw->
phy.type) {
3818 switch (hw->
phy.mdix) {
3851 static s32 e1000_get_link_up_info_ich8lan(
struct e1000_hw *hw,
u16 *speed,
3863 ret_val = e1000_kmrn_lock_loss_workaround_ich8lan(hw);
3884 static s32 e1000_kmrn_lock_loss_workaround_ich8lan(
struct e1000_hw *hw)
3904 for (i = 0; i < 10; i++) {
3924 phy_ctrl |= (E1000_PHY_CTRL_GBE_DISABLE |
3952 e_dbg(
"Workaround applies to ICH8 only.\n");
3982 reg |= (E1000_PHY_CTRL_GBE_DISABLE |
4006 ew32(
CTRL, reg | E1000_CTRL_PHY_RST);
4068 ret_val = hw->
phy.ops.acquire(hw);
4088 I217_EEE_100_SUPPORTED) &&
4102 if (!(
er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
4132 hw->
phy.ops.release(hw);
4141 e1000_oem_bits_config_ich8lan(hw,
false);
4147 ret_val = hw->
phy.ops.acquire(hw);
4150 e1000_write_smbus_addr(hw);
4151 hw->
phy.ops.release(hw);
4172 ret_val = e1000_init_phy_workarounds_pchlan(hw);
4174 e_dbg(
"Failed to init PHY flow ret_val=%d\n", ret_val);
4187 ret_val = hw->
phy.ops.acquire(hw);
4189 e_dbg(
"Failed to setup iRST\n");
4193 if (!(
er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
4198 ret_val = e1e_rphy_locked(hw,
I217_MEMPWR, &phy_reg);
4208 ret_val = e1e_rphy_locked(hw,
I217_CGFREG, &phy_reg);
4215 e_dbg(
"Error %d in resume workarounds\n", ret_val);
4216 hw->
phy.ops.release(hw);
4226 static s32 e1000_cleanup_led_ich8lan(
struct e1000_hw *hw)
4231 ew32(LEDCTL, hw->
mac.ledctl_default);
4241 static s32 e1000_led_on_ich8lan(
struct e1000_hw *hw)
4247 ew32(LEDCTL, hw->
mac.ledctl_mode2);
4257 static s32 e1000_led_off_ich8lan(
struct e1000_hw *hw)
4264 ew32(LEDCTL, hw->
mac.ledctl_mode1);
4274 static s32 e1000_setup_led_pchlan(
struct e1000_hw *hw)
4285 static s32 e1000_cleanup_led_pchlan(
struct e1000_hw *hw)
4296 static s32 e1000_led_on_pchlan(
struct e1000_hw *hw)
4306 for (i = 0; i < 3; i++) {
4312 data &= ~(E1000_PHY_LED0_IVRT << (i * 5));
4314 data |= (E1000_PHY_LED0_IVRT << (i * 5));
4327 static s32 e1000_led_off_pchlan(
struct e1000_hw *hw)
4337 for (i = 0; i < 3; i++) {
4343 data &= ~(E1000_PHY_LED0_IVRT << (i * 5));
4345 data |= (E1000_PHY_LED0_IVRT << (i * 5));
4364 static s32 e1000_get_cfg_done_ich8lan(
struct e1000_hw *hw)
4374 e1000_lan_init_done_ich8lan(hw);
4383 e_dbg(
"Auto Read Done did not complete\n");
4393 e_dbg(
"PHY Reset Asserted not set - needs delay\n");
4402 if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) {
4404 e_dbg(
"EEPROM not present\n");
4419 static void e1000_power_down_phy_copper_ich8lan(
struct e1000_hw *hw)
4422 if (!(hw->
mac.ops.check_mng_mode(hw) ||
4423 hw->
phy.ops.check_reset_block(hw)))
4434 static void e1000_clear_hw_cntrs_ich8lan(
struct e1000_hw *hw)
4460 ret_val = hw->
phy.ops.acquire(hw);
4463 ret_val = hw->
phy.ops.set_page(hw,
4482 hw->
phy.ops.release(hw);
4488 .check_for_link = e1000_check_for_copper_link_ich8lan,
4490 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
4491 .get_bus_info = e1000_get_bus_info_ich8lan,
4493 .get_link_up_info = e1000_get_link_up_info_ich8lan,
4497 .reset_hw = e1000_reset_hw_ich8lan,
4498 .init_hw = e1000_init_hw_ich8lan,
4499 .setup_link = e1000_setup_link_ich8lan,
4500 .setup_physical_interface= e1000_setup_copper_link_ich8lan,
4507 .acquire = e1000_acquire_swflag_ich8lan,
4508 .check_reset_block = e1000_check_reset_block_ich8lan,
4510 .get_cfg_done = e1000_get_cfg_done_ich8lan,
4513 .release = e1000_release_swflag_ich8lan,
4514 .reset = e1000_phy_hw_reset_ich8lan,
4515 .set_d0_lplu_state = e1000_set_d0_lplu_state_ich8lan,
4516 .set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan,
4521 .acquire = e1000_acquire_nvm_ich8lan,
4522 .read = e1000_read_nvm_ich8lan,
4523 .release = e1000_release_nvm_ich8lan,
4525 .update = e1000_update_nvm_checksum_ich8lan,
4526 .valid_led_default = e1000_valid_led_default_ich8lan,
4527 .validate = e1000_validate_nvm_checksum_ich8lan,
4528 .write = e1000_write_nvm_ich8lan,
4541 .get_variants = e1000_get_variants_ich8lan,
4542 .mac_ops = &ich8_mac_ops,
4543 .phy_ops = &ich8_phy_ops,
4544 .nvm_ops = &ich8_nvm_ops,
4558 .get_variants = e1000_get_variants_ich8lan,
4559 .mac_ops = &ich8_mac_ops,
4560 .phy_ops = &ich8_phy_ops,
4561 .nvm_ops = &ich8_nvm_ops,
4575 .get_variants = e1000_get_variants_ich8lan,
4576 .mac_ops = &ich8_mac_ops,
4577 .phy_ops = &ich8_phy_ops,
4578 .nvm_ops = &ich8_nvm_ops,
4593 .max_hw_frame_size = 4096,
4594 .get_variants = e1000_get_variants_ich8lan,
4595 .mac_ops = &ich8_mac_ops,
4596 .phy_ops = &ich8_phy_ops,
4597 .nvm_ops = &ich8_nvm_ops,
4613 .get_variants = e1000_get_variants_ich8lan,
4614 .mac_ops = &ich8_mac_ops,
4615 .phy_ops = &ich8_phy_ops,
4616 .nvm_ops = &ich8_nvm_ops,
4632 .get_variants = e1000_get_variants_ich8lan,
4633 .mac_ops = &ich8_mac_ops,
4634 .phy_ops = &ich8_phy_ops,
4635 .nvm_ops = &ich8_nvm_ops,