diff options
| -rw-r--r-- | drivers/net/e1000e/defines.h | 1 | ||||
| -rw-r--r-- | drivers/net/e1000e/ich8lan.c | 125 |
2 files changed, 82 insertions, 44 deletions
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 4329ec34b178..c0f185beb8bc 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
| @@ -238,6 +238,7 @@ | |||
| 238 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ | 238 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ |
| 239 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ | 239 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ |
| 240 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ | 240 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ |
| 241 | #define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ | ||
| 241 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ | 242 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ |
| 242 | 243 | ||
| 243 | /* Constants used to interpret the masked PCI-X bus speed. */ | 244 | /* Constants used to interpret the masked PCI-X bus speed. */ |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 9e23f50fb9cd..438778fef5ac 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
| @@ -694,6 +694,38 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) | |||
| 694 | } | 694 | } |
| 695 | 695 | ||
| 696 | /** | 696 | /** |
| 697 | * e1000_lan_init_done_ich8lan - Check for PHY config completion | ||
| 698 | * @hw: pointer to the HW structure | ||
| 699 | * | ||
| 700 | * Check the appropriate indication the MAC has finished configuring the | ||
| 701 | * PHY after a software reset. | ||
| 702 | **/ | ||
| 703 | static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw) | ||
| 704 | { | ||
| 705 | u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT; | ||
| 706 | |||
| 707 | /* Wait for basic configuration completes before proceeding */ | ||
| 708 | do { | ||
| 709 | data = er32(STATUS); | ||
| 710 | data &= E1000_STATUS_LAN_INIT_DONE; | ||
| 711 | udelay(100); | ||
| 712 | } while ((!data) && --loop); | ||
| 713 | |||
| 714 | /* | ||
| 715 | * If basic configuration is incomplete before the above loop | ||
| 716 | * count reaches 0, loading the configuration from NVM will | ||
| 717 | * leave the PHY in a bad state possibly resulting in no link. | ||
| 718 | */ | ||
| 719 | if (loop == 0) | ||
| 720 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); | ||
| 721 | |||
| 722 | /* Clear the Init Done bit for the next init event */ | ||
| 723 | data = er32(STATUS); | ||
| 724 | data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
| 725 | ew32(STATUS, data); | ||
| 726 | } | ||
| 727 | |||
| 728 | /** | ||
| 697 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset | 729 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset |
| 698 | * @hw: pointer to the HW structure | 730 | * @hw: pointer to the HW structure |
| 699 | * | 731 | * |
| @@ -707,13 +739,15 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
| 707 | u32 i; | 739 | u32 i; |
| 708 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; | 740 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; |
| 709 | s32 ret_val; | 741 | s32 ret_val; |
| 710 | u16 loop = E1000_ICH8_LAN_INIT_TIMEOUT; | ||
| 711 | u16 word_addr, reg_data, reg_addr, phy_page = 0; | 742 | u16 word_addr, reg_data, reg_addr, phy_page = 0; |
| 712 | 743 | ||
| 713 | ret_val = e1000e_phy_hw_reset_generic(hw); | 744 | ret_val = e1000e_phy_hw_reset_generic(hw); |
| 714 | if (ret_val) | 745 | if (ret_val) |
| 715 | return ret_val; | 746 | return ret_val; |
| 716 | 747 | ||
| 748 | /* Allow time for h/w to get to a quiescent state after reset */ | ||
| 749 | mdelay(10); | ||
| 750 | |||
| 717 | if (hw->mac.type == e1000_pchlan) { | 751 | if (hw->mac.type == e1000_pchlan) { |
| 718 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | 752 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); |
| 719 | if (ret_val) | 753 | if (ret_val) |
| @@ -741,26 +775,8 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
| 741 | if (!(data & sw_cfg_mask)) | 775 | if (!(data & sw_cfg_mask)) |
| 742 | return 0; | 776 | return 0; |
| 743 | 777 | ||
| 744 | /* Wait for basic configuration completes before proceeding*/ | 778 | /* Wait for basic configuration completes before proceeding */ |
| 745 | do { | 779 | e1000_lan_init_done_ich8lan(hw); |
| 746 | data = er32(STATUS); | ||
| 747 | data &= E1000_STATUS_LAN_INIT_DONE; | ||
| 748 | udelay(100); | ||
| 749 | } while ((!data) && --loop); | ||
| 750 | |||
| 751 | /* | ||
| 752 | * If basic configuration is incomplete before the above loop | ||
| 753 | * count reaches 0, loading the configuration from NVM will | ||
| 754 | * leave the PHY in a bad state possibly resulting in no link. | ||
| 755 | */ | ||
| 756 | if (loop == 0) { | ||
| 757 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); | ||
| 758 | } | ||
| 759 | |||
| 760 | /* Clear the Init Done bit for the next init event */ | ||
| 761 | data = er32(STATUS); | ||
| 762 | data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
| 763 | ew32(STATUS, data); | ||
| 764 | 780 | ||
| 765 | /* | 781 | /* |
| 766 | * Make sure HW does not configure LCD from PHY | 782 | * Make sure HW does not configure LCD from PHY |
| @@ -2143,6 +2159,12 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
| 2143 | ctrl = er32(CTRL); | 2159 | ctrl = er32(CTRL); |
| 2144 | 2160 | ||
| 2145 | if (!e1000_check_reset_block(hw)) { | 2161 | if (!e1000_check_reset_block(hw)) { |
| 2162 | /* Clear PHY Reset Asserted bit */ | ||
| 2163 | if (hw->mac.type >= e1000_pchlan) { | ||
| 2164 | u32 status = er32(STATUS); | ||
| 2165 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
| 2166 | } | ||
| 2167 | |||
| 2146 | /* | 2168 | /* |
| 2147 | * PHY HW reset requires MAC CORE reset at the same | 2169 | * PHY HW reset requires MAC CORE reset at the same |
| 2148 | * time to make sure the interface between MAC and the | 2170 | * time to make sure the interface between MAC and the |
| @@ -2156,21 +2178,24 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
| 2156 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); | 2178 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); |
| 2157 | msleep(20); | 2179 | msleep(20); |
| 2158 | 2180 | ||
| 2159 | if (!ret_val) { | 2181 | if (!ret_val) |
| 2160 | /* release the swflag because it is not reset by | ||
| 2161 | * hardware reset | ||
| 2162 | */ | ||
| 2163 | e1000_release_swflag_ich8lan(hw); | 2182 | e1000_release_swflag_ich8lan(hw); |
| 2164 | } | ||
| 2165 | 2183 | ||
| 2166 | ret_val = e1000e_get_auto_rd_done(hw); | 2184 | if (ctrl & E1000_CTRL_PHY_RST) |
| 2167 | if (ret_val) { | 2185 | ret_val = hw->phy.ops.get_cfg_done(hw); |
| 2168 | /* | 2186 | |
| 2169 | * When auto config read does not complete, do not | 2187 | if (hw->mac.type >= e1000_ich10lan) { |
| 2170 | * return with an error. This can happen in situations | 2188 | e1000_lan_init_done_ich8lan(hw); |
| 2171 | * where there is no eeprom and prevents getting link. | 2189 | } else { |
| 2172 | */ | 2190 | ret_val = e1000e_get_auto_rd_done(hw); |
| 2173 | hw_dbg(hw, "Auto Read Done did not complete\n"); | 2191 | if (ret_val) { |
| 2192 | /* | ||
| 2193 | * When auto config read does not complete, do not | ||
| 2194 | * return with an error. This can happen in situations | ||
| 2195 | * where there is no eeprom and prevents getting link. | ||
| 2196 | */ | ||
| 2197 | hw_dbg(hw, "Auto Read Done did not complete\n"); | ||
| 2198 | } | ||
| 2174 | } | 2199 | } |
| 2175 | 2200 | ||
| 2176 | ew32(IMC, 0xffffffff); | 2201 | ew32(IMC, 0xffffffff); |
| @@ -2222,6 +2247,18 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) | |||
| 2222 | for (i = 0; i < mac->mta_reg_count; i++) | 2247 | for (i = 0; i < mac->mta_reg_count; i++) |
| 2223 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); | 2248 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); |
| 2224 | 2249 | ||
| 2250 | /* | ||
| 2251 | * The 82578 Rx buffer will stall if wakeup is enabled in host and | ||
| 2252 | * the ME. Reading the BM_WUC register will clear the host wakeup bit. | ||
| 2253 | * Reset the phy after disabling host wakeup to reset the Rx buffer. | ||
| 2254 | */ | ||
| 2255 | if (hw->phy.type == e1000_phy_82578) { | ||
| 2256 | hw->phy.ops.read_phy_reg(hw, BM_WUC, &i); | ||
| 2257 | ret_val = e1000_phy_hw_reset_ich8lan(hw); | ||
| 2258 | if (ret_val) | ||
| 2259 | return ret_val; | ||
| 2260 | } | ||
| 2261 | |||
| 2225 | /* Setup link and flow control */ | 2262 | /* Setup link and flow control */ |
| 2226 | ret_val = e1000_setup_link_ich8lan(hw); | 2263 | ret_val = e1000_setup_link_ich8lan(hw); |
| 2227 | 2264 | ||
| @@ -2254,16 +2291,6 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) | |||
| 2254 | ew32(CTRL_EXT, ctrl_ext); | 2291 | ew32(CTRL_EXT, ctrl_ext); |
| 2255 | 2292 | ||
| 2256 | /* | 2293 | /* |
| 2257 | * The 82578 Rx buffer will stall if wakeup is enabled in host and | ||
| 2258 | * the ME. Reading the BM_WUC register will clear the host wakeup bit. | ||
| 2259 | * Reset the phy after disabling host wakeup to reset the Rx buffer. | ||
| 2260 | */ | ||
| 2261 | if (hw->phy.type == e1000_phy_82578) { | ||
| 2262 | e1e_rphy(hw, BM_WUC, &i); | ||
| 2263 | e1000e_phy_hw_reset_generic(hw); | ||
| 2264 | } | ||
| 2265 | |||
| 2266 | /* | ||
| 2267 | * Clear all of the statistics registers (clear on read). It is | 2294 | * Clear all of the statistics registers (clear on read). It is |
| 2268 | * important that we do this after we have tried to establish link | 2295 | * important that we do this after we have tried to establish link |
| 2269 | * because the symbol error count will increment wildly if there | 2296 | * because the symbol error count will increment wildly if there |
| @@ -2850,6 +2877,16 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) | |||
| 2850 | { | 2877 | { |
| 2851 | u32 bank = 0; | 2878 | u32 bank = 0; |
| 2852 | 2879 | ||
| 2880 | if (hw->mac.type >= e1000_pchlan) { | ||
| 2881 | u32 status = er32(STATUS); | ||
| 2882 | |||
| 2883 | if (status & E1000_STATUS_PHYRA) | ||
| 2884 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
| 2885 | else | ||
| 2886 | hw_dbg(hw, | ||
| 2887 | "PHY Reset Asserted not set - needs delay\n"); | ||
| 2888 | } | ||
| 2889 | |||
| 2853 | e1000e_get_cfg_done(hw); | 2890 | e1000e_get_cfg_done(hw); |
| 2854 | 2891 | ||
| 2855 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ | 2892 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ |
