e1000_82540.c File Reference

#include "e1000_api.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
static s32 e1000_init_phy_params_82540 (struct e1000_hw *hw)
 e1000_init_phy_params_82540 - Init PHY func ptrs.
static s32 e1000_init_nvm_params_82540 (struct e1000_hw *hw)
 e1000_init_nvm_params_82540 - Init NVM func ptrs.
static s32 e1000_init_mac_params_82540 (struct e1000_hw *hw)
 e1000_init_mac_params_82540 - Init MAC func ptrs.
static s32 e1000_adjust_serdes_amplitude_82540 (struct e1000_hw *hw)
 e1000_adjust_serdes_amplitude_82540 - Adjust amplitude based on EEPROM : pointer to the HW structure
static void e1000_clear_hw_cntrs_82540 (struct e1000_hw *hw)
 e1000_clear_hw_cntrs_82540 - Clear device specific hardware counters : pointer to the HW structure
static s32 e1000_init_hw_82540 (struct e1000_hw *hw)
 e1000_init_hw_82540 - Initialize hardware : pointer to the HW structure
static s32 e1000_reset_hw_82540 (struct e1000_hw *hw)
 e1000_reset_hw_82540 - Reset hardware : pointer to the HW structure
static s32 e1000_set_phy_mode_82540 (struct e1000_hw *hw)
 e1000_set_phy_mode_82540 - Set PHY to class A mode : pointer to the HW structure
static s32 e1000_set_vco_speed_82540 (struct e1000_hw *hw)
 e1000_set_vco_speed_82540 - Set VCO speed for better performance : pointer to the HW structure
static s32 e1000_setup_copper_link_82540 (struct e1000_hw *hw)
 e1000_setup_copper_link_82540 - Configure copper link settings : pointer to the HW structure
static s32 e1000_setup_fiber_serdes_link_82540 (struct e1000_hw *hw)
 e1000_setup_fiber_serdes_link_82540 - Setup link for fiber/serdes : pointer to the HW structure
static void e1000_power_down_phy_copper_82540 (struct e1000_hw *hw)
 e1000_power_down_phy_copper_82540 - Remove link in case of PHY power down : pointer to the HW structure
static s32 e1000_read_mac_addr_82540 (struct e1000_hw *hw)
 e1000_read_mac_addr_82540 - Read device MAC address : pointer to the HW structure
void e1000_init_function_pointers_82540 (struct e1000_hw *hw)
 e1000_init_function_pointers_82540 - Init func ptrs.

Variables

static struct pci_device_id e1000_82540_nics []
struct pci_driver
e1000_82540_driver 
__pci_driver


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

static s32 e1000_init_phy_params_82540 ( struct e1000_hw hw  )  [static]

e1000_init_phy_params_82540 - Init PHY func ptrs.

: pointer to the HW structure

Definition at line 62 of file e1000_82540.c.

References e1000_phy_info::addr, AUTONEG_ADVERTISE_SPEED_DEFAULT, e1000_phy_info::autoneg_mask, e1000_phy_operations::check_polarity, e1000_phy_operations::commit, e1000_82540, e1000_82545, e1000_82545_rev_3, e1000_82546, e1000_82546_rev_3, e1000_check_polarity_m88(), E1000_ERR_PHY, e1000_get_cfg_done_generic(), e1000_get_phy_id(), e1000_get_phy_info_m88(), e1000_phy_hw_reset_generic(), e1000_phy_m88, e1000_phy_sw_reset_generic(), e1000_power_down_phy_copper_82540(), e1000_power_up_phy_copper(), e1000_read_phy_reg_m88(), E1000_SUCCESS, e1000_write_phy_reg_m88(), e1000_phy_operations::get_cfg_done, e1000_phy_operations::get_info, e1000_phy_info::id, M88E1011_I_PHY_ID, e1000_hw::mac, e1000_phy_info::ops, e1000_hw::phy, e1000_phy_operations::power_down, e1000_phy_operations::power_up, e1000_phy_operations::read_reg, e1000_phy_operations::reset, e1000_phy_info::reset_delay_us, e1000_mac_info::type, e1000_phy_info::type, and e1000_phy_operations::write_reg.

Referenced by e1000_init_function_pointers_82540().

00063 {
00064         struct e1000_phy_info *phy = &hw->phy;
00065         s32 ret_val = E1000_SUCCESS;
00066 
00067         phy->addr                      = 1;
00068         phy->autoneg_mask              = AUTONEG_ADVERTISE_SPEED_DEFAULT;
00069         phy->reset_delay_us            = 10000;
00070         phy->type                      = e1000_phy_m88;
00071 
00072         /* Function Pointers */
00073         phy->ops.check_polarity        = e1000_check_polarity_m88;
00074         phy->ops.commit                = e1000_phy_sw_reset_generic;
00075 #if 0
00076         phy->ops.force_speed_duplex    = e1000_phy_force_speed_duplex_m88;
00077 #endif
00078 #if 0
00079         phy->ops.get_cable_length      = e1000_get_cable_length_m88;
00080 #endif
00081         phy->ops.get_cfg_done          = e1000_get_cfg_done_generic;
00082         phy->ops.read_reg              = e1000_read_phy_reg_m88;
00083         phy->ops.reset                 = e1000_phy_hw_reset_generic;
00084         phy->ops.write_reg             = e1000_write_phy_reg_m88;
00085         phy->ops.get_info              = e1000_get_phy_info_m88;
00086         phy->ops.power_up              = e1000_power_up_phy_copper;
00087         phy->ops.power_down            = e1000_power_down_phy_copper_82540;
00088 
00089         ret_val = e1000_get_phy_id(hw);
00090         if (ret_val)
00091                 goto out;
00092 
00093         /* Verify phy id */
00094         switch (hw->mac.type) {
00095         case e1000_82540:
00096         case e1000_82545:
00097         case e1000_82545_rev_3:
00098         case e1000_82546:
00099         case e1000_82546_rev_3:
00100                 if (phy->id == M88E1011_I_PHY_ID)
00101                         break;
00102                 /* Fall Through */
00103         default:
00104                 ret_val = -E1000_ERR_PHY;
00105                 goto out;
00106                 break;
00107         }
00108 
00109 out:
00110         return ret_val;
00111 }

