38 static void e1000_clear_hw_cntrs(
struct e1000_hw *
hw);
39 static void e1000_clear_vfta(
struct e1000_hw *
hw);
40 static s32 e1000_config_dsp_after_link_change(
struct e1000_hw *
hw,
42 static s32 e1000_config_fc_after_link_up(
struct e1000_hw *
hw);
49 static void e1000_init_rx_addrs(
struct e1000_hw *
hw);
58 static void e1000_phy_init_script(
struct e1000_hw *
hw);
60 static s32 e1000_setup_fiber_serdes_link(
struct e1000_hw *
hw);
61 static s32 e1000_adjust_serdes_amplitude(
struct e1000_hw *
hw);
74 static void e1000_raise_ee_clk(
struct e1000_hw *
hw,
u32 *eecd);
75 static void e1000_lower_ee_clk(
struct e1000_hw *
hw,
u32 *eecd);
83 static void e1000_release_eeprom(
struct e1000_hw *
hw);
84 static void e1000_standby_eeprom(
struct e1000_hw *
hw);
86 static s32 e1000_polarity_reversal_workaround(
struct e1000_hw *
hw);
96 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
97 5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 25, 25, 25,
98 25, 25, 25, 25, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40,
99 40, 50, 50, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60, 60, 60,
100 60, 70, 70, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 90, 90, 90,
101 90, 90, 90, 90, 90, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100,
103 100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
105 110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120,
117 e_dbg(
"e1000_set_phy_type");
156 static void e1000_phy_init_script(
struct e1000_hw *hw)
161 e_dbg(
"e1000_phy_init_script");
206 u16 fused, fine, coarse;
233 (fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) |
254 e_dbg(
"e1000_set_mac_type");
366 e_dbg(
"e1000_set_media_type");
416 e_dbg(
"e1000_reset_hw");
420 e_dbg(
"Disabling MWI on 82542 rev 2.0\n");
425 e_dbg(
"Masking off all interrupts\n");
458 e_dbg(
"Issuing a global reset to MAC\n");
493 ctrl_ext =
er32(CTRL_EXT);
495 ew32(CTRL_EXT, ctrl_ext);
509 ret_val = e1000_get_auto_rd_done(hw);
523 e1000_phy_init_script(hw);
526 led_ctrl =
er32(LEDCTL);
529 ew32(LEDCTL, led_ctrl);
533 e_dbg(
"Masking off all interrupts\n");
566 e_dbg(
"e1000_init_hw");
569 ret_val = e1000_id_led_init(hw);
571 e_dbg(
"Error Initializing Identification LED\n");
579 e_dbg(
"Initializing the IEEE VLAN\n");
582 e1000_clear_vfta(hw);
586 e_dbg(
"Disabling MWI on 82542 rev 2.0\n");
596 e1000_init_rx_addrs(hw);
608 e_dbg(
"Zeroing the MTA\n");
610 for (i = 0; i < mta_size; i++) {
656 e1000_clear_hw_cntrs(hw);
660 ctrl_ext =
er32(CTRL_EXT);
664 ew32(CTRL_EXT, ctrl_ext);
674 static s32 e1000_adjust_serdes_amplitude(
struct e1000_hw *hw)
679 e_dbg(
"e1000_adjust_serdes_amplitude");
726 e_dbg(
"e1000_setup_link");
740 e_dbg(
"EEPROM Read Error\n");
745 else if ((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) ==
764 e_dbg(
"After fix-ups FlowControl is now = %x\n", hw->
fc);
777 e_dbg(
"EEPROM Read Error\n");
782 ew32(CTRL_EXT, ctrl_ext);
787 e1000_setup_copper_link(hw) : e1000_setup_fiber_serdes_link(hw);
794 e_dbg(
"Initializing the Flow Control address, type and timer regs\n");
834 static s32 e1000_setup_fiber_serdes_link(
struct e1000_hw *hw)
843 e_dbg(
"e1000_setup_fiber_serdes_link");
855 ret_val = e1000_adjust_serdes_amplitude(hw);
863 ret_val = e1000_set_vco_speed(hw);
909 e_dbg(
"Flow control param set incorrectly\n");
920 e_dbg(
"Auto-negotiation enabled\n");
937 e_dbg(
"Looking for Link\n");
945 e_dbg(
"Never got a valid link from auto-neg!!!\n");
954 e_dbg(
"Error while checking for link\n");
960 e_dbg(
"Valid Link Found\n");
963 e_dbg(
"No Signal Detected\n");
974 static s32 e1000_copper_link_rtl_setup(
struct e1000_hw *hw)
981 e_dbg(
"Error Resetting the PHY\n");
995 ret_val = e1000_copper_link_rtl_setup(hw);
997 e_dbg(
"e1000_copper_link_rtl_setup failed!\n");
1003 ctrl_aux =
er32(CTL_AUX);
1005 ew32(CTL_AUX, ctrl_aux);
1009 ctrl_aux =
er32(CTL_AUX);
1012 ew32(CTL_AUX, ctrl_aux);
1014 ret_val = e1000_copper_link_rtl_setup(hw);
1017 e_dbg(
"e1000_copper_link_rtl_setup failed!\n");
1022 e_dbg(
"Error Resetting the PHY\n");
1035 static s32 e1000_copper_link_preconfig(
struct e1000_hw *hw)
1041 e_dbg(
"e1000_copper_link_preconfig");
1062 ret_val = e1000_detect_gig_phy(hw);
1064 e_dbg(
"Error, did not detect valid phy.\n");
1070 ret_val = e1000_set_phy_mode(hw);
1078 phy_data |= 0x00000008;
1096 static s32 e1000_copper_link_igp_setup(
struct e1000_hw *hw)
1102 e_dbg(
"e1000_copper_link_igp_setup");
1109 e_dbg(
"Error Resetting the PHY\n");
1116 led_ctrl =
er32(LEDCTL);
1119 ew32(LEDCTL, led_ctrl);
1124 ret_val = e1000_set_d3_lplu_state(hw,
false);
1126 e_dbg(
"Error Disabling LPLU D3\n");
1213 switch (phy_ms_setting) {
1238 static s32 e1000_copper_link_mgp_setup(
struct e1000_hw *hw)
1243 e_dbg(
"e1000_copper_link_mgp_setup");
1332 e_dbg(
"Error Resetting the PHY\n");
1346 static s32 e1000_copper_link_autoneg(
struct e1000_hw *hw)
1351 e_dbg(
"e1000_copper_link_autoneg");
1368 e_dbg(
"Reconfiguring auto-neg advertisement params\n");
1371 e_dbg(
"Error Setting up Auto-Negotiation\n");
1374 e_dbg(
"Restarting Auto-Neg\n");
1392 ret_val = e1000_wait_autoneg(hw);
1395 (
"Error while waiting for autoneg to complete\n");
1418 static s32 e1000_copper_link_postconfig(
struct e1000_hw *hw)
1421 e_dbg(
"e1000_copper_link_postconfig");
1426 ret_val = e1000_config_mac_to_phy(hw);
1428 e_dbg(
"Error configuring MAC to PHY settings\n");
1432 ret_val = e1000_config_fc_after_link_up(hw);
1434 e_dbg(
"Error Configuring Flow Control\n");
1440 ret_val = e1000_config_dsp_after_link_change(hw,
true);
1442 e_dbg(
"Error Configuring DSP after link up\n");
1456 static s32 e1000_setup_copper_link(
struct e1000_hw *hw)
1462 e_dbg(
"e1000_setup_copper_link");
1465 ret_val = e1000_copper_link_preconfig(hw);
1470 ret_val = e1000_copper_link_igp_setup(hw);
1474 ret_val = e1000_copper_link_mgp_setup(hw);
1478 ret_val = gbe_dhg_phy_setup(hw);
1480 e_dbg(
"gbe_dhg_phy_setup failed!\n");
1488 ret_val = e1000_copper_link_autoneg(hw);
1494 e_dbg(
"Forcing speed and duplex\n");
1495 ret_val = e1000_phy_force_speed_duplex(hw);
1497 e_dbg(
"Error Forcing Speed and Duplex\n");
1505 for (i = 0; i < 10; i++) {
1515 ret_val = e1000_copper_link_postconfig(hw);
1519 e_dbg(
"Valid link established!!!\n");
1525 e_dbg(
"Unable to establish link!!!\n");
1538 u16 mii_autoneg_adv_reg;
1539 u16 mii_1000t_ctrl_reg;
1541 e_dbg(
"e1000_phy_setup_autoneg");
1573 e_dbg(
"Advertise 10mb Half duplex\n");
1579 e_dbg(
"Advertise 10mb Full duplex\n");
1585 e_dbg(
"Advertise 100mb Half duplex\n");
1591 e_dbg(
"Advertise 100mb Full duplex\n");
1598 (
"Advertise 1000mb Half duplex requested, request denied!\n");
1603 e_dbg(
"Advertise 1000mb Full duplex\n");
1656 e_dbg(
"Flow control param set incorrectly\n");
1664 e_dbg(
"Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
1667 mii_1000t_ctrl_reg = 0;
1670 mii_1000t_ctrl_reg);
1684 static s32 e1000_phy_force_speed_duplex(
struct e1000_hw *hw)
1693 e_dbg(
"e1000_phy_force_speed_duplex");
1698 e_dbg(
"hw->fc = %d\n", hw->
fc);
1727 e_dbg(
"Full Duplex\n");
1734 e_dbg(
"Half Duplex\n");
1744 e_dbg(
"Forcing 100mb ");
1750 e_dbg(
"Forcing 10mb ");
1773 e_dbg(
"M88E1000 PSCR: %x\n", phy_data);
1813 e_dbg(
"Waiting for forced speed/duplex link.\n");
1837 ret_val = e1000_phy_reset_dsp(hw);
1839 e_dbg(
"Error Resetting PHY DSP\n");
1899 ret_val = e1000_polarity_reversal_workaround(hw);
1917 u32 tctl, coll_dist;
1919 e_dbg(
"e1000_config_collision_dist");
1944 static s32 e1000_config_mac_to_phy(
struct e1000_hw *hw)
1950 e_dbg(
"e1000_config_mac_to_phy");
2003 else if ((phy_data & M88E1000_PSSR_SPEED) ==
2028 e_dbg(
"e1000_force_mac_fc");
2067 e_dbg(
"Flow control param set incorrectly\n");
2090 static s32 e1000_config_fc_after_link_up(
struct e1000_hw *hw)
2094 u16 mii_nway_adv_reg;
2095 u16 mii_nway_lp_ability_reg;
2099 e_dbg(
"e1000_config_fc_after_link_up");
2112 e_dbg(
"Error forcing flow control settings\n");
2146 &mii_nway_lp_ability_reg);
2194 e_dbg(
"Flow Control = FULL.\n");
2198 (
"Flow Control = RX PAUSE frames only.\n");
2209 else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
2211 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
2216 (
"Flow Control = TX PAUSE frames only.\n");
2226 else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
2227 (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
2228 !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
2229 (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR))
2233 (
"Flow Control = RX PAUSE frames only.\n");
2259 e_dbg(
"Flow Control = NONE.\n");
2263 (
"Flow Control = RX PAUSE frames only.\n");
2274 (
"Error getting link speed and duplex\n");
2287 (
"Error forcing flow control settings\n");
2292 (
"Copper PHY and Auto Neg has not completed.\n");
2305 static s32 e1000_check_for_serdes_link_generic(
struct e1000_hw *hw)
2312 e_dbg(
"e1000_check_for_serdes_link_generic");
2331 e_dbg(
"NOT RXing /C/, disable AutoNeg and force link.\n");
2342 ret_val = e1000_config_fc_after_link_up(hw);
2344 e_dbg(
"Error configuring flow control\n");
2354 e_dbg(
"RXing /C/, enable AutoNeg and stop forcing link.\n");
2356 ew32(
CTRL, (ctrl & ~E1000_CTRL_SLU));
2371 e_dbg(
"SERDES: Link up - forced.\n");
2375 e_dbg(
"SERDES: Link down - force failed.\n");
2381 if (status & E1000_STATUS_LU) {
2385 if (rxcw & E1000_RXCW_SYNCH) {
2388 e_dbg(
"SERDES: Link up - autoneg "
2389 "completed successfully.\n");
2392 e_dbg(
"SERDES: Link down - invalid"
2393 "codewords detected in autoneg.\n");
2397 e_dbg(
"SERDES: Link down - no sync.\n");
2401 e_dbg(
"SERDES: Link down - autoneg failed\n");
2427 e_dbg(
"e1000_check_for_link");
2444 if (status & E1000_STATUS_LU)
2468 if (phy_data & MII_SR_LINK_STATUS) {
2472 e1000_check_downshift(hw);
2488 e1000_polarity_reversal_workaround(hw);
2496 e1000_config_dsp_after_link_change(hw,
false);
2507 e1000_config_dsp_after_link_change(hw,
true);
2521 ret_val = e1000_config_mac_to_phy(hw);
2524 (
"Error configuring MAC to PHY settings\n");
2533 ret_val = e1000_config_fc_after_link_up(hw);
2535 e_dbg(
"Error configuring flow control\n");
2552 (
"Error getting link speed and duplex\n");
2584 e1000_check_for_serdes_link_generic(hw);
2603 e_dbg(
"e1000_get_speed_and_duplex");
2609 e_dbg(
"1000 Mbs, ");
2620 e_dbg(
"Full Duplex\n");
2623 e_dbg(
" Half Duplex\n");
2626 e_dbg(
"1000 Mbs, Full Duplex\n");
2664 static s32 e1000_wait_autoneg(
struct e1000_hw *hw)
2670 e_dbg(
"e1000_wait_autoneg");
2671 e_dbg(
"Waiting for Auto-Neg to complete.\n");
2684 if (phy_data & MII_SR_AUTONEG_COMPLETE) {
2697 static void e1000_raise_mdi_clk(
struct e1000_hw *hw,
u32 *ctrl)
2712 static void e1000_lower_mdi_clk(
struct e1000_hw *hw,
u32 *ctrl)
2740 mask <<= (count - 1);
2763 e1000_raise_mdi_clk(hw, &ctrl);
2764 e1000_lower_mdi_clk(hw, &ctrl);
2776 static u16 e1000_shift_in_mdi_bits(
struct e1000_hw *hw)
2802 e1000_raise_mdi_clk(hw, &ctrl);
2803 e1000_lower_mdi_clk(hw, &ctrl);
2805 for (data = 0, i = 0; i < 16; i++) {
2807 e1000_raise_mdi_clk(hw, &ctrl);
2812 e1000_lower_mdi_clk(hw, &ctrl);
2815 e1000_raise_mdi_clk(hw, &ctrl);
2816 e1000_lower_mdi_clk(hw, &ctrl);
2834 e_dbg(
"e1000_read_phy_reg");
2857 e_dbg(
"e1000_read_phy_reg_ex");
2860 e_dbg(
"PHY Address %d is out of range\n", reg_addr);
2880 for (i = 0; i < 64; i++) {
2888 e_dbg(
"MDI Read did not complete\n");
2894 e_dbg(
"MDI Read Error\n");
2897 *phy_data = (
u16) mdic;
2908 for (i = 0; i < 64; i++) {
2915 e_dbg(
"MDI Read did not complete\n");
2919 e_dbg(
"MDI Error\n");
2922 *phy_data = (
u16) mdic;
2942 mdic = ((
reg_addr) | (phy_addr << 5) |
2945 e1000_shift_out_mdi_bits(hw, mdic, 14);
2951 *phy_data = e1000_shift_in_mdi_bits(hw);
2969 e_dbg(
"e1000_write_phy_reg");
2985 static s32 e1000_write_phy_reg_ex(
struct e1000_hw *hw,
u32 reg_addr,
2992 e_dbg(
"e1000_write_phy_reg_ex");
2995 e_dbg(
"PHY Address %d is out of range\n", reg_addr);
3006 mdic = (((
u32) phy_data) |
3010 (INTEL_CE_GBE_MDIC_GO));
3017 for (i = 0; i < 640; i++) {
3020 if (!(mdic & INTEL_CE_GBE_MDIC_GO))
3023 if (mdic & INTEL_CE_GBE_MDIC_GO) {
3024 e_dbg(
"MDI Write did not complete\n");
3028 mdic = (((
u32) phy_data) |
3038 for (i = 0; i < 641; i++) {
3045 e_dbg(
"MDI Write did not complete\n");
3066 mdic |= (
u32) phy_data;
3068 e1000_shift_out_mdi_bits(hw, mdic, 32);
3085 e_dbg(
"e1000_phy_hw_reset");
3087 e_dbg(
"Resetting Phy...\n");
3108 ctrl_ext =
er32(CTRL_EXT);
3111 ew32(CTRL_EXT, ctrl_ext);
3115 ew32(CTRL_EXT, ctrl_ext);
3122 led_ctrl =
er32(LEDCTL);
3125 ew32(LEDCTL, led_ctrl);
3129 return e1000_get_phy_cfg_done(hw);
3144 e_dbg(
"e1000_phy_reset");
3167 e1000_phy_init_script(hw);
3178 static s32 e1000_detect_gig_phy(
struct e1000_hw *hw)
3180 s32 phy_init_status, ret_val;
3181 u16 phy_id_high, phy_id_low;
3184 e_dbg(
"e1000_detect_gig_phy");
3237 phy_init_status = e1000_set_phy_type(hw);
3253 static s32 e1000_phy_reset_dsp(
struct e1000_hw *hw)
3256 e_dbg(
"e1000_phy_reset_dsp");
3281 static s32 e1000_phy_igp_get_info(
struct e1000_hw *hw,
3285 u16 phy_data, min_length, max_length,
average;
3288 e_dbg(
"e1000_phy_igp_get_info");
3301 ret_val = e1000_check_polarity(hw, &polarity);
3330 ret_val = e1000_get_cable_length(hw, &min_length, &max_length);
3335 average = (max_length + min_length) / 2;
3359 static s32 e1000_phy_m88_get_info(
struct e1000_hw *hw,
3366 e_dbg(
"e1000_phy_m88_get_info");
3388 ret_val = e1000_check_polarity(hw, &polarity);
3438 e_dbg(
"e1000_phy_get_info");
3450 e_dbg(
"PHY info is only valid for copper media\n");
3462 if ((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) {
3463 e_dbg(
"PHY info is only valid if link is up\n");
3468 return e1000_phy_igp_get_info(hw, phy_info);
3473 return e1000_phy_m88_get_info(hw, phy_info);
3478 e_dbg(
"e1000_validate_mdi_settings");
3481 e_dbg(
"Invalid MDI setting detected\n");
3502 e_dbg(
"e1000_init_eeprom_params");
3590 static void e1000_raise_ee_clk(
struct e1000_hw *hw,
u32 *eecd)
3606 static void e1000_lower_ee_clk(
struct e1000_hw *hw,
u32 *eecd)
3623 static void e1000_shift_out_ee_bits(
struct e1000_hw *hw,
u16 data,
u16 count)
3633 mask = 0x01 << (count - 1);
3656 e1000_raise_ee_clk(hw, &eecd);
3657 e1000_lower_ee_clk(hw, &eecd);
3673 static u16 e1000_shift_in_ee_bits(
struct e1000_hw *hw,
u16 count)
3691 for (i = 0; i <
count; i++) {
3693 e1000_raise_ee_clk(hw, &eecd);
3701 e1000_lower_ee_clk(hw, &eecd);
3714 static s32 e1000_acquire_eeprom(
struct e1000_hw *hw)
3719 e_dbg(
"e1000_acquire_eeprom");
3734 if (!(eecd & E1000_EECD_GNT)) {
3737 e_dbg(
"Could not acquire EEPROM grant\n");
3767 static void e1000_standby_eeprom(
struct e1000_hw *hw)
3816 static void e1000_release_eeprom(
struct e1000_hw *hw)
3820 e_dbg(
"e1000_release_eeprom");
3864 static s32 e1000_spi_eeprom_ready(
struct e1000_hw *hw)
3869 e_dbg(
"e1000_spi_eeprom_ready");
3880 spi_stat_reg = (
u8) e1000_shift_in_ee_bits(hw, 8);
3887 e1000_standby_eeprom(hw);
3894 e_dbg(
"SPI EEPROM Status error\n");
3911 spin_lock(&e1000_eeprom_lock);
3912 ret = e1000_do_read_eeprom(hw, offset, words, data);
3913 spin_unlock(&e1000_eeprom_lock);
3923 e_dbg(
"e1000_read_eeprom");
3939 || (words > eeprom->
word_size - offset) || (words == 0)) {
3940 e_dbg(
"\"words\" parameter out of bounds. Words = %d,"
3941 "size = %d\n", offset, eeprom->
word_size);
3959 if (e1000_spi_eeprom_ready(hw)) {
3960 e1000_release_eeprom(hw);
3964 e1000_standby_eeprom(hw);
3971 e1000_shift_out_ee_bits(hw, read_opcode, eeprom->
opcode_bits);
3972 e1000_shift_out_ee_bits(hw, (
u16) (offset * 2),
3980 for (i = 0; i < words; i++) {
3981 word_in = e1000_shift_in_ee_bits(hw, 16);
3982 data[
i] = (word_in >> 8) | (word_in << 8);
3985 for (i = 0; i < words; i++) {
3987 e1000_shift_out_ee_bits(hw,
3990 e1000_shift_out_ee_bits(hw, (
u16) (offset + i),
3995 data[
i] = e1000_shift_in_ee_bits(hw, 16);
3996 e1000_standby_eeprom(hw);
4001 e1000_release_eeprom(hw);
4019 e_dbg(
"e1000_validate_eeprom_checksum");
4023 e_dbg(
"EEPROM Read Error\n");
4026 checksum += eeprom_data;
4029 #ifdef CONFIG_PARISC
4038 e_dbg(
"EEPROM Checksum Invalid\n");
4055 e_dbg(
"e1000_update_eeprom_checksum");
4059 e_dbg(
"EEPROM Read Error\n");
4062 checksum += eeprom_data;
4066 e_dbg(
"EEPROM Write Error\n");
4085 spin_lock(&e1000_eeprom_lock);
4086 ret = e1000_do_write_eeprom(hw, offset, words, data);
4087 spin_unlock(&e1000_eeprom_lock);
4097 e_dbg(
"e1000_write_eeprom");
4113 || (words > eeprom->
word_size - offset) || (words == 0)) {
4114 e_dbg(
"\"words\" parameter out of bounds\n");
4123 status = e1000_write_eeprom_microwire(hw, offset, words, data);
4125 status = e1000_write_eeprom_spi(hw, offset, words, data);
4130 e1000_release_eeprom(hw);
4148 e_dbg(
"e1000_write_eeprom_spi");
4150 while (widx < words) {
4153 if (e1000_spi_eeprom_ready(hw))
4156 e1000_standby_eeprom(hw);
4162 e1000_standby_eeprom(hw);
4169 e1000_shift_out_ee_bits(hw, write_opcode, eeprom->
opcode_bits);
4171 e1000_shift_out_ee_bits(hw, (
u16) ((offset + widx) * 2),
4177 while (widx < words) {
4178 u16 word_out = data[widx];
4179 word_out = (word_out >> 8) | (word_out << 8);
4180 e1000_shift_out_ee_bits(hw, word_out, 16);
4187 if ((((offset + widx) * 2) % eeprom->
page_size) == 0) {
4188 e1000_standby_eeprom(hw);
4204 static s32 e1000_write_eeprom_microwire(
struct e1000_hw *hw,
u16 offset,
4209 u16 words_written = 0;
4212 e_dbg(
"e1000_write_eeprom_microwire");
4226 e1000_standby_eeprom(hw);
4228 while (words_written < words) {
4233 e1000_shift_out_ee_bits(hw, (
u16) (offset + words_written),
4237 e1000_shift_out_ee_bits(hw, data[words_written], 16);
4242 e1000_standby_eeprom(hw);
4248 for (i = 0; i < 200; i++) {
4255 e_dbg(
"EEPROM Write did not complete\n");
4260 e1000_standby_eeprom(hw);
4291 e_dbg(
"e1000_read_mac_addr");
4296 e_dbg(
"EEPROM Read Error\n");
4326 static void e1000_init_rx_addrs(
struct e1000_hw *hw)
4331 e_dbg(
"e1000_init_rx_addrs");
4334 e_dbg(
"Programming MAC Address into RAR[0]\n");
4341 e_dbg(
"Clearing RAR[1-15]\n");
4342 for (i = 1; i < rar_num; i++) {
4369 hash_value = ((mc_addr[4] >> 4) | (((
u16) mc_addr[5]) << 4));
4373 hash_value = ((mc_addr[4] >> 3) | (((
u16) mc_addr[5]) << 5));
4377 hash_value = ((mc_addr[4] >> 2) | (((
u16) mc_addr[5]) << 6));
4381 hash_value = ((mc_addr[4]) | (((
u16) mc_addr[5]) << 8));
4385 hash_value &= 0xFFF;
4397 u32 rar_low, rar_high;
4402 rar_low = ((
u32) addr[0] | ((
u32) addr[1] << 8) |
4403 ((
u32) addr[2] << 16) | ((
u32) addr[3] << 24));
4404 rar_high = ((
u32) addr[4] | ((
u32) addr[5] << 8));
4463 static void e1000_clear_vfta(
struct e1000_hw *hw)
4467 u32 vfta_offset = 0;
4468 u32 vfta_bit_in_reg = 0;
4474 vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
4483 const u32 ledctl_mask = 0x000000FF;
4489 e_dbg(
"e1000_id_led_init");
4496 ledctl =
er32(LEDCTL);
4502 e_dbg(
"EEPROM Read Error\n");
4511 for (i = 0; i < 4; i++) {
4512 temp = (eeprom_data >> (i << 2)) &
led_mask;
4562 e_dbg(
"e1000_setup_led");
4588 ledctl =
er32(LEDCTL);
4597 ew32(LEDCTL, ledctl);
4614 e_dbg(
"e1000_cleanup_led");
4650 e_dbg(
"e1000_led_on");
4696 e_dbg(
"e1000_led_off");
4738 static void e1000_clear_hw_cntrs(
struct e1000_hw *hw)
4742 temp =
er32(CRCERRS);
4743 temp =
er32(SYMERRS);
4748 temp =
er32(LATECOL);
4753 temp =
er32(XONRXC);
4754 temp =
er32(XONTXC);
4755 temp =
er32(XOFFRXC);
4756 temp =
er32(XOFFTXC);
4760 temp =
er32(PRC127);
4761 temp =
er32(PRC255);
4762 temp =
er32(PRC511);
4763 temp =
er32(PRC1023);
4764 temp =
er32(PRC1522);
4787 temp =
er32(PTC127);
4788 temp =
er32(PTC255);
4789 temp =
er32(PTC511);
4790 temp =
er32(PTC1023);
4791 temp =
er32(PTC1522);
4799 temp =
er32(ALGNERRC);
4800 temp =
er32(RXERRC);
4802 temp =
er32(CEXTERR);
4804 temp =
er32(TSCTFC);
4809 temp =
er32(MGTPRC);
4810 temp =
er32(MGTPDC);
4811 temp =
er32(MGTPTC);
4825 e_dbg(
"e1000_reset_adaptive");
4838 e_dbg(
"Not in Adaptive IFS mode!\n");
4853 e_dbg(
"e1000_update_adaptive");
4878 e_dbg(
"Not in Adaptive IFS mode!\n");
4907 carry_bit = 0x80000000 & stats->
gorcl;
4908 stats->
gorcl += frame_len;
4916 if (carry_bit && ((stats->
gorcl & 0x80000000) == 0))
4922 if ((mac_addr[0] == (
u8) 0xff) && (mac_addr[1] == (
u8) 0xff))
4925 else if (*mac_addr & 0x01)
4940 if (frame_len == 64) {
4943 }
else if (frame_len == 127) {
4946 }
else if (frame_len == 255) {
4949 }
else if (frame_len == 511) {
4952 }
else if (frame_len == 1023) {
4955 }
else if (frame_len == 1522) {
5022 unsigned long io_data = hw->
io_base + 4;
5042 static s32 e1000_get_cable_length(
struct e1000_hw *hw,
u16 *min_length,
5050 e_dbg(
"e1000_get_cable_length");
5052 *min_length = *max_length = 0;
5065 switch (cable_length) {
5110 if ((cur_agc_value >=
5112 || (cur_agc_value == 0))
5115 agc_value += cur_agc_value;
5118 if (min_agc_value > cur_agc_value)
5119 min_agc_value = cur_agc_value;
5125 agc_value -= min_agc_value;
5128 agc_value /= (IGP01E1000_PHY_CHANNEL_NUM - 1);
5135 *min_length = ((e1000_igp_cable_length_table[agc_value] -
5137 (e1000_igp_cable_length_table[agc_value] -
5139 *max_length = e1000_igp_cable_length_table[agc_value] +
5161 static s32 e1000_check_polarity(
struct e1000_hw *hw,
5167 e_dbg(
"e1000_check_polarity");
5188 if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) ==
5228 static s32 e1000_check_downshift(
struct e1000_hw *hw)
5233 e_dbg(
"e1000_check_downshift");
5263 static s32 e1000_1000Mb_check_cable_length(
struct e1000_hw *hw)
5265 u16 min_length, max_length;
5269 ret_val = e1000_get_cable_length(hw, &min_length, &max_length);
5300 for (i = 0; i < ffe_idle_err_timeout; i++) {
5320 ffe_idle_err_timeout =
5343 u16 phy_data, phy_saved_data, speed,
duplex,
i;
5345 e_dbg(
"e1000_config_dsp_after_link_change");
5353 e_dbg(
"Error getting link speed and duplex\n");
5358 ret_val = e1000_1000Mb_check_cable_length(hw);
5473 static s32 e1000_set_phy_mode(
struct e1000_hw *hw)
5478 e_dbg(
"e1000_set_phy_mode");
5526 e_dbg(
"e1000_set_d3_lplu_state");
5623 static s32 e1000_set_vco_speed(
struct e1000_hw *hw)
5626 u16 default_page = 0;
5629 e_dbg(
"e1000_set_vco_speed");
5706 static s32 e1000_polarity_reversal_workaround(
struct e1000_hw *hw)
5741 if ((mii_status_reg & ~MII_SR_LINK_STATUS) == 0)
5785 if (mii_status_reg & MII_SR_LINK_STATUS)
5800 static s32 e1000_get_auto_rd_done(
struct e1000_hw *hw)
5802 e_dbg(
"e1000_get_auto_rd_done");
5815 static s32 e1000_get_phy_cfg_done(
struct e1000_hw *hw)
5817 e_dbg(
"e1000_get_phy_cfg_done");