diff options
author | Vivek Natarajan <vnatarajan@atheros.com> | 2009-09-16 23:54:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-09-23 11:35:50 -0400 |
commit | 93b1b37f6a4de8bce17f55d9cfa10ef5c8c04e8a (patch) | |
tree | 16405891b20c8d73e80812d525ec45a9f71255f5 /drivers/net/wireless/ath/ath9k/hw.c | |
parent | 6170cd5c72399f8536412ac75cba29cddc9919fb (diff) |
ath9k: Revamp PCIE workarounds
* Disable L1 state ONLY when device is in D3 mode.
* Clear bit 22 of register 0x4004.
* Handle power on/off properly
Not setting the workarounds properly resulted in the
disappearance of the card in certain cases.
Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hw.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 162 |
1 files changed, 96 insertions, 66 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index b6c6cca07812..82a24408528b 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -965,7 +965,7 @@ int ath9k_hw_init(struct ath_hw *ah) | |||
965 | ath9k_hw_init_mode_regs(ah); | 965 | ath9k_hw_init_mode_regs(ah); |
966 | 966 | ||
967 | if (ah->is_pciexpress) | 967 | if (ah->is_pciexpress) |
968 | ath9k_hw_configpcipowersave(ah, 0); | 968 | ath9k_hw_configpcipowersave(ah, 0, 0); |
969 | else | 969 | else |
970 | ath9k_hw_disablepcie(ah); | 970 | ath9k_hw_disablepcie(ah); |
971 | 971 | ||
@@ -3005,9 +3005,10 @@ void ath9k_ps_restore(struct ath_softc *sc) | |||
3005 | * Programming the SerDes must go through the same 288 bit serial shift | 3005 | * Programming the SerDes must go through the same 288 bit serial shift |
3006 | * register as the other analog registers. Hence the 9 writes. | 3006 | * register as the other analog registers. Hence the 9 writes. |
3007 | */ | 3007 | */ |
3008 | void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore) | 3008 | void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off) |
3009 | { | 3009 | { |
3010 | u8 i; | 3010 | u8 i; |
3011 | u32 val; | ||
3011 | 3012 | ||
3012 | if (ah->is_pciexpress != true) | 3013 | if (ah->is_pciexpress != true) |
3013 | return; | 3014 | return; |
@@ -3017,84 +3018,113 @@ void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore) | |||
3017 | return; | 3018 | return; |
3018 | 3019 | ||
3019 | /* Nothing to do on restore for 11N */ | 3020 | /* Nothing to do on restore for 11N */ |
3020 | if (restore) | 3021 | if (!restore) { |
3021 | return; | 3022 | if (AR_SREV_9280_20_OR_LATER(ah)) { |
3022 | 3023 | /* | |
3023 | if (AR_SREV_9280_20_OR_LATER(ah)) { | 3024 | * AR9280 2.0 or later chips use SerDes values from the |
3024 | /* | 3025 | * initvals.h initialized depending on chipset during |
3025 | * AR9280 2.0 or later chips use SerDes values from the | 3026 | * ath9k_hw_init() |
3026 | * initvals.h initialized depending on chipset during | 3027 | */ |
3027 | * ath9k_hw_init() | 3028 | for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) { |
3028 | */ | 3029 | REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0), |
3029 | for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) { | 3030 | INI_RA(&ah->iniPcieSerdes, i, 1)); |
3030 | REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0), | 3031 | } |
3031 | INI_RA(&ah->iniPcieSerdes, i, 1)); | 3032 | } else if (AR_SREV_9280(ah) && |
3032 | } | 3033 | (ah->hw_version.macRev == AR_SREV_REVISION_9280_10)) { |
3033 | } else if (AR_SREV_9280(ah) && | 3034 | REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fd00); |
3034 | (ah->hw_version.macRev == AR_SREV_REVISION_9280_10)) { | 3035 | REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924); |
3035 | REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fd00); | 3036 | |
3036 | REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924); | 3037 | /* RX shut off when elecidle is asserted */ |
3038 | REG_WRITE(ah, AR_PCIE_SERDES, 0xa8000019); | ||
3039 | REG_WRITE(ah, AR_PCIE_SERDES, 0x13160820); | ||
3040 | REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980560); | ||
3041 | |||
3042 | /* Shut off CLKREQ active in L1 */ | ||
3043 | if (ah->config.pcie_clock_req) | ||
3044 | REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffc); | ||
3045 | else | ||
3046 | REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffd); | ||
3037 | 3047 | ||
3038 | /* RX shut off when elecidle is asserted */ | 3048 | REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40); |
3039 | REG_WRITE(ah, AR_PCIE_SERDES, 0xa8000019); | 3049 | REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554); |
3040 | REG_WRITE(ah, AR_PCIE_SERDES, 0x13160820); | 3050 | REG_WRITE(ah, AR_PCIE_SERDES, 0x00043007); |
3041 | REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980560); | ||
3042 | 3051 | ||
3043 | /* Shut off CLKREQ active in L1 */ | 3052 | /* Load the new settings */ |
3044 | if (ah->config.pcie_clock_req) | 3053 | REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000); |
3045 | REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffc); | ||
3046 | else | ||
3047 | REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffd); | ||
3048 | 3054 | ||
3049 | REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40); | 3055 | } else { |
3050 | REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554); | 3056 | REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00); |
3051 | REG_WRITE(ah, AR_PCIE_SERDES, 0x00043007); | 3057 | REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924); |
3052 | 3058 | ||
3053 | /* Load the new settings */ | 3059 | /* RX shut off when elecidle is asserted */ |
3054 | REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000); | 3060 | REG_WRITE(ah, AR_PCIE_SERDES, 0x28000039); |
3061 | REG_WRITE(ah, AR_PCIE_SERDES, 0x53160824); | ||
3062 | REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980579); | ||
3055 | 3063 | ||
3056 | } else { | 3064 | /* |
3057 | REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00); | 3065 | * Ignore ah->ah_config.pcie_clock_req setting for |
3058 | REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924); | 3066 | * pre-AR9280 11n |
3067 | */ | ||
3068 | REG_WRITE(ah, AR_PCIE_SERDES, 0x001defff); | ||
3059 | 3069 | ||
3060 | /* RX shut off when elecidle is asserted */ | 3070 | REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40); |
3061 | REG_WRITE(ah, AR_PCIE_SERDES, 0x28000039); | 3071 | REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554); |
3062 | REG_WRITE(ah, AR_PCIE_SERDES, 0x53160824); | 3072 | REG_WRITE(ah, AR_PCIE_SERDES, 0x000e3007); |
3063 | REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980579); | ||
3064 | 3073 | ||
3065 | /* | 3074 | /* Load the new settings */ |
3066 | * Ignore ah->ah_config.pcie_clock_req setting for | 3075 | REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000); |
3067 | * pre-AR9280 11n | 3076 | } |
3068 | */ | ||
3069 | REG_WRITE(ah, AR_PCIE_SERDES, 0x001defff); | ||
3070 | 3077 | ||
3071 | REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40); | 3078 | udelay(1000); |
3072 | REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554); | ||
3073 | REG_WRITE(ah, AR_PCIE_SERDES, 0x000e3007); | ||
3074 | 3079 | ||
3075 | /* Load the new settings */ | 3080 | /* set bit 19 to allow forcing of pcie core into L1 state */ |
3076 | REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000); | 3081 | REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); |
3077 | } | ||
3078 | 3082 | ||
3079 | udelay(1000); | 3083 | /* Several PCIe massages to ensure proper behaviour */ |
3084 | if (ah->config.pcie_waen) { | ||
3085 | val = ah->config.pcie_waen; | ||
3086 | if (!power_off) | ||
3087 | val &= (~AR_WA_D3_L1_DISABLE); | ||
3088 | } else { | ||
3089 | if (AR_SREV_9285(ah) || AR_SREV_9271(ah) || | ||
3090 | AR_SREV_9287(ah)) { | ||
3091 | val = AR9285_WA_DEFAULT; | ||
3092 | if (!power_off) | ||
3093 | val &= (~AR_WA_D3_L1_DISABLE); | ||
3094 | } else if (AR_SREV_9280(ah)) { | ||
3095 | /* | ||
3096 | * On AR9280 chips bit 22 of 0x4004 needs to be | ||
3097 | * set otherwise card may disappear. | ||
3098 | */ | ||
3099 | val = AR9280_WA_DEFAULT; | ||
3100 | if (!power_off) | ||
3101 | val &= (~AR_WA_D3_L1_DISABLE); | ||
3102 | } else | ||
3103 | val = AR_WA_DEFAULT; | ||
3104 | } | ||
3080 | 3105 | ||
3081 | /* set bit 19 to allow forcing of pcie core into L1 state */ | 3106 | REG_WRITE(ah, AR_WA, val); |
3082 | REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); | 3107 | } |
3083 | 3108 | ||
3084 | /* Several PCIe massages to ensure proper behaviour */ | 3109 | if (power_off) { |
3085 | if (ah->config.pcie_waen) { | ||
3086 | REG_WRITE(ah, AR_WA, ah->config.pcie_waen); | ||
3087 | } else { | ||
3088 | if (AR_SREV_9285(ah) || AR_SREV_9271(ah) || AR_SREV_9287(ah)) | ||
3089 | REG_WRITE(ah, AR_WA, AR9285_WA_DEFAULT); | ||
3090 | /* | 3110 | /* |
3091 | * On AR9280 chips bit 22 of 0x4004 needs to be set to | 3111 | * Set PCIe workaround bits |
3092 | * otherwise card may disappear. | 3112 | * bit 14 in WA register (disable L1) should only |
3113 | * be set when device enters D3 and be cleared | ||
3114 | * when device comes back to D0. | ||
3093 | */ | 3115 | */ |
3094 | else if (AR_SREV_9280(ah)) | 3116 | if (ah->config.pcie_waen) { |
3095 | REG_WRITE(ah, AR_WA, AR9280_WA_DEFAULT); | 3117 | if (ah->config.pcie_waen & AR_WA_D3_L1_DISABLE) |
3096 | else | 3118 | REG_SET_BIT(ah, AR_WA, AR_WA_D3_L1_DISABLE); |
3097 | REG_WRITE(ah, AR_WA, AR_WA_DEFAULT); | 3119 | } else { |
3120 | if (((AR_SREV_9285(ah) || AR_SREV_9271(ah) || | ||
3121 | AR_SREV_9287(ah)) && | ||
3122 | (AR9285_WA_DEFAULT & AR_WA_D3_L1_DISABLE)) || | ||
3123 | (AR_SREV_9280(ah) && | ||
3124 | (AR9280_WA_DEFAULT & AR_WA_D3_L1_DISABLE))) { | ||
3125 | REG_SET_BIT(ah, AR_WA, AR_WA_D3_L1_DISABLE); | ||
3126 | } | ||
3127 | } | ||
3098 | } | 3128 | } |
3099 | } | 3129 | } |
3100 | 3130 | ||