Lines Matching full:hw
127 static int e1000_setup_link(struct e1000_hw *hw);
128 static int e1000_setup_fiber_link(struct e1000_hw *hw);
129 static int e1000_setup_copper_link(struct e1000_hw *hw);
130 static int e1000_phy_setup_autoneg(struct e1000_hw *hw);
131 static void e1000_config_collision_dist(struct e1000_hw *hw);
132 static int e1000_config_mac_to_phy(struct e1000_hw *hw);
133 static int e1000_config_fc_after_link_up(struct e1000_hw *hw);
134 static int e1000_check_for_link(struct e1000_hw *hw);
135 static int e1000_wait_autoneg(struct e1000_hw *hw);
136 static int e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t * speed,
138 static int e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr,
140 static int e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr,
142 static int32_t e1000_phy_hw_reset(struct e1000_hw *hw);
143 static int e1000_phy_reset(struct e1000_hw *hw);
144 static int e1000_detect_gig_phy(struct e1000_hw *hw);
145 static void e1000_set_media_type(struct e1000_hw *hw);
147 static int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask);
148 static void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask);
149 static int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);
152 static void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw);
153 static int32_t e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw);
154 static int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset,
160 * hw - Struct containing variables accessed by shared code
163 void e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t * eecd) in e1000_raise_ee_clk() argument
169 E1000_WRITE_REG(hw, EECD, *eecd); in e1000_raise_ee_clk()
170 E1000_WRITE_FLUSH(hw); in e1000_raise_ee_clk()
177 * hw - Struct containing variables accessed by shared code
180 void e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t * eecd) in e1000_lower_ee_clk() argument
186 E1000_WRITE_REG(hw, EECD, *eecd); in e1000_lower_ee_clk()
187 E1000_WRITE_FLUSH(hw); in e1000_lower_ee_clk()
194 * hw - Struct containing variables accessed by shared code
199 e1000_shift_out_ee_bits(struct e1000_hw *hw, uint16_t data, uint16_t count) in e1000_shift_out_ee_bits() argument
209 eecd = E1000_READ_REG(hw, EECD); in e1000_shift_out_ee_bits()
222 E1000_WRITE_REG(hw, EECD, eecd); in e1000_shift_out_ee_bits()
223 E1000_WRITE_FLUSH(hw); in e1000_shift_out_ee_bits()
227 e1000_raise_ee_clk(hw, &eecd); in e1000_shift_out_ee_bits()
228 e1000_lower_ee_clk(hw, &eecd); in e1000_shift_out_ee_bits()
236 E1000_WRITE_REG(hw, EECD, eecd); in e1000_shift_out_ee_bits()
242 * hw - Struct containing variables accessed by shared code
245 e1000_shift_in_ee_bits(struct e1000_hw *hw, uint16_t count) in e1000_shift_in_ee_bits() argument
258 eecd = E1000_READ_REG(hw, EECD); in e1000_shift_in_ee_bits()
265 e1000_raise_ee_clk(hw, &eecd); in e1000_shift_in_ee_bits()
267 eecd = E1000_READ_REG(hw, EECD); in e1000_shift_in_ee_bits()
273 e1000_lower_ee_clk(hw, &eecd); in e1000_shift_in_ee_bits()
282 * hw - Struct containing variables accessed by shared code
284 void e1000_standby_eeprom(struct e1000_hw *hw) in e1000_standby_eeprom() argument
286 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_standby_eeprom()
289 eecd = E1000_READ_REG(hw, EECD); in e1000_standby_eeprom()
293 E1000_WRITE_REG(hw, EECD, eecd); in e1000_standby_eeprom()
294 E1000_WRITE_FLUSH(hw); in e1000_standby_eeprom()
299 E1000_WRITE_REG(hw, EECD, eecd); in e1000_standby_eeprom()
300 E1000_WRITE_FLUSH(hw); in e1000_standby_eeprom()
305 E1000_WRITE_REG(hw, EECD, eecd); in e1000_standby_eeprom()
306 E1000_WRITE_FLUSH(hw); in e1000_standby_eeprom()
311 E1000_WRITE_REG(hw, EECD, eecd); in e1000_standby_eeprom()
312 E1000_WRITE_FLUSH(hw); in e1000_standby_eeprom()
317 E1000_WRITE_REG(hw, EECD, eecd); in e1000_standby_eeprom()
318 E1000_WRITE_FLUSH(hw); in e1000_standby_eeprom()
321 E1000_WRITE_REG(hw, EECD, eecd); in e1000_standby_eeprom()
322 E1000_WRITE_FLUSH(hw); in e1000_standby_eeprom()
330 * hw - Struct containing variables accessed by shared code
332 static bool e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw) in e1000_is_onboard_nvm_eeprom() argument
338 if (hw->mac_type == e1000_ich8lan) in e1000_is_onboard_nvm_eeprom()
341 if (hw->mac_type == e1000_82573 || hw->mac_type == e1000_82574) { in e1000_is_onboard_nvm_eeprom()
342 eecd = E1000_READ_REG(hw, EECD); in e1000_is_onboard_nvm_eeprom()
357 * hw - Struct containing variables accessed by shared code
362 int32_t e1000_acquire_eeprom(struct e1000_hw *hw) in e1000_acquire_eeprom() argument
364 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_acquire_eeprom()
369 if (e1000_swfw_sync_acquire(hw, E1000_SWFW_EEP_SM)) in e1000_acquire_eeprom()
371 eecd = E1000_READ_REG(hw, EECD); in e1000_acquire_eeprom()
373 if (hw->mac_type != e1000_82573 && hw->mac_type != e1000_82574) { in e1000_acquire_eeprom()
375 if (hw->mac_type > e1000_82544) { in e1000_acquire_eeprom()
377 E1000_WRITE_REG(hw, EECD, eecd); in e1000_acquire_eeprom()
378 eecd = E1000_READ_REG(hw, EECD); in e1000_acquire_eeprom()
383 eecd = E1000_READ_REG(hw, EECD); in e1000_acquire_eeprom()
387 E1000_WRITE_REG(hw, EECD, eecd); in e1000_acquire_eeprom()
399 E1000_WRITE_REG(hw, EECD, eecd); in e1000_acquire_eeprom()
403 E1000_WRITE_REG(hw, EECD, eecd); in e1000_acquire_eeprom()
407 E1000_WRITE_REG(hw, EECD, eecd); in e1000_acquire_eeprom()
415 * Sets up eeprom variables in the hw struct. Must be called after mac_type
419 * hw - Struct containing variables accessed by shared code
421 static int32_t e1000_init_eeprom_params(struct e1000_hw *hw) in e1000_init_eeprom_params() argument
423 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_init_eeprom_params()
428 if (hw->mac_type == e1000_igb) in e1000_init_eeprom_params()
429 eecd = E1000_READ_REG(hw, I210_EECD); in e1000_init_eeprom_params()
431 eecd = E1000_READ_REG(hw, EECD); in e1000_init_eeprom_params()
435 switch (hw->mac_type) { in e1000_init_eeprom_params()
523 if (e1000_is_onboard_nvm_eeprom(hw) == false) { in e1000_init_eeprom_params()
533 E1000_WRITE_REG(hw, EECD, eecd); in e1000_init_eeprom_params()
570 if (hw->mac_type <= e1000_82547_rev_2) { in e1000_init_eeprom_params()
573 ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, in e1000_init_eeprom_params()
599 * hw - Struct containing variables accessed by shared code
602 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd) in e1000_poll_eerd_eewr_done() argument
610 if (hw->mac_type == e1000_igb) in e1000_poll_eerd_eewr_done()
611 reg = E1000_READ_REG(hw, I210_EERD); in e1000_poll_eerd_eewr_done()
613 reg = E1000_READ_REG(hw, EERD); in e1000_poll_eerd_eewr_done()
615 if (hw->mac_type == e1000_igb) in e1000_poll_eerd_eewr_done()
616 reg = E1000_READ_REG(hw, I210_EEWR); in e1000_poll_eerd_eewr_done()
618 reg = E1000_READ_REG(hw, EEWR); in e1000_poll_eerd_eewr_done()
634 * hw - Struct containing variables accessed by shared code
640 e1000_read_eeprom_eerd(struct e1000_hw *hw, in e1000_read_eeprom_eerd() argument
652 if (hw->mac_type == e1000_igb) in e1000_read_eeprom_eerd()
653 E1000_WRITE_REG(hw, I210_EERD, eerd); in e1000_read_eeprom_eerd()
655 E1000_WRITE_REG(hw, EERD, eerd); in e1000_read_eeprom_eerd()
657 error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_READ); in e1000_read_eeprom_eerd()
662 if (hw->mac_type == e1000_igb) { in e1000_read_eeprom_eerd()
663 data[i] = (E1000_READ_REG(hw, I210_EERD) >> in e1000_read_eeprom_eerd()
666 data[i] = (E1000_READ_REG(hw, EERD) >> in e1000_read_eeprom_eerd()
675 void e1000_release_eeprom(struct e1000_hw *hw) in e1000_release_eeprom() argument
681 eecd = E1000_READ_REG(hw, EECD); in e1000_release_eeprom()
683 if (hw->eeprom.type == e1000_eeprom_spi) { in e1000_release_eeprom()
687 E1000_WRITE_REG(hw, EECD, eecd); in e1000_release_eeprom()
689 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
690 } else if (hw->eeprom.type == e1000_eeprom_microwire) { in e1000_release_eeprom()
696 E1000_WRITE_REG(hw, EECD, eecd); in e1000_release_eeprom()
700 E1000_WRITE_REG(hw, EECD, eecd); in e1000_release_eeprom()
701 E1000_WRITE_FLUSH(hw); in e1000_release_eeprom()
702 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
706 E1000_WRITE_REG(hw, EECD, eecd); in e1000_release_eeprom()
707 E1000_WRITE_FLUSH(hw); in e1000_release_eeprom()
708 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
712 if (hw->mac_type > e1000_82544) { in e1000_release_eeprom()
714 E1000_WRITE_REG(hw, EECD, eecd); in e1000_release_eeprom()
717 e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM); in e1000_release_eeprom()
723 * hw - Struct containing variables accessed by shared code
726 e1000_spi_eeprom_ready(struct e1000_hw *hw) in e1000_spi_eeprom_ready() argument
740 e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, in e1000_spi_eeprom_ready()
741 hw->eeprom.opcode_bits); in e1000_spi_eeprom_ready()
742 spi_stat_reg = (uint8_t)e1000_shift_in_ee_bits(hw, 8); in e1000_spi_eeprom_ready()
749 e1000_standby_eeprom(hw); in e1000_spi_eeprom_ready()
766 * hw - Struct containing variables accessed by shared code
771 e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset, in e1000_read_eeprom() argument
774 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_read_eeprom()
781 e1000_init_eeprom_params(hw); in e1000_read_eeprom()
798 if (e1000_is_onboard_nvm_eeprom(hw) == true && in e1000_read_eeprom()
799 hw->eeprom.use_eerd == false) { in e1000_read_eeprom()
802 if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) in e1000_read_eeprom()
808 return e1000_read_eeprom_eerd(hw, offset, words, data); in e1000_read_eeprom()
816 if (e1000_spi_eeprom_ready(hw)) { in e1000_read_eeprom()
817 e1000_release_eeprom(hw); in e1000_read_eeprom()
821 e1000_standby_eeprom(hw); in e1000_read_eeprom()
829 e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); in e1000_read_eeprom()
830 e1000_shift_out_ee_bits(hw, (uint16_t)(offset*2), in e1000_read_eeprom()
840 word_in = e1000_shift_in_ee_bits(hw, 16); in e1000_read_eeprom()
846 e1000_shift_out_ee_bits(hw, in e1000_read_eeprom()
849 e1000_shift_out_ee_bits(hw, (uint16_t)(offset + i), in e1000_read_eeprom()
854 data[i] = e1000_shift_in_ee_bits(hw, 16); in e1000_read_eeprom()
855 e1000_standby_eeprom(hw); in e1000_read_eeprom()
860 e1000_release_eeprom(hw); in e1000_read_eeprom()
868 * @hw: pointer to the HW structure
878 static int32_t e1000_write_eeprom_srwr(struct e1000_hw *hw, uint16_t offset, in e1000_write_eeprom_srwr() argument
881 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_write_eeprom_srwr()
901 E1000_WRITE_REG(hw, I210_EEWR, eewr); in e1000_write_eeprom_srwr()
905 E1000_READ_REG(hw, I210_EEWR)) { in e1000_write_eeprom_srwr()
924 * @hw: pointer to the HW structure
927 static int32_t e1000_pool_flash_update_done_i210(struct e1000_hw *hw) in e1000_pool_flash_update_done_i210() argument
933 reg = E1000_READ_REG(hw, EECD); in e1000_pool_flash_update_done_i210()
946 * @hw: pointer to the HW structure
949 static int32_t e1000_update_flash_i210(struct e1000_hw *hw) in e1000_update_flash_i210() argument
954 ret_val = e1000_pool_flash_update_done_i210(hw); in e1000_update_flash_i210()
960 flup = E1000_READ_REG(hw, EECD) | E1000_EECD_FLUPD_I210; in e1000_update_flash_i210()
961 E1000_WRITE_REG(hw, EECD, flup); in e1000_update_flash_i210()
963 ret_val = e1000_pool_flash_update_done_i210(hw); in e1000_update_flash_i210()
975 * @hw: pointer to the HW structure
981 static int32_t e1000_update_eeprom_checksum_i210(struct e1000_hw *hw) in e1000_update_eeprom_checksum_i210() argument
991 ret_val = e1000_read_eeprom_eerd(hw, 0, 1, &nvm_data); in e1000_update_eeprom_checksum_i210()
997 if (!(e1000_get_hw_eeprom_semaphore(hw))) { in e1000_update_eeprom_checksum_i210()
998 /* Do not use hw->nvm.ops.write, hw->nvm.ops.read in e1000_update_eeprom_checksum_i210()
1004 ret_val = e1000_read_eeprom_eerd(hw, i, 1, &nvm_data); in e1000_update_eeprom_checksum_i210()
1006 e1000_put_hw_eeprom_semaphore(hw); in e1000_update_eeprom_checksum_i210()
1013 ret_val = e1000_write_eeprom_srwr(hw, EEPROM_CHECKSUM_REG, 1, in e1000_update_eeprom_checksum_i210()
1016 e1000_put_hw_eeprom_semaphore(hw); in e1000_update_eeprom_checksum_i210()
1021 e1000_put_hw_eeprom_semaphore(hw); in e1000_update_eeprom_checksum_i210()
1023 ret_val = e1000_update_flash_i210(hw); in e1000_update_eeprom_checksum_i210()
1036 * hw - Struct containing variables accessed by shared code
1042 static int e1000_validate_eeprom_checksum(struct e1000_hw *hw) in e1000_validate_eeprom_checksum() argument
1051 E1000_ERR(hw, "Unable to allocate EEPROM buffer!\n"); in e1000_validate_eeprom_checksum()
1056 if (e1000_read_eeprom(hw, 0, EEPROM_CHECKSUM_REG + 1, buf) < 0) { in e1000_validate_eeprom_checksum()
1057 E1000_ERR(hw, "Unable to read EEPROM!\n"); in e1000_validate_eeprom_checksum()
1073 E1000_ERR(hw, "EEPROM checksum is incorrect!\n"); in e1000_validate_eeprom_checksum()
1074 E1000_ERR(hw, " ...register was 0x%04hx, calculated 0x%04hx\n", in e1000_validate_eeprom_checksum()
1087 * hw - Struct containing variables accessed by shared code
1090 e1000_set_phy_mode(struct e1000_hw *hw) in e1000_set_phy_mode() argument
1098 if ((hw->mac_type == e1000_82545_rev_3) && in e1000_set_phy_mode()
1099 (hw->media_type == e1000_media_type_copper)) { in e1000_set_phy_mode()
1100 ret_val = e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, in e1000_set_phy_mode()
1107 ret_val = e1000_write_phy_reg(hw, in e1000_set_phy_mode()
1111 ret_val = e1000_write_phy_reg(hw, in e1000_set_phy_mode()
1116 hw->phy_reset_disable = false; in e1000_set_phy_mode()
1128 * hw: Struct containing variables accessed by shared code
1135 e1000_get_software_semaphore(struct e1000_hw *hw) in e1000_get_software_semaphore() argument
1137 int32_t timeout = hw->eeprom.word_size + 1; in e1000_get_software_semaphore()
1142 if (hw->mac_type != e1000_80003es2lan && hw->mac_type != e1000_igb) in e1000_get_software_semaphore()
1146 swsm = E1000_READ_REG(hw, SWSM); in e1000_get_software_semaphore()
1165 * This function clears HW semaphore bits.
1167 * hw: Struct containing variables accessed by shared code
1173 e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) in e1000_put_hw_eeprom_semaphore() argument
1180 if (!hw->eeprom_semaphore_present) in e1000_put_hw_eeprom_semaphore()
1183 swsm = E1000_READ_REG(hw, SWSM); in e1000_put_hw_eeprom_semaphore()
1184 if (hw->mac_type == e1000_80003es2lan || hw->mac_type == e1000_igb) { in e1000_put_hw_eeprom_semaphore()
1189 E1000_WRITE_REG(hw, SWSM, swsm); in e1000_put_hw_eeprom_semaphore()
1198 * hw: Struct containing variables accessed by shared code
1205 e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw) in e1000_get_hw_eeprom_semaphore() argument
1213 if (!hw->eeprom_semaphore_present) in e1000_get_hw_eeprom_semaphore()
1216 if (hw->mac_type == e1000_80003es2lan || hw->mac_type == e1000_igb) { in e1000_get_hw_eeprom_semaphore()
1218 if (e1000_get_software_semaphore(hw) != E1000_SUCCESS) in e1000_get_hw_eeprom_semaphore()
1223 timeout = hw->eeprom.word_size + 1; in e1000_get_hw_eeprom_semaphore()
1225 swsm = E1000_READ_REG(hw, SWSM); in e1000_get_hw_eeprom_semaphore()
1227 E1000_WRITE_REG(hw, SWSM, swsm); in e1000_get_hw_eeprom_semaphore()
1229 swsm = E1000_READ_REG(hw, SWSM); in e1000_get_hw_eeprom_semaphore()
1239 e1000_put_hw_eeprom_semaphore(hw); in e1000_get_hw_eeprom_semaphore()
1250 e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask) in e1000_swfw_sync_acquire() argument
1259 if (e1000_get_hw_eeprom_semaphore(hw)) in e1000_swfw_sync_acquire()
1262 swfw_sync = E1000_READ_REG(hw, SW_FW_SYNC); in e1000_swfw_sync_acquire()
1268 e1000_put_hw_eeprom_semaphore(hw); in e1000_swfw_sync_acquire()
1279 E1000_WRITE_REG(hw, SW_FW_SYNC, swfw_sync); in e1000_swfw_sync_acquire()
1281 e1000_put_hw_eeprom_semaphore(hw); in e1000_swfw_sync_acquire()
1285 static void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask) in e1000_swfw_sync_release() argument
1290 while (e1000_get_hw_eeprom_semaphore(hw)) in e1000_swfw_sync_release()
1293 swfw_sync = E1000_READ_REG(hw, SW_FW_SYNC); in e1000_swfw_sync_release()
1295 E1000_WRITE_REG(hw, SW_FW_SYNC, swfw_sync); in e1000_swfw_sync_release()
1297 e1000_put_hw_eeprom_semaphore(hw); in e1000_swfw_sync_release()
1300 static bool e1000_is_second_port(struct e1000_hw *hw) in e1000_is_second_port() argument
1302 switch (hw->mac_type) { in e1000_is_second_port()
1306 if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) in e1000_is_second_port()
1318 * hw - Struct containing variables accessed by shared code
1321 static int e1000_read_mac_addr_from_eeprom(struct e1000_hw *hw, in e1000_read_mac_addr_from_eeprom() argument
1330 if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { in e1000_read_mac_addr_from_eeprom()
1344 * hw - Struct containing variables accessed by shared code
1347 static int e1000_read_mac_addr_from_regs(struct e1000_hw *hw, in e1000_read_mac_addr_from_regs() argument
1354 if (hw->mac_type != e1000_igb) in e1000_read_mac_addr_from_regs()
1361 reg_data = E1000_READ_REG_ARRAY(hw, RA, 0); in e1000_read_mac_addr_from_regs()
1365 reg_data = E1000_READ_REG_ARRAY(hw, RA, 1); in e1000_read_mac_addr_from_regs()
1379 * hw - Struct containing variables accessed by shared code
1382 static int e1000_read_mac_addr(struct e1000_hw *hw, unsigned char enetaddr[6]) in e1000_read_mac_addr() argument
1386 if (hw->mac_type == e1000_igb) { in e1000_read_mac_addr()
1388 ret_val = e1000_read_mac_addr_from_regs(hw, enetaddr); in e1000_read_mac_addr()
1390 ret_val = e1000_read_mac_addr_from_eeprom(hw, enetaddr); in e1000_read_mac_addr()
1396 if (e1000_is_second_port(hw)) in e1000_read_mac_addr()
1406 * hw - Struct containing variables accessed by shared code
1413 e1000_init_rx_addrs(struct e1000_hw *hw, unsigned char enetaddr[6]) in e1000_init_rx_addrs() argument
1429 E1000_WRITE_REG_ARRAY(hw, RA, 0, addr_low); in e1000_init_rx_addrs()
1430 E1000_WRITE_REG_ARRAY(hw, RA, 1, addr_high); in e1000_init_rx_addrs()
1435 E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); in e1000_init_rx_addrs()
1436 E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); in e1000_init_rx_addrs()
1443 * hw - Struct containing variables accessed by shared code
1446 e1000_clear_vfta(struct e1000_hw *hw) in e1000_clear_vfta() argument
1451 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0); in e1000_clear_vfta()
1455 * Set the mac type member in the hw struct.
1457 * hw - Struct containing variables accessed by shared code
1460 e1000_set_mac_type(struct e1000_hw *hw) in e1000_set_mac_type() argument
1464 switch (hw->device_id) { in e1000_set_mac_type()
1466 switch (hw->revision_id) { in e1000_set_mac_type()
1468 hw->mac_type = e1000_82542_rev2_0; in e1000_set_mac_type()
1471 hw->mac_type = e1000_82542_rev2_1; in e1000_set_mac_type()
1480 hw->mac_type = e1000_82543; in e1000_set_mac_type()
1486 hw->mac_type = e1000_82544; in e1000_set_mac_type()
1493 hw->mac_type = e1000_82540; in e1000_set_mac_type()
1497 hw->mac_type = e1000_82545; in e1000_set_mac_type()
1502 hw->mac_type = e1000_82545_rev_3; in e1000_set_mac_type()
1507 hw->mac_type = e1000_82546; in e1000_set_mac_type()
1515 hw->mac_type = e1000_82546_rev_3; in e1000_set_mac_type()
1520 hw->mac_type = e1000_82541; in e1000_set_mac_type()
1526 hw->mac_type = e1000_82541_rev_2; in e1000_set_mac_type()
1530 hw->mac_type = e1000_82547; in e1000_set_mac_type()
1533 hw->mac_type = e1000_82547_rev_2; in e1000_set_mac_type()
1544 hw->mac_type = e1000_82571; in e1000_set_mac_type()
1550 hw->mac_type = e1000_82572; in e1000_set_mac_type()
1555 hw->mac_type = e1000_82573; in e1000_set_mac_type()
1558 hw->mac_type = e1000_82574; in e1000_set_mac_type()
1564 hw->mac_type = e1000_80003es2lan; in e1000_set_mac_type()
1573 hw->mac_type = e1000_ich8lan; in e1000_set_mac_type()
1583 hw->mac_type = e1000_igb; in e1000_set_mac_type()
1595 * hw - Struct containing variables accessed by shared code
1598 e1000_reset_hw(struct e1000_hw *hw) in e1000_reset_hw() argument
1609 if (hw->mac_type < e1000_82571) in e1000_reset_hw()
1615 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_reset_hw()
1618 dm_pci_write_config16(hw->pdev, PCI_COMMAND, in e1000_reset_hw()
1619 hw->pci_cmd_word & ~PCI_COMMAND_INVALIDATE); in e1000_reset_hw()
1621 pci_write_config_word(hw->pdev, PCI_COMMAND, in e1000_reset_hw()
1622 hw->pci_cmd_word & ~PCI_COMMAND_INVALIDATE); in e1000_reset_hw()
1628 if (hw->mac_type == e1000_igb) in e1000_reset_hw()
1629 E1000_WRITE_REG(hw, I210_IAM, 0); in e1000_reset_hw()
1630 E1000_WRITE_REG(hw, IMC, 0xffffffff); in e1000_reset_hw()
1636 E1000_WRITE_REG(hw, RCTL, 0); in e1000_reset_hw()
1637 E1000_WRITE_REG(hw, TCTL, E1000_TCTL_PSP); in e1000_reset_hw()
1638 E1000_WRITE_FLUSH(hw); in e1000_reset_hw()
1641 hw->tbi_compatibility_on = false; in e1000_reset_hw()
1654 ctrl = E1000_READ_REG(hw, CTRL); in e1000_reset_hw()
1656 E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); in e1000_reset_hw()
1659 if (hw->mac_type == e1000_igb) { in e1000_reset_hw()
1661 reg = E1000_READ_REG(hw, STATUS); in e1000_reset_hw()
1664 reg = E1000_READ_REG(hw, I210_EECD); in e1000_reset_hw()
1667 } else if (hw->mac_type < e1000_82540) { in e1000_reset_hw()
1670 ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); in e1000_reset_hw()
1672 E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); in e1000_reset_hw()
1673 E1000_WRITE_FLUSH(hw); in e1000_reset_hw()
1679 /* Dissable HW ARPs on ASF enabled adapters */ in e1000_reset_hw()
1680 manc = E1000_READ_REG(hw, MANC); in e1000_reset_hw()
1682 E1000_WRITE_REG(hw, MANC, manc); in e1000_reset_hw()
1687 if (hw->mac_type == e1000_igb) in e1000_reset_hw()
1688 E1000_WRITE_REG(hw, I210_IAM, 0); in e1000_reset_hw()
1689 E1000_WRITE_REG(hw, IMC, 0xffffffff); in e1000_reset_hw()
1692 E1000_READ_REG(hw, ICR); in e1000_reset_hw()
1695 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_reset_hw()
1697 dm_pci_write_config16(hw->pdev, PCI_COMMAND, hw->pci_cmd_word); in e1000_reset_hw()
1699 pci_write_config_word(hw->pdev, PCI_COMMAND, hw->pci_cmd_word); in e1000_reset_hw()
1702 if (hw->mac_type != e1000_igb) in e1000_reset_hw()
1703 E1000_WRITE_REG(hw, PBA, pba); in e1000_reset_hw()
1710 * hw: Struct containing variables accessed by shared code
1716 e1000_initialize_hardware_bits(struct e1000_hw *hw) in e1000_initialize_hardware_bits() argument
1718 if ((hw->mac_type >= e1000_82571) && in e1000_initialize_hardware_bits()
1719 (!hw->initialize_hw_bits_disable)) { in e1000_initialize_hardware_bits()
1727 reg_tarc0 = E1000_READ_REG(hw, TARC0); in e1000_initialize_hardware_bits()
1731 reg_txdctl = E1000_READ_REG(hw, TXDCTL); in e1000_initialize_hardware_bits()
1733 E1000_WRITE_REG(hw, TXDCTL, reg_txdctl); in e1000_initialize_hardware_bits()
1735 reg_txdctl1 = E1000_READ_REG(hw, TXDCTL1); in e1000_initialize_hardware_bits()
1737 E1000_WRITE_REG(hw, TXDCTL1, reg_txdctl1); in e1000_initialize_hardware_bits()
1740 switch (hw->mac_type) { in e1000_initialize_hardware_bits()
1746 reg_tarc1 = E1000_READ_REG(hw, TARC1); in e1000_initialize_hardware_bits()
1756 reg_tctl = E1000_READ_REG(hw, TCTL); in e1000_initialize_hardware_bits()
1762 E1000_WRITE_REG(hw, TARC1, reg_tarc1); in e1000_initialize_hardware_bits()
1766 reg_ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); in e1000_initialize_hardware_bits()
1771 reg_ctrl = E1000_READ_REG(hw, CTRL); in e1000_initialize_hardware_bits()
1774 E1000_WRITE_REG(hw, CTRL_EXT, reg_ctrl_ext); in e1000_initialize_hardware_bits()
1775 E1000_WRITE_REG(hw, CTRL, reg_ctrl); in e1000_initialize_hardware_bits()
1779 if ((hw->media_type == e1000_media_type_fiber) in e1000_initialize_hardware_bits()
1780 || (hw->media_type == in e1000_initialize_hardware_bits()
1786 reg_tctl = E1000_READ_REG(hw, TCTL); in e1000_initialize_hardware_bits()
1787 reg_tarc1 = E1000_READ_REG(hw, TARC1); in e1000_initialize_hardware_bits()
1793 E1000_WRITE_REG(hw, TARC1, reg_tarc1); in e1000_initialize_hardware_bits()
1797 if ((hw->revision_id < 3) || in e1000_initialize_hardware_bits()
1798 ((hw->device_id != E1000_DEV_ID_ICH8_IGP_M_AMT) && in e1000_initialize_hardware_bits()
1799 (hw->device_id != E1000_DEV_ID_ICH8_IGP_M))) in e1000_initialize_hardware_bits()
1802 reg_ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); in e1000_initialize_hardware_bits()
1804 E1000_WRITE_REG(hw, CTRL_EXT, reg_ctrl_ext); in e1000_initialize_hardware_bits()
1810 reg_tctl = E1000_READ_REG(hw, TCTL); in e1000_initialize_hardware_bits()
1811 reg_tarc1 = E1000_READ_REG(hw, TARC1); in e1000_initialize_hardware_bits()
1820 E1000_WRITE_REG(hw, TARC1, reg_tarc1); in e1000_initialize_hardware_bits()
1826 E1000_WRITE_REG(hw, TARC0, reg_tarc0); in e1000_initialize_hardware_bits()
1833 * hw - Struct containing variables accessed by shared code
1842 e1000_init_hw(struct e1000_hw *hw, unsigned char enetaddr[6]) in e1000_init_hw() argument
1856 if ((hw->mac_type == e1000_ich8lan) && in e1000_init_hw()
1857 ((hw->revision_id < 3) || in e1000_init_hw()
1858 ((hw->device_id != E1000_DEV_ID_ICH8_IGP_M_AMT) && in e1000_init_hw()
1859 (hw->device_id != E1000_DEV_ID_ICH8_IGP_M)))) { in e1000_init_hw()
1860 reg_data = E1000_READ_REG(hw, STATUS); in e1000_init_hw()
1862 E1000_WRITE_REG(hw, STATUS, reg_data); in e1000_init_hw()
1867 e1000_set_media_type(hw); in e1000_init_hw()
1871 e1000_initialize_hardware_bits(hw); in e1000_init_hw()
1876 if (hw->mac_type != e1000_ich8lan) { in e1000_init_hw()
1877 if (hw->mac_type < e1000_82545_rev_3) in e1000_init_hw()
1878 E1000_WRITE_REG(hw, VET, 0); in e1000_init_hw()
1879 e1000_clear_vfta(hw); in e1000_init_hw()
1883 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_init_hw()
1886 dm_pci_write_config16(hw->pdev, PCI_COMMAND, in e1000_init_hw()
1887 hw-> in e1000_init_hw()
1890 pci_write_config_word(hw->pdev, PCI_COMMAND, in e1000_init_hw()
1891 hw-> in e1000_init_hw()
1894 E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST); in e1000_init_hw()
1895 E1000_WRITE_FLUSH(hw); in e1000_init_hw()
1902 e1000_init_rx_addrs(hw, enetaddr); in e1000_init_hw()
1905 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_init_hw()
1906 E1000_WRITE_REG(hw, RCTL, 0); in e1000_init_hw()
1907 E1000_WRITE_FLUSH(hw); in e1000_init_hw()
1910 dm_pci_write_config16(hw->pdev, PCI_COMMAND, hw->pci_cmd_word); in e1000_init_hw()
1912 pci_write_config_word(hw->pdev, PCI_COMMAND, hw->pci_cmd_word); in e1000_init_hw()
1919 if (hw->mac_type == e1000_ich8lan) in e1000_init_hw()
1922 E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); in e1000_init_hw()
1925 E1000_WRITE_FLUSH(hw); in e1000_init_hw()
1928 switch (hw->mac_type) { in e1000_init_hw()
1935 if (hw->bus_type == e1000_bus_type_pcix) { in e1000_init_hw()
1937 dm_pci_read_config16(hw->pdev, PCIX_COMMAND_REGISTER, in e1000_init_hw()
1939 dm_pci_read_config16(hw->pdev, PCIX_STATUS_REGISTER_HI, in e1000_init_hw()
1942 pci_read_config_word(hw->pdev, PCIX_COMMAND_REGISTER, in e1000_init_hw()
1944 pci_read_config_word(hw->pdev, PCIX_STATUS_REGISTER_HI, in e1000_init_hw()
1959 dm_pci_write_config16(hw->pdev, PCIX_COMMAND_REGISTER, in e1000_init_hw()
1962 pci_write_config_word(hw->pdev, PCIX_COMMAND_REGISTER, in e1000_init_hw()
1971 if (hw->mac_type == e1000_ich8lan) in e1000_init_hw()
1973 if (hw->mac_type == e1000_igb) in e1000_init_hw()
1977 ret_val = e1000_setup_link(hw); in e1000_init_hw()
1980 if (hw->mac_type > e1000_82544) { in e1000_init_hw()
1981 ctrl = E1000_READ_REG(hw, TXDCTL); in e1000_init_hw()
1985 E1000_WRITE_REG(hw, TXDCTL, ctrl); in e1000_init_hw()
1989 if (hw->mac_type >= e1000_82571) { in e1000_init_hw()
1990 ctrl = E1000_READ_REG(hw, RXDCTL); in e1000_init_hw()
1994 E1000_WRITE_REG(hw, RXDCTL, ctrl); in e1000_init_hw()
1997 switch (hw->mac_type) { in e1000_init_hw()
2002 reg_data = E1000_READ_REG(hw, TCTL); in e1000_init_hw()
2004 E1000_WRITE_REG(hw, TCTL, reg_data); in e1000_init_hw()
2007 reg_data = E1000_READ_REG(hw, TCTL_EXT); in e1000_init_hw()
2010 E1000_WRITE_REG(hw, TCTL_EXT, reg_data); in e1000_init_hw()
2013 reg_data = E1000_READ_REG(hw, TIPG); in e1000_init_hw()
2016 E1000_WRITE_REG(hw, TIPG, reg_data); in e1000_init_hw()
2018 reg_data = E1000_READ_REG_ARRAY(hw, FFLT, 0x0001); in e1000_init_hw()
2020 E1000_WRITE_REG_ARRAY(hw, FFLT, 0x0001, reg_data); in e1000_init_hw()
2025 ctrl = E1000_READ_REG(hw, TXDCTL1); in e1000_init_hw()
2028 E1000_WRITE_REG(hw, TXDCTL1, ctrl); in e1000_init_hw()
2032 reg_data = E1000_READ_REG(hw, GCR); in e1000_init_hw()
2034 E1000_WRITE_REG(hw, GCR, reg_data); in e1000_init_hw()
2039 if (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER || in e1000_init_hw()
2040 hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3) { in e1000_init_hw()
2041 ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); in e1000_init_hw()
2045 E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); in e1000_init_hw()
2054 * hw - Struct containing variables accessed by shared code
2063 e1000_setup_link(struct e1000_hw *hw) in e1000_setup_link() argument
2075 if (e1000_check_phy_reset_block(hw)) in e1000_setup_link()
2081 * a bit that determines whether the HW defaults to enabling or in e1000_setup_link()
2084 * control setting, then the variable hw->fc will in e1000_setup_link()
2087 if (e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, in e1000_setup_link()
2093 if (hw->fc == e1000_fc_default) { in e1000_setup_link()
2094 switch (hw->mac_type) { in e1000_setup_link()
2099 hw->fc = e1000_fc_full; in e1000_setup_link()
2103 ret_val = e1000_read_eeprom(hw, in e1000_setup_link()
2110 hw->fc = e1000_fc_none; in e1000_setup_link()
2113 hw->fc = e1000_fc_tx_pause; in e1000_setup_link()
2116 hw->fc = e1000_fc_full; in e1000_setup_link()
2125 if (hw->mac_type == e1000_82542_rev2_0) in e1000_setup_link()
2126 hw->fc &= (~e1000_fc_tx_pause); in e1000_setup_link()
2128 if ((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) in e1000_setup_link()
2129 hw->fc &= (~e1000_fc_rx_pause); in e1000_setup_link()
2131 hw->original_fc = hw->fc; in e1000_setup_link()
2133 DEBUGOUT("After fix-ups FlowControl is now = %x\n", hw->fc); in e1000_setup_link()
2143 if (hw->mac_type == e1000_82543) { in e1000_setup_link()
2146 E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); in e1000_setup_link()
2151 ret_val = (hw->media_type == e1000_media_type_fiber) ? in e1000_setup_link()
2152 e1000_setup_fiber_link(hw) : e1000_setup_copper_link(hw); in e1000_setup_link()
2166 if (hw->mac_type != e1000_ich8lan) { in e1000_setup_link()
2167 E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE); in e1000_setup_link()
2168 E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); in e1000_setup_link()
2169 E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); in e1000_setup_link()
2172 E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time); in e1000_setup_link()
2180 if (!(hw->fc & e1000_fc_tx_pause)) { in e1000_setup_link()
2181 E1000_WRITE_REG(hw, FCRTL, 0); in e1000_setup_link()
2182 E1000_WRITE_REG(hw, FCRTH, 0); in e1000_setup_link()
2187 if (hw->fc_send_xon) { in e1000_setup_link()
2188 E1000_WRITE_REG(hw, FCRTL, in e1000_setup_link()
2189 (hw->fc_low_water | E1000_FCRTL_XONE)); in e1000_setup_link()
2190 E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); in e1000_setup_link()
2192 E1000_WRITE_REG(hw, FCRTL, hw->fc_low_water); in e1000_setup_link()
2193 E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); in e1000_setup_link()
2202 * hw - Struct containing variables accessed by shared code
2209 e1000_setup_fiber_link(struct e1000_hw *hw) in e1000_setup_fiber_link() argument
2223 ctrl = E1000_READ_REG(hw, CTRL); in e1000_setup_fiber_link()
2224 if ((hw->mac_type > e1000_82544) && !(ctrl & E1000_CTRL_ILOS)) in e1000_setup_fiber_link()
2229 printf("signal for %s is %x (ctrl %08x)!!!!\n", hw->name, signal, in e1000_setup_fiber_link()
2234 e1000_config_collision_dist(hw); in e1000_setup_fiber_link()
2251 switch (hw->fc) { in e1000_setup_fiber_link()
2289 E1000_WRITE_REG(hw, TXCW, txcw); in e1000_setup_fiber_link()
2290 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_setup_fiber_link()
2291 E1000_WRITE_FLUSH(hw); in e1000_setup_fiber_link()
2293 hw->txcw = txcw; in e1000_setup_fiber_link()
2301 if ((E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { in e1000_setup_fiber_link()
2305 status = E1000_READ_REG(hw, STATUS); in e1000_setup_fiber_link()
2316 hw->autoneg_failed = 1; in e1000_setup_fiber_link()
2317 ret_val = e1000_check_for_link(hw); in e1000_setup_fiber_link()
2322 hw->autoneg_failed = 0; in e1000_setup_fiber_link()
2324 hw->autoneg_failed = 0; in e1000_setup_fiber_link()
2337 * hw - Struct containing variables accessed by shared code
2340 e1000_copper_link_preconfig(struct e1000_hw *hw) in e1000_copper_link_preconfig() argument
2348 ctrl = E1000_READ_REG(hw, CTRL); in e1000_copper_link_preconfig()
2353 if (hw->mac_type > e1000_82543) { in e1000_copper_link_preconfig()
2356 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_copper_link_preconfig()
2360 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_copper_link_preconfig()
2361 ret_val = e1000_phy_hw_reset(hw); in e1000_copper_link_preconfig()
2367 ret_val = e1000_detect_gig_phy(hw); in e1000_copper_link_preconfig()
2372 DEBUGOUT("Phy ID = %x\n", hw->phy_id); in e1000_copper_link_preconfig()
2375 ret_val = e1000_set_phy_mode(hw); in e1000_copper_link_preconfig()
2378 if ((hw->mac_type == e1000_82545_rev_3) || in e1000_copper_link_preconfig()
2379 (hw->mac_type == e1000_82546_rev_3)) { in e1000_copper_link_preconfig()
2380 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, in e1000_copper_link_preconfig()
2383 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, in e1000_copper_link_preconfig()
2387 if (hw->mac_type <= e1000_82543 || in e1000_copper_link_preconfig()
2388 hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || in e1000_copper_link_preconfig()
2389 hw->mac_type == e1000_82541_rev_2 in e1000_copper_link_preconfig()
2390 || hw->mac_type == e1000_82547_rev_2) in e1000_copper_link_preconfig()
2391 hw->phy_reset_disable = false; in e1000_copper_link_preconfig()
2402 * hw: Struct containing variables accessed by shared code
2411 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active) in e1000_set_d3_lplu_state() argument
2418 if (hw->phy_type != e1000_phy_igp && hw->phy_type != e1000_phy_igp_2 in e1000_set_d3_lplu_state()
2419 && hw->phy_type != e1000_phy_igp_3) in e1000_set_d3_lplu_state()
2425 if (hw->mac_type == e1000_82541_rev_2 in e1000_set_d3_lplu_state()
2426 || hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
2427 ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_set_d3_lplu_state()
2431 } else if (hw->mac_type == e1000_ich8lan) { in e1000_set_d3_lplu_state()
2435 phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); in e1000_set_d3_lplu_state()
2437 ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, in e1000_set_d3_lplu_state()
2444 if (hw->mac_type == e1000_82541_rev_2 || in e1000_set_d3_lplu_state()
2445 hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
2447 ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_set_d3_lplu_state()
2452 if (hw->mac_type == e1000_ich8lan) { in e1000_set_d3_lplu_state()
2454 E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); in e1000_set_d3_lplu_state()
2457 ret_val = e1000_write_phy_reg(hw, in e1000_set_d3_lplu_state()
2468 if (hw->smart_speed == e1000_smart_speed_on) { in e1000_set_d3_lplu_state()
2469 ret_val = e1000_read_phy_reg(hw, in e1000_set_d3_lplu_state()
2475 ret_val = e1000_write_phy_reg(hw, in e1000_set_d3_lplu_state()
2479 } else if (hw->smart_speed == e1000_smart_speed_off) { in e1000_set_d3_lplu_state()
2480 ret_val = e1000_read_phy_reg(hw, in e1000_set_d3_lplu_state()
2486 ret_val = e1000_write_phy_reg(hw, in e1000_set_d3_lplu_state()
2492 } else if ((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) in e1000_set_d3_lplu_state()
2493 || (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL) || in e1000_set_d3_lplu_state()
2494 (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { in e1000_set_d3_lplu_state()
2496 if (hw->mac_type == e1000_82541_rev_2 || in e1000_set_d3_lplu_state()
2497 hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
2499 ret_val = e1000_write_phy_reg(hw, in e1000_set_d3_lplu_state()
2504 if (hw->mac_type == e1000_ich8lan) { in e1000_set_d3_lplu_state()
2506 E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); in e1000_set_d3_lplu_state()
2509 ret_val = e1000_write_phy_reg(hw, in e1000_set_d3_lplu_state()
2517 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
2523 ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
2537 * hw: Struct containing variables accessed by shared code
2546 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) in e1000_set_d0_lplu_state() argument
2553 if (hw->mac_type <= e1000_82547_rev_2) in e1000_set_d0_lplu_state()
2556 if (hw->mac_type == e1000_ich8lan) { in e1000_set_d0_lplu_state()
2557 phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); in e1000_set_d0_lplu_state()
2558 } else if (hw->mac_type == e1000_igb) { in e1000_set_d0_lplu_state()
2559 phy_ctrl = E1000_READ_REG(hw, I210_PHY_CTRL); in e1000_set_d0_lplu_state()
2561 ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, in e1000_set_d0_lplu_state()
2568 if (hw->mac_type == e1000_ich8lan) { in e1000_set_d0_lplu_state()
2570 E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); in e1000_set_d0_lplu_state()
2571 } else if (hw->mac_type == e1000_igb) { in e1000_set_d0_lplu_state()
2573 E1000_WRITE_REG(hw, I210_PHY_CTRL, phy_ctrl); in e1000_set_d0_lplu_state()
2576 ret_val = e1000_write_phy_reg(hw, in e1000_set_d0_lplu_state()
2582 if (hw->mac_type == e1000_igb) in e1000_set_d0_lplu_state()
2589 if (hw->smart_speed == e1000_smart_speed_on) { in e1000_set_d0_lplu_state()
2590 ret_val = e1000_read_phy_reg(hw, in e1000_set_d0_lplu_state()
2596 ret_val = e1000_write_phy_reg(hw, in e1000_set_d0_lplu_state()
2600 } else if (hw->smart_speed == e1000_smart_speed_off) { in e1000_set_d0_lplu_state()
2601 ret_val = e1000_read_phy_reg(hw, in e1000_set_d0_lplu_state()
2607 ret_val = e1000_write_phy_reg(hw, in e1000_set_d0_lplu_state()
2616 if (hw->mac_type == e1000_ich8lan) { in e1000_set_d0_lplu_state()
2618 E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); in e1000_set_d0_lplu_state()
2619 } else if (hw->mac_type == e1000_igb) { in e1000_set_d0_lplu_state()
2621 E1000_WRITE_REG(hw, I210_PHY_CTRL, phy_ctrl); in e1000_set_d0_lplu_state()
2624 ret_val = e1000_write_phy_reg(hw, in e1000_set_d0_lplu_state()
2630 if (hw->mac_type == e1000_igb) in e1000_set_d0_lplu_state()
2634 ret_val = e1000_read_phy_reg(hw, in e1000_set_d0_lplu_state()
2640 ret_val = e1000_write_phy_reg(hw, in e1000_set_d0_lplu_state()
2652 * hw - Struct containing variables accessed by shared code
2655 e1000_copper_link_igp_setup(struct e1000_hw *hw) in e1000_copper_link_igp_setup() argument
2663 if (hw->phy_reset_disable) in e1000_copper_link_igp_setup()
2666 ret_val = e1000_phy_reset(hw); in e1000_copper_link_igp_setup()
2674 if (hw->mac_type != e1000_ich8lan) { in e1000_copper_link_igp_setup()
2676 led_ctrl = E1000_READ_REG(hw, LEDCTL); in e1000_copper_link_igp_setup()
2679 E1000_WRITE_REG(hw, LEDCTL, led_ctrl); in e1000_copper_link_igp_setup()
2683 if (hw->phy_type == e1000_phy_igp) { in e1000_copper_link_igp_setup()
2685 ret_val = e1000_set_d3_lplu_state(hw, false); in e1000_copper_link_igp_setup()
2693 ret_val = e1000_set_d0_lplu_state(hw, false); in e1000_copper_link_igp_setup()
2699 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000_copper_link_igp_setup()
2703 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_copper_link_igp_setup()
2704 hw->dsp_config_state = e1000_dsp_config_disabled; in e1000_copper_link_igp_setup()
2708 hw->mdix = 1; in e1000_copper_link_igp_setup()
2711 hw->dsp_config_state = e1000_dsp_config_enabled; in e1000_copper_link_igp_setup()
2714 switch (hw->mdix) { in e1000_copper_link_igp_setup()
2727 ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000_copper_link_igp_setup()
2732 if (hw->autoneg) { in e1000_copper_link_igp_setup()
2733 e1000_ms_type phy_ms_setting = hw->master_slave; in e1000_copper_link_igp_setup()
2735 if (hw->ffe_config_state == e1000_ffe_config_active) in e1000_copper_link_igp_setup()
2736 hw->ffe_config_state = e1000_ffe_config_enabled; in e1000_copper_link_igp_setup()
2738 if (hw->dsp_config_state == e1000_dsp_config_activated) in e1000_copper_link_igp_setup()
2739 hw->dsp_config_state = e1000_dsp_config_enabled; in e1000_copper_link_igp_setup()
2744 if (hw->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000_copper_link_igp_setup()
2746 ret_val = e1000_read_phy_reg(hw, in e1000_copper_link_igp_setup()
2751 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_igp_setup()
2756 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, in e1000_copper_link_igp_setup()
2761 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, in e1000_copper_link_igp_setup()
2767 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); in e1000_copper_link_igp_setup()
2772 hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? in e1000_copper_link_igp_setup()
2791 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); in e1000_copper_link_igp_setup()
2805 e1000_check_mng_mode(struct e1000_hw *hw) in e1000_check_mng_mode() argument
2810 fwsm = E1000_READ_REG(hw, FWSM); in e1000_check_mng_mode()
2812 if (hw->mac_type == e1000_ich8lan) { in e1000_check_mng_mode()
2824 e1000_write_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data) in e1000_write_kmrn_reg() argument
2830 if (e1000_is_second_port(hw)) in e1000_write_kmrn_reg()
2833 if (e1000_swfw_sync_acquire(hw, swfw)) in e1000_write_kmrn_reg()
2838 E1000_WRITE_REG(hw, KUMCTRLSTA, reg_val); in e1000_write_kmrn_reg()
2845 e1000_read_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *data) in e1000_read_kmrn_reg() argument
2851 if (e1000_is_second_port(hw)) in e1000_read_kmrn_reg()
2854 if (e1000_swfw_sync_acquire(hw, swfw)) { in e1000_read_kmrn_reg()
2862 E1000_WRITE_REG(hw, KUMCTRLSTA, reg_val); in e1000_read_kmrn_reg()
2866 reg_val = E1000_READ_REG(hw, KUMCTRLSTA); in e1000_read_kmrn_reg()
2875 * hw - Struct containing variables accessed by shared code
2878 e1000_copper_link_ggp_setup(struct e1000_hw *hw) in e1000_copper_link_ggp_setup() argument
2886 if (!hw->phy_reset_disable) { in e1000_copper_link_ggp_setup()
2888 ret_val = e1000_read_phy_reg(hw, in e1000_copper_link_ggp_setup()
2897 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_ggp_setup()
2909 ret_val = e1000_read_phy_reg(hw, in e1000_copper_link_ggp_setup()
2916 switch (hw->mdix) { in e1000_copper_link_ggp_setup()
2936 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_ggp_setup()
2943 ret_val = e1000_phy_reset(hw); in e1000_copper_link_ggp_setup()
2950 if (hw->mac_type == e1000_80003es2lan) { in e1000_copper_link_ggp_setup()
2952 ret_val = e1000_write_kmrn_reg(hw, in e1000_copper_link_ggp_setup()
2959 ret_val = e1000_read_phy_reg(hw, in e1000_copper_link_ggp_setup()
2965 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_ggp_setup()
2971 reg_data = E1000_READ_REG(hw, CTRL_EXT); in e1000_copper_link_ggp_setup()
2973 E1000_WRITE_REG(hw, CTRL_EXT, reg_data); in e1000_copper_link_ggp_setup()
2975 ret_val = e1000_read_phy_reg(hw, in e1000_copper_link_ggp_setup()
2980 /* Do not init these registers when the HW is in IAMT mode, since the in e1000_copper_link_ggp_setup()
2982 * them if the HW is not in IAMT mode. in e1000_copper_link_ggp_setup()
2984 if (e1000_check_mng_mode(hw) == false) { in e1000_copper_link_ggp_setup()
2987 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_ggp_setup()
2992 ret_val = e1000_read_phy_reg(hw, in e1000_copper_link_ggp_setup()
2998 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_ggp_setup()
3008 ret_val = e1000_read_phy_reg(hw, in e1000_copper_link_ggp_setup()
3013 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_ggp_setup()
3024 * hw - Struct containing variables accessed by shared code
3027 e1000_copper_link_mgp_setup(struct e1000_hw *hw) in e1000_copper_link_mgp_setup() argument
3034 if (hw->phy_reset_disable) in e1000_copper_link_mgp_setup()
3038 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_copper_link_mgp_setup()
3053 switch (hw->mdix) { in e1000_copper_link_mgp_setup()
3076 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_copper_link_mgp_setup()
3080 if (hw->phy_revision < M88E1011_I_REV_4) { in e1000_copper_link_mgp_setup()
3084 ret_val = e1000_read_phy_reg(hw, in e1000_copper_link_mgp_setup()
3091 if ((hw->phy_revision == E1000_REVISION_2) && in e1000_copper_link_mgp_setup()
3092 (hw->phy_id == M88E1111_I_PHY_ID)) { in e1000_copper_link_mgp_setup()
3096 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_mgp_setup()
3106 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_mgp_setup()
3114 ret_val = e1000_phy_reset(hw); in e1000_copper_link_mgp_setup()
3127 * hw - Struct containing variables accessed by shared code
3130 e1000_copper_link_autoneg(struct e1000_hw *hw) in e1000_copper_link_autoneg() argument
3137 /* Perform some bounds checking on the hw->autoneg_advertised in e1000_copper_link_autoneg()
3140 hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; in e1000_copper_link_autoneg()
3145 if (hw->autoneg_advertised == 0) in e1000_copper_link_autoneg()
3146 hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; in e1000_copper_link_autoneg()
3149 if (hw->phy_type == e1000_phy_ife) in e1000_copper_link_autoneg()
3150 hw->autoneg_advertised &= AUTONEG_ADVERTISE_10_100_ALL; in e1000_copper_link_autoneg()
3153 ret_val = e1000_phy_setup_autoneg(hw); in e1000_copper_link_autoneg()
3163 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); in e1000_copper_link_autoneg()
3168 ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); in e1000_copper_link_autoneg()
3179 if (hw->wait_autoneg_complete) { in e1000_copper_link_autoneg()
3180 ret_val = e1000_wait_autoneg(hw); in e1000_copper_link_autoneg()
3188 hw->get_link_status = true; in e1000_copper_link_autoneg()
3203 * hw - Struct containing variables accessed by shared code
3206 e1000_copper_link_postconfig(struct e1000_hw *hw) in e1000_copper_link_postconfig() argument
3211 if (hw->mac_type >= e1000_82544) { in e1000_copper_link_postconfig()
3212 e1000_config_collision_dist(hw); in e1000_copper_link_postconfig()
3214 ret_val = e1000_config_mac_to_phy(hw); in e1000_copper_link_postconfig()
3220 ret_val = e1000_config_fc_after_link_up(hw); in e1000_copper_link_postconfig()
3231 * hw - Struct containing variables accessed by shared code
3234 e1000_setup_copper_link(struct e1000_hw *hw) in e1000_setup_copper_link() argument
3243 switch (hw->mac_type) { in e1000_setup_copper_link()
3249 ret_val = e1000_write_kmrn_reg(hw, in e1000_setup_copper_link()
3253 ret_val = e1000_read_kmrn_reg(hw, in e1000_setup_copper_link()
3258 ret_val = e1000_write_kmrn_reg(hw, in e1000_setup_copper_link()
3267 ret_val = e1000_copper_link_preconfig(hw); in e1000_setup_copper_link()
3270 switch (hw->mac_type) { in e1000_setup_copper_link()
3276 ret_val = e1000_write_kmrn_reg(hw, in e1000_setup_copper_link()
3285 if (hw->phy_type == e1000_phy_igp || in e1000_setup_copper_link()
3286 hw->phy_type == e1000_phy_igp_3 || in e1000_setup_copper_link()
3287 hw->phy_type == e1000_phy_igp_2) { in e1000_setup_copper_link()
3288 ret_val = e1000_copper_link_igp_setup(hw); in e1000_setup_copper_link()
3291 } else if (hw->phy_type == e1000_phy_m88 || in e1000_setup_copper_link()
3292 hw->phy_type == e1000_phy_igb) { in e1000_setup_copper_link()
3293 ret_val = e1000_copper_link_mgp_setup(hw); in e1000_setup_copper_link()
3296 } else if (hw->phy_type == e1000_phy_gg82563) { in e1000_setup_copper_link()
3297 ret_val = e1000_copper_link_ggp_setup(hw); in e1000_setup_copper_link()
3305 ret_val = e1000_copper_link_autoneg(hw); in e1000_setup_copper_link()
3313 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_setup_copper_link()
3316 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_setup_copper_link()
3322 ret_val = e1000_copper_link_postconfig(hw); in e1000_setup_copper_link()
3339 * hw - Struct containing variables accessed by shared code
3342 e1000_phy_setup_autoneg(struct e1000_hw *hw) in e1000_phy_setup_autoneg() argument
3351 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
3355 if (hw->phy_type != e1000_phy_ife) { in e1000_phy_setup_autoneg()
3357 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, in e1000_phy_setup_autoneg()
3378 DEBUGOUT("autoneg_advertised %x\n", hw->autoneg_advertised); in e1000_phy_setup_autoneg()
3381 if (hw->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
3387 if (hw->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
3393 if (hw->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
3399 if (hw->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
3405 if (hw->autoneg_advertised & ADVERTISE_1000_HALF) { in e1000_phy_setup_autoneg()
3411 if (hw->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
3432 switch (hw->fc) { in e1000_phy_setup_autoneg()
3447 *hw's ability to send PAUSE frames. in e1000_phy_setup_autoneg()
3469 ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
3475 if (hw->phy_type != e1000_phy_ife) { in e1000_phy_setup_autoneg()
3476 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, in e1000_phy_setup_autoneg()
3488 * hw - Struct containing variables accessed by shared code
3494 e1000_config_collision_dist(struct e1000_hw *hw) in e1000_config_collision_dist() argument
3500 if (hw->mac_type < e1000_82543) in e1000_config_collision_dist()
3505 tctl = E1000_READ_REG(hw, TCTL); in e1000_config_collision_dist()
3510 E1000_WRITE_REG(hw, TCTL, tctl); in e1000_config_collision_dist()
3511 E1000_WRITE_FLUSH(hw); in e1000_config_collision_dist()
3517 * hw - Struct containing variables accessed by shared code
3524 e1000_config_mac_to_phy(struct e1000_hw *hw) in e1000_config_mac_to_phy() argument
3534 ctrl = E1000_READ_REG(hw, CTRL); in e1000_config_mac_to_phy()
3542 if (e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data) < 0) { in e1000_config_mac_to_phy()
3551 e1000_config_collision_dist(hw); in e1000_config_mac_to_phy()
3561 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_config_mac_to_phy()
3568 * hw - Struct containing variables accessed by shared code
3577 e1000_force_mac_fc(struct e1000_hw *hw) in e1000_force_mac_fc() argument
3584 ctrl = E1000_READ_REG(hw, CTRL); in e1000_force_mac_fc()
3592 * according to the "hw->fc" parameter. in e1000_force_mac_fc()
3604 switch (hw->fc) { in e1000_force_mac_fc()
3625 if (hw->mac_type == e1000_82542_rev2_0) in e1000_force_mac_fc()
3628 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_force_mac_fc()
3635 * hw - Struct containing variables accessed by shared code
3644 e1000_config_fc_after_link_up(struct e1000_hw *hw) in e1000_config_fc_after_link_up() argument
3659 if (((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) in e1000_config_fc_after_link_up()
3660 || ((hw->media_type == e1000_media_type_internal_serdes) in e1000_config_fc_after_link_up()
3661 && (hw->autoneg_failed)) in e1000_config_fc_after_link_up()
3662 || ((hw->media_type == e1000_media_type_copper) in e1000_config_fc_after_link_up()
3663 && (!hw->autoneg))) { in e1000_config_fc_after_link_up()
3664 ret_val = e1000_force_mac_fc(hw); in e1000_config_fc_after_link_up()
3676 if (hw->media_type == e1000_media_type_copper) { in e1000_config_fc_after_link_up()
3681 if (e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg) < 0) { in e1000_config_fc_after_link_up()
3685 if (e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg) < 0) { in e1000_config_fc_after_link_up()
3698 (hw, PHY_AUTONEG_ADV, &mii_nway_adv_reg) < 0) { in e1000_config_fc_after_link_up()
3703 (hw, PHY_LP_ABILITY, in e1000_config_fc_after_link_up()
3751 if (hw->original_fc == e1000_fc_full) { in e1000_config_fc_after_link_up()
3752 hw->fc = e1000_fc_full; in e1000_config_fc_after_link_up()
3755 hw->fc = e1000_fc_rx_pause; in e1000_config_fc_after_link_up()
3773 hw->fc = e1000_fc_tx_pause; in e1000_config_fc_after_link_up()
3790 hw->fc = e1000_fc_rx_pause; in e1000_config_fc_after_link_up()
3814 else if (hw->original_fc == e1000_fc_none || in e1000_config_fc_after_link_up()
3815 hw->original_fc == e1000_fc_tx_pause) { in e1000_config_fc_after_link_up()
3816 hw->fc = e1000_fc_none; in e1000_config_fc_after_link_up()
3819 hw->fc = e1000_fc_rx_pause; in e1000_config_fc_after_link_up()
3828 e1000_get_speed_and_duplex(hw, &speed, &duplex); in e1000_config_fc_after_link_up()
3831 hw->fc = e1000_fc_none; in e1000_config_fc_after_link_up()
3836 ret_val = e1000_force_mac_fc(hw); in e1000_config_fc_after_link_up()
3853 * hw - Struct containing variables accessed by shared code
3858 e1000_check_for_link(struct e1000_hw *hw) in e1000_check_for_link() argument
3875 ctrl = E1000_READ_REG(hw, CTRL); in e1000_check_for_link()
3876 if ((hw->mac_type > e1000_82544) && !(ctrl & E1000_CTRL_ILOS)) in e1000_check_for_link()
3881 status = E1000_READ_REG(hw, STATUS); in e1000_check_for_link()
3882 rxcw = E1000_READ_REG(hw, RXCW); in e1000_check_for_link()
3891 if ((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { in e1000_check_for_link()
3897 if (e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { in e1000_check_for_link()
3901 if (e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { in e1000_check_for_link()
3907 hw->get_link_status = false; in e1000_check_for_link()
3921 if (hw->mac_type >= e1000_82544) in e1000_check_for_link()
3922 e1000_config_collision_dist(hw); in e1000_check_for_link()
3924 ret_val = e1000_config_mac_to_phy(hw); in e1000_check_for_link()
3936 ret_val = e1000_config_fc_after_link_up(hw); in e1000_check_for_link()
3951 if (hw->tbi_compatibility_en) { in e1000_check_for_link()
3953 (hw, PHY_LP_ABILITY, &lp_capability) < 0) { in e1000_check_for_link()
3965 if (hw->tbi_compatibility_on) { in e1000_check_for_link()
3967 rctl = E1000_READ_REG(hw, RCTL); in e1000_check_for_link()
3969 E1000_WRITE_REG(hw, RCTL, rctl); in e1000_check_for_link()
3970 hw->tbi_compatibility_on = false; in e1000_check_for_link()
3978 if (!hw->tbi_compatibility_on) { in e1000_check_for_link()
3979 hw->tbi_compatibility_on = true; in e1000_check_for_link()
3980 rctl = E1000_READ_REG(hw, RCTL); in e1000_check_for_link()
3982 E1000_WRITE_REG(hw, RCTL, rctl); in e1000_check_for_link()
3994 else if ((hw->media_type == e1000_media_type_fiber) && in e1000_check_for_link()
3998 if (hw->autoneg_failed == 0) { in e1000_check_for_link()
3999 hw->autoneg_failed = 1; in e1000_check_for_link()
4005 E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE)); in e1000_check_for_link()
4008 ctrl = E1000_READ_REG(hw, CTRL); in e1000_check_for_link()
4010 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_check_for_link()
4013 ret_val = e1000_config_fc_after_link_up(hw); in e1000_check_for_link()
4024 else if ((hw->media_type == e1000_media_type_fiber) && in e1000_check_for_link()
4028 E1000_WRITE_REG(hw, TXCW, hw->txcw); in e1000_check_for_link()
4029 E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); in e1000_check_for_link()
4037 * hw - Struct containing variables accessed by shared code
4040 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, uint16_t duplex) in e1000_configure_kmrn_for_10_100() argument
4049 ret_val = e1000_write_kmrn_reg(hw, in e1000_configure_kmrn_for_10_100()
4055 tipg = E1000_READ_REG(hw, TIPG); in e1000_configure_kmrn_for_10_100()
4058 E1000_WRITE_REG(hw, TIPG, tipg); in e1000_configure_kmrn_for_10_100()
4060 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); in e1000_configure_kmrn_for_10_100()
4070 ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); in e1000_configure_kmrn_for_10_100()
4076 e1000_configure_kmrn_for_1000(struct e1000_hw *hw) in e1000_configure_kmrn_for_1000() argument
4085 ret_val = e1000_write_kmrn_reg(hw, in e1000_configure_kmrn_for_1000()
4091 tipg = E1000_READ_REG(hw, TIPG); in e1000_configure_kmrn_for_1000()
4094 E1000_WRITE_REG(hw, TIPG, tipg); in e1000_configure_kmrn_for_1000()
4096 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); in e1000_configure_kmrn_for_1000()
4102 ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); in e1000_configure_kmrn_for_1000()
4110 * hw - Struct containing variables accessed by shared code
4115 e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t *speed, in e1000_get_speed_and_duplex() argument
4124 if (hw->mac_type >= e1000_82543) { in e1000_get_speed_and_duplex()
4125 status = E1000_READ_REG(hw, STATUS); in e1000_get_speed_and_duplex()
4154 if (hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { in e1000_get_speed_and_duplex()
4155 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data); in e1000_get_speed_and_duplex()
4162 ret_val = e1000_read_phy_reg(hw, in e1000_get_speed_and_duplex()
4174 if ((hw->mac_type == e1000_80003es2lan) && in e1000_get_speed_and_duplex()
4175 (hw->media_type == e1000_media_type_copper)) { in e1000_get_speed_and_duplex()
4177 ret_val = e1000_configure_kmrn_for_1000(hw); in e1000_get_speed_and_duplex()
4179 ret_val = e1000_configure_kmrn_for_10_100(hw, *duplex); in e1000_get_speed_and_duplex()
4189 * hw - Struct containing variables accessed by shared code
4192 e1000_wait_autoneg(struct e1000_hw *hw) in e1000_wait_autoneg() argument
4205 if (e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { in e1000_wait_autoneg()
4209 if (e1000_read_phy_reg(hw, PHY_STATUS, &phy_data) < 0) { in e1000_wait_autoneg()
4226 * hw - Struct containing variables accessed by shared code
4230 e1000_raise_mdi_clk(struct e1000_hw *hw, uint32_t * ctrl) in e1000_raise_mdi_clk() argument
4235 E1000_WRITE_REG(hw, CTRL, (*ctrl | E1000_CTRL_MDC)); in e1000_raise_mdi_clk()
4236 E1000_WRITE_FLUSH(hw); in e1000_raise_mdi_clk()
4243 * hw - Struct containing variables accessed by shared code
4247 e1000_lower_mdi_clk(struct e1000_hw *hw, uint32_t * ctrl) in e1000_lower_mdi_clk() argument
4252 E1000_WRITE_REG(hw, CTRL, (*ctrl & ~E1000_CTRL_MDC)); in e1000_lower_mdi_clk()
4253 E1000_WRITE_FLUSH(hw); in e1000_lower_mdi_clk()
4260 * hw - Struct containing variables accessed by shared code
4267 e1000_shift_out_mdi_bits(struct e1000_hw *hw, uint32_t data, uint16_t count) in e1000_shift_out_mdi_bits() argument
4279 ctrl = E1000_READ_REG(hw, CTRL); in e1000_shift_out_mdi_bits()
4295 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_shift_out_mdi_bits()
4296 E1000_WRITE_FLUSH(hw); in e1000_shift_out_mdi_bits()
4300 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_out_mdi_bits()
4301 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_out_mdi_bits()
4310 * hw - Struct containing variables accessed by shared code
4315 e1000_shift_in_mdi_bits(struct e1000_hw *hw) in e1000_shift_in_mdi_bits() argument
4328 ctrl = E1000_READ_REG(hw, CTRL); in e1000_shift_in_mdi_bits()
4334 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_shift_in_mdi_bits()
4335 E1000_WRITE_FLUSH(hw); in e1000_shift_in_mdi_bits()
4341 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
4342 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
4346 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
4347 ctrl = E1000_READ_REG(hw, CTRL); in e1000_shift_in_mdi_bits()
4351 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
4354 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
4355 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
4363 * hw - Struct containing variables accessed by shared code
4367 e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t * phy_data) in e1000_read_phy_reg() argument
4378 if (hw->mac_type > e1000_82543) { in e1000_read_phy_reg()
4387 E1000_WRITE_REG(hw, MDIC, mdic); in e1000_read_phy_reg()
4392 mdic = E1000_READ_REG(hw, MDIC); in e1000_read_phy_reg()
4410 e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); in e1000_read_phy_reg()
4426 e1000_shift_out_mdi_bits(hw, mdic, 14); in e1000_read_phy_reg()
4432 *phy_data = e1000_shift_in_mdi_bits(hw); in e1000_read_phy_reg()
4440 * hw - Struct containing variables accessed by shared code
4445 e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t phy_data) in e1000_write_phy_reg() argument
4456 if (hw->mac_type > e1000_82543) { in e1000_write_phy_reg()
4466 E1000_WRITE_REG(hw, MDIC, mdic); in e1000_write_phy_reg()
4471 mdic = E1000_READ_REG(hw, MDIC); in e1000_write_phy_reg()
4485 e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); in e1000_write_phy_reg()
4498 e1000_shift_out_mdi_bits(hw, mdic, 32); in e1000_write_phy_reg()
4508 * hw - Struct containing variables accessed by shared code
4515 e1000_check_phy_reset_block(struct e1000_hw *hw) in e1000_check_phy_reset_block() argument
4520 if (hw->mac_type == e1000_ich8lan) { in e1000_check_phy_reset_block()
4521 fwsm = E1000_READ_REG(hw, FWSM); in e1000_check_phy_reset_block()
4526 if (hw->mac_type > e1000_82547_rev_2) in e1000_check_phy_reset_block()
4527 manc = E1000_READ_REG(hw, MANC); in e1000_check_phy_reset_block()
4535 * hw: Struct containing variables accessed by shared code
4542 e1000_get_phy_cfg_done(struct e1000_hw *hw) in e1000_get_phy_cfg_done() argument
4549 switch (hw->mac_type) { in e1000_get_phy_cfg_done()
4556 if (e1000_is_second_port(hw)) in e1000_get_phy_cfg_done()
4564 if (hw->mac_type == e1000_igb) { in e1000_get_phy_cfg_done()
4565 if (E1000_READ_REG(hw, I210_EEMNGCTL) & cfg_mask) in e1000_get_phy_cfg_done()
4568 if (E1000_READ_REG(hw, EEMNGCTL) & cfg_mask) in e1000_get_phy_cfg_done()
4588 * hw - Struct containing variables accessed by shared code
4591 e1000_phy_hw_reset(struct e1000_hw *hw) in e1000_phy_hw_reset() argument
4602 ret_val = e1000_check_phy_reset_block(hw); in e1000_phy_hw_reset()
4608 if (hw->mac_type > e1000_82543) { in e1000_phy_hw_reset()
4609 if (e1000_is_second_port(hw)) in e1000_phy_hw_reset()
4612 if (e1000_swfw_sync_acquire(hw, swfw)) { in e1000_phy_hw_reset()
4620 ctrl = E1000_READ_REG(hw, CTRL); in e1000_phy_hw_reset()
4621 E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST); in e1000_phy_hw_reset()
4622 E1000_WRITE_FLUSH(hw); in e1000_phy_hw_reset()
4624 if (hw->mac_type < e1000_82571) in e1000_phy_hw_reset()
4629 E1000_WRITE_REG(hw, CTRL, ctrl); in e1000_phy_hw_reset()
4630 E1000_WRITE_FLUSH(hw); in e1000_phy_hw_reset()
4632 if (hw->mac_type >= e1000_82571) in e1000_phy_hw_reset()
4639 ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); in e1000_phy_hw_reset()
4642 E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); in e1000_phy_hw_reset()
4643 E1000_WRITE_FLUSH(hw); in e1000_phy_hw_reset()
4646 E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); in e1000_phy_hw_reset()
4647 E1000_WRITE_FLUSH(hw); in e1000_phy_hw_reset()
4651 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_phy_hw_reset()
4653 led_ctrl = E1000_READ_REG(hw, LEDCTL); in e1000_phy_hw_reset()
4656 E1000_WRITE_REG(hw, LEDCTL, led_ctrl); in e1000_phy_hw_reset()
4659 e1000_swfw_sync_release(hw, swfw); in e1000_phy_hw_reset()
4662 ret_val = e1000_get_phy_cfg_done(hw); in e1000_phy_hw_reset()
4672 * hw - Struct containing variables accessed by shared code
4675 e1000_phy_init_script(struct e1000_hw *hw) in e1000_phy_init_script() argument
4681 if (hw->phy_init_script) { in e1000_phy_init_script()
4686 ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); in e1000_phy_init_script()
4689 e1000_write_phy_reg(hw, 0x2F5B, 0x0003); in e1000_phy_init_script()
4693 e1000_write_phy_reg(hw, 0x0000, 0x0140); in e1000_phy_init_script()
4697 switch (hw->mac_type) { in e1000_phy_init_script()
4700 e1000_write_phy_reg(hw, 0x1F95, 0x0001); in e1000_phy_init_script()
4702 e1000_write_phy_reg(hw, 0x1F71, 0xBD21); in e1000_phy_init_script()
4704 e1000_write_phy_reg(hw, 0x1F79, 0x0018); in e1000_phy_init_script()
4706 e1000_write_phy_reg(hw, 0x1F30, 0x1600); in e1000_phy_init_script()
4708 e1000_write_phy_reg(hw, 0x1F31, 0x0014); in e1000_phy_init_script()
4710 e1000_write_phy_reg(hw, 0x1F32, 0x161C); in e1000_phy_init_script()
4712 e1000_write_phy_reg(hw, 0x1F94, 0x0003); in e1000_phy_init_script()
4714 e1000_write_phy_reg(hw, 0x1F96, 0x003F); in e1000_phy_init_script()
4716 e1000_write_phy_reg(hw, 0x2010, 0x0008); in e1000_phy_init_script()
4721 e1000_write_phy_reg(hw, 0x1F73, 0x0099); in e1000_phy_init_script()
4727 e1000_write_phy_reg(hw, 0x0000, 0x3300); in e1000_phy_init_script()
4733 e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); in e1000_phy_init_script()
4735 if (hw->mac_type == e1000_82547) { in e1000_phy_init_script()
4739 e1000_read_phy_reg(hw, in e1000_phy_init_script()
4743 e1000_read_phy_reg(hw, in e1000_phy_init_script()
4766 e1000_write_phy_reg(hw, in e1000_phy_init_script()
4768 e1000_write_phy_reg(hw, in e1000_phy_init_script()
4779 * hw - Struct containing variables accessed by shared code
4784 e1000_phy_reset(struct e1000_hw *hw) in e1000_phy_reset() argument
4793 ret_val = e1000_check_phy_reset_block(hw); in e1000_phy_reset()
4797 switch (hw->phy_type) { in e1000_phy_reset()
4803 ret_val = e1000_phy_hw_reset(hw); in e1000_phy_reset()
4808 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); in e1000_phy_reset()
4813 ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); in e1000_phy_reset()
4821 if (hw->phy_type == e1000_phy_igp || hw->phy_type == e1000_phy_igp_2) in e1000_phy_reset()
4822 e1000_phy_init_script(hw); in e1000_phy_reset()
4827 static int e1000_set_phy_type (struct e1000_hw *hw) in e1000_set_phy_type() argument
4831 if (hw->mac_type == e1000_undefined) in e1000_set_phy_type()
4834 switch (hw->phy_id) { in e1000_set_phy_type()
4839 hw->phy_type = e1000_phy_m88; in e1000_set_phy_type()
4842 if (hw->mac_type == e1000_82541 || in e1000_set_phy_type()
4843 hw->mac_type == e1000_82541_rev_2 || in e1000_set_phy_type()
4844 hw->mac_type == e1000_82547 || in e1000_set_phy_type()
4845 hw->mac_type == e1000_82547_rev_2) { in e1000_set_phy_type()
4846 hw->phy_type = e1000_phy_igp; in e1000_set_phy_type()
4850 hw->phy_type = e1000_phy_igp_3; in e1000_set_phy_type()
4855 hw->phy_type = e1000_phy_ife; in e1000_set_phy_type()
4858 if (hw->mac_type == e1000_80003es2lan) { in e1000_set_phy_type()
4859 hw->phy_type = e1000_phy_gg82563; in e1000_set_phy_type()
4863 hw->phy_type = e1000_phy_bm; in e1000_set_phy_type()
4866 hw->phy_type = e1000_phy_igb; in e1000_set_phy_type()
4871 hw->phy_type = e1000_phy_undefined; in e1000_set_phy_type()
4881 * hw - Struct containing variables accessed by shared code
4884 e1000_detect_gig_phy(struct e1000_hw *hw) in e1000_detect_gig_phy() argument
4895 if (hw->mac_type == e1000_82571 || in e1000_detect_gig_phy()
4896 hw->mac_type == e1000_82572) { in e1000_detect_gig_phy()
4897 hw->phy_id = IGP01E1000_I_PHY_ID; in e1000_detect_gig_phy()
4898 hw->phy_type = e1000_phy_igp_2; in e1000_detect_gig_phy()
4908 if (hw->mac_type == e1000_80003es2lan) in e1000_detect_gig_phy()
4909 hw->phy_type = e1000_phy_gg82563; in e1000_detect_gig_phy()
4912 ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); in e1000_detect_gig_phy()
4916 hw->phy_id = (uint32_t) (phy_id_high << 16); in e1000_detect_gig_phy()
4918 ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low); in e1000_detect_gig_phy()
4922 hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK); in e1000_detect_gig_phy()
4923 hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK; in e1000_detect_gig_phy()
4925 switch (hw->mac_type) { in e1000_detect_gig_phy()
4927 if (hw->phy_id == M88E1000_E_PHY_ID) in e1000_detect_gig_phy()
4931 if (hw->phy_id == M88E1000_I_PHY_ID) in e1000_detect_gig_phy()
4939 if (hw->phy_id == M88E1011_I_PHY_ID) in e1000_detect_gig_phy()
4946 if(hw->phy_id == IGP01E1000_I_PHY_ID) in e1000_detect_gig_phy()
4951 if (hw->phy_id == M88E1111_I_PHY_ID) in e1000_detect_gig_phy()
4955 if (hw->phy_id == BME1000_E_PHY_ID) in e1000_detect_gig_phy()
4959 if (hw->phy_id == GG82563_E_PHY_ID) in e1000_detect_gig_phy()
4963 if (hw->phy_id == IGP03E1000_E_PHY_ID) in e1000_detect_gig_phy()
4965 if (hw->phy_id == IFE_E_PHY_ID) in e1000_detect_gig_phy()
4967 if (hw->phy_id == IFE_PLUS_E_PHY_ID) in e1000_detect_gig_phy()
4969 if (hw->phy_id == IFE_C_E_PHY_ID) in e1000_detect_gig_phy()
4973 if (hw->phy_id == I210_I_PHY_ID) in e1000_detect_gig_phy()
4977 DEBUGOUT("Invalid MAC type %d\n", hw->mac_type); in e1000_detect_gig_phy()
4981 phy_init_status = e1000_set_phy_type(hw); in e1000_detect_gig_phy()
4984 DEBUGOUT("PHY ID 0x%X detected\n", hw->phy_id); in e1000_detect_gig_phy()
4987 DEBUGOUT("Invalid PHY ID 0x%X\n", hw->phy_id); in e1000_detect_gig_phy()
4994 * hw - Struct containing variables accessed by shared code
4997 e1000_set_media_type(struct e1000_hw *hw) in e1000_set_media_type() argument
5003 if (hw->mac_type != e1000_82543) { in e1000_set_media_type()
5005 hw->tbi_compatibility_en = false; in e1000_set_media_type()
5008 switch (hw->device_id) { in e1000_set_media_type()
5016 hw->media_type = e1000_media_type_internal_serdes; in e1000_set_media_type()
5019 switch (hw->mac_type) { in e1000_set_media_type()
5022 hw->media_type = e1000_media_type_fiber; in e1000_set_media_type()
5031 hw->media_type = e1000_media_type_copper; in e1000_set_media_type()
5034 status = E1000_READ_REG(hw, STATUS); in e1000_set_media_type()
5036 hw->media_type = e1000_media_type_fiber; in e1000_set_media_type()
5038 hw->tbi_compatibility_en = false; in e1000_set_media_type()
5040 hw->media_type = e1000_media_type_copper; in e1000_set_media_type()
5056 e1000_sw_init(struct e1000_hw *hw) in e1000_sw_init() argument
5062 dm_pci_read_config16(hw->pdev, PCI_VENDOR_ID, &hw->vendor_id); in e1000_sw_init()
5063 dm_pci_read_config16(hw->pdev, PCI_DEVICE_ID, &hw->device_id); in e1000_sw_init()
5064 dm_pci_read_config16(hw->pdev, PCI_SUBSYSTEM_VENDOR_ID, in e1000_sw_init()
5065 &hw->subsystem_vendor_id); in e1000_sw_init()
5066 dm_pci_read_config16(hw->pdev, PCI_SUBSYSTEM_ID, &hw->subsystem_id); in e1000_sw_init()
5068 dm_pci_read_config8(hw->pdev, PCI_REVISION_ID, &hw->revision_id); in e1000_sw_init()
5069 dm_pci_read_config16(hw->pdev, PCI_COMMAND, &hw->pci_cmd_word); in e1000_sw_init()
5071 pci_read_config_word(hw->pdev, PCI_VENDOR_ID, &hw->vendor_id); in e1000_sw_init()
5072 pci_read_config_word(hw->pdev, PCI_DEVICE_ID, &hw->device_id); in e1000_sw_init()
5073 pci_read_config_word(hw->pdev, PCI_SUBSYSTEM_VENDOR_ID, in e1000_sw_init()
5074 &hw->subsystem_vendor_id); in e1000_sw_init()
5075 pci_read_config_word(hw->pdev, PCI_SUBSYSTEM_ID, &hw->subsystem_id); in e1000_sw_init()
5077 pci_read_config_byte(hw->pdev, PCI_REVISION_ID, &hw->revision_id); in e1000_sw_init()
5078 pci_read_config_word(hw->pdev, PCI_COMMAND, &hw->pci_cmd_word); in e1000_sw_init()
5082 result = e1000_set_mac_type(hw); in e1000_sw_init()
5084 E1000_ERR(hw, "Unknown MAC Type\n"); in e1000_sw_init()
5088 switch (hw->mac_type) { in e1000_sw_init()
5095 hw->phy_init_script = 1; in e1000_sw_init()
5100 hw->fc_high_water = E1000_FC_HIGH_THRESH; in e1000_sw_init()
5101 hw->fc_low_water = E1000_FC_LOW_THRESH; in e1000_sw_init()
5102 hw->fc_pause_time = E1000_FC_PAUSE_TIME; in e1000_sw_init()
5103 hw->fc_send_xon = 1; in e1000_sw_init()
5106 hw->tbi_compatibility_en = true; in e1000_sw_init()
5107 e1000_set_media_type(hw); in e1000_sw_init()
5109 if (hw->mac_type >= e1000_82543) { in e1000_sw_init()
5110 uint32_t status = E1000_READ_REG(hw, STATUS); in e1000_sw_init()
5114 hw->media_type = e1000_media_type_fiber; in e1000_sw_init()
5117 hw->media_type = e1000_media_type_copper; in e1000_sw_init()
5120 hw->media_type = e1000_media_type_fiber; in e1000_sw_init()
5123 hw->wait_autoneg_complete = true; in e1000_sw_init()
5124 if (hw->mac_type < e1000_82543) in e1000_sw_init()
5125 hw->report_tx_early = 0; in e1000_sw_init()
5127 hw->report_tx_early = 1; in e1000_sw_init()
5133 fill_rx(struct e1000_hw *hw) in fill_rx() argument
5156 E1000_WRITE_REG(hw, RDT, rx_tail); in fill_rx()
5167 e1000_configure_tx(struct e1000_hw *hw) in e1000_configure_tx() argument
5173 E1000_WRITE_REG(hw, TDBAL, lower_32_bits((unsigned long)tx_base)); in e1000_configure_tx()
5174 E1000_WRITE_REG(hw, TDBAH, upper_32_bits((unsigned long)tx_base)); in e1000_configure_tx()
5176 E1000_WRITE_REG(hw, TDLEN, 128); in e1000_configure_tx()
5178 /* Setup the HW Tx Head and Tail descriptor pointers */ in e1000_configure_tx()
5179 E1000_WRITE_REG(hw, TDH, 0); in e1000_configure_tx()
5180 E1000_WRITE_REG(hw, TDT, 0); in e1000_configure_tx()
5184 if (hw->mac_type <= e1000_82547_rev_2 && in e1000_configure_tx()
5185 (hw->media_type == e1000_media_type_fiber || in e1000_configure_tx()
5186 hw->media_type == e1000_media_type_internal_serdes)) in e1000_configure_tx()
5192 switch (hw->mac_type) { in e1000_configure_tx()
5210 E1000_WRITE_REG(hw, TIPG, tipg); in e1000_configure_tx()
5212 tctl = E1000_READ_REG(hw, TCTL); in e1000_configure_tx()
5217 if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572) { in e1000_configure_tx()
5218 tarc = E1000_READ_REG(hw, TARC0); in e1000_configure_tx()
5222 } else if (hw->mac_type == e1000_80003es2lan) { in e1000_configure_tx()
5223 tarc = E1000_READ_REG(hw, TARC0); in e1000_configure_tx()
5225 E1000_WRITE_REG(hw, TARC0, tarc); in e1000_configure_tx()
5226 tarc = E1000_READ_REG(hw, TARC1); in e1000_configure_tx()
5228 E1000_WRITE_REG(hw, TARC1, tarc); in e1000_configure_tx()
5232 e1000_config_collision_dist(hw); in e1000_configure_tx()
5234 hw->txd_cmd = E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS; in e1000_configure_tx()
5237 if (hw->mac_type < e1000_82543) in e1000_configure_tx()
5238 hw->txd_cmd |= E1000_TXD_CMD_RPS; in e1000_configure_tx()
5240 hw->txd_cmd |= E1000_TXD_CMD_RS; in e1000_configure_tx()
5243 if (hw->mac_type == e1000_igb) { in e1000_configure_tx()
5244 E1000_WRITE_REG(hw, TCTL_EXT, 0x42 << 10); in e1000_configure_tx()
5246 uint32_t reg_txdctl = E1000_READ_REG(hw, TXDCTL); in e1000_configure_tx()
5248 E1000_WRITE_REG(hw, TXDCTL, reg_txdctl); in e1000_configure_tx()
5254 E1000_WRITE_REG(hw, TCTL, tctl); in e1000_configure_tx()
5264 e1000_setup_rctl(struct e1000_hw *hw) in e1000_setup_rctl() argument
5268 rctl = E1000_READ_REG(hw, RCTL); in e1000_setup_rctl()
5274 (hw.mc_filter_type << E1000_RCTL_MO_SHIFT); */ in e1000_setup_rctl()
5276 if (hw->tbi_compatibility_on == 1) in e1000_setup_rctl()
5284 E1000_WRITE_REG(hw, RCTL, rctl); in e1000_setup_rctl()
5294 e1000_configure_rx(struct e1000_hw *hw) in e1000_configure_rx() argument
5300 rctl = E1000_READ_REG(hw, RCTL); in e1000_configure_rx()
5301 E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN); in e1000_configure_rx()
5302 if (hw->mac_type >= e1000_82540) { in e1000_configure_rx()
5307 E1000_WRITE_REG(hw, ITR, DEFAULT_ITR); in e1000_configure_rx()
5310 if (hw->mac_type >= e1000_82571) { in e1000_configure_rx()
5311 ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); in e1000_configure_rx()
5314 E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); in e1000_configure_rx()
5315 E1000_WRITE_FLUSH(hw); in e1000_configure_rx()
5318 E1000_WRITE_REG(hw, RDBAL, lower_32_bits((unsigned long)rx_base)); in e1000_configure_rx()
5319 E1000_WRITE_REG(hw, RDBAH, upper_32_bits((unsigned long)rx_base)); in e1000_configure_rx()
5321 E1000_WRITE_REG(hw, RDLEN, 128); in e1000_configure_rx()
5323 /* Setup the HW Rx Head and Tail Descriptor Pointers */ in e1000_configure_rx()
5324 E1000_WRITE_REG(hw, RDH, 0); in e1000_configure_rx()
5325 E1000_WRITE_REG(hw, RDT, 0); in e1000_configure_rx()
5328 if (hw->mac_type == e1000_igb) { in e1000_configure_rx()
5330 uint32_t reg_rxdctl = E1000_READ_REG(hw, RXDCTL); in e1000_configure_rx()
5332 E1000_WRITE_REG(hw, RXDCTL, reg_rxdctl); in e1000_configure_rx()
5336 E1000_WRITE_REG(hw, RCTL, rctl); in e1000_configure_rx()
5338 fill_rx(hw); in e1000_configure_rx()
5345 _e1000_poll(struct e1000_hw *hw) in _e1000_poll() argument
5370 static int _e1000_transmit(struct e1000_hw *hw, void *txpacket, int length) in _e1000_transmit() argument
5380 txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, nv_packet)); in _e1000_transmit()
5381 txp->lower.data = cpu_to_le32(hw->txd_cmd | length); in _e1000_transmit()
5393 E1000_WRITE_REG(hw, TDT, tx_tail); in _e1000_transmit()
5395 E1000_WRITE_FLUSH(hw); in _e1000_transmit()
5410 _e1000_disable(struct e1000_hw *hw) in _e1000_disable() argument
5413 E1000_WRITE_REG(hw, RCTL, 0); in _e1000_disable()
5414 E1000_WRITE_REG(hw, TCTL, 0); in _e1000_disable()
5417 E1000_WRITE_REG(hw, TDH, 0); in _e1000_disable()
5418 E1000_WRITE_REG(hw, TDT, 0); in _e1000_disable()
5421 E1000_WRITE_REG(hw, RDH, 0); in _e1000_disable()
5422 E1000_WRITE_REG(hw, RDT, 0); in _e1000_disable()
5429 e1000_reset(struct e1000_hw *hw, unsigned char enetaddr[6]) in e1000_reset() argument
5431 e1000_reset_hw(hw); in e1000_reset()
5432 if (hw->mac_type >= e1000_82544) in e1000_reset()
5433 E1000_WRITE_REG(hw, WUC, 0); in e1000_reset()
5435 return e1000_init_hw(hw, enetaddr); in e1000_reset()
5439 _e1000_init(struct e1000_hw *hw, unsigned char enetaddr[6]) in _e1000_init() argument
5443 ret_val = e1000_reset(hw, enetaddr); in _e1000_init()
5447 E1000_ERR(hw, "Valid Link not detected: %d\n", ret_val); in _e1000_init()
5449 E1000_ERR(hw, "Hardware Initialization Failed\n"); in _e1000_init()
5453 e1000_configure_tx(hw); in _e1000_init()
5454 e1000_setup_rctl(hw); in _e1000_init()
5455 e1000_configure_rx(hw); in _e1000_init()
5462 * hw - Struct containing variables accessed by shared code
5464 void e1000_get_bus_type(struct e1000_hw *hw) in e1000_get_bus_type() argument
5468 switch (hw->mac_type) { in e1000_get_bus_type()
5471 hw->bus_type = e1000_bus_type_pci; in e1000_get_bus_type()
5480 hw->bus_type = e1000_bus_type_pci_express; in e1000_get_bus_type()
5483 status = E1000_READ_REG(hw, STATUS); in e1000_get_bus_type()
5484 hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? in e1000_get_bus_type()
5496 static int e1000_init_one(struct e1000_hw *hw, int cardnum, in e1000_init_one() argument
5499 static int e1000_init_one(struct e1000_hw *hw, int cardnum, pci_dev_t devno, in e1000_init_one()
5507 hw->pdev = devno; in e1000_init_one()
5509 hw->pdev = devno; in e1000_init_one()
5511 hw->cardnum = cardnum; in e1000_init_one()
5519 E1000_DBG(hw, "iobase 0x%08x\n", val & 0xfffffff0); in e1000_init_one()
5536 E1000_ERR(hw, "Can't enable I/O memory\n"); in e1000_init_one()
5540 E1000_ERR(hw, "Can't enable bus-mastering\n"); in e1000_init_one()
5545 hw->fc = e1000_fc_default; in e1000_init_one()
5546 hw->original_fc = e1000_fc_default; in e1000_init_one()
5547 hw->autoneg_failed = 0; in e1000_init_one()
5548 hw->autoneg = 1; in e1000_init_one()
5549 hw->get_link_status = true; in e1000_init_one()
5551 hw->eeprom_semaphore_present = true; in e1000_init_one()
5554 hw->hw_addr = dm_pci_map_bar(devno, PCI_BASE_ADDRESS_0, in e1000_init_one()
5557 hw->hw_addr = pci_map_bar(devno, PCI_BASE_ADDRESS_0, in e1000_init_one()
5560 hw->mac_type = e1000_undefined; in e1000_init_one()
5563 if (e1000_sw_init(hw) < 0) { in e1000_init_one()
5564 E1000_ERR(hw, "Software init failed\n"); in e1000_init_one()
5567 if (e1000_check_phy_reset_block(hw)) in e1000_init_one()
5568 E1000_ERR(hw, "PHY Reset is blocked!\n"); in e1000_init_one()
5571 e1000_reset_hw(hw); in e1000_init_one()
5575 if (e1000_init_eeprom_params(hw)) { in e1000_init_one()
5576 E1000_ERR(hw, "EEPROM is invalid!\n"); in e1000_init_one()
5579 if ((E1000_READ_REG(hw, I210_EECD) & E1000_EECD_FLUPD) && in e1000_init_one()
5580 e1000_validate_eeprom_checksum(hw)) in e1000_init_one()
5582 e1000_read_mac_addr(hw, enetaddr); in e1000_init_one()
5584 e1000_get_bus_type(hw); in e1000_init_one()
5610 struct e1000_hw *hw = nic->priv; in e1000_transmit() local
5612 return _e1000_transmit(hw, txpacket, length); in e1000_transmit()
5621 struct e1000_hw *hw = nic->priv; in e1000_disable() local
5623 _e1000_disable(hw); in e1000_disable()
5632 struct e1000_hw *hw = nic->priv; in e1000_init() local
5634 return _e1000_init(hw, nic->enetaddr); in e1000_init()
5640 struct e1000_hw *hw = nic->priv; in e1000_poll() local
5643 len = _e1000_poll(hw); in e1000_poll()
5646 fill_rx(hw); in e1000_poll()
5657 struct e1000_hw *hw = dev->priv; in e1000_write_hwaddr() local
5668 ret_val = e1000_read_mac_addr_from_eeprom(hw, current_mac); in e1000_write_hwaddr()
5680 ret_val = e1000_write_eeprom_srwr(hw, 0x0, 3, data); in e1000_write_hwaddr()
5683 ret_val = e1000_update_eeprom_checksum_i210(hw); in e1000_write_hwaddr()
5711 struct e1000_hw *hw = malloc(sizeof(*hw)); in e1000_initialize() local
5712 if (!nic || !hw) { in e1000_initialize()
5715 free(hw); in e1000_initialize()
5721 memset(hw, 0, sizeof(*hw)); in e1000_initialize()
5722 nic->priv = hw; in e1000_initialize()
5726 hw->name = nic->name; in e1000_initialize()
5728 ret = e1000_init_one(hw, i, devno, nic->enetaddr); in e1000_initialize()
5731 list_add_tail(&hw->list_node, &e1000_hw_list); in e1000_initialize()
5733 hw->nic = nic; in e1000_initialize()
5749 struct e1000_hw *hw; in e1000_find_card() local
5751 list_for_each_entry(hw, &e1000_hw_list, list_node) in e1000_find_card()
5752 if (hw->cardnum == cardnum) in e1000_find_card()
5753 return hw; in e1000_find_card()
5771 struct e1000_hw *hw; in do_e1000() local
5790 hw = e1000_find_card(cardnum); in do_e1000()
5791 if (hw) in do_e1000()
5792 mac = hw->nic->enetaddr; in do_e1000()
5807 hw = dev_get_priv(dev); in do_e1000()
5811 return do_e1000_spi(cmdtp, hw, argc - 3, argv + 3); in do_e1000()
5836 struct e1000_hw *hw = dev_get_priv(dev); in e1000_eth_start() local
5838 return _e1000_init(hw, plat->enetaddr); in e1000_eth_start()
5843 struct e1000_hw *hw = dev_get_priv(dev); in e1000_eth_stop() local
5845 _e1000_disable(hw); in e1000_eth_stop()
5850 struct e1000_hw *hw = dev_get_priv(dev); in e1000_eth_send() local
5853 ret = _e1000_transmit(hw, packet, length); in e1000_eth_send()
5860 struct e1000_hw *hw = dev_get_priv(dev); in e1000_eth_recv() local
5863 len = _e1000_poll(hw); in e1000_eth_recv()
5872 struct e1000_hw *hw = dev_get_priv(dev); in e1000_free_pkt() local
5874 fill_rx(hw); in e1000_free_pkt()
5882 struct e1000_hw *hw = dev_get_priv(dev); in e1000_eth_probe() local
5885 hw->name = dev->name; in e1000_eth_probe()
5886 ret = e1000_init_one(hw, trailing_strtol(dev->name), in e1000_eth_probe()