aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000/e1000_hw.c')
-rw-r--r--drivers/net/e1000/e1000_hw.c139
1 files changed, 71 insertions, 68 deletions
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 65077f39da69..3655d902b0bd 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -385,6 +385,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
385 case E1000_DEV_ID_82571EB_FIBER: 385 case E1000_DEV_ID_82571EB_FIBER:
386 case E1000_DEV_ID_82571EB_SERDES: 386 case E1000_DEV_ID_82571EB_SERDES:
387 case E1000_DEV_ID_82571EB_QUAD_COPPER: 387 case E1000_DEV_ID_82571EB_QUAD_COPPER:
388 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
388 hw->mac_type = e1000_82571; 389 hw->mac_type = e1000_82571;
389 break; 390 break;
390 case E1000_DEV_ID_82572EI_COPPER: 391 case E1000_DEV_ID_82572EI_COPPER:
@@ -408,6 +409,8 @@ e1000_set_mac_type(struct e1000_hw *hw)
408 case E1000_DEV_ID_ICH8_IGP_AMT: 409 case E1000_DEV_ID_ICH8_IGP_AMT:
409 case E1000_DEV_ID_ICH8_IGP_C: 410 case E1000_DEV_ID_ICH8_IGP_C:
410 case E1000_DEV_ID_ICH8_IFE: 411 case E1000_DEV_ID_ICH8_IFE:
412 case E1000_DEV_ID_ICH8_IFE_GT:
413 case E1000_DEV_ID_ICH8_IFE_G:
411 case E1000_DEV_ID_ICH8_IGP_M: 414 case E1000_DEV_ID_ICH8_IGP_M:
412 hw->mac_type = e1000_ich8lan; 415 hw->mac_type = e1000_ich8lan;
413 break; 416 break;
@@ -2367,6 +2370,7 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw)
2367 2370
2368 /* Need to reset the PHY or these changes will be ignored */ 2371 /* Need to reset the PHY or these changes will be ignored */
2369 mii_ctrl_reg |= MII_CR_RESET; 2372 mii_ctrl_reg |= MII_CR_RESET;
2373
2370 /* Disable MDI-X support for 10/100 */ 2374 /* Disable MDI-X support for 10/100 */
2371 } else if (hw->phy_type == e1000_phy_ife) { 2375 } else if (hw->phy_type == e1000_phy_ife) {
2372 ret_val = e1000_read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, &phy_data); 2376 ret_val = e1000_read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, &phy_data);
@@ -2379,6 +2383,7 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw)
2379 ret_val = e1000_write_phy_reg(hw, IFE_PHY_MDIX_CONTROL, phy_data); 2383 ret_val = e1000_write_phy_reg(hw, IFE_PHY_MDIX_CONTROL, phy_data);
2380 if (ret_val) 2384 if (ret_val)
2381 return ret_val; 2385 return ret_val;
2386
2382 } else { 2387 } else {
2383 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI 2388 /* Clear Auto-Crossover to force MDI manually. IGP requires MDI
2384 * forced whenever speed or duplex are forced. 2389 * forced whenever speed or duplex are forced.
@@ -3868,7 +3873,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw)
3868* 3873*
3869* hw - Struct containing variables accessed by shared code 3874* hw - Struct containing variables accessed by shared code
3870* 3875*
3871* Sets bit 15 of the MII Control regiser 3876* Sets bit 15 of the MII Control register
3872******************************************************************************/ 3877******************************************************************************/
3873int32_t 3878int32_t
3874e1000_phy_reset(struct e1000_hw *hw) 3879e1000_phy_reset(struct e1000_hw *hw)
@@ -3940,14 +3945,15 @@ e1000_phy_powerdown_workaround(struct e1000_hw *hw)
3940 E1000_WRITE_REG(hw, PHY_CTRL, reg | E1000_PHY_CTRL_GBE_DISABLE | 3945 E1000_WRITE_REG(hw, PHY_CTRL, reg | E1000_PHY_CTRL_GBE_DISABLE |
3941 E1000_PHY_CTRL_NOND0A_GBE_DISABLE); 3946 E1000_PHY_CTRL_NOND0A_GBE_DISABLE);
3942 3947
3943 /* Write VR power-down enable */ 3948 /* Write VR power-down enable - bits 9:8 should be 10b */
3944 e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data); 3949 e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data);
3945 e1000_write_phy_reg(hw, IGP3_VR_CTRL, phy_data | 3950 phy_data |= (1 << 9);
3946 IGP3_VR_CTRL_MODE_SHUT); 3951 phy_data &= ~(1 << 8);
3952 e1000_write_phy_reg(hw, IGP3_VR_CTRL, phy_data);
3947 3953
3948 /* Read it back and test */ 3954 /* Read it back and test */
3949 e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data); 3955 e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data);
3950 if ((phy_data & IGP3_VR_CTRL_MODE_SHUT) || retry) 3956 if (((phy_data & IGP3_VR_CTRL_MODE_MASK) == IGP3_VR_CTRL_MODE_SHUT) || retry)
3951 break; 3957 break;
3952 3958
3953 /* Issue PHY reset and repeat at most one more time */ 3959 /* Issue PHY reset and repeat at most one more time */
@@ -4549,7 +4555,7 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
4549 case e1000_ich8lan: 4555 case e1000_ich8lan:
4550 { 4556 {
4551 int32_t i = 0; 4557 int32_t i = 0;
4552 uint32_t flash_size = E1000_READ_ICH8_REG(hw, ICH8_FLASH_GFPREG); 4558 uint32_t flash_size = E1000_READ_ICH_FLASH_REG(hw, ICH_FLASH_GFPREG);
4553 4559
4554 eeprom->type = e1000_eeprom_ich8; 4560 eeprom->type = e1000_eeprom_ich8;
4555 eeprom->use_eerd = FALSE; 4561 eeprom->use_eerd = FALSE;
@@ -4565,12 +4571,14 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
4565 } 4571 }
4566 } 4572 }
4567 4573
4568 hw->flash_base_addr = (flash_size & ICH8_GFPREG_BASE_MASK) * 4574 hw->flash_base_addr = (flash_size & ICH_GFPREG_BASE_MASK) *
4569 ICH8_FLASH_SECTOR_SIZE; 4575 ICH_FLASH_SECTOR_SIZE;
4576
4577 hw->flash_bank_size = ((flash_size >> 16) & ICH_GFPREG_BASE_MASK) + 1;
4578 hw->flash_bank_size -= (flash_size & ICH_GFPREG_BASE_MASK);
4579
4580 hw->flash_bank_size *= ICH_FLASH_SECTOR_SIZE;
4570 4581
4571 hw->flash_bank_size = ((flash_size >> 16) & ICH8_GFPREG_BASE_MASK) + 1;
4572 hw->flash_bank_size -= (flash_size & ICH8_GFPREG_BASE_MASK);
4573 hw->flash_bank_size *= ICH8_FLASH_SECTOR_SIZE;
4574 hw->flash_bank_size /= 2 * sizeof(uint16_t); 4582 hw->flash_bank_size /= 2 * sizeof(uint16_t);
4575 4583
4576 break; 4584 break;
@@ -5620,8 +5628,8 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
5620 * signature is valid. We want to do this after the write 5628 * signature is valid. We want to do this after the write
5621 * has completed so that we don't mark the segment valid 5629 * has completed so that we don't mark the segment valid
5622 * while the write is still in progress */ 5630 * while the write is still in progress */
5623 if (i == E1000_ICH8_NVM_SIG_WORD) 5631 if (i == E1000_ICH_NVM_SIG_WORD)
5624 high_byte = E1000_ICH8_NVM_SIG_MASK | high_byte; 5632 high_byte = E1000_ICH_NVM_SIG_MASK | high_byte;
5625 5633
5626 error = e1000_verify_write_ich8_byte(hw, 5634 error = e1000_verify_write_ich8_byte(hw,
5627 (i << 1) + new_bank_offset + 1, high_byte); 5635 (i << 1) + new_bank_offset + 1, high_byte);
@@ -5643,18 +5651,18 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
5643 * erase as well since these bits are 11 to start with 5651 * erase as well since these bits are 11 to start with
5644 * and we need to change bit 14 to 0b */ 5652 * and we need to change bit 14 to 0b */
5645 e1000_read_ich8_byte(hw, 5653 e1000_read_ich8_byte(hw,
5646 E1000_ICH8_NVM_SIG_WORD * 2 + 1 + new_bank_offset, 5654 E1000_ICH_NVM_SIG_WORD * 2 + 1 + new_bank_offset,
5647 &high_byte); 5655 &high_byte);
5648 high_byte &= 0xBF; 5656 high_byte &= 0xBF;
5649 error = e1000_verify_write_ich8_byte(hw, 5657 error = e1000_verify_write_ich8_byte(hw,
5650 E1000_ICH8_NVM_SIG_WORD * 2 + 1 + new_bank_offset, high_byte); 5658 E1000_ICH_NVM_SIG_WORD * 2 + 1 + new_bank_offset, high_byte);
5651 /* And invalidate the previously valid segment by setting 5659 /* And invalidate the previously valid segment by setting
5652 * its signature word (0x13) high_byte to 0b. This can be 5660 * its signature word (0x13) high_byte to 0b. This can be
5653 * done without an erase because flash erase sets all bits 5661 * done without an erase because flash erase sets all bits
5654 * to 1's. We can write 1's to 0's without an erase */ 5662 * to 1's. We can write 1's to 0's without an erase */
5655 if (error == E1000_SUCCESS) { 5663 if (error == E1000_SUCCESS) {
5656 error = e1000_verify_write_ich8_byte(hw, 5664 error = e1000_verify_write_ich8_byte(hw,
5657 E1000_ICH8_NVM_SIG_WORD * 2 + 1 + old_bank_offset, 0); 5665 E1000_ICH_NVM_SIG_WORD * 2 + 1 + old_bank_offset, 0);
5658 } 5666 }
5659 5667
5660 /* Clear the now not used entry in the cache */ 5668 /* Clear the now not used entry in the cache */
@@ -5841,6 +5849,7 @@ e1000_mta_set(struct e1000_hw *hw,
5841 hash_reg = (hash_value >> 5) & 0x7F; 5849 hash_reg = (hash_value >> 5) & 0x7F;
5842 if (hw->mac_type == e1000_ich8lan) 5850 if (hw->mac_type == e1000_ich8lan)
5843 hash_reg &= 0x1F; 5851 hash_reg &= 0x1F;
5852
5844 hash_bit = hash_value & 0x1F; 5853 hash_bit = hash_value & 0x1F;
5845 5854
5846 mta = E1000_READ_REG_ARRAY(hw, MTA, hash_reg); 5855 mta = E1000_READ_REG_ARRAY(hw, MTA, hash_reg);
@@ -6026,6 +6035,7 @@ e1000_id_led_init(struct e1000_hw * hw)
6026 else 6035 else
6027 eeprom_data = ID_LED_DEFAULT; 6036 eeprom_data = ID_LED_DEFAULT;
6028 } 6037 }
6038
6029 for (i = 0; i < 4; i++) { 6039 for (i = 0; i < 4; i++) {
6030 temp = (eeprom_data >> (i << 2)) & led_mask; 6040 temp = (eeprom_data >> (i << 2)) & led_mask;
6031 switch (temp) { 6041 switch (temp) {
@@ -8486,7 +8496,7 @@ e1000_ich8_cycle_init(struct e1000_hw *hw)
8486 8496
8487 DEBUGFUNC("e1000_ich8_cycle_init"); 8497 DEBUGFUNC("e1000_ich8_cycle_init");
8488 8498
8489 hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); 8499 hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS);
8490 8500
8491 /* May be check the Flash Des Valid bit in Hw status */ 8501 /* May be check the Flash Des Valid bit in Hw status */
8492 if (hsfsts.hsf_status.fldesvalid == 0) { 8502 if (hsfsts.hsf_status.fldesvalid == 0) {
@@ -8499,7 +8509,7 @@ e1000_ich8_cycle_init(struct e1000_hw *hw)
8499 hsfsts.hsf_status.flcerr = 1; 8509 hsfsts.hsf_status.flcerr = 1;
8500 hsfsts.hsf_status.dael = 1; 8510 hsfsts.hsf_status.dael = 1;
8501 8511
8502 E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval); 8512 E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS, hsfsts.regval);
8503 8513
8504 /* Either we should have a hardware SPI cycle in progress bit to check 8514 /* Either we should have a hardware SPI cycle in progress bit to check
8505 * against, in order to start a new cycle or FDONE bit should be changed 8515 * against, in order to start a new cycle or FDONE bit should be changed
@@ -8514,13 +8524,13 @@ e1000_ich8_cycle_init(struct e1000_hw *hw)
8514 /* There is no cycle running at present, so we can start a cycle */ 8524 /* There is no cycle running at present, so we can start a cycle */
8515 /* Begin by setting Flash Cycle Done. */ 8525 /* Begin by setting Flash Cycle Done. */
8516 hsfsts.hsf_status.flcdone = 1; 8526 hsfsts.hsf_status.flcdone = 1;
8517 E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval); 8527 E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS, hsfsts.regval);
8518 error = E1000_SUCCESS; 8528 error = E1000_SUCCESS;
8519 } else { 8529 } else {
8520 /* otherwise poll for sometime so the current cycle has a chance 8530 /* otherwise poll for sometime so the current cycle has a chance
8521 * to end before giving up. */ 8531 * to end before giving up. */
8522 for (i = 0; i < ICH8_FLASH_COMMAND_TIMEOUT; i++) { 8532 for (i = 0; i < ICH_FLASH_COMMAND_TIMEOUT; i++) {
8523 hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); 8533 hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS);
8524 if (hsfsts.hsf_status.flcinprog == 0) { 8534 if (hsfsts.hsf_status.flcinprog == 0) {
8525 error = E1000_SUCCESS; 8535 error = E1000_SUCCESS;
8526 break; 8536 break;
@@ -8531,7 +8541,7 @@ e1000_ich8_cycle_init(struct e1000_hw *hw)
8531 /* Successful in waiting for previous cycle to timeout, 8541 /* Successful in waiting for previous cycle to timeout,
8532 * now set the Flash Cycle Done. */ 8542 * now set the Flash Cycle Done. */
8533 hsfsts.hsf_status.flcdone = 1; 8543 hsfsts.hsf_status.flcdone = 1;
8534 E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval); 8544 E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS, hsfsts.regval);
8535 } else { 8545 } else {
8536 DEBUGOUT("Flash controller busy, cannot get access"); 8546 DEBUGOUT("Flash controller busy, cannot get access");
8537 } 8547 }
@@ -8553,13 +8563,13 @@ e1000_ich8_flash_cycle(struct e1000_hw *hw, uint32_t timeout)
8553 uint32_t i = 0; 8563 uint32_t i = 0;
8554 8564
8555 /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */ 8565 /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */
8556 hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL); 8566 hsflctl.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL);
8557 hsflctl.hsf_ctrl.flcgo = 1; 8567 hsflctl.hsf_ctrl.flcgo = 1;
8558 E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval); 8568 E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval);
8559 8569
8560 /* wait till FDONE bit is set to 1 */ 8570 /* wait till FDONE bit is set to 1 */
8561 do { 8571 do {
8562 hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); 8572 hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS);
8563 if (hsfsts.hsf_status.flcdone == 1) 8573 if (hsfsts.hsf_status.flcdone == 1)
8564 break; 8574 break;
8565 udelay(1); 8575 udelay(1);
@@ -8593,10 +8603,10 @@ e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index,
8593 DEBUGFUNC("e1000_read_ich8_data"); 8603 DEBUGFUNC("e1000_read_ich8_data");
8594 8604
8595 if (size < 1 || size > 2 || data == 0x0 || 8605 if (size < 1 || size > 2 || data == 0x0 ||
8596 index > ICH8_FLASH_LINEAR_ADDR_MASK) 8606 index > ICH_FLASH_LINEAR_ADDR_MASK)
8597 return error; 8607 return error;
8598 8608
8599 flash_linear_address = (ICH8_FLASH_LINEAR_ADDR_MASK & index) + 8609 flash_linear_address = (ICH_FLASH_LINEAR_ADDR_MASK & index) +
8600 hw->flash_base_addr; 8610 hw->flash_base_addr;
8601 8611
8602 do { 8612 do {
@@ -8606,25 +8616,25 @@ e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index,
8606 if (error != E1000_SUCCESS) 8616 if (error != E1000_SUCCESS)
8607 break; 8617 break;
8608 8618
8609 hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL); 8619 hsflctl.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL);
8610 /* 0b/1b corresponds to 1 or 2 byte size, respectively. */ 8620 /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
8611 hsflctl.hsf_ctrl.fldbcount = size - 1; 8621 hsflctl.hsf_ctrl.fldbcount = size - 1;
8612 hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_READ; 8622 hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_READ;
8613 E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval); 8623 E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval);
8614 8624
8615 /* Write the last 24 bits of index into Flash Linear address field in 8625 /* Write the last 24 bits of index into Flash Linear address field in
8616 * Flash Address */ 8626 * Flash Address */
8617 /* TODO: TBD maybe check the index against the size of flash */ 8627 /* TODO: TBD maybe check the index against the size of flash */
8618 8628
8619 E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address); 8629 E1000_WRITE_ICH_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_address);
8620 8630
8621 error = e1000_ich8_flash_cycle(hw, ICH8_FLASH_COMMAND_TIMEOUT); 8631 error = e1000_ich8_flash_cycle(hw, ICH_FLASH_COMMAND_TIMEOUT);
8622 8632
8623 /* Check if FCERR is set to 1, if set to 1, clear it and try the whole 8633 /* Check if FCERR is set to 1, if set to 1, clear it and try the whole
8624 * sequence a few more times, else read in (shift in) the Flash Data0, 8634 * sequence a few more times, else read in (shift in) the Flash Data0,
8625 * the order is least significant byte first msb to lsb */ 8635 * the order is least significant byte first msb to lsb */
8626 if (error == E1000_SUCCESS) { 8636 if (error == E1000_SUCCESS) {
8627 flash_data = E1000_READ_ICH8_REG(hw, ICH8_FLASH_FDATA0); 8637 flash_data = E1000_READ_ICH_FLASH_REG(hw, ICH_FLASH_FDATA0);
8628 if (size == 1) { 8638 if (size == 1) {
8629 *data = (uint8_t)(flash_data & 0x000000FF); 8639 *data = (uint8_t)(flash_data & 0x000000FF);
8630 } else if (size == 2) { 8640 } else if (size == 2) {
@@ -8634,9 +8644,9 @@ e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index,
8634 } else { 8644 } else {
8635 /* If we've gotten here, then things are probably completely hosed, 8645 /* If we've gotten here, then things are probably completely hosed,
8636 * but if the error condition is detected, it won't hurt to give 8646 * but if the error condition is detected, it won't hurt to give
8637 * it another try...ICH8_FLASH_CYCLE_REPEAT_COUNT times. 8647 * it another try...ICH_FLASH_CYCLE_REPEAT_COUNT times.
8638 */ 8648 */
8639 hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); 8649 hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS);
8640 if (hsfsts.hsf_status.flcerr == 1) { 8650 if (hsfsts.hsf_status.flcerr == 1) {
8641 /* Repeat for some time before giving up. */ 8651 /* Repeat for some time before giving up. */
8642 continue; 8652 continue;
@@ -8645,7 +8655,7 @@ e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index,
8645 break; 8655 break;
8646 } 8656 }
8647 } 8657 }
8648 } while (count++ < ICH8_FLASH_CYCLE_REPEAT_COUNT); 8658 } while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
8649 8659
8650 return error; 8660 return error;
8651} 8661}
@@ -8672,10 +8682,10 @@ e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32_t size,
8672 DEBUGFUNC("e1000_write_ich8_data"); 8682 DEBUGFUNC("e1000_write_ich8_data");
8673 8683
8674 if (size < 1 || size > 2 || data > size * 0xff || 8684 if (size < 1 || size > 2 || data > size * 0xff ||
8675 index > ICH8_FLASH_LINEAR_ADDR_MASK) 8685 index > ICH_FLASH_LINEAR_ADDR_MASK)
8676 return error; 8686 return error;
8677 8687
8678 flash_linear_address = (ICH8_FLASH_LINEAR_ADDR_MASK & index) + 8688 flash_linear_address = (ICH_FLASH_LINEAR_ADDR_MASK & index) +
8679 hw->flash_base_addr; 8689 hw->flash_base_addr;
8680 8690
8681 do { 8691 do {
@@ -8685,34 +8695,34 @@ e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32_t size,
8685 if (error != E1000_SUCCESS) 8695 if (error != E1000_SUCCESS)
8686 break; 8696 break;
8687 8697
8688 hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL); 8698 hsflctl.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL);
8689 /* 0b/1b corresponds to 1 or 2 byte size, respectively. */ 8699 /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
8690 hsflctl.hsf_ctrl.fldbcount = size -1; 8700 hsflctl.hsf_ctrl.fldbcount = size -1;
8691 hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_WRITE; 8701 hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_WRITE;
8692 E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval); 8702 E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval);
8693 8703
8694 /* Write the last 24 bits of index into Flash Linear address field in 8704 /* Write the last 24 bits of index into Flash Linear address field in
8695 * Flash Address */ 8705 * Flash Address */
8696 E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address); 8706 E1000_WRITE_ICH_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_address);
8697 8707
8698 if (size == 1) 8708 if (size == 1)
8699 flash_data = (uint32_t)data & 0x00FF; 8709 flash_data = (uint32_t)data & 0x00FF;
8700 else 8710 else
8701 flash_data = (uint32_t)data; 8711 flash_data = (uint32_t)data;
8702 8712
8703 E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FDATA0, flash_data); 8713 E1000_WRITE_ICH_FLASH_REG(hw, ICH_FLASH_FDATA0, flash_data);
8704 8714
8705 /* check if FCERR is set to 1 , if set to 1, clear it and try the whole 8715 /* check if FCERR is set to 1 , if set to 1, clear it and try the whole
8706 * sequence a few more times else done */ 8716 * sequence a few more times else done */
8707 error = e1000_ich8_flash_cycle(hw, ICH8_FLASH_COMMAND_TIMEOUT); 8717 error = e1000_ich8_flash_cycle(hw, ICH_FLASH_COMMAND_TIMEOUT);
8708 if (error == E1000_SUCCESS) { 8718 if (error == E1000_SUCCESS) {
8709 break; 8719 break;
8710 } else { 8720 } else {
8711 /* If we're here, then things are most likely completely hosed, 8721 /* If we're here, then things are most likely completely hosed,
8712 * but if the error condition is detected, it won't hurt to give 8722 * but if the error condition is detected, it won't hurt to give
8713 * it another try...ICH8_FLASH_CYCLE_REPEAT_COUNT times. 8723 * it another try...ICH_FLASH_CYCLE_REPEAT_COUNT times.
8714 */ 8724 */
8715 hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); 8725 hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS);
8716 if (hsfsts.hsf_status.flcerr == 1) { 8726 if (hsfsts.hsf_status.flcerr == 1) {
8717 /* Repeat for some time before giving up. */ 8727 /* Repeat for some time before giving up. */
8718 continue; 8728 continue;
@@ -8721,7 +8731,7 @@ e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32_t size,
8721 break; 8731 break;
8722 } 8732 }
8723 } 8733 }
8724 } while (count++ < ICH8_FLASH_CYCLE_REPEAT_COUNT); 8734 } while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT);
8725 8735
8726 return error; 8736 return error;
8727} 8737}
@@ -8840,7 +8850,7 @@ e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank)
8840 int32_t j = 0; 8850 int32_t j = 0;
8841 int32_t error_flag = 0; 8851 int32_t error_flag = 0;
8842 8852
8843 hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); 8853 hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS);
8844 8854
8845 /* Determine HW Sector size: Read BERASE bits of Hw flash Status register */ 8855 /* Determine HW Sector size: Read BERASE bits of Hw flash Status register */
8846 /* 00: The Hw sector is 256 bytes, hence we need to erase 16 8856 /* 00: The Hw sector is 256 bytes, hence we need to erase 16
@@ -8853,19 +8863,14 @@ e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank)
8853 * 11: The Hw sector size is 64K bytes */ 8863 * 11: The Hw sector size is 64K bytes */
8854 if (hsfsts.hsf_status.berasesz == 0x0) { 8864 if (hsfsts.hsf_status.berasesz == 0x0) {
8855 /* Hw sector size 256 */ 8865 /* Hw sector size 256 */
8856 sub_sector_size = ICH8_FLASH_SEG_SIZE_256; 8866 sub_sector_size = ICH_FLASH_SEG_SIZE_256;
8857 bank_size = ICH8_FLASH_SECTOR_SIZE; 8867 bank_size = ICH_FLASH_SECTOR_SIZE;
8858 iteration = ICH8_FLASH_SECTOR_SIZE / ICH8_FLASH_SEG_SIZE_256; 8868 iteration = ICH_FLASH_SECTOR_SIZE / ICH_FLASH_SEG_SIZE_256;
8859 } else if (hsfsts.hsf_status.berasesz == 0x1) { 8869 } else if (hsfsts.hsf_status.berasesz == 0x1) {
8860 bank_size = ICH8_FLASH_SEG_SIZE_4K; 8870 bank_size = ICH_FLASH_SEG_SIZE_4K;
8861 iteration = 1;
8862 } else if (hw->mac_type != e1000_ich8lan &&
8863 hsfsts.hsf_status.berasesz == 0x2) {
8864 /* 8K erase size invalid for ICH8 - added in for ICH9 */
8865 bank_size = ICH9_FLASH_SEG_SIZE_8K;
8866 iteration = 1; 8871 iteration = 1;
8867 } else if (hsfsts.hsf_status.berasesz == 0x3) { 8872 } else if (hsfsts.hsf_status.berasesz == 0x3) {
8868 bank_size = ICH8_FLASH_SEG_SIZE_64K; 8873 bank_size = ICH_FLASH_SEG_SIZE_64K;
8869 iteration = 1; 8874 iteration = 1;
8870 } else { 8875 } else {
8871 return error; 8876 return error;
@@ -8883,9 +8888,9 @@ e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank)
8883 8888
8884 /* Write a value 11 (block Erase) in Flash Cycle field in Hw flash 8889 /* Write a value 11 (block Erase) in Flash Cycle field in Hw flash
8885 * Control */ 8890 * Control */
8886 hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL); 8891 hsflctl.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL);
8887 hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_ERASE; 8892 hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_ERASE;
8888 E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval); 8893 E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval);
8889 8894
8890 /* Write the last 24 bits of an index within the block into Flash 8895 /* Write the last 24 bits of an index within the block into Flash
8891 * Linear address field in Flash Address. This probably needs to 8896 * Linear address field in Flash Address. This probably needs to
@@ -8893,17 +8898,17 @@ e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank)
8893 * the software bank size (4, 8 or 64 KBytes) */ 8898 * the software bank size (4, 8 or 64 KBytes) */
8894 flash_linear_address = bank * bank_size + j * sub_sector_size; 8899 flash_linear_address = bank * bank_size + j * sub_sector_size;
8895 flash_linear_address += hw->flash_base_addr; 8900 flash_linear_address += hw->flash_base_addr;
8896 flash_linear_address &= ICH8_FLASH_LINEAR_ADDR_MASK; 8901 flash_linear_address &= ICH_FLASH_LINEAR_ADDR_MASK;
8897 8902
8898 E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address); 8903 E1000_WRITE_ICH_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_address);
8899 8904
8900 error = e1000_ich8_flash_cycle(hw, ICH8_FLASH_ERASE_TIMEOUT); 8905 error = e1000_ich8_flash_cycle(hw, ICH_FLASH_ERASE_TIMEOUT);
8901 /* Check if FCERR is set to 1. If 1, clear it and try the whole 8906 /* Check if FCERR is set to 1. If 1, clear it and try the whole
8902 * sequence a few more times else Done */ 8907 * sequence a few more times else Done */
8903 if (error == E1000_SUCCESS) { 8908 if (error == E1000_SUCCESS) {
8904 break; 8909 break;
8905 } else { 8910 } else {
8906 hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); 8911 hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS);
8907 if (hsfsts.hsf_status.flcerr == 1) { 8912 if (hsfsts.hsf_status.flcerr == 1) {
8908 /* repeat for some time before giving up */ 8913 /* repeat for some time before giving up */
8909 continue; 8914 continue;
@@ -8912,7 +8917,7 @@ e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank)
8912 break; 8917 break;
8913 } 8918 }
8914 } 8919 }
8915 } while ((count < ICH8_FLASH_CYCLE_REPEAT_COUNT) && !error_flag); 8920 } while ((count < ICH_FLASH_CYCLE_REPEAT_COUNT) && !error_flag);
8916 if (error_flag == 1) 8921 if (error_flag == 1)
8917 break; 8922 break;
8918 } 8923 }
@@ -9013,5 +9018,3 @@ e1000_init_lcd_from_nvm(struct e1000_hw *hw)
9013 return E1000_SUCCESS; 9018 return E1000_SUCCESS;
9014} 9019}
9015 9020
9016
9017