static s32 e1000_init_nvm_params_82540 ( struct e1000_hw hw  )  [static]

e1000_init_nvm_params_82540 - Init NVM func ptrs.

: pointer to the HW structure

Definition at line 117 of file e1000_82540.c.

References e1000_nvm_operations::acquire, e1000_nvm_info::address_bits, DEBUGFUNC, e1000_nvm_info::delay_usec, e1000_acquire_nvm_generic(), E1000_EECD, E1000_EECD_SIZE, e1000_nvm_eeprom_microwire, e1000_nvm_override_microwire_large, e1000_nvm_override_microwire_small, e1000_read_nvm_microwire(), E1000_READ_REG, e1000_release_nvm_generic(), E1000_SUCCESS, e1000_update_nvm_checksum_generic(), e1000_valid_led_default_generic(), e1000_validate_nvm_checksum_generic(), e1000_write_nvm_microwire(), e1000_hw::nvm, e1000_nvm_info::opcode_bits, e1000_nvm_info::ops, e1000_nvm_info::override, e1000_nvm_operations::read, e1000_nvm_operations::release, e1000_nvm_info::type, u32, e1000_nvm_operations::update, e1000_nvm_operations::valid_led_default, e1000_nvm_operations::validate, e1000_nvm_info::word_size, and e1000_nvm_operations::write.

Referenced by e1000_init_function_pointers_82540().

00118 {
00119         struct e1000_nvm_info *nvm = &hw->nvm;
00120         u32 eecd = E1000_READ_REG(hw, E1000_EECD);
00121 
00122         DEBUGFUNC("e1000_init_nvm_params_82540");
00123 
00124         nvm->type               = e1000_nvm_eeprom_microwire;
00125         nvm->delay_usec         = 50;
00126         nvm->opcode_bits        = 3;
00127         switch (nvm->override) {
00128         case e1000_nvm_override_microwire_large:
00129                 nvm->address_bits       = 8;
00130                 nvm->word_size          = 256;
00131                 break;
00132         case e1000_nvm_override_microwire_small:
00133                 nvm->address_bits       = 6;
00134                 nvm->word_size          = 64;
00135                 break;
00136         default:
00137                 nvm->address_bits       = eecd & E1000_EECD_SIZE ? 8 : 6;
00138                 nvm->word_size          = eecd & E1000_EECD_SIZE ? 256 : 64;
00139                 break;
00140         }
00141 
00142         /* Function Pointers */
00143         nvm->ops.acquire            = e1000_acquire_nvm_generic;
00144         nvm->ops.read               = e1000_read_nvm_microwire;
00145         nvm->ops.release            = e1000_release_nvm_generic;
00146         nvm->ops.update             = e1000_update_nvm_checksum_generic;
00147         nvm->ops.valid_led_default  = e1000_valid_led_default_generic;
00148         nvm->ops.validate           = e1000_validate_nvm_checksum_generic;
00149         nvm->ops.write              = e1000_write_nvm_microwire;
00150 
00151         return E1000_SUCCESS;
00152 }

static s32 e1000_init_mac_params_82540 ( struct e1000_hw hw  )  [static]

e1000_init_mac_params_82540 - Init MAC func ptrs.

: pointer to the HW structure

Definition at line 158 of file e1000_82540.c.

References e1000_mac_operations::check_for_link, e1000_mac_operations::cleanup_led, e1000_mac_operations::clear_hw_cntrs, e1000_mac_operations::clear_vfta, DEBUGFUNC, e1000_hw::device_id, e1000_check_for_copper_link_generic(), e1000_check_for_fiber_link_generic(), e1000_check_for_serdes_link_generic(), e1000_cleanup_led_generic(), e1000_clear_hw_cntrs_82540(), e1000_clear_vfta_generic(), E1000_DEV_ID_82545EM_FIBER, E1000_DEV_ID_82545GM_FIBER, E1000_DEV_ID_82545GM_SERDES, E1000_DEV_ID_82546EB_FIBER, E1000_DEV_ID_82546GB_FIBER, E1000_DEV_ID_82546GB_SERDES, E1000_ERR_CONFIG, e1000_get_bus_info_pci_generic(), e1000_get_speed_and_duplex_copper_generic(), e1000_get_speed_and_duplex_fiber_serdes_generic(), e1000_id_led_init_generic(), e1000_init_hw_82540(), e1000_led_off_generic(), e1000_led_on_generic(), e1000_media_type_copper, e1000_media_type_fiber, e1000_media_type_internal_serdes, e1000_mta_set_generic(), E1000_RAR_ENTRIES, e1000_read_mac_addr_82540(), e1000_reset_hw_82540(), e1000_set_lan_id_multi_port_pci(), e1000_setup_copper_link_82540(), e1000_setup_fiber_serdes_link_82540(), e1000_setup_led_generic(), e1000_setup_link_generic(), E1000_SUCCESS, e1000_update_mc_addr_list_generic(), e1000_write_vfta_generic(), e1000_mac_operations::get_bus_info, e1000_mac_operations::get_link_up_info, e1000_mac_operations::id_led_init, e1000_mac_operations::init_hw, e1000_mac_operations::led_off, e1000_mac_operations::led_on, e1000_hw::mac, e1000_phy_info::media_type, e1000_mac_info::mta_reg_count, e1000_mac_operations::mta_set, e1000_mac_info::ops, e1000_hw::phy, e1000_mac_info::rar_entry_count, e1000_mac_operations::read_mac_addr, e1000_mac_operations::reset_hw, e1000_mac_operations::set_lan_id, e1000_mac_operations::setup_led, e1000_mac_operations::setup_link, e1000_mac_operations::setup_physical_interface, e1000_mac_operations::update_mc_addr_list, and e1000_mac_operations::write_vfta.

Referenced by e1000_init_function_pointers_82540().

00159 {
00160         struct e1000_mac_info *mac = &hw->mac;
00161         s32 ret_val = E1000_SUCCESS;
00162 
00163         DEBUGFUNC("e1000_init_mac_params_82540");
00164 
00165         /* Set media type */
00166         switch (hw->device_id) {
00167         case E1000_DEV_ID_82545EM_FIBER:
00168         case E1000_DEV_ID_82545GM_FIBER:
00169         case E1000_DEV_ID_82546EB_FIBER:
00170         case E1000_DEV_ID_82546GB_FIBER:
00171                 hw->phy.media_type = e1000_media_type_fiber;
00172                 break;
00173         case E1000_DEV_ID_82545GM_SERDES:
00174         case E1000_DEV_ID_82546GB_SERDES:
00175                 hw->phy.media_type = e1000_media_type_internal_serdes;
00176                 break;
00177         default:
00178                 hw->phy.media_type = e1000_media_type_copper;
00179                 break;
00180         }
00181 
00182         /* Set mta register count */
00183         mac->mta_reg_count = 128;
00184         /* Set rar entry count */
00185         mac->rar_entry_count = E1000_RAR_ENTRIES;
00186 
00187         /* Function pointers */
00188 
00189         /* bus type/speed/width */
00190         mac->ops.get_bus_info = e1000_get_bus_info_pci_generic;
00191         /* function id */
00192         mac->ops.set_lan_id = e1000_set_lan_id_multi_port_pci;
00193         /* reset */
00194         mac->ops.reset_hw = e1000_reset_hw_82540;
00195         /* hw initialization */
00196         mac->ops.init_hw = e1000_init_hw_82540;
00197         /* link setup */
00198         mac->ops.setup_link = e1000_setup_link_generic;
00199         /* physical interface setup */
00200         mac->ops.setup_physical_interface =
00201                 (hw->phy.media_type == e1000_media_type_copper)
00202                         ? e1000_setup_copper_link_82540
00203                         : e1000_setup_fiber_serdes_link_82540;
00204         /* check for link */
00205         switch (hw->phy.media_type) {
00206         case e1000_media_type_copper:
00207                 mac->ops.check_for_link = e1000_check_for_copper_link_generic;
00208                 break;
00209         case e1000_media_type_fiber:
00210                 mac->ops.check_for_link = e1000_check_for_fiber_link_generic;
00211                 break;
00212         case e1000_media_type_internal_serdes:
00213                 mac->ops.check_for_link = e1000_check_for_serdes_link_generic;
00214                 break;
00215         default:
00216                 ret_val = -E1000_ERR_CONFIG;
00217                 goto out;
00218                 break;
00219         }
00220         /* link info */
00221         mac->ops.get_link_up_info =
00222                 (hw->phy.media_type == e1000_media_type_copper)
00223                         ? e1000_get_speed_and_duplex_copper_generic
00224                         : e1000_get_speed_and_duplex_fiber_serdes_generic;
00225         /* multicast address update */
00226         mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic;
00227         /* writing VFTA */
00228         mac->ops.write_vfta = e1000_write_vfta_generic;
00229         /* clearing VFTA */
00230         mac->ops.clear_vfta = e1000_clear_vfta_generic;
00231         /* setting MTA */
00232         mac->ops.mta_set = e1000_mta_set_generic;
00233         /* read mac address */
00234         mac->ops.read_mac_addr = e1000_read_mac_addr_82540;
00235         /* ID LED init */
00236         mac->ops.id_led_init = e1000_id_led_init_generic;
00237         /* setup LED */
00238         mac->ops.setup_led = e1000_setup_led_generic;
00239         /* cleanup LED */
00240         mac->ops.cleanup_led = e1000_cleanup_led_generic;
00241         /* turn on/off LED */
00242         mac->ops.led_on = e1000_led_on_generic;
00243         mac->ops.led_off = e1000_led_off_generic;
00244         /* clear hardware counters */
00245         mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82540;
00246 
00247 out:
00248         return ret_val;
00249 }

static s32 e1000_adjust_serdes_amplitude_82540 ( struct e1000_hw hw  )  [static]

e1000_adjust_serdes_amplitude_82540 - Adjust amplitude based on EEPROM : pointer to the HW structure

Adjust the SERDES output amplitude based on the EEPROM settings.

Definition at line 499 of file e1000_82540.c.

References DEBUGFUNC, E1000_SUCCESS, M88E1000_PHY_EXT_CTRL, e1000_hw::nvm, NVM_RESERVED_WORD, NVM_SERDES_AMPLITUDE, NVM_SERDES_AMPLITUDE_MASK, e1000_phy_info::ops, e1000_nvm_info::ops, e1000_hw::phy, e1000_nvm_operations::read, u16, and e1000_phy_operations::write_reg.

Referenced by e1000_setup_fiber_serdes_link_82540().

00500 {
00501         s32 ret_val = E1000_SUCCESS;
00502         u16 nvm_data;
00503 
00504         DEBUGFUNC("e1000_adjust_serdes_amplitude_82540");
00505 
00506         ret_val = hw->nvm.ops.read(hw, NVM_SERDES_AMPLITUDE, 1, &nvm_data);
00507         if (ret_val)
00508                 goto out;
00509 
00510         if (nvm_data != NVM_RESERVED_WORD) {
00511                 /* Adjust serdes output amplitude only. */
00512                 nvm_data &= NVM_SERDES_AMPLITUDE_MASK;
00513                 ret_val = hw->phy.ops.write_reg(hw,
00514                                              M88E1000_PHY_EXT_CTRL,
00515                                              nvm_data);
00516                 if (ret_val)
00517                         goto out;
00518         }
00519 
00520 out:
00521         return ret_val;
00522 }

static void e1000_clear_hw_cntrs_82540 ( struct e1000_hw hw  )  [static]

e1000_clear_hw_cntrs_82540 - Clear device specific hardware counters : pointer to the HW structure

Clears the hardware counters by reading the counter registers.

Definition at line 651 of file e1000_82540.c.

References DEBUGFUNC, E1000_ALGNERRC, E1000_CEXTERR, e1000_clear_hw_cntrs_base_generic(), E1000_MGTPDC, E1000_MGTPRC, E1000_MGTPTC, E1000_PRC1023, E1000_PRC127, E1000_PRC1522, E1000_PRC255, E1000_PRC511, E1000_PRC64, E1000_PTC1023, E1000_PTC127, E1000_PTC1522, E1000_PTC255, E1000_PTC511, E1000_PTC64, E1000_READ_REG, E1000_RXERRC, E1000_TNCRS, E1000_TSCTC, and E1000_TSCTFC.

Referenced by e1000_init_hw_82540(), and e1000_init_mac_params_82540().

00652 {
00653         DEBUGFUNC("e1000_clear_hw_cntrs_82540");
00654 
00655         e1000_clear_hw_cntrs_base_generic(hw);
00656 
00657 #if 0
00658         E1000_READ_REG(hw, E1000_PRC64);
00659         E1000_READ_REG(hw, E1000_PRC127);
00660         E1000_READ_REG(hw, E1000_PRC255);
00661         E1000_READ_REG(hw, E1000_PRC511);
00662         E1000_READ_REG(hw, E1000_PRC1023);
00663         E1000_READ_REG(hw, E1000_PRC1522);
00664         E1000_READ_REG(hw, E1000_PTC64);
00665         E1000_READ_REG(hw, E1000_PTC127);
00666         E1000_READ_REG(hw, E1000_PTC255);
00667         E1000_READ_REG(hw, E1000_PTC511);
00668         E1000_READ_REG(hw, E1000_PTC1023);
00669         E1000_READ_REG(hw, E1000_PTC1522);
00670 
00671         E1000_READ_REG(hw, E1000_ALGNERRC);
00672         E1000_READ_REG(hw, E1000_RXERRC);
00673         E1000_READ_REG(hw, E1000_TNCRS);
00674         E1000_READ_REG(hw, E1000_CEXTERR);
00675         E1000_READ_REG(hw, E1000_TSCTC);
00676         E1000_READ_REG(hw, E1000_TSCTFC);
00677 
00678         E1000_READ_REG(hw, E1000_MGTPRC);
00679         E1000_READ_REG(hw, E1000_MGTPDC);
00680         E1000_READ_REG(hw, E1000_MGTPTC);
00681 #endif
00682 }

static s32 e1000_init_hw_82540 ( struct e1000_hw hw  )  [static]

e1000_init_hw_82540 - Initialize hardware : pointer to the HW structure

This inits the hardware readying it for operation.

Definition at line 330 of file e1000_82540.c.

References e1000_mac_operations::clear_vfta, DEBUGFUNC, DEBUGOUT, e1000_hw::device_id, e1000_82545_rev_3, e1000_clear_hw_cntrs_82540(), E1000_CTRL_EXT, E1000_CTRL_EXT_RO_DIS, E1000_DEV_ID_82546GB_QUAD_COPPER, E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3, e1000_init_rx_addrs_generic(), E1000_MTA, e1000_pcix_mmrbc_workaround_generic(), E1000_READ_REG, E1000_SUCCESS, E1000_TXDCTL, E1000_TXDCTL_FULL_TX_DESC_WB, E1000_TXDCTL_WTHRESH, E1000_VET, E1000_WRITE_FLUSH, E1000_WRITE_REG, E1000_WRITE_REG_ARRAY, e1000_mac_operations::id_led_init, e1000_hw::mac, e1000_mac_info::mta_reg_count, e1000_mac_info::ops, e1000_mac_info::rar_entry_count, e1000_mac_operations::setup_link, e1000_mac_info::type, u16, and u32.

Referenced by e1000_init_mac_params_82540().

00331 {
00332         struct e1000_mac_info *mac = &hw->mac;
00333         u32 txdctl, ctrl_ext;
00334         s32 ret_val = E1000_SUCCESS;
00335         u16 i;
00336 
00337         DEBUGFUNC("e1000_init_hw_82540");
00338 
00339         /* Initialize identification LED */
00340         ret_val = mac->ops.id_led_init(hw);
00341         if (ret_val) {
00342                 DEBUGOUT("Error initializing identification LED\n");
00343                 /* This is not fatal and we should not stop init due to this */
00344         }
00345 
00346         /* Disabling VLAN filtering */
00347         DEBUGOUT("Initializing the IEEE VLAN\n");
00348         if (mac->type < e1000_82545_rev_3)
00349                 E1000_WRITE_REG(hw, E1000_VET, 0);
00350 
00351         mac->ops.clear_vfta(hw);
00352 
00353         /* Setup the receive address. */
00354         e1000_init_rx_addrs_generic(hw, mac->rar_entry_count);
00355 
00356         /* Zero out the Multicast HASH table */
00357         DEBUGOUT("Zeroing the MTA\n");
00358         for (i = 0; i < mac->mta_reg_count; i++) {
00359                 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
00360                 /*
00361                  * Avoid back to back register writes by adding the register
00362                  * read (flush).  This is to protect against some strange
00363                  * bridge configurations that may issue Memory Write Block
00364                  * (MWB) to our register space.  The *_rev_3 hardware at
00365                  * least doesn't respond correctly to every other dword in an
00366                  * MWB to our register space.
00367                  */
00368                 E1000_WRITE_FLUSH(hw);
00369         }
00370 
00371         if (mac->type < e1000_82545_rev_3)
00372                 e1000_pcix_mmrbc_workaround_generic(hw);
00373 
00374         /* Setup link and flow control */
00375         ret_val = mac->ops.setup_link(hw);
00376 
00377         txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0));
00378         txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) |
00379                  E1000_TXDCTL_FULL_TX_DESC_WB;
00380         E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl);
00381 
00382         /*
00383          * Clear all of the statistics registers (clear on read).  It is
00384          * important that we do this after we have tried to establish link
00385          * because the symbol error count will increment wildly if there
00386          * is no link.
00387          */
00388         e1000_clear_hw_cntrs_82540(hw);
00389 
00390         if ((hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER) ||
00391             (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3)) {
00392                 ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT);
00393                 /*
00394                  * Relaxed ordering must be disabled to avoid a parity
00395                  * error crash in a PCI slot.
00396                  */
00397                 ctrl_ext |= E1000_CTRL_EXT_RO_DIS;
00398                 E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext);
00399         }
00400 
00401         return ret_val;
00402 }

static s32 e1000_reset_hw_82540 ( struct e1000_hw hw  )  [static]

e1000_reset_hw_82540 - Reset hardware : pointer to the HW structure

This resets the hardware into a known state.

Definition at line 272 of file e1000_82540.c.

References DEBUGFUNC, DEBUGOUT, e1000_82545_rev_3, e1000_82546_rev_3, E1000_CTRL, E1000_CTRL_DUP, E1000_CTRL_RST, E1000_ICR, E1000_IMC, E1000_MANC, E1000_MANC_ARP_EN, E1000_RCTL, E1000_READ_REG, E1000_SUCCESS, E1000_TCTL, E1000_TCTL_PSP, E1000_WRITE_FLUSH, E1000_WRITE_REG, E1000_WRITE_REG_IO, e1000_hw::mac, msec_delay, e1000_mac_info::type, and u32.

Referenced by e1000_init_mac_params_82540().

00273 {
00274         u32 ctrl, icr, manc;
00275         s32 ret_val = E1000_SUCCESS;
00276 
00277         DEBUGFUNC("e1000_reset_hw_82540");
00278 
00279         DEBUGOUT("Masking off all interrupts\n");
00280         E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
00281 
00282         E1000_WRITE_REG(hw, E1000_RCTL, 0);
00283         E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP);
00284         E1000_WRITE_FLUSH(hw);
00285 
00286         /*
00287          * Delay to allow any outstanding PCI transactions to complete
00288          * before resetting the device.
00289          */
00290         msec_delay(10);
00291 
00292         ctrl = E1000_READ_REG(hw, E1000_CTRL);
00293 
00294         DEBUGOUT("Issuing a global reset to 82540/82545/82546 MAC\n");
00295         switch (hw->mac.type) {
00296         case e1000_82545_rev_3:
00297         case e1000_82546_rev_3:
00298                 E1000_WRITE_REG(hw, E1000_CTRL_DUP, ctrl | E1000_CTRL_RST);
00299                 break;
00300         default:
00301                 /*
00302                  * These controllers can't ack the 64-bit write when
00303                  * issuing the reset, so we use IO-mapping as a
00304                  * workaround to issue the reset.
00305                  */
00306                 E1000_WRITE_REG_IO(hw, E1000_CTRL, ctrl | E1000_CTRL_RST);
00307                 break;
00308         }
00309 
00310         /* Wait for EEPROM reload */
00311         msec_delay(5);
00312 
00313         /* Disable HW ARPs on ASF enabled adapters */
00314         manc = E1000_READ_REG(hw, E1000_MANC);
00315         manc &= ~E1000_MANC_ARP_EN;
00316         E1000_WRITE_REG(hw, E1000_MANC, manc);
00317 
00318         E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
00319         icr = E1000_READ_REG(hw, E1000_ICR);
00320 
00321         return ret_val;
00322 }

static s32 e1000_set_phy_mode_82540 ( struct e1000_hw hw  )  [static]

e1000_set_phy_mode_82540 - Set PHY to class A mode : pointer to the HW structure

Sets the PHY to class A mode and assumes the following operations will follow to enable the new class mode: 1. Do a PHY soft reset. 2. Restart auto-negotiation or force link.

Definition at line 590 of file e1000_82540.c.

References DEBUGFUNC, e1000_82545_rev_3, E1000_ERR_PHY, E1000_SUCCESS, M88E1000_PHY_GEN_CONTROL, M88E1000_PHY_PAGE_SELECT, e1000_hw::mac, e1000_hw::nvm, NVM_PHY_CLASS_A, NVM_PHY_CLASS_WORD, NVM_RESERVED_WORD, e1000_phy_info::ops, e1000_nvm_info::ops, e1000_hw::phy, e1000_nvm_operations::read, e1000_phy_info::reset_disable, e1000_mac_info::type, u16, and e1000_phy_operations::write_reg.

Referenced by e1000_setup_copper_link_82540().

00591 {
00592         struct e1000_phy_info *phy = &hw->phy;
00593         s32 ret_val = E1000_SUCCESS;
00594         u16 nvm_data;
00595 
00596         DEBUGFUNC("e1000_set_phy_mode_82540");
00597 
00598         if (hw->mac.type != e1000_82545_rev_3)
00599                 goto out;
00600 
00601         ret_val = hw->nvm.ops.read(hw, NVM_PHY_CLASS_WORD, 1, &nvm_data);
00602         if (ret_val) {
00603                 ret_val = -E1000_ERR_PHY;
00604                 goto out;
00605         }
00606 
00607         if ((nvm_data != NVM_RESERVED_WORD) && (nvm_data & NVM_PHY_CLASS_A)) {
00608                 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT,
00609                                               0x000B);
00610                 if (ret_val) {
00611                         ret_val = -E1000_ERR_PHY;
00612                         goto out;
00613                 }
00614                 ret_val = hw->phy.ops.write_reg(hw,
00615                                               M88E1000_PHY_GEN_CONTROL,
00616                                               0x8104);
00617                 if (ret_val) {
00618                         ret_val = -E1000_ERR_PHY;
00619                         goto out;
00620                 }
00621 
00622                 phy->reset_disable = false;
00623         }
00624 
00625 out:
00626         return ret_val;
00627 }

static s32 e1000_set_vco_speed_82540 ( struct e1000_hw hw  )  [static]

e1000_set_vco_speed_82540 - Set VCO speed for better performance : pointer to the HW structure

Set the VCO speed to improve Bit Error Rate (BER) performance.

Definition at line 530 of file e1000_82540.c.

References DEBUGFUNC, E1000_SUCCESS, M88E1000_PHY_GEN_CONTROL, M88E1000_PHY_PAGE_SELECT, M88E1000_PHY_VCO_REG_BIT11, M88E1000_PHY_VCO_REG_BIT8, e1000_phy_info::ops, e1000_hw::phy, e1000_phy_operations::read_reg, u16, and e1000_phy_operations::write_reg.

Referenced by e1000_setup_fiber_serdes_link_82540().

00531 {
00532         s32  ret_val = E1000_SUCCESS;
00533         u16 default_page = 0;
00534         u16 phy_data;
00535 
00536         DEBUGFUNC("e1000_set_vco_speed_82540");
00537 
00538         /* Set PHY register 30, page 5, bit 8 to 0 */
00539 
00540         ret_val = hw->phy.ops.read_reg(hw,
00541                                     M88E1000_PHY_PAGE_SELECT,
00542                                     &default_page);
00543         if (ret_val)
00544                 goto out;
00545 
00546         ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005);
00547         if (ret_val)
00548                 goto out;
00549 
00550         ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data);
00551         if (ret_val)
00552                 goto out;
00553 
00554         phy_data &= ~M88E1000_PHY_VCO_REG_BIT8;
00555         ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data);
00556         if (ret_val)
00557                 goto out;
00558 
00559         /* Set PHY register 30, page 4, bit 11 to 1 */
00560 
00561         ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004);
00562         if (ret_val)
00563                 goto out;
00564 
00565         ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data);
00566         if (ret_val)
00567                 goto out;
00568 
00569         phy_data |= M88E1000_PHY_VCO_REG_BIT11;
00570         ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data);
00571         if (ret_val)
00572                 goto out;
00573 
00574         ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT,
00575                                       default_page);
00576 
00577 out:
00578         return ret_val;
00579 }

static s32 e1000_setup_copper_link_82540 ( struct e1000_hw hw  )  [static]

e1000_setup_copper_link_82540 - Configure copper link settings : pointer to the HW structure

Calls the appropriate function to configure the link for auto-neg or forced speed and duplex. Then we check for link, once link is established calls to configure collision distance and flow control are called. If link is not established, we return -E1000_ERR_PHY (-2).

Definition at line 413 of file e1000_82540.c.

References DEBUGFUNC, e1000_82545_rev_3, e1000_82546_rev_3, e1000_copper_link_setup_m88(), E1000_CTRL, E1000_CTRL_FRCDPX, E1000_CTRL_FRCSPD, E1000_CTRL_SLU, E1000_READ_REG, e1000_set_phy_mode_82540(), e1000_setup_copper_link_generic(), E1000_SUCCESS, E1000_WRITE_REG, M88E1000_PHY_SPEC_CTRL, e1000_hw::mac, e1000_phy_info::ops, e1000_hw::phy, e1000_phy_operations::read_reg, e1000_mac_info::type, u16, u32, and e1000_phy_operations::write_reg.

Referenced by e1000_init_mac_params_82540().

00414 {
00415         u32 ctrl;
00416         s32 ret_val = E1000_SUCCESS;
00417         u16 data;
00418 
00419         DEBUGFUNC("e1000_setup_copper_link_82540");
00420 
00421         ctrl = E1000_READ_REG(hw, E1000_CTRL);
00422         ctrl |= E1000_CTRL_SLU;
00423         ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
00424         E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
00425 
00426         ret_val = e1000_set_phy_mode_82540(hw);
00427         if (ret_val)
00428                 goto out;
00429 
00430         if (hw->mac.type == e1000_82545_rev_3 ||
00431             hw->mac.type == e1000_82546_rev_3) {
00432                 ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &data);
00433                 if (ret_val)
00434                         goto out;
00435                 data |= 0x00000008;
00436                 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, data);
00437                 if (ret_val)
00438                         goto out;
00439         }
00440 
00441         ret_val = e1000_copper_link_setup_m88(hw);
00442         if (ret_val)
00443                 goto out;
00444 
00445         ret_val = e1000_setup_copper_link_generic(hw);
00446 
00447 out:
00448         return ret_val;
00449 }

static s32 e1000_setup_fiber_serdes_link_82540 ( struct e1000_hw hw  )  [static]

e1000_setup_fiber_serdes_link_82540 - Setup link for fiber/serdes : pointer to the HW structure

Set the output amplitude to the value in the EEPROM and adjust the VCO speed to improve Bit Error Rate (BER) performance. Configures collision distance and flow control for fiber and serdes links. Upon successful setup, poll for link.

Definition at line 460 of file e1000_82540.c.

References DEBUGFUNC, e1000_82545_rev_3, e1000_82546_rev_3, e1000_adjust_serdes_amplitude_82540(), e1000_media_type_internal_serdes, e1000_set_vco_speed_82540(), e1000_setup_fiber_serdes_link_generic(), E1000_SUCCESS, e1000_hw::mac, e1000_phy_info::media_type, e1000_hw::phy, and e1000_mac_info::type.

Referenced by e1000_init_mac_params_82540().

00461 {
00462         struct e1000_mac_info *mac = &hw->mac;
00463         s32 ret_val = E1000_SUCCESS;
00464 
00465         DEBUGFUNC("e1000_setup_fiber_serdes_link_82540");
00466 
00467         switch (mac->type) {
00468         case e1000_82545_rev_3:
00469         case e1000_82546_rev_3:
00470                 if (hw->phy.media_type == e1000_media_type_internal_serdes) {
00471                         /*
00472                          * If we're on serdes media, adjust the output
00473                          * amplitude to value set in the EEPROM.
00474                          */
00475                         ret_val = e1000_adjust_serdes_amplitude_82540(hw);
00476                         if (ret_val)
00477                                 goto out;
00478                 }
00479                 /* Adjust VCO speed to improve BER performance */
00480                 ret_val = e1000_set_vco_speed_82540(hw);
00481                 if (ret_val)
00482                         goto out;
00483         default:
00484                 break;
00485         }
00486 
00487         ret_val = e1000_setup_fiber_serdes_link_generic(hw);
00488 
00489 out:
00490         return ret_val;
00491 }

static void e1000_power_down_phy_copper_82540 ( struct e1000_hw hw  )  [static]

e1000_power_down_phy_copper_82540 - Remove link in case of PHY power down : pointer to the HW structure

In the case of a PHY power down to save power, or to turn off link during a driver unload, or wake on lan is not enabled, remove the link.

Definition at line 636 of file e1000_82540.c.

References E1000_MANC, E1000_MANC_SMBUS_EN, e1000_power_down_phy_copper(), and E1000_READ_REG.

Referenced by e1000_init_phy_params_82540().

00637 {
00638         /* If the management interface is not enabled, then power down */
00639         if (!(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_SMBUS_EN))
00640                 e1000_power_down_phy_copper(hw);
00641 
00642         return;
00643 }

s32 e1000_read_mac_addr_82540 ( struct e1000_hw hw  )  [static]

e1000_read_mac_addr_82540 - Read device MAC address : pointer to the HW structure

Reads the device MAC address from the EEPROM and stores the value. Since devices with two ports use the same EEPROM, we increment the last bit in the MAC address for the second port.

This version is being used over generic because of customer issues with VmWare and Virtual Box when using generic. It seems in the emulated 82545, RAR[0] does NOT have a valid address after a reset, this older method works and using this breaks nothing for these legacy adapters.

Definition at line 698 of file e1000_82540.c.

References e1000_mac_info::addr, e1000_hw::bus, DEBUGFUNC, DEBUGOUT, E1000_FUNC_1, E1000_SUCCESS, ETH_ADDR_LEN, e1000_bus_info::func, e1000_hw::mac, e1000_hw::nvm, offset, e1000_nvm_info::ops, e1000_mac_info::perm_addr, e1000_nvm_operations::read, u16, and u8.

Referenced by e1000_init_mac_params_82540().

00699 {
00700         s32  ret_val = E1000_SUCCESS;
00701         u16 offset, nvm_data, i;
00702 
00703         DEBUGFUNC("e1000_read_mac_addr");
00704 
00705         for (i = 0; i < ETH_ADDR_LEN; i += 2) {
00706                 offset = i >> 1;
00707                 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
00708                 if (ret_val) {
00709                         DEBUGOUT("NVM Read Error\n");
00710                         goto out;
00711                 }
00712                 hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
00713                 hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
00714         }
00715 
00716         /* Flip last bit of mac address if we're on second port */
00717         if (hw->bus.func == E1000_FUNC_1)
00718                 hw->mac.perm_addr[5] ^= 1;
00719 
00720         for (i = 0; i < ETH_ADDR_LEN; i++)
00721                 hw->mac.addr[i] = hw->mac.perm_addr[i];
00722 
00723 out:
00724         return ret_val;
00725 }

void e1000_init_function_pointers_82540 ( struct e1000_hw hw  ) 

e1000_init_function_pointers_82540 - Init func ptrs.

: pointer to the HW structure

Called to initialize all function pointers and parameters.

Definition at line 257 of file e1000_82540.c.

References DEBUGFUNC, e1000_init_mac_params_82540(), e1000_init_nvm_params_82540(), e1000_init_phy_params_82540(), e1000_phy_operations::init_params, e1000_nvm_operations::init_params, e1000_mac_operations::init_params, e1000_hw::mac, e1000_hw::nvm, e1000_phy_info::ops, e1000_nvm_info::ops, e1000_mac_info::ops, and e1000_hw::phy.

Referenced by e1000_setup_init_funcs().

00258 {
00259         DEBUGFUNC("e1000_init_function_pointers_82540");
00260 
00261         hw->mac.ops.init_params = e1000_init_mac_params_82540;
00262         hw->nvm.ops.init_params = e1000_init_nvm_params_82540;
00263         hw->phy.ops.init_params = e1000_init_phy_params_82540;
00264 }


Variable Documentation

struct pci_device_id e1000_82540_nics[] [static]

Initial value:

 {
     PCI_ROM(0x8086, 0x100E, "E1000_DEV_ID_82540EM", "E1000_DEV_ID_82540EM", e1000_82540),
     PCI_ROM(0x8086, 0x1015, "E1000_DEV_ID_82540EM_LOM", "E1000_DEV_ID_82540EM_LOM", e1000_82540),
     PCI_ROM(0x8086, 0x1016, "E1000_DEV_ID_82540EP_LOM", "E1000_DEV_ID_82540EP_LOM", e1000_82540),
     PCI_ROM(0x8086, 0x1017, "E1000_DEV_ID_82540EP", "E1000_DEV_ID_82540EP", e1000_82540),
     PCI_ROM(0x8086, 0x101E, "E1000_DEV_ID_82540EP_LP", "E1000_DEV_ID_82540EP_LP", e1000_82540),
     PCI_ROM(0x8086, 0x100F, "E1000_DEV_ID_82545EM_COPPER", "E1000_DEV_ID_82545EM_COPPER", e1000_82545),
     PCI_ROM(0x8086, 0x1011, "E1000_DEV_ID_82545EM_FIBER", "E1000_DEV_ID_82545EM_FIBER", e1000_82545),
     PCI_ROM(0x8086, 0x1026, "E1000_DEV_ID_82545GM_COPPER", "E1000_DEV_ID_82545GM_COPPER", e1000_82545_rev_3),
     PCI_ROM(0x8086, 0x1027, "E1000_DEV_ID_82545GM_FIBER", "E1000_DEV_ID_82545GM_FIBER", e1000_82545_rev_3),
     PCI_ROM(0x8086, 0x1028, "E1000_DEV_ID_82545GM_SERDES", "E1000_DEV_ID_82545GM_SERDES", e1000_82545_rev_3),
     PCI_ROM(0x8086, 0x1010, "E1000_DEV_ID_82546EB_COPPER", "E1000_DEV_ID_82546EB_COPPER", e1000_82546),
     PCI_ROM(0x8086, 0x1012, "E1000_DEV_ID_82546EB_FIBER", "E1000_DEV_ID_82546EB_FIBER", e1000_82546),
     PCI_ROM(0x8086, 0x101D, "E1000_DEV_ID_82546EB_QUAD_COPPER", "E1000_DEV_ID_82546EB_QUAD_COPPER", e1000_82546),
     PCI_ROM(0x8086, 0x1079, "E1000_DEV_ID_82546GB_COPPER", "E1000_DEV_ID_82546GB_COPPER", e1000_82546_rev_3),
     PCI_ROM(0x8086, 0x107A, "E1000_DEV_ID_82546GB_FIBER", "E1000_DEV_ID_82546GB_FIBER", e1000_82546_rev_3),
     PCI_ROM(0x8086, 0x107B, "E1000_DEV_ID_82546GB_SERDES", "E1000_DEV_ID_82546GB_SERDES", e1000_82546_rev_3),
     PCI_ROM(0x8086, 0x108A, "E1000_DEV_ID_82546GB_PCIE", "E1000_DEV_ID_82546GB_PCIE", e1000_82546_rev_3),
     PCI_ROM(0x8086, 0x1099, "E1000_DEV_ID_82546GB_QUAD_COPPER", "E1000_DEV_ID_82546GB_QUAD_COPPER", e1000_82546_rev_3),
     PCI_ROM(0x8086, 0x10B5, "E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3", "E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3", e1000_82546_rev_3),
}

Definition at line 727 of file e1000_82540.c.

struct pci_driver e1000_82540_driver __pci_driver

Initial value:

 {
        .ids = e1000_82540_nics,
        .id_count = (sizeof (e1000_82540_nics) / sizeof (e1000_82540_nics[0])),
        .probe = e1000_probe,
        .remove = e1000_remove,
}

Definition at line 749 of file e1000_82540.c.


Generated on Tue Apr 6 20:01:23 2010 for gPXE by  doxygen 1.5.7.1