Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/e1000/e1000_82575.c
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw); | static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw); | ||||
static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw); | static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw); | ||||
static s32 e1000_get_media_type_82575(struct e1000_hw *hw); | static s32 e1000_get_media_type_82575(struct e1000_hw *hw); | ||||
static s32 e1000_set_sfp_media_type_82575(struct e1000_hw *hw); | static s32 e1000_set_sfp_media_type_82575(struct e1000_hw *hw); | ||||
static s32 e1000_valid_led_default_82575(struct e1000_hw *hw, u16 *data); | static s32 e1000_valid_led_default_82575(struct e1000_hw *hw, u16 *data); | ||||
static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, | static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, | ||||
u32 offset, u16 data); | u32 offset, u16 data); | ||||
static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw); | static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw); | ||||
static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask); | |||||
static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, | static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, | ||||
u16 *speed, u16 *duplex); | u16 *speed, u16 *duplex); | ||||
static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); | static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); | ||||
static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask); | |||||
static bool e1000_sgmii_active_82575(struct e1000_hw *hw); | static bool e1000_sgmii_active_82575(struct e1000_hw *hw); | ||||
static s32 e1000_reset_init_script_82575(struct e1000_hw *hw); | static s32 e1000_reset_init_script_82575(struct e1000_hw *hw); | ||||
static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); | static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); | ||||
static void e1000_config_collision_dist_82575(struct e1000_hw *hw); | static void e1000_config_collision_dist_82575(struct e1000_hw *hw); | ||||
static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw); | static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw); | ||||
static void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw); | static void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw); | ||||
static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw); | static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw); | ||||
static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw); | static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw); | ||||
▲ Show 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) | ||||
/* turn on/off LED */ | /* turn on/off LED */ | ||||
mac->ops.led_on = e1000_led_on_generic; | mac->ops.led_on = e1000_led_on_generic; | ||||
mac->ops.led_off = e1000_led_off_generic; | mac->ops.led_off = e1000_led_off_generic; | ||||
/* clear hardware counters */ | /* clear hardware counters */ | ||||
mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82575; | mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82575; | ||||
/* link info */ | /* link info */ | ||||
mac->ops.get_link_up_info = e1000_get_link_up_info_82575; | mac->ops.get_link_up_info = e1000_get_link_up_info_82575; | ||||
/* acquire SW_FW sync */ | /* acquire SW_FW sync */ | ||||
mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync_82575; | mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync; | ||||
mac->ops.release_swfw_sync = e1000_release_swfw_sync_82575; | mac->ops.release_swfw_sync = e1000_release_swfw_sync; | ||||
if (mac->type >= e1000_i210) { | |||||
mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync_i210; | |||||
mac->ops.release_swfw_sync = e1000_release_swfw_sync_i210; | |||||
} | |||||
/* set lan id for port to determine which phy lock to use */ | /* set lan id for port to determine which phy lock to use */ | ||||
hw->mac.ops.set_lan_id(hw); | hw->mac.ops.set_lan_id(hw); | ||||
return E1000_SUCCESS; | return E1000_SUCCESS; | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 455 Lines • ▼ Show 20 Lines | |||||
* EEPROM access and return -E1000_ERR_NVM (-1). | * EEPROM access and return -E1000_ERR_NVM (-1). | ||||
**/ | **/ | ||||
static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw) | static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw) | ||||
{ | { | ||||
s32 ret_val = E1000_SUCCESS; | s32 ret_val = E1000_SUCCESS; | ||||
DEBUGFUNC("e1000_acquire_nvm_82575"); | DEBUGFUNC("e1000_acquire_nvm_82575"); | ||||
ret_val = e1000_acquire_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); | ret_val = e1000_acquire_swfw_sync(hw, E1000_SWFW_EEP_SM); | ||||
if (ret_val) | if (ret_val) | ||||
goto out; | goto out; | ||||
/* | /* | ||||
* Check if there is some access | * Check if there is some access | ||||
* error this access may hook on | * error this access may hook on | ||||
*/ | */ | ||||
if (hw->mac.type == e1000_i350) { | if (hw->mac.type == e1000_i350) { | ||||
Show All 14 Lines | if (eecd & E1000_EECD_BLOCKED) { | ||||
E1000_WRITE_REG(hw, E1000_EECD, eecd | | E1000_WRITE_REG(hw, E1000_EECD, eecd | | ||||
E1000_EECD_BLOCKED); | E1000_EECD_BLOCKED); | ||||
DEBUGOUT("Nvm bit banging access error detected and cleared.\n"); | DEBUGOUT("Nvm bit banging access error detected and cleared.\n"); | ||||
} | } | ||||
} | } | ||||
ret_val = e1000_acquire_nvm_generic(hw); | ret_val = e1000_acquire_nvm_generic(hw); | ||||
if (ret_val) | if (ret_val) | ||||
e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); | e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); | ||||
out: | out: | ||||
return ret_val; | return ret_val; | ||||
} | } | ||||
/** | /** | ||||
* e1000_release_nvm_82575 - Release exclusive access to EEPROM | * e1000_release_nvm_82575 - Release exclusive access to EEPROM | ||||
* @hw: pointer to the HW structure | * @hw: pointer to the HW structure | ||||
* | * | ||||
* Stop any current commands to the EEPROM and clear the EEPROM request bit, | * Stop any current commands to the EEPROM and clear the EEPROM request bit, | ||||
* then release the semaphores acquired. | * then release the semaphores acquired. | ||||
**/ | **/ | ||||
static void e1000_release_nvm_82575(struct e1000_hw *hw) | static void e1000_release_nvm_82575(struct e1000_hw *hw) | ||||
{ | { | ||||
DEBUGFUNC("e1000_release_nvm_82575"); | DEBUGFUNC("e1000_release_nvm_82575"); | ||||
e1000_release_nvm_generic(hw); | e1000_release_nvm_generic(hw); | ||||
e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); | e1000_release_swfw_sync(hw, E1000_SWFW_EEP_SM); | ||||
} | |||||
/** | |||||
* e1000_acquire_swfw_sync_82575 - Acquire SW/FW semaphore | |||||
* @hw: pointer to the HW structure | |||||
* @mask: specifies which semaphore to acquire | |||||
* | |||||
* Acquire the SW/FW semaphore to access the PHY or NVM. The mask | |||||
* will also specify which port we're acquiring the lock for. | |||||
**/ | |||||
static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) | |||||
{ | |||||
u32 swfw_sync; | |||||
u32 swmask = mask; | |||||
u32 fwmask = mask << 16; | |||||
s32 ret_val = E1000_SUCCESS; | |||||
s32 i = 0, timeout = 200; | |||||
DEBUGFUNC("e1000_acquire_swfw_sync_82575"); | |||||
while (i < timeout) { | |||||
if (e1000_get_hw_semaphore_generic(hw)) { | |||||
ret_val = -E1000_ERR_SWFW_SYNC; | |||||
goto out; | |||||
} | |||||
swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); | |||||
if (!(swfw_sync & (fwmask | swmask))) | |||||
break; | |||||
/* | |||||
* Firmware currently using resource (fwmask) | |||||
* or other software thread using resource (swmask) | |||||
*/ | |||||
e1000_put_hw_semaphore_generic(hw); | |||||
msec_delay_irq(5); | |||||
i++; | |||||
} | |||||
if (i == timeout) { | |||||
DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); | |||||
ret_val = -E1000_ERR_SWFW_SYNC; | |||||
goto out; | |||||
} | |||||
swfw_sync |= swmask; | |||||
E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); | |||||
e1000_put_hw_semaphore_generic(hw); | |||||
out: | |||||
return ret_val; | |||||
} | |||||
/** | |||||
* e1000_release_swfw_sync_82575 - Release SW/FW semaphore | |||||
* @hw: pointer to the HW structure | |||||
* @mask: specifies which semaphore to acquire | |||||
* | |||||
* Release the SW/FW semaphore used to access the PHY or NVM. The mask | |||||
* will also specify which port we're releasing the lock for. | |||||
**/ | |||||
static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask) | |||||
{ | |||||
u32 swfw_sync; | |||||
DEBUGFUNC("e1000_release_swfw_sync_82575"); | |||||
while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) | |||||
; /* Empty */ | |||||
swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); | |||||
swfw_sync &= ~mask; | |||||
E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); | |||||
e1000_put_hw_semaphore_generic(hw); | |||||
} | } | ||||
/** | /** | ||||
* e1000_get_cfg_done_82575 - Read config done bit | * e1000_get_cfg_done_82575 - Read config done bit | ||||
* @hw: pointer to the HW structure | * @hw: pointer to the HW structure | ||||
* | * | ||||
* Read the management control register for the config done bit for | * Read the management control register for the config done bit for | ||||
* completion status. NOTE: silicon which is EEPROM-less will fail trying | * completion status. NOTE: silicon which is EEPROM-less will fail trying | ||||
▲ Show 20 Lines • Show All 2,653 Lines • Show Last 20 Lines |