diff options
Diffstat (limited to 'drivers/net/e1000e/ich8lan.c')
| -rw-r--r-- | drivers/net/e1000e/ich8lan.c | 630 |
1 files changed, 502 insertions, 128 deletions
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 99df2abf82a9..eff3f4783655 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
| @@ -122,6 +122,27 @@ | |||
| 122 | 122 | ||
| 123 | #define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ | 123 | #define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */ |
| 124 | 124 | ||
| 125 | #define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */ | ||
| 126 | |||
| 127 | /* SMBus Address Phy Register */ | ||
| 128 | #define HV_SMB_ADDR PHY_REG(768, 26) | ||
| 129 | #define HV_SMB_ADDR_PEC_EN 0x0200 | ||
| 130 | #define HV_SMB_ADDR_VALID 0x0080 | ||
| 131 | |||
| 132 | /* Strapping Option Register - RO */ | ||
| 133 | #define E1000_STRAP 0x0000C | ||
| 134 | #define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 | ||
| 135 | #define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17 | ||
| 136 | |||
| 137 | /* OEM Bits Phy Register */ | ||
| 138 | #define HV_OEM_BITS PHY_REG(768, 25) | ||
| 139 | #define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */ | ||
| 140 | #define HV_OEM_BITS_GBE_DIS 0x0040 /* Gigabit Disable */ | ||
| 141 | #define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */ | ||
| 142 | |||
| 143 | #define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */ | ||
| 144 | #define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */ | ||
| 145 | |||
| 125 | /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ | 146 | /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ |
| 126 | /* Offset 04h HSFSTS */ | 147 | /* Offset 04h HSFSTS */ |
| 127 | union ich8_hws_flash_status { | 148 | union ich8_hws_flash_status { |
| @@ -200,6 +221,10 @@ static s32 e1000_setup_led_pchlan(struct e1000_hw *hw); | |||
| 200 | static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw); | 221 | static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw); |
| 201 | static s32 e1000_led_on_pchlan(struct e1000_hw *hw); | 222 | static s32 e1000_led_on_pchlan(struct e1000_hw *hw); |
| 202 | static s32 e1000_led_off_pchlan(struct e1000_hw *hw); | 223 | static s32 e1000_led_off_pchlan(struct e1000_hw *hw); |
| 224 | static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active); | ||
| 225 | static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw); | ||
| 226 | static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link); | ||
| 227 | static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); | ||
| 203 | 228 | ||
| 204 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) | 229 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) |
| 205 | { | 230 | { |
| @@ -242,7 +267,11 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
| 242 | 267 | ||
| 243 | phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; | 268 | phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; |
| 244 | phy->ops.read_phy_reg = e1000_read_phy_reg_hv; | 269 | phy->ops.read_phy_reg = e1000_read_phy_reg_hv; |
| 270 | phy->ops.read_phy_reg_locked = e1000_read_phy_reg_hv_locked; | ||
| 271 | phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan; | ||
| 272 | phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan; | ||
| 245 | phy->ops.write_phy_reg = e1000_write_phy_reg_hv; | 273 | phy->ops.write_phy_reg = e1000_write_phy_reg_hv; |
| 274 | phy->ops.write_phy_reg_locked = e1000_write_phy_reg_hv_locked; | ||
| 246 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 275 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
| 247 | 276 | ||
| 248 | phy->id = e1000_phy_unknown; | 277 | phy->id = e1000_phy_unknown; |
| @@ -303,6 +332,8 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) | |||
| 303 | case IGP03E1000_E_PHY_ID: | 332 | case IGP03E1000_E_PHY_ID: |
| 304 | phy->type = e1000_phy_igp_3; | 333 | phy->type = e1000_phy_igp_3; |
| 305 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 334 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
| 335 | phy->ops.read_phy_reg_locked = e1000e_read_phy_reg_igp_locked; | ||
| 336 | phy->ops.write_phy_reg_locked = e1000e_write_phy_reg_igp_locked; | ||
| 306 | break; | 337 | break; |
| 307 | case IFE_E_PHY_ID: | 338 | case IFE_E_PHY_ID: |
| 308 | case IFE_PLUS_E_PHY_ID: | 339 | case IFE_PLUS_E_PHY_ID: |
| @@ -469,14 +500,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) | |||
| 469 | goto out; | 500 | goto out; |
| 470 | } | 501 | } |
| 471 | 502 | ||
| 472 | if (hw->mac.type == e1000_pchlan) { | ||
| 473 | ret_val = e1000e_write_kmrn_reg(hw, | ||
| 474 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
| 475 | E1000_KMRNCTRLSTA_K1_ENABLE); | ||
| 476 | if (ret_val) | ||
| 477 | goto out; | ||
| 478 | } | ||
| 479 | |||
| 480 | /* | 503 | /* |
| 481 | * First we want to see if the MII Status Register reports | 504 | * First we want to see if the MII Status Register reports |
| 482 | * link. If so, then we want to get the current speed/duplex | 505 | * link. If so, then we want to get the current speed/duplex |
| @@ -486,6 +509,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) | |||
| 486 | if (ret_val) | 509 | if (ret_val) |
| 487 | goto out; | 510 | goto out; |
| 488 | 511 | ||
| 512 | if (hw->mac.type == e1000_pchlan) { | ||
| 513 | ret_val = e1000_k1_gig_workaround_hv(hw, link); | ||
| 514 | if (ret_val) | ||
| 515 | goto out; | ||
| 516 | } | ||
| 517 | |||
| 489 | if (!link) | 518 | if (!link) |
| 490 | goto out; /* No link detected */ | 519 | goto out; /* No link detected */ |
| 491 | 520 | ||
| @@ -568,12 +597,39 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) | |||
| 568 | static DEFINE_MUTEX(nvm_mutex); | 597 | static DEFINE_MUTEX(nvm_mutex); |
| 569 | 598 | ||
| 570 | /** | 599 | /** |
| 600 | * e1000_acquire_nvm_ich8lan - Acquire NVM mutex | ||
| 601 | * @hw: pointer to the HW structure | ||
| 602 | * | ||
| 603 | * Acquires the mutex for performing NVM operations. | ||
| 604 | **/ | ||
| 605 | static s32 e1000_acquire_nvm_ich8lan(struct e1000_hw *hw) | ||
| 606 | { | ||
| 607 | mutex_lock(&nvm_mutex); | ||
| 608 | |||
| 609 | return 0; | ||
| 610 | } | ||
| 611 | |||
| 612 | /** | ||
| 613 | * e1000_release_nvm_ich8lan - Release NVM mutex | ||
| 614 | * @hw: pointer to the HW structure | ||
| 615 | * | ||
| 616 | * Releases the mutex used while performing NVM operations. | ||
| 617 | **/ | ||
| 618 | static void e1000_release_nvm_ich8lan(struct e1000_hw *hw) | ||
| 619 | { | ||
| 620 | mutex_unlock(&nvm_mutex); | ||
| 621 | |||
| 622 | return; | ||
| 623 | } | ||
| 624 | |||
| 625 | static DEFINE_MUTEX(swflag_mutex); | ||
| 626 | |||
| 627 | /** | ||
| 571 | * e1000_acquire_swflag_ich8lan - Acquire software control flag | 628 | * e1000_acquire_swflag_ich8lan - Acquire software control flag |
| 572 | * @hw: pointer to the HW structure | 629 | * @hw: pointer to the HW structure |
| 573 | * | 630 | * |
| 574 | * Acquires the software control flag for performing NVM and PHY | 631 | * Acquires the software control flag for performing PHY and select |
| 575 | * operations. This is a function pointer entry point only called by | 632 | * MAC CSR accesses. |
| 576 | * read/write routines for the PHY and NVM parts. | ||
| 577 | **/ | 633 | **/ |
| 578 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | 634 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) |
| 579 | { | 635 | { |
| @@ -582,7 +638,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
| 582 | 638 | ||
| 583 | might_sleep(); | 639 | might_sleep(); |
| 584 | 640 | ||
| 585 | mutex_lock(&nvm_mutex); | 641 | mutex_lock(&swflag_mutex); |
| 586 | 642 | ||
| 587 | while (timeout) { | 643 | while (timeout) { |
| 588 | extcnf_ctrl = er32(EXTCNF_CTRL); | 644 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| @@ -599,7 +655,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
| 599 | goto out; | 655 | goto out; |
| 600 | } | 656 | } |
| 601 | 657 | ||
| 602 | timeout = PHY_CFG_TIMEOUT * 2; | 658 | timeout = SW_FLAG_TIMEOUT; |
| 603 | 659 | ||
| 604 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; | 660 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; |
| 605 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 661 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
| @@ -623,7 +679,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
| 623 | 679 | ||
| 624 | out: | 680 | out: |
| 625 | if (ret_val) | 681 | if (ret_val) |
| 626 | mutex_unlock(&nvm_mutex); | 682 | mutex_unlock(&swflag_mutex); |
| 627 | 683 | ||
| 628 | return ret_val; | 684 | return ret_val; |
| 629 | } | 685 | } |
| @@ -632,9 +688,8 @@ out: | |||
| 632 | * e1000_release_swflag_ich8lan - Release software control flag | 688 | * e1000_release_swflag_ich8lan - Release software control flag |
| 633 | * @hw: pointer to the HW structure | 689 | * @hw: pointer to the HW structure |
| 634 | * | 690 | * |
| 635 | * Releases the software control flag for performing NVM and PHY operations. | 691 | * Releases the software control flag for performing PHY and select |
| 636 | * This is a function pointer entry point only called by read/write | 692 | * MAC CSR accesses. |
| 637 | * routines for the PHY and NVM parts. | ||
| 638 | **/ | 693 | **/ |
| 639 | static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) | 694 | static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) |
| 640 | { | 695 | { |
| @@ -644,7 +699,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) | |||
| 644 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; | 699 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; |
| 645 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 700 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
| 646 | 701 | ||
| 647 | mutex_unlock(&nvm_mutex); | 702 | mutex_unlock(&swflag_mutex); |
| 703 | |||
| 704 | return; | ||
| 648 | } | 705 | } |
| 649 | 706 | ||
| 650 | /** | 707 | /** |
| @@ -752,6 +809,327 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw) | |||
| 752 | } | 809 | } |
| 753 | 810 | ||
| 754 | /** | 811 | /** |
| 812 | * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration | ||
| 813 | * @hw: pointer to the HW structure | ||
| 814 | * | ||
| 815 | * SW should configure the LCD from the NVM extended configuration region | ||
| 816 | * as a workaround for certain parts. | ||
| 817 | **/ | ||
| 818 | static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) | ||
| 819 | { | ||
| 820 | struct e1000_phy_info *phy = &hw->phy; | ||
| 821 | u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; | ||
| 822 | s32 ret_val; | ||
| 823 | u16 word_addr, reg_data, reg_addr, phy_page = 0; | ||
| 824 | |||
| 825 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
| 826 | if (ret_val) | ||
| 827 | return ret_val; | ||
| 828 | |||
| 829 | /* | ||
| 830 | * Initialize the PHY from the NVM on ICH platforms. This | ||
| 831 | * is needed due to an issue where the NVM configuration is | ||
| 832 | * not properly autoloaded after power transitions. | ||
| 833 | * Therefore, after each PHY reset, we will load the | ||
| 834 | * configuration data out of the NVM manually. | ||
| 835 | */ | ||
| 836 | if ((hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) || | ||
| 837 | (hw->mac.type == e1000_pchlan)) { | ||
| 838 | struct e1000_adapter *adapter = hw->adapter; | ||
| 839 | |||
| 840 | /* Check if SW needs to configure the PHY */ | ||
| 841 | if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) || | ||
| 842 | (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) || | ||
| 843 | (hw->mac.type == e1000_pchlan)) | ||
| 844 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; | ||
| 845 | else | ||
| 846 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; | ||
| 847 | |||
| 848 | data = er32(FEXTNVM); | ||
| 849 | if (!(data & sw_cfg_mask)) | ||
| 850 | goto out; | ||
| 851 | |||
| 852 | /* Wait for basic configuration completes before proceeding */ | ||
| 853 | e1000_lan_init_done_ich8lan(hw); | ||
| 854 | |||
| 855 | /* | ||
| 856 | * Make sure HW does not configure LCD from PHY | ||
| 857 | * extended configuration before SW configuration | ||
| 858 | */ | ||
| 859 | data = er32(EXTCNF_CTRL); | ||
| 860 | if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) | ||
| 861 | goto out; | ||
| 862 | |||
| 863 | cnf_size = er32(EXTCNF_SIZE); | ||
| 864 | cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; | ||
| 865 | cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT; | ||
| 866 | if (!cnf_size) | ||
| 867 | goto out; | ||
| 868 | |||
| 869 | cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; | ||
| 870 | cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; | ||
| 871 | |||
| 872 | if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && | ||
| 873 | (hw->mac.type == e1000_pchlan)) { | ||
| 874 | /* | ||
| 875 | * HW configures the SMBus address and LEDs when the | ||
| 876 | * OEM and LCD Write Enable bits are set in the NVM. | ||
| 877 | * When both NVM bits are cleared, SW will configure | ||
| 878 | * them instead. | ||
| 879 | */ | ||
| 880 | data = er32(STRAP); | ||
| 881 | data &= E1000_STRAP_SMBUS_ADDRESS_MASK; | ||
| 882 | reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT; | ||
| 883 | reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID; | ||
| 884 | ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, | ||
| 885 | reg_data); | ||
| 886 | if (ret_val) | ||
| 887 | goto out; | ||
| 888 | |||
| 889 | data = er32(LEDCTL); | ||
| 890 | ret_val = e1000_write_phy_reg_hv_locked(hw, | ||
| 891 | HV_LED_CONFIG, | ||
| 892 | (u16)data); | ||
| 893 | if (ret_val) | ||
| 894 | goto out; | ||
| 895 | } | ||
| 896 | /* Configure LCD from extended configuration region. */ | ||
| 897 | |||
| 898 | /* cnf_base_addr is in DWORD */ | ||
| 899 | word_addr = (u16)(cnf_base_addr << 1); | ||
| 900 | |||
| 901 | for (i = 0; i < cnf_size; i++) { | ||
| 902 | ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1, | ||
| 903 | ®_data); | ||
| 904 | if (ret_val) | ||
| 905 | goto out; | ||
| 906 | |||
| 907 | ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1), | ||
| 908 | 1, ®_addr); | ||
| 909 | if (ret_val) | ||
| 910 | goto out; | ||
| 911 | |||
| 912 | /* Save off the PHY page for future writes. */ | ||
| 913 | if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) { | ||
| 914 | phy_page = reg_data; | ||
| 915 | continue; | ||
| 916 | } | ||
| 917 | |||
| 918 | reg_addr &= PHY_REG_MASK; | ||
| 919 | reg_addr |= phy_page; | ||
| 920 | |||
| 921 | ret_val = phy->ops.write_phy_reg_locked(hw, | ||
| 922 | (u32)reg_addr, | ||
| 923 | reg_data); | ||
| 924 | if (ret_val) | ||
| 925 | goto out; | ||
| 926 | } | ||
| 927 | } | ||
| 928 | |||
| 929 | out: | ||
| 930 | hw->phy.ops.release_phy(hw); | ||
| 931 | return ret_val; | ||
| 932 | } | ||
| 933 | |||
| 934 | /** | ||
| 935 | * e1000_k1_gig_workaround_hv - K1 Si workaround | ||
| 936 | * @hw: pointer to the HW structure | ||
| 937 | * @link: link up bool flag | ||
| 938 | * | ||
| 939 | * If K1 is enabled for 1Gbps, the MAC might stall when transitioning | ||
| 940 | * from a lower speed. This workaround disables K1 whenever link is at 1Gig | ||
| 941 | * If link is down, the function will restore the default K1 setting located | ||
| 942 | * in the NVM. | ||
| 943 | **/ | ||
| 944 | static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) | ||
| 945 | { | ||
| 946 | s32 ret_val = 0; | ||
| 947 | u16 status_reg = 0; | ||
| 948 | bool k1_enable = hw->dev_spec.ich8lan.nvm_k1_enabled; | ||
| 949 | |||
| 950 | if (hw->mac.type != e1000_pchlan) | ||
| 951 | goto out; | ||
| 952 | |||
| 953 | /* Wrap the whole flow with the sw flag */ | ||
| 954 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
| 955 | if (ret_val) | ||
| 956 | goto out; | ||
| 957 | |||
| 958 | /* Disable K1 when link is 1Gbps, otherwise use the NVM setting */ | ||
| 959 | if (link) { | ||
| 960 | if (hw->phy.type == e1000_phy_82578) { | ||
| 961 | ret_val = hw->phy.ops.read_phy_reg_locked(hw, | ||
| 962 | BM_CS_STATUS, | ||
| 963 | &status_reg); | ||
| 964 | if (ret_val) | ||
| 965 | goto release; | ||
| 966 | |||
| 967 | status_reg &= BM_CS_STATUS_LINK_UP | | ||
| 968 | BM_CS_STATUS_RESOLVED | | ||
| 969 | BM_CS_STATUS_SPEED_MASK; | ||
| 970 | |||
| 971 | if (status_reg == (BM_CS_STATUS_LINK_UP | | ||
| 972 | BM_CS_STATUS_RESOLVED | | ||
| 973 | BM_CS_STATUS_SPEED_1000)) | ||
| 974 | k1_enable = false; | ||
| 975 | } | ||
| 976 | |||
| 977 | if (hw->phy.type == e1000_phy_82577) { | ||
| 978 | ret_val = hw->phy.ops.read_phy_reg_locked(hw, | ||
| 979 | HV_M_STATUS, | ||
| 980 | &status_reg); | ||
| 981 | if (ret_val) | ||
| 982 | goto release; | ||
| 983 | |||
| 984 | status_reg &= HV_M_STATUS_LINK_UP | | ||
| 985 | HV_M_STATUS_AUTONEG_COMPLETE | | ||
| 986 | HV_M_STATUS_SPEED_MASK; | ||
| 987 | |||
| 988 | if (status_reg == (HV_M_STATUS_LINK_UP | | ||
| 989 | HV_M_STATUS_AUTONEG_COMPLETE | | ||
| 990 | HV_M_STATUS_SPEED_1000)) | ||
| 991 | k1_enable = false; | ||
| 992 | } | ||
| 993 | |||
| 994 | /* Link stall fix for link up */ | ||
| 995 | ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19), | ||
| 996 | 0x0100); | ||
| 997 | if (ret_val) | ||
| 998 | goto release; | ||
| 999 | |||
| 1000 | } else { | ||
| 1001 | /* Link stall fix for link down */ | ||
| 1002 | ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19), | ||
| 1003 | 0x4100); | ||
| 1004 | if (ret_val) | ||
| 1005 | goto release; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | ret_val = e1000_configure_k1_ich8lan(hw, k1_enable); | ||
| 1009 | |||
| 1010 | release: | ||
| 1011 | hw->phy.ops.release_phy(hw); | ||
| 1012 | out: | ||
| 1013 | return ret_val; | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | /** | ||
| 1017 | * e1000_configure_k1_ich8lan - Configure K1 power state | ||
| 1018 | * @hw: pointer to the HW structure | ||
| 1019 | * @enable: K1 state to configure | ||
| 1020 | * | ||
| 1021 | * Configure the K1 power state based on the provided parameter. | ||
| 1022 | * Assumes semaphore already acquired. | ||
| 1023 | * | ||
| 1024 | * Success returns 0, Failure returns -E1000_ERR_PHY (-2) | ||
| 1025 | **/ | ||
| 1026 | static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable) | ||
| 1027 | { | ||
| 1028 | s32 ret_val = 0; | ||
| 1029 | u32 ctrl_reg = 0; | ||
| 1030 | u32 ctrl_ext = 0; | ||
| 1031 | u32 reg = 0; | ||
| 1032 | u16 kmrn_reg = 0; | ||
| 1033 | |||
| 1034 | ret_val = e1000e_read_kmrn_reg_locked(hw, | ||
| 1035 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
| 1036 | &kmrn_reg); | ||
| 1037 | if (ret_val) | ||
| 1038 | goto out; | ||
| 1039 | |||
| 1040 | if (k1_enable) | ||
| 1041 | kmrn_reg |= E1000_KMRNCTRLSTA_K1_ENABLE; | ||
| 1042 | else | ||
| 1043 | kmrn_reg &= ~E1000_KMRNCTRLSTA_K1_ENABLE; | ||
| 1044 | |||
| 1045 | ret_val = e1000e_write_kmrn_reg_locked(hw, | ||
| 1046 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
| 1047 | kmrn_reg); | ||
| 1048 | if (ret_val) | ||
| 1049 | goto out; | ||
| 1050 | |||
| 1051 | udelay(20); | ||
| 1052 | ctrl_ext = er32(CTRL_EXT); | ||
| 1053 | ctrl_reg = er32(CTRL); | ||
| 1054 | |||
| 1055 | reg = ctrl_reg & ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); | ||
| 1056 | reg |= E1000_CTRL_FRCSPD; | ||
| 1057 | ew32(CTRL, reg); | ||
| 1058 | |||
| 1059 | ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS); | ||
| 1060 | udelay(20); | ||
| 1061 | ew32(CTRL, ctrl_reg); | ||
| 1062 | ew32(CTRL_EXT, ctrl_ext); | ||
| 1063 | udelay(20); | ||
| 1064 | |||
| 1065 | out: | ||
| 1066 | return ret_val; | ||
| 1067 | } | ||
| 1068 | |||
| 1069 | /** | ||
| 1070 | * e1000_oem_bits_config_ich8lan - SW-based LCD Configuration | ||
| 1071 | * @hw: pointer to the HW structure | ||
| 1072 | * @d0_state: boolean if entering d0 or d3 device state | ||
| 1073 | * | ||
| 1074 | * SW will configure Gbe Disable and LPLU based on the NVM. The four bits are | ||
| 1075 | * collectively called OEM bits. The OEM Write Enable bit and SW Config bit | ||
| 1076 | * in NVM determines whether HW should configure LPLU and Gbe Disable. | ||
| 1077 | **/ | ||
| 1078 | static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | ||
| 1079 | { | ||
| 1080 | s32 ret_val = 0; | ||
| 1081 | u32 mac_reg; | ||
| 1082 | u16 oem_reg; | ||
| 1083 | |||
| 1084 | if (hw->mac.type != e1000_pchlan) | ||
| 1085 | return ret_val; | ||
| 1086 | |||
| 1087 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
| 1088 | if (ret_val) | ||
| 1089 | return ret_val; | ||
| 1090 | |||
| 1091 | mac_reg = er32(EXTCNF_CTRL); | ||
| 1092 | if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) | ||
| 1093 | goto out; | ||
| 1094 | |||
| 1095 | mac_reg = er32(FEXTNVM); | ||
| 1096 | if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M)) | ||
| 1097 | goto out; | ||
| 1098 | |||
| 1099 | mac_reg = er32(PHY_CTRL); | ||
| 1100 | |||
| 1101 | ret_val = hw->phy.ops.read_phy_reg_locked(hw, HV_OEM_BITS, &oem_reg); | ||
| 1102 | if (ret_val) | ||
| 1103 | goto out; | ||
| 1104 | |||
| 1105 | oem_reg &= ~(HV_OEM_BITS_GBE_DIS | HV_OEM_BITS_LPLU); | ||
| 1106 | |||
| 1107 | if (d0_state) { | ||
| 1108 | if (mac_reg & E1000_PHY_CTRL_GBE_DISABLE) | ||
| 1109 | oem_reg |= HV_OEM_BITS_GBE_DIS; | ||
| 1110 | |||
| 1111 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) | ||
| 1112 | oem_reg |= HV_OEM_BITS_LPLU; | ||
| 1113 | } else { | ||
| 1114 | if (mac_reg & E1000_PHY_CTRL_NOND0A_GBE_DISABLE) | ||
| 1115 | oem_reg |= HV_OEM_BITS_GBE_DIS; | ||
| 1116 | |||
| 1117 | if (mac_reg & E1000_PHY_CTRL_NOND0A_LPLU) | ||
| 1118 | oem_reg |= HV_OEM_BITS_LPLU; | ||
| 1119 | } | ||
| 1120 | /* Restart auto-neg to activate the bits */ | ||
| 1121 | if (!e1000_check_reset_block(hw)) | ||
| 1122 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
| 1123 | ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg); | ||
| 1124 | |||
| 1125 | out: | ||
| 1126 | hw->phy.ops.release_phy(hw); | ||
| 1127 | |||
| 1128 | return ret_val; | ||
| 1129 | } | ||
| 1130 | |||
| 1131 | |||
| 1132 | /** | ||
| 755 | * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be | 1133 | * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be |
| 756 | * done after every PHY reset. | 1134 | * done after every PHY reset. |
| 757 | **/ | 1135 | **/ |
| @@ -791,10 +1169,20 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) | |||
| 791 | ret_val = hw->phy.ops.acquire_phy(hw); | 1169 | ret_val = hw->phy.ops.acquire_phy(hw); |
| 792 | if (ret_val) | 1170 | if (ret_val) |
| 793 | return ret_val; | 1171 | return ret_val; |
| 1172 | |||
| 794 | hw->phy.addr = 1; | 1173 | hw->phy.addr = 1; |
| 795 | e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0); | 1174 | ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0); |
| 1175 | if (ret_val) | ||
| 1176 | goto out; | ||
| 796 | hw->phy.ops.release_phy(hw); | 1177 | hw->phy.ops.release_phy(hw); |
| 797 | 1178 | ||
| 1179 | /* | ||
| 1180 | * Configure the K1 Si workaround during phy reset assuming there is | ||
| 1181 | * link so that it disables K1 if link is in 1Gbps. | ||
| 1182 | */ | ||
| 1183 | ret_val = e1000_k1_gig_workaround_hv(hw, true); | ||
| 1184 | |||
| 1185 | out: | ||
| 798 | return ret_val; | 1186 | return ret_val; |
| 799 | } | 1187 | } |
| 800 | 1188 | ||
| @@ -840,11 +1228,8 @@ static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw) | |||
| 840 | **/ | 1228 | **/ |
| 841 | static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | 1229 | static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) |
| 842 | { | 1230 | { |
| 843 | struct e1000_phy_info *phy = &hw->phy; | 1231 | s32 ret_val = 0; |
| 844 | u32 i; | 1232 | u16 reg; |
| 845 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; | ||
| 846 | s32 ret_val; | ||
| 847 | u16 word_addr, reg_data, reg_addr, phy_page = 0; | ||
| 848 | 1233 | ||
| 849 | ret_val = e1000e_phy_hw_reset_generic(hw); | 1234 | ret_val = e1000e_phy_hw_reset_generic(hw); |
| 850 | if (ret_val) | 1235 | if (ret_val) |
| @@ -859,81 +1244,20 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
| 859 | return ret_val; | 1244 | return ret_val; |
| 860 | } | 1245 | } |
| 861 | 1246 | ||
| 862 | /* | 1247 | /* Dummy read to clear the phy wakeup bit after lcd reset */ |
| 863 | * Initialize the PHY from the NVM on ICH platforms. This | 1248 | if (hw->mac.type == e1000_pchlan) |
| 864 | * is needed due to an issue where the NVM configuration is | 1249 | e1e_rphy(hw, BM_WUC, ®); |
| 865 | * not properly autoloaded after power transitions. | ||
| 866 | * Therefore, after each PHY reset, we will load the | ||
| 867 | * configuration data out of the NVM manually. | ||
| 868 | */ | ||
| 869 | if (hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) { | ||
| 870 | struct e1000_adapter *adapter = hw->adapter; | ||
| 871 | |||
| 872 | /* Check if SW needs configure the PHY */ | ||
| 873 | if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) || | ||
| 874 | (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M)) | ||
| 875 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; | ||
| 876 | else | ||
| 877 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; | ||
| 878 | |||
| 879 | data = er32(FEXTNVM); | ||
| 880 | if (!(data & sw_cfg_mask)) | ||
| 881 | return 0; | ||
| 882 | |||
| 883 | /* Wait for basic configuration completes before proceeding */ | ||
| 884 | e1000_lan_init_done_ich8lan(hw); | ||
| 885 | |||
| 886 | /* | ||
| 887 | * Make sure HW does not configure LCD from PHY | ||
| 888 | * extended configuration before SW configuration | ||
| 889 | */ | ||
| 890 | data = er32(EXTCNF_CTRL); | ||
| 891 | if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) | ||
| 892 | return 0; | ||
| 893 | |||
| 894 | cnf_size = er32(EXTCNF_SIZE); | ||
| 895 | cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; | ||
| 896 | cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT; | ||
| 897 | if (!cnf_size) | ||
| 898 | return 0; | ||
| 899 | |||
| 900 | cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; | ||
| 901 | cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; | ||
| 902 | |||
| 903 | /* Configure LCD from extended configuration region. */ | ||
| 904 | |||
| 905 | /* cnf_base_addr is in DWORD */ | ||
| 906 | word_addr = (u16)(cnf_base_addr << 1); | ||
| 907 | |||
| 908 | for (i = 0; i < cnf_size; i++) { | ||
| 909 | ret_val = e1000_read_nvm(hw, | ||
| 910 | (word_addr + i * 2), | ||
| 911 | 1, | ||
| 912 | ®_data); | ||
| 913 | if (ret_val) | ||
| 914 | return ret_val; | ||
| 915 | |||
| 916 | ret_val = e1000_read_nvm(hw, | ||
| 917 | (word_addr + i * 2 + 1), | ||
| 918 | 1, | ||
| 919 | ®_addr); | ||
| 920 | if (ret_val) | ||
| 921 | return ret_val; | ||
| 922 | |||
| 923 | /* Save off the PHY page for future writes. */ | ||
| 924 | if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) { | ||
| 925 | phy_page = reg_data; | ||
| 926 | continue; | ||
| 927 | } | ||
| 928 | 1250 | ||
| 929 | reg_addr |= phy_page; | 1251 | /* Configure the LCD with the extended configuration region in NVM */ |
| 1252 | ret_val = e1000_sw_lcd_config_ich8lan(hw); | ||
| 1253 | if (ret_val) | ||
| 1254 | goto out; | ||
| 930 | 1255 | ||
| 931 | ret_val = e1e_wphy(hw, (u32)reg_addr, reg_data); | 1256 | /* Configure the LCD with the OEM bits in NVM */ |
| 932 | if (ret_val) | 1257 | if (hw->mac.type == e1000_pchlan) |
| 933 | return ret_val; | 1258 | ret_val = e1000_oem_bits_config_ich8lan(hw, true); |
| 934 | } | ||
| 935 | } | ||
| 936 | 1259 | ||
| 1260 | out: | ||
| 937 | return 0; | 1261 | return 0; |
| 938 | } | 1262 | } |
| 939 | 1263 | ||
| @@ -1054,6 +1378,38 @@ static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw) | |||
| 1054 | } | 1378 | } |
| 1055 | 1379 | ||
| 1056 | /** | 1380 | /** |
| 1381 | * e1000_set_lplu_state_pchlan - Set Low Power Link Up state | ||
| 1382 | * @hw: pointer to the HW structure | ||
| 1383 | * @active: true to enable LPLU, false to disable | ||
| 1384 | * | ||
| 1385 | * Sets the LPLU state according to the active flag. For PCH, if OEM write | ||
| 1386 | * bit are disabled in the NVM, writing the LPLU bits in the MAC will not set | ||
| 1387 | * the phy speed. This function will manually set the LPLU bit and restart | ||
| 1388 | * auto-neg as hw would do. D3 and D0 LPLU will call the same function | ||
| 1389 | * since it configures the same bit. | ||
| 1390 | **/ | ||
| 1391 | static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active) | ||
| 1392 | { | ||
| 1393 | s32 ret_val = 0; | ||
| 1394 | u16 oem_reg; | ||
| 1395 | |||
| 1396 | ret_val = e1e_rphy(hw, HV_OEM_BITS, &oem_reg); | ||
| 1397 | if (ret_val) | ||
| 1398 | goto out; | ||
| 1399 | |||
| 1400 | if (active) | ||
| 1401 | oem_reg |= HV_OEM_BITS_LPLU; | ||
| 1402 | else | ||
| 1403 | oem_reg &= ~HV_OEM_BITS_LPLU; | ||
| 1404 | |||
| 1405 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
| 1406 | ret_val = e1e_wphy(hw, HV_OEM_BITS, oem_reg); | ||
| 1407 | |||
| 1408 | out: | ||
| 1409 | return ret_val; | ||
| 1410 | } | ||
| 1411 | |||
| 1412 | /** | ||
| 1057 | * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state | 1413 | * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state |
| 1058 | * @hw: pointer to the HW structure | 1414 | * @hw: pointer to the HW structure |
| 1059 | * @active: TRUE to enable LPLU, FALSE to disable | 1415 | * @active: TRUE to enable LPLU, FALSE to disable |
| @@ -1314,12 +1670,11 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
| 1314 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || | 1670 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || |
| 1315 | (words == 0)) { | 1671 | (words == 0)) { |
| 1316 | hw_dbg(hw, "nvm parameter(s) out of bounds\n"); | 1672 | hw_dbg(hw, "nvm parameter(s) out of bounds\n"); |
| 1317 | return -E1000_ERR_NVM; | 1673 | ret_val = -E1000_ERR_NVM; |
| 1674 | goto out; | ||
| 1318 | } | 1675 | } |
| 1319 | 1676 | ||
| 1320 | ret_val = e1000_acquire_swflag_ich8lan(hw); | 1677 | nvm->ops.acquire_nvm(hw); |
| 1321 | if (ret_val) | ||
| 1322 | goto out; | ||
| 1323 | 1678 | ||
| 1324 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); | 1679 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); |
| 1325 | if (ret_val) { | 1680 | if (ret_val) { |
| @@ -1345,7 +1700,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
| 1345 | } | 1700 | } |
| 1346 | } | 1701 | } |
| 1347 | 1702 | ||
| 1348 | e1000_release_swflag_ich8lan(hw); | 1703 | nvm->ops.release_nvm(hw); |
| 1349 | 1704 | ||
| 1350 | out: | 1705 | out: |
| 1351 | if (ret_val) | 1706 | if (ret_val) |
| @@ -1603,11 +1958,15 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
| 1603 | return -E1000_ERR_NVM; | 1958 | return -E1000_ERR_NVM; |
| 1604 | } | 1959 | } |
| 1605 | 1960 | ||
| 1961 | nvm->ops.acquire_nvm(hw); | ||
| 1962 | |||
| 1606 | for (i = 0; i < words; i++) { | 1963 | for (i = 0; i < words; i++) { |
| 1607 | dev_spec->shadow_ram[offset+i].modified = 1; | 1964 | dev_spec->shadow_ram[offset+i].modified = 1; |
| 1608 | dev_spec->shadow_ram[offset+i].value = data[i]; | 1965 | dev_spec->shadow_ram[offset+i].value = data[i]; |
| 1609 | } | 1966 | } |
| 1610 | 1967 | ||
| 1968 | nvm->ops.release_nvm(hw); | ||
| 1969 | |||
| 1611 | return 0; | 1970 | return 0; |
| 1612 | } | 1971 | } |
| 1613 | 1972 | ||
| @@ -1637,9 +1996,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1637 | if (nvm->type != e1000_nvm_flash_sw) | 1996 | if (nvm->type != e1000_nvm_flash_sw) |
| 1638 | goto out; | 1997 | goto out; |
| 1639 | 1998 | ||
| 1640 | ret_val = e1000_acquire_swflag_ich8lan(hw); | 1999 | nvm->ops.acquire_nvm(hw); |
| 1641 | if (ret_val) | ||
| 1642 | goto out; | ||
| 1643 | 2000 | ||
| 1644 | /* | 2001 | /* |
| 1645 | * We're writing to the opposite bank so if we're on bank 1, | 2002 | * We're writing to the opposite bank so if we're on bank 1, |
| @@ -1657,7 +2014,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1657 | old_bank_offset = 0; | 2014 | old_bank_offset = 0; |
| 1658 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); | 2015 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); |
| 1659 | if (ret_val) { | 2016 | if (ret_val) { |
| 1660 | e1000_release_swflag_ich8lan(hw); | 2017 | nvm->ops.release_nvm(hw); |
| 1661 | goto out; | 2018 | goto out; |
| 1662 | } | 2019 | } |
| 1663 | } else { | 2020 | } else { |
| @@ -1665,7 +2022,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1665 | new_bank_offset = 0; | 2022 | new_bank_offset = 0; |
| 1666 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); | 2023 | ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); |
| 1667 | if (ret_val) { | 2024 | if (ret_val) { |
| 1668 | e1000_release_swflag_ich8lan(hw); | 2025 | nvm->ops.release_nvm(hw); |
| 1669 | goto out; | 2026 | goto out; |
| 1670 | } | 2027 | } |
| 1671 | } | 2028 | } |
| @@ -1723,7 +2080,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1723 | if (ret_val) { | 2080 | if (ret_val) { |
| 1724 | /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ | 2081 | /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ |
| 1725 | hw_dbg(hw, "Flash commit failed.\n"); | 2082 | hw_dbg(hw, "Flash commit failed.\n"); |
| 1726 | e1000_release_swflag_ich8lan(hw); | 2083 | nvm->ops.release_nvm(hw); |
| 1727 | goto out; | 2084 | goto out; |
| 1728 | } | 2085 | } |
| 1729 | 2086 | ||
| @@ -1736,7 +2093,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1736 | act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; | 2093 | act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; |
| 1737 | ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); | 2094 | ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); |
| 1738 | if (ret_val) { | 2095 | if (ret_val) { |
| 1739 | e1000_release_swflag_ich8lan(hw); | 2096 | nvm->ops.release_nvm(hw); |
| 1740 | goto out; | 2097 | goto out; |
| 1741 | } | 2098 | } |
| 1742 | data &= 0xBFFF; | 2099 | data &= 0xBFFF; |
| @@ -1744,7 +2101,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1744 | act_offset * 2 + 1, | 2101 | act_offset * 2 + 1, |
| 1745 | (u8)(data >> 8)); | 2102 | (u8)(data >> 8)); |
| 1746 | if (ret_val) { | 2103 | if (ret_val) { |
| 1747 | e1000_release_swflag_ich8lan(hw); | 2104 | nvm->ops.release_nvm(hw); |
| 1748 | goto out; | 2105 | goto out; |
| 1749 | } | 2106 | } |
| 1750 | 2107 | ||
| @@ -1757,7 +2114,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1757 | act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; | 2114 | act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; |
| 1758 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); | 2115 | ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); |
| 1759 | if (ret_val) { | 2116 | if (ret_val) { |
| 1760 | e1000_release_swflag_ich8lan(hw); | 2117 | nvm->ops.release_nvm(hw); |
| 1761 | goto out; | 2118 | goto out; |
| 1762 | } | 2119 | } |
| 1763 | 2120 | ||
| @@ -1767,7 +2124,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1767 | dev_spec->shadow_ram[i].value = 0xFFFF; | 2124 | dev_spec->shadow_ram[i].value = 0xFFFF; |
| 1768 | } | 2125 | } |
| 1769 | 2126 | ||
| 1770 | e1000_release_swflag_ich8lan(hw); | 2127 | nvm->ops.release_nvm(hw); |
| 1771 | 2128 | ||
| 1772 | /* | 2129 | /* |
| 1773 | * Reload the EEPROM, or else modifications will not appear | 2130 | * Reload the EEPROM, or else modifications will not appear |
| @@ -1831,14 +2188,12 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1831 | **/ | 2188 | **/ |
| 1832 | void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) | 2189 | void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) |
| 1833 | { | 2190 | { |
| 2191 | struct e1000_nvm_info *nvm = &hw->nvm; | ||
| 1834 | union ich8_flash_protected_range pr0; | 2192 | union ich8_flash_protected_range pr0; |
| 1835 | union ich8_hws_flash_status hsfsts; | 2193 | union ich8_hws_flash_status hsfsts; |
| 1836 | u32 gfpreg; | 2194 | u32 gfpreg; |
| 1837 | s32 ret_val; | ||
| 1838 | 2195 | ||
| 1839 | ret_val = e1000_acquire_swflag_ich8lan(hw); | 2196 | nvm->ops.acquire_nvm(hw); |
| 1840 | if (ret_val) | ||
| 1841 | return; | ||
| 1842 | 2197 | ||
| 1843 | gfpreg = er32flash(ICH_FLASH_GFPREG); | 2198 | gfpreg = er32flash(ICH_FLASH_GFPREG); |
| 1844 | 2199 | ||
| @@ -1859,7 +2214,7 @@ void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) | |||
| 1859 | hsfsts.hsf_status.flockdn = true; | 2214 | hsfsts.hsf_status.flockdn = true; |
| 1860 | ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); | 2215 | ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); |
| 1861 | 2216 | ||
| 1862 | e1000_release_swflag_ich8lan(hw); | 2217 | nvm->ops.release_nvm(hw); |
| 1863 | } | 2218 | } |
| 1864 | 2219 | ||
| 1865 | /** | 2220 | /** |
| @@ -2229,6 +2584,8 @@ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw) | |||
| 2229 | **/ | 2584 | **/ |
| 2230 | static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | 2585 | static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) |
| 2231 | { | 2586 | { |
| 2587 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | ||
| 2588 | u16 reg; | ||
| 2232 | u32 ctrl, icr, kab; | 2589 | u32 ctrl, icr, kab; |
| 2233 | s32 ret_val; | 2590 | s32 ret_val; |
| 2234 | 2591 | ||
| @@ -2263,6 +2620,18 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
| 2263 | ew32(PBS, E1000_PBS_16K); | 2620 | ew32(PBS, E1000_PBS_16K); |
| 2264 | } | 2621 | } |
| 2265 | 2622 | ||
| 2623 | if (hw->mac.type == e1000_pchlan) { | ||
| 2624 | /* Save the NVM K1 bit setting*/ | ||
| 2625 | ret_val = e1000_read_nvm(hw, E1000_NVM_K1_CONFIG, 1, ®); | ||
| 2626 | if (ret_val) | ||
| 2627 | return ret_val; | ||
| 2628 | |||
| 2629 | if (reg & E1000_NVM_K1_ENABLE) | ||
| 2630 | dev_spec->nvm_k1_enabled = true; | ||
| 2631 | else | ||
| 2632 | dev_spec->nvm_k1_enabled = false; | ||
| 2633 | } | ||
| 2634 | |||
| 2266 | ctrl = er32(CTRL); | 2635 | ctrl = er32(CTRL); |
| 2267 | 2636 | ||
| 2268 | if (!e1000_check_reset_block(hw)) { | 2637 | if (!e1000_check_reset_block(hw)) { |
| @@ -2304,7 +2673,19 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
| 2304 | hw_dbg(hw, "Auto Read Done did not complete\n"); | 2673 | hw_dbg(hw, "Auto Read Done did not complete\n"); |
| 2305 | } | 2674 | } |
| 2306 | } | 2675 | } |
| 2676 | /* Dummy read to clear the phy wakeup bit after lcd reset */ | ||
| 2677 | if (hw->mac.type == e1000_pchlan) | ||
| 2678 | e1e_rphy(hw, BM_WUC, ®); | ||
| 2307 | 2679 | ||
| 2680 | ret_val = e1000_sw_lcd_config_ich8lan(hw); | ||
| 2681 | if (ret_val) | ||
| 2682 | goto out; | ||
| 2683 | |||
| 2684 | if (hw->mac.type == e1000_pchlan) { | ||
| 2685 | ret_val = e1000_oem_bits_config_ich8lan(hw, true); | ||
| 2686 | if (ret_val) | ||
| 2687 | goto out; | ||
| 2688 | } | ||
| 2308 | /* | 2689 | /* |
| 2309 | * For PCH, this write will make sure that any noise | 2690 | * For PCH, this write will make sure that any noise |
| 2310 | * will be detected as a CRC error and be dropped rather than show up | 2691 | * will be detected as a CRC error and be dropped rather than show up |
| @@ -2323,6 +2704,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
| 2323 | if (hw->mac.type == e1000_pchlan) | 2704 | if (hw->mac.type == e1000_pchlan) |
| 2324 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | 2705 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); |
| 2325 | 2706 | ||
| 2707 | out: | ||
| 2326 | return ret_val; | 2708 | return ret_val; |
| 2327 | } | 2709 | } |
| 2328 | 2710 | ||
| @@ -2627,14 +3009,6 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, | |||
| 2627 | if (ret_val) | 3009 | if (ret_val) |
| 2628 | return ret_val; | 3010 | return ret_val; |
| 2629 | 3011 | ||
| 2630 | if ((hw->mac.type == e1000_pchlan) && (*speed == SPEED_1000)) { | ||
| 2631 | ret_val = e1000e_write_kmrn_reg(hw, | ||
| 2632 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
| 2633 | E1000_KMRNCTRLSTA_K1_DISABLE); | ||
| 2634 | if (ret_val) | ||
| 2635 | return ret_val; | ||
| 2636 | } | ||
| 2637 | |||
| 2638 | if ((hw->mac.type == e1000_ich8lan) && | 3012 | if ((hw->mac.type == e1000_ich8lan) && |
| 2639 | (hw->phy.type == e1000_phy_igp_3) && | 3013 | (hw->phy.type == e1000_phy_igp_3) && |
| 2640 | (*speed == SPEED_1000)) { | 3014 | (*speed == SPEED_1000)) { |
| @@ -2843,9 +3217,8 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) | |||
| 2843 | E1000_PHY_CTRL_GBE_DISABLE; | 3217 | E1000_PHY_CTRL_GBE_DISABLE; |
| 2844 | ew32(PHY_CTRL, phy_ctrl); | 3218 | ew32(PHY_CTRL, phy_ctrl); |
| 2845 | 3219 | ||
| 2846 | /* Workaround SWFLAG unexpectedly set during S0->Sx */ | ||
| 2847 | if (hw->mac.type == e1000_pchlan) | 3220 | if (hw->mac.type == e1000_pchlan) |
| 2848 | udelay(500); | 3221 | e1000_phy_hw_reset_ich8lan(hw); |
| 2849 | default: | 3222 | default: |
| 2850 | break; | 3223 | break; |
| 2851 | } | 3224 | } |
| @@ -3113,9 +3486,9 @@ static struct e1000_phy_operations ich8_phy_ops = { | |||
| 3113 | }; | 3486 | }; |
| 3114 | 3487 | ||
| 3115 | static struct e1000_nvm_operations ich8_nvm_ops = { | 3488 | static struct e1000_nvm_operations ich8_nvm_ops = { |
| 3116 | .acquire_nvm = e1000_acquire_swflag_ich8lan, | 3489 | .acquire_nvm = e1000_acquire_nvm_ich8lan, |
| 3117 | .read_nvm = e1000_read_nvm_ich8lan, | 3490 | .read_nvm = e1000_read_nvm_ich8lan, |
| 3118 | .release_nvm = e1000_release_swflag_ich8lan, | 3491 | .release_nvm = e1000_release_nvm_ich8lan, |
| 3119 | .update_nvm = e1000_update_nvm_checksum_ich8lan, | 3492 | .update_nvm = e1000_update_nvm_checksum_ich8lan, |
| 3120 | .valid_led_default = e1000_valid_led_default_ich8lan, | 3493 | .valid_led_default = e1000_valid_led_default_ich8lan, |
| 3121 | .validate_nvm = e1000_validate_nvm_checksum_ich8lan, | 3494 | .validate_nvm = e1000_validate_nvm_checksum_ich8lan, |
| @@ -3186,6 +3559,7 @@ struct e1000_info e1000_pch_info = { | |||
| 3186 | | FLAG_HAS_AMT | 3559 | | FLAG_HAS_AMT |
| 3187 | | FLAG_HAS_FLASH | 3560 | | FLAG_HAS_FLASH |
| 3188 | | FLAG_HAS_JUMBO_FRAMES | 3561 | | FLAG_HAS_JUMBO_FRAMES |
| 3562 | | FLAG_DISABLE_FC_PAUSE_TIME /* errata */ | ||
| 3189 | | FLAG_APME_IN_WUC, | 3563 | | FLAG_APME_IN_WUC, |
| 3190 | .pba = 26, | 3564 | .pba = 26, |
| 3191 | .max_hw_frame_size = 4096, | 3565 | .max_hw_frame_size = 4096, |
