int igc_init_nvm_params_i225(struct igc_hw *);
int igc_init_mac_params_i225(struct igc_hw *);
int igc_init_phy_params_i225(struct igc_hw *);
int igc_reset_hw_i225(struct igc_hw *);
int igc_acquire_nvm_i225(struct igc_hw *);
void igc_release_nvm_i225(struct igc_hw *);
int igc_get_hw_semaphore_i225(struct igc_hw *);
int __igc_write_nvm_srwr(struct igc_hw *, uint16_t, uint16_t, uint16_t *);
int igc_pool_flash_update_done_i225(struct igc_hw *);
/**
* igc_init_mac_params_i225 - Init MAC func ptrs.
* @hw: pointer to the HW structure
**/
int
igc_init_mac_params_i225(struct igc_hw *hw)
{
struct igc_mac_info *mac = &hw->mac;
struct igc_dev_spec_i225 *dev_spec = &hw->dev_spec._i225;
DEBUGFUNC("igc_init_mac_params_i225");
/* Initialize function pointer */
igc_init_mac_ops_generic(hw);
/* Set media type */
hw->phy.media_type = igc_media_type_copper;
/* Set mta register count */
mac->mta_reg_count = 128;
/* Set rar entry count */
mac->rar_entry_count = IGC_RAR_ENTRIES_BASE;
/* Allow a single clear of the SW semaphore on I225 */
dev_spec->clear_semaphore_once = true;
mac->ops.setup_physical_interface = igc_setup_copper_link_i225;
/* Set if part includes ASF firmware */
mac->asf_firmware_present = true;
/* Make sure the PHY is in a good state. Several people have reported
* firmware leaving the PHY's page select register set to something
* other than the default of zero, which causes the PHY ID read to
* access something other than the intended register.
*/
ret_val = hw->phy.ops.reset(hw);
if (ret_val)
goto out;
/**
* igc_reset_hw_i225 - Reset hardware
* @hw: pointer to the HW structure
*
* This resets the hardware into a known state.
**/
int
igc_reset_hw_i225(struct igc_hw *hw)
{
uint32_t ctrl;
int ret_val;
DEBUGFUNC("igc_reset_hw_i225");
/*
* Prevent the PCI-E bus from sticking if there is no TLP connection
* on the last TLP read/write transaction when MAC is reset.
*/
ret_val = igc_disable_pcie_master_generic(hw);
if (ret_val)
DEBUGOUT("PCI-E Master disable polling has failed.\n");
DEBUGOUT("Masking off all interrupts\n");
IGC_WRITE_REG(hw, IGC_IMC, 0xffffffff);
DEBUGOUT("Issuing a global reset to MAC\n");
IGC_WRITE_REG(hw, IGC_CTRL, ctrl | IGC_CTRL_DEV_RST);
ret_val = igc_get_auto_rd_done_generic(hw);
if (ret_val) {
/*
* When auto config read does not complete, do not
* return with an error. This can happen in situations
* where there is no eeprom and prevents getting link.
*/
DEBUGOUT("Auto Read Done did not complete\n");
}
/* Install any alternate MAC address into RAR0 */
ret_val = igc_check_alt_mac_addr_generic(hw);
return ret_val;
}
/* igc_acquire_nvm_i225 - Request for access to EEPROM
* @hw: pointer to the HW structure
*
* Acquire the necessary semaphores for exclusive access to the EEPROM.
* Set the EEPROM access request bit and wait for EEPROM access grant bit.
* Return successful if access grant bit set, else clear the request for
* EEPROM access and return -IGC_ERR_NVM (-1).
*/
int
igc_acquire_nvm_i225(struct igc_hw *hw)
{
int ret_val;
/* igc_release_nvm_i225 - Release exclusive access to EEPROM
* @hw: pointer to the HW structure
*
* Stop any current commands to the EEPROM and clear the EEPROM request bit,
* then release the semaphores acquired.
*/
void
igc_release_nvm_i225(struct igc_hw *hw)
{
DEBUGFUNC("igc_release_nvm_i225");
/* igc_acquire_swfw_sync_i225 - 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.
*/
int
igc_acquire_swfw_sync_i225(struct igc_hw *hw, uint16_t mask)
{
uint32_t swfw_sync;
uint32_t swmask = mask;
uint32_t fwmask = mask << 16;
int ret_val = IGC_SUCCESS;
int i = 0, timeout = 200; /* FIXME: find real value to use here */
DEBUGFUNC("igc_acquire_swfw_sync_i225");
while (i < timeout) {
if (igc_get_hw_semaphore_i225(hw)) {
ret_val = -IGC_ERR_SWFW_SYNC;
goto out;
}
/* Firmware currently using resource (fwmask)
* or other software thread using resource (swmask)
*/
igc_put_hw_semaphore_generic(hw);
msec_delay(5);
i++;
}
if (i == timeout) {
DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n");
ret_val = -IGC_ERR_SWFW_SYNC;
goto out;
}
/* igc_release_swfw_sync_i225 - 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.
*/
void
igc_release_swfw_sync_i225(struct igc_hw *hw, uint16_t mask)
{
uint32_t swfw_sync;
DEBUGFUNC("igc_release_swfw_sync_i225");
while (igc_get_hw_semaphore_i225(hw) != IGC_SUCCESS)
; /* Empty */
/*
* igc_setup_copper_link_i225 - Configure copper link settings
* @hw: pointer to the HW structure
*
* Configures 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.
*/
int
igc_setup_copper_link_i225(struct igc_hw *hw)
{
uint32_t ctrl, phpm_reg;
int ret_val;
/* igc_get_hw_semaphore_i225 - Acquire hardware semaphore
* @hw: pointer to the HW structure
*
* Acquire the HW semaphore to access the PHY or NVM
*/
int
igc_get_hw_semaphore_i225(struct igc_hw *hw)
{
uint32_t swsm;
int timeout = hw->nvm.word_size + 1;
int i = 0;
DEBUGFUNC("igc_get_hw_semaphore_i225");
/* Get the SW semaphore */
while (i < timeout) {
swsm = IGC_READ_REG(hw, IGC_SWSM);
if (!(swsm & IGC_SWSM_SMBI))
break;
DELAY(50);
i++;
}
if (i == timeout) {
/* In rare circumstances, the SW semaphore may already be held
* unintentionally. Clear the semaphore once before giving up.
*/
if (hw->dev_spec._i225.clear_semaphore_once) {
hw->dev_spec._i225.clear_semaphore_once = false;
igc_put_hw_semaphore_generic(hw);
for (i = 0; i < timeout; i++) {
swsm = IGC_READ_REG(hw, IGC_SWSM);
if (!(swsm & IGC_SWSM_SMBI))
break;
DELAY(50);
}
}
/* If we do not have the semaphore here, we have to give up. */
if (i == timeout) {
DEBUGOUT("Driver can't access device -\n");
DEBUGOUT("SMBI bit is set.\n");
return -IGC_ERR_NVM;
}
}
/* Get the FW semaphore. */
for (i = 0; i < timeout; i++) {
swsm = IGC_READ_REG(hw, IGC_SWSM);
IGC_WRITE_REG(hw, IGC_SWSM, swsm | IGC_SWSM_SWESMBI);
/* Semaphore acquired if bit latched */
if (IGC_READ_REG(hw, IGC_SWSM) & IGC_SWSM_SWESMBI)
break;
DELAY(50);
}
if (i == timeout) {
/* Release semaphores */
igc_put_hw_semaphore_generic(hw);
DEBUGOUT("Driver can't access the NVM\n");
return -IGC_ERR_NVM;
}
return IGC_SUCCESS;
}
/* igc_read_nvm_srrd_i225 - Reads Shadow Ram using EERD register
* @hw: pointer to the HW structure
* @offset: offset of word in the Shadow Ram to read
* @words: number of words to read
* @data: word read from the Shadow Ram
*
* Reads a 16 bit word from the Shadow Ram using the EERD register.
* Uses necessary synchronization semaphores.
*/
int
igc_read_nvm_srrd_i225(struct igc_hw *hw, uint16_t offset, uint16_t words,
uint16_t *data)
{
uint16_t i, count;
int status = IGC_SUCCESS;
DEBUGFUNC("igc_read_nvm_srrd_i225");
/* We cannot hold synchronization semaphores for too long,
* because of forceful takeover procedure. However it is more efficient
* to read in bursts than synchronizing access for each word.
*/
for (i = 0; i < words; i += IGC_EERD_EEWR_MAX_COUNT) {
count = (words - i) / IGC_EERD_EEWR_MAX_COUNT > 0 ?
IGC_EERD_EEWR_MAX_COUNT : (words - i);
if (hw->nvm.ops.acquire(hw) == IGC_SUCCESS) {
status = igc_read_nvm_eerd(hw, offset, count, data + i);
hw->nvm.ops.release(hw);
} else {
status = IGC_ERR_SWFW_SYNC;
}
if (status != IGC_SUCCESS)
break;
}
return status;
}
/* igc_write_nvm_srwr_i225 - Write to Shadow RAM using EEWR
* @hw: pointer to the HW structure
* @offset: offset within the Shadow RAM to be written to
* @words: number of words to write
* @data: 16 bit word(s) to be written to the Shadow RAM
*
* Writes data to Shadow RAM at offset using EEWR register.
*
* If igc_update_nvm_checksum is not called after this function , the
* data will not be committed to FLASH and also Shadow RAM will most likely
* contain an invalid checksum.
*
* If error code is returned, data and Shadow RAM may be inconsistent - buffer
* partially written.
*/
int
igc_write_nvm_srwr_i225(struct igc_hw *hw, uint16_t offset, uint16_t words,
uint16_t *data)
{
uint16_t i, count;
int status = IGC_SUCCESS;
DEBUGFUNC("igc_write_nvm_srwr_i225");
/* We cannot hold synchronization semaphores for too long,
* because of forceful takeover procedure. However it is more efficient
* to write in bursts than synchronizing access for each word.
*/
for (i = 0; i < words; i += IGC_EERD_EEWR_MAX_COUNT) {
count = (words - i) / IGC_EERD_EEWR_MAX_COUNT > 0 ?
IGC_EERD_EEWR_MAX_COUNT : (words - i);
if (hw->nvm.ops.acquire(hw) == IGC_SUCCESS) {
status = __igc_write_nvm_srwr(hw, offset, count,
data + i);
hw->nvm.ops.release(hw);
} else
status = IGC_ERR_SWFW_SYNC;
if (status != IGC_SUCCESS)
break;
}
return status;
}
/* __igc_write_nvm_srwr - Write to Shadow Ram using EEWR
* @hw: pointer to the HW structure
* @offset: offset within the Shadow Ram to be written to
* @words: number of words to write
* @data: 16 bit word(s) to be written to the Shadow Ram
*
* Writes data to Shadow Ram at offset using EEWR register.
*
* If igc_update_nvm_checksum is not called after this function , the
* Shadow Ram will most likely contain an invalid checksum.
*/
int
__igc_write_nvm_srwr(struct igc_hw *hw, uint16_t offset, uint16_t words,
uint16_t *data)
{
struct igc_nvm_info *nvm = &hw->nvm;
uint32_t i, k, eewr = 0;
uint32_t attempts = 100000;
int ret_val = IGC_SUCCESS;
DEBUGFUNC("__igc_write_nvm_srwr");
/* A check for invalid values: offset too large, too many words,
* too many words for the offset, and not enough words.
*/
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
(words == 0)) {
DEBUGOUT("nvm parameter(s) out of bounds\n");
ret_val = -IGC_ERR_NVM;
goto out;
}
for (i = 0; i < words; i++) {
eewr = ((offset + i) << IGC_NVM_RW_ADDR_SHIFT) |
(data[i] << IGC_NVM_RW_REG_DATA) | IGC_NVM_RW_REG_START;
IGC_WRITE_REG(hw, IGC_SRWR, eewr);
for (k = 0; k < attempts; k++) {
if (IGC_NVM_RW_REG_DONE & IGC_READ_REG(hw, IGC_SRWR)) {
ret_val = IGC_SUCCESS;
break;
}
DELAY(5);
}
/* igc_validate_nvm_checksum_i225 - Validate EEPROM checksum
* @hw: pointer to the HW structure
*
* Calculates the EEPROM checksum by reading/adding each word of the EEPROM
* and then verifies that the sum of the EEPROM is equal to 0xBABA.
*/
int
igc_validate_nvm_checksum_i225(struct igc_hw *hw)
{
int status = IGC_SUCCESS;
int (*read_op_ptr)(struct igc_hw *, uint16_t, uint16_t, uint16_t *);
DEBUGFUNC("igc_validate_nvm_checksum_i225");
if (hw->nvm.ops.acquire(hw) == IGC_SUCCESS) {
/* Replace the read function with semaphore grabbing with
* the one that skips this for a while.
* We have semaphore taken already here.
*/
read_op_ptr = hw->nvm.ops.read;
hw->nvm.ops.read = igc_read_nvm_eerd;
status = igc_validate_nvm_checksum_generic(hw);
/* Revert original read operation. */
hw->nvm.ops.read = read_op_ptr;
hw->nvm.ops.release(hw);
} else {
status = IGC_ERR_SWFW_SYNC;
}
return status;
}
/* igc_update_nvm_checksum_i225 - Update EEPROM checksum
* @hw: pointer to the HW structure
*
* Updates the EEPROM checksum by reading/adding each word of the EEPROM
* up to the checksum. Then calculates the EEPROM checksum and writes the
* value to the EEPROM. Next commit EEPROM data onto the Flash.
*/
int
igc_update_nvm_checksum_i225(struct igc_hw *hw)
{
uint16_t checksum = 0;
uint16_t i, nvm_data;
int ret_val;
DEBUGFUNC("igc_update_nvm_checksum_i225");
/* Read the first word from the EEPROM. If this times out or fails, do
* not continue or we could be in for a very long wait while every
* EEPROM read fails
*/
ret_val = igc_read_nvm_eerd(hw, 0, 1, &nvm_data);
if (ret_val != IGC_SUCCESS) {
DEBUGOUT("EEPROM read failed\n");
goto out;
}
if (hw->nvm.ops.acquire(hw) == IGC_SUCCESS) {
/* Do not use hw->nvm.ops.write, hw->nvm.ops.read
* because we do not want to take the synchronization
* semaphores twice here.
*/
for (i = 0; i < NVM_CHECKSUM_REG; i++) {
ret_val = igc_read_nvm_eerd(hw, i, 1, &nvm_data);
if (ret_val) {
hw->nvm.ops.release(hw);
DEBUGOUT("NVM Read Error while updating\n");
DEBUGOUT("checksum.\n");
goto out;
}
checksum += nvm_data;
}
checksum = (uint16_t)NVM_SUM - checksum;
ret_val = __igc_write_nvm_srwr(hw, NVM_CHECKSUM_REG, 1,
&checksum);
if (ret_val != IGC_SUCCESS) {
hw->nvm.ops.release(hw);
DEBUGOUT("NVM Write Error while updating checksum.\n");
goto out;
}
/* igc_get_flash_presence_i225 - Check if flash device is detected.
* @hw: pointer to the HW structure
*/
bool
igc_get_flash_presence_i225(struct igc_hw *hw)
{
uint32_t eec = 0;
bool ret_val = false;
DEBUGFUNC("igc_get_flash_presence_i225");
eec = IGC_READ_REG(hw, IGC_EECD);
if (eec & IGC_EECD_FLASH_DETECTED_I225)
ret_val = true;
return ret_val;
}
/* igc_set_flsw_flash_burst_counter_i225 - sets FLSW NVM Burst
* Counter in FLSWCNT register.
*
* @hw: pointer to the HW structure
* @burst_counter: size in bytes of the Flash burst to read or write
*/
int
igc_set_flsw_flash_burst_counter_i225(struct igc_hw *hw, uint32_t burst_counter)
{
int ret_val = IGC_SUCCESS;
/* igc_write_erase_flash_command_i225 - write/erase to a sector
* region on a given address.
*
* @hw: pointer to the HW structure
* @opcode: opcode to be used for the write command
* @address: the offset to write into the FLASH image
*/
int
igc_write_erase_flash_command_i225(struct igc_hw *hw, uint32_t opcode,
uint32_t address)
{
uint32_t flswctl = 0;
int timeout = IGC_NVM_GRANT_ATTEMPTS;
int ret_val = IGC_SUCCESS;
DEBUGFUNC("igc_write_erase_flash_command_i225");
flswctl = IGC_READ_REG(hw, IGC_I225_FLSWCTL);
/* Polling done bit on FLSWCTL register */
while (timeout) {
if (flswctl & IGC_FLSWCTL_DONE)
break;
DELAY(5);
flswctl = IGC_READ_REG(hw, IGC_I225_FLSWCTL);
timeout--;
}
if (!timeout) {
DEBUGOUT("Flash transaction was not done\n");
return -IGC_ERR_NVM;
}
/* Build and issue command on FLSWCTL register */
flswctl = address | opcode;
IGC_WRITE_REG(hw, IGC_I225_FLSWCTL, flswctl);
/* Check if issued command is valid on FLSWCTL register */
flswctl = IGC_READ_REG(hw, IGC_I225_FLSWCTL);
if (!(flswctl & IGC_FLSWCTL_CMDV)) {
DEBUGOUT("Write flash command failed\n");
ret_val = IGC_ERR_INVALID_ARGUMENT;
}
return ret_val;
}
/* igc_update_flash_i225 - Commit EEPROM to the flash
* if fw_valid_bit is set, FW is active. setting FLUPD bit in EEC
* register makes the FW load the internal shadow RAM into the flash.
* Otherwise, fw_valid_bit is 0. if FL_SECU.block_prtotected_sw = 0
* then FW is not active so the SW is responsible shadow RAM dump.
*
* @hw: pointer to the HW structure
*/
int
igc_update_flash_i225(struct igc_hw *hw)
{
uint32_t block_sw_protect = 1;
uint32_t i, flup, fw_valid_bit;
uint16_t current_offset;
uint16_t base_address = 0x0;
uint16_t current_offset_data = 0;
int ret_val = 0;
ret_val = igc_pool_flash_update_done_i225(hw);
if (ret_val == IGC_SUCCESS)
DEBUGOUT("Flash update complete\n");
else
DEBUGOUT("Flash update time out\n");
} else if (!block_sw_protect) {
/* FW is not active and security protection is disabled.
* therefore, SW is in charge of shadow RAM dump.
* Check which sector is valid. if sector 0 is valid,
* base address remains 0x0. otherwise, sector 1 is
* valid and its base address is 0x1000
*/
if (IGC_READ_REG(hw, IGC_EECD) & IGC_EECD_SEC1VAL_I225)
base_address = 0x1000;
/* Wait till operation has finished */
ret_val = igc_poll_eerd_eewr_done(hw,
IGC_NVM_POLL_READ);
if (ret_val)
break;
DELAY(1000);
}
}
out:
return ret_val;
}
/* igc_pool_flash_update_done_i225 - Pool FLUDONE status.
* @hw: pointer to the HW structure
*/
int
igc_pool_flash_update_done_i225(struct igc_hw *hw)
{
uint32_t i, reg;
int ret_val = -IGC_ERR_NVM;
DEBUGFUNC("igc_pool_flash_update_done_i225");
for (i = 0; i < IGC_FLUDONE_ATTEMPTS; i++) {
reg = IGC_READ_REG(hw, IGC_EECD);
if (reg & IGC_EECD_FLUDONE_I225) {
ret_val = IGC_SUCCESS;
break;
}
DELAY(5);
}
return ret_val;
}
/* igc_set_ltr_i225 - Set Latency Tolerance Reporting thresholds.
* @hw: pointer to the HW structure
* @link: bool indicating link status
*
* Set the LTR thresholds based on the link speed (Mbps), EEE, and DMAC
* settings, otherwise specify that there is no LTR requirement.
*/
int
igc_set_ltr_i225(struct igc_hw *hw, bool link)
{
uint16_t speed, duplex;
uint32_t tw_system, ltrc, ltrv, ltr_min, ltr_max, scale_min, scale_max;
int size;
DEBUGFUNC("igc_set_ltr_i225");
/* If we do not have link, LTR thresholds are zero. */
if (link) {
hw->mac.ops.get_link_up_info(hw, &speed, &duplex);
/* Check if using copper interface with EEE enabled or if the
* link speed is 10 Mbps.
*/
if ((hw->phy.media_type == igc_media_type_copper) &&
!(hw->dev_spec._i225.eee_disable) &&
(speed != SPEED_10)) {
/* EEE enabled, so send LTRMAX threshold. */
ltrc = IGC_READ_REG(hw, IGC_LTRC) | IGC_LTRC_EEEMS_EN;
IGC_WRITE_REG(hw, IGC_LTRC, ltrc);
/* Calculate the thresholds. Since speed is in Mbps, simplify
* the calculation by multiplying size/speed by 1000 for result
* to be in nsec before dividing by the scale in nsec. Set the
* scale such that the LTR threshold fits in the register.
*/
ltr_min = (1000 * size) / speed;
ltr_max = ltr_min + tw_system;
scale_min = (ltr_min / 1024) < 1024 ? IGC_LTRMINV_SCALE_1024 :
IGC_LTRMINV_SCALE_32768;
scale_max = (ltr_max / 1024) < 1024 ? IGC_LTRMAXV_SCALE_1024 :
IGC_LTRMAXV_SCALE_32768;
ltr_min /= scale_min == IGC_LTRMINV_SCALE_1024 ? 1024 : 32768;
ltr_max /= scale_max == IGC_LTRMAXV_SCALE_1024 ? 1024 : 32768;
/* Only write the LTR thresholds if they differ from before. */
ltrv = IGC_READ_REG(hw, IGC_LTRMINV);
if (ltr_min != (ltrv & IGC_LTRMINV_LTRV_MASK)) {
ltrv = IGC_LTRMINV_LSNP_REQ | ltr_min |
(scale_min << IGC_LTRMINV_SCALE_SHIFT);
IGC_WRITE_REG(hw, IGC_LTRMINV, ltrv);
}
/* igc_check_for_link_i225 - Check for link
* @hw: pointer to the HW structure
*
* Checks to see of the link status of the hardware has changed. If a
* change in link status has been detected, then we read the PHY registers
* to get the current speed/duplex if link exists.
*/
int
igc_check_for_link_i225(struct igc_hw *hw)
{
struct igc_mac_info *mac = &hw->mac;
int ret_val;
bool link = false;
DEBUGFUNC("igc_check_for_link_i225");
/* We only want to go out to the PHY registers to see if
* Auto-Neg has completed and/or if our link status has
* changed. The get_link_status flag is set upon receiving
* a Link Status Change or Rx Sequence Error interrupt.
*/
if (!mac->get_link_status) {
ret_val = IGC_SUCCESS;
goto out;
}
/* First we want to see if the MII Status Register reports
* link. If so, then we want to get the current speed/duplex
* of the PHY.
*/
ret_val = igc_phy_has_link_generic(hw, 1, 0, &link);
if (ret_val)
goto out;
if (!link)
goto out; /* No link detected */
/* First we want to see if the MII Status Register reports
* link. If so, then we want to get the current speed/duplex
* of the PHY.
*/
ret_val = igc_phy_has_link_generic(hw, 1, 0, &link);
if (ret_val)
goto out;
if (!link)
goto out; /* No link detected */
mac->get_link_status = false;
/* Check if there was DownShift, must be checked
* immediately after link-up
*/
igc_check_downshift_generic(hw);
/* If we are forcing speed/duplex, then we simply return since
* we have already determined whether we have link or not.
*/
if (!mac->autoneg)
goto out;
/* Auto-Neg is enabled. Auto Speed Detection takes care
* of MAC speed/duplex configuration. So we only need to
* configure Collision Distance in the MAC.
*/
mac->ops.config_collision_dist(hw);
/* Configure Flow Control now that Auto-Neg has completed.
* First, we need to restore the desired flow control
* settings because we may have had to re-autoneg with a
* different link partner.
*/
ret_val = igc_config_fc_after_link_up_generic(hw);
if (ret_val)
DEBUGOUT("Error configuring flow control\n");
out:
/* Now that we are aware of our link settings, we can set the LTR
* thresholds.
*/
ret_val = igc_set_ltr_i225(hw, link);
return ret_val;
}
/* igc_init_function_pointers_i225 - Init func ptrs.
* @hw: pointer to the HW structure
*
* Called to initialize all function pointers and parameters.
*/
void
igc_init_function_pointers_i225(struct igc_hw *hw)
{
igc_init_mac_ops_generic(hw);
igc_init_phy_ops_generic(hw);
igc_init_nvm_ops_generic(hw);
hw->mac.ops.init_params = igc_init_mac_params_i225;
hw->nvm.ops.init_params = igc_init_nvm_params_i225;
hw->phy.ops.init_params = igc_init_phy_params_i225;
}
/* igc_init_hw_i225 - Init hw for I225
* @hw: pointer to the HW structure
*
* Called to initialize hw for i225 hw family.
*/
int
igc_init_hw_i225(struct igc_hw *hw)
{
int ret_val;
DEBUGFUNC("igc_init_hw_i225");
ret_val = igc_init_hw_base(hw);
return ret_val;
}
/**
* igc_set_eee_i225 - Enable/disable EEE support
* @hw: pointer to the HW structure
* @adv2p5G: boolean flag enabling 2.5G EEE advertisement
* @adv1G: boolean flag enabling 1G EEE advertisement
* @adv100M: boolean flag enabling 100M EEE advertisement
*
* Enable/disable EEE based on setting in dev_spec structure.
*
**/
int
igc_set_eee_i225(struct igc_hw *hw, bool adv2p5G, bool adv1G,
bool adv100M)
{
uint32_t ipcnfg, eeer;
/* This bit should not be set in normal operation. */
if (eee_su & IGC_EEE_SU_LPI_CLK_STP)
DEBUGOUT("LPI Clock Stop Bit should not be set!\n");
} else {
ipcnfg &= ~(IGC_IPCNFG_EEE_2_5G_AN | IGC_IPCNFG_EEE_1G_AN |
IGC_IPCNFG_EEE_100M_AN);
eeer &= ~(IGC_EEER_TX_LPI_EN | IGC_EEER_RX_LPI_EN |
IGC_EEER_LPI_FC);
}
IGC_WRITE_REG(hw, IGC_IPCNFG, ipcnfg);
IGC_WRITE_REG(hw, IGC_EEER, eeer);
IGC_READ_REG(hw, IGC_IPCNFG);
IGC_READ_REG(hw, IGC_EEER);
out: