diff options
author | Nick Kossifidis <mick@madwifi-project.org> | 2009-08-09 20:26:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:13:55 -0400 |
commit | c38e7a9348f725be0ea2493454db9e6d44fb7e0c (patch) | |
tree | e535611368ee9a99ceefea6f9089291224c46d9e | |
parent | d6756d0dc220c3d12e2c4c06ca97d1dbcb5edf4e (diff) |
ath5k: Check EEPROM before tweaking SERDES
* Read PCI-E infos offset from EEPROM and if it points to
serdes section (0x40), enable serdes programming (further tweaking
of serdes values during attach). This follows Legacy and Sam's
HAL sources.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath5k/attach.c | 56 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/eeprom.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/eeprom.h | 4 |
3 files changed, 48 insertions, 22 deletions
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c index 9a84d9410b27..626306592cf8 100644 --- a/drivers/net/wireless/ath/ath5k/attach.c +++ b/drivers/net/wireless/ath/ath5k/attach.c | |||
@@ -253,28 +253,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) | |||
253 | } | 253 | } |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * Write PCI-E power save settings | ||
257 | */ | ||
258 | if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { | ||
259 | ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES); | ||
260 | ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES); | ||
261 | /* Shut off RX when elecidle is asserted */ | ||
262 | ath5k_hw_reg_write(ah, 0x28000039, AR5K_PCIE_SERDES); | ||
263 | ath5k_hw_reg_write(ah, 0x53160824, AR5K_PCIE_SERDES); | ||
264 | /* TODO: EEPROM work */ | ||
265 | ath5k_hw_reg_write(ah, 0xe5980579, AR5K_PCIE_SERDES); | ||
266 | /* Shut off PLL and CLKREQ active in L1 */ | ||
267 | ath5k_hw_reg_write(ah, 0x001defff, AR5K_PCIE_SERDES); | ||
268 | /* Preserce other settings */ | ||
269 | ath5k_hw_reg_write(ah, 0x1aaabe40, AR5K_PCIE_SERDES); | ||
270 | ath5k_hw_reg_write(ah, 0xbe105554, AR5K_PCIE_SERDES); | ||
271 | ath5k_hw_reg_write(ah, 0x000e3007, AR5K_PCIE_SERDES); | ||
272 | /* Reset SERDES to load new settings */ | ||
273 | ath5k_hw_reg_write(ah, 0x00000000, AR5K_PCIE_SERDES_RESET); | ||
274 | mdelay(1); | ||
275 | } | ||
276 | |||
277 | /* | ||
278 | * POST | 256 | * POST |
279 | */ | 257 | */ |
280 | ret = ath5k_hw_post(ah); | 258 | ret = ath5k_hw_post(ah); |
@@ -295,6 +273,40 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) | |||
295 | goto err_free; | 273 | goto err_free; |
296 | } | 274 | } |
297 | 275 | ||
276 | /* | ||
277 | * Write PCI-E power save settings | ||
278 | */ | ||
279 | if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { | ||
280 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; | ||
281 | |||
282 | ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES); | ||
283 | ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES); | ||
284 | |||
285 | /* Shut off RX when elecidle is asserted */ | ||
286 | ath5k_hw_reg_write(ah, 0x28000039, AR5K_PCIE_SERDES); | ||
287 | ath5k_hw_reg_write(ah, 0x53160824, AR5K_PCIE_SERDES); | ||
288 | |||
289 | /* If serdes programing is enabled, increase PCI-E | ||
290 | * tx power for systems with long trace from host | ||
291 | * to minicard connector. */ | ||
292 | if (ee->ee_serdes) | ||
293 | ath5k_hw_reg_write(ah, 0xe5980579, AR5K_PCIE_SERDES); | ||
294 | else | ||
295 | ath5k_hw_reg_write(ah, 0xf6800579, AR5K_PCIE_SERDES); | ||
296 | |||
297 | /* Shut off PLL and CLKREQ active in L1 */ | ||
298 | ath5k_hw_reg_write(ah, 0x001defff, AR5K_PCIE_SERDES); | ||
299 | |||
300 | /* Preserve other settings */ | ||
301 | ath5k_hw_reg_write(ah, 0x1aaabe40, AR5K_PCIE_SERDES); | ||
302 | ath5k_hw_reg_write(ah, 0xbe105554, AR5K_PCIE_SERDES); | ||
303 | ath5k_hw_reg_write(ah, 0x000e3007, AR5K_PCIE_SERDES); | ||
304 | |||
305 | /* Reset SERDES to load new settings */ | ||
306 | ath5k_hw_reg_write(ah, 0x00000000, AR5K_PCIE_SERDES_RESET); | ||
307 | mdelay(1); | ||
308 | } | ||
309 | |||
298 | /* Get misc capabilities */ | 310 | /* Get misc capabilities */ |
299 | ret = ath5k_hw_set_capabilities(ah); | 311 | ret = ath5k_hw_set_capabilities(ah); |
300 | if (ret) { | 312 | if (ret) { |
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c index c56b494d417a..8af477dd6fc7 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.c +++ b/drivers/net/wireless/ath/ath5k/eeprom.c | |||
@@ -167,6 +167,16 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah) | |||
167 | ee->ee_rfkill_pin = (u8) AR5K_REG_MS(val, AR5K_EEPROM_RFKILL_GPIO_SEL); | 167 | ee->ee_rfkill_pin = (u8) AR5K_REG_MS(val, AR5K_EEPROM_RFKILL_GPIO_SEL); |
168 | ee->ee_rfkill_pol = val & AR5K_EEPROM_RFKILL_POLARITY ? true : false; | 168 | ee->ee_rfkill_pol = val & AR5K_EEPROM_RFKILL_POLARITY ? true : false; |
169 | 169 | ||
170 | /* Check if PCIE_OFFSET points to PCIE_SERDES_SECTION | ||
171 | * and enable serdes programming if needed. | ||
172 | * | ||
173 | * XXX: Serdes values seem to be fixed so | ||
174 | * no need to read them here, we write them | ||
175 | * during ath5k_hw_attach */ | ||
176 | AR5K_EEPROM_READ(AR5K_EEPROM_PCIE_OFFSET, val); | ||
177 | ee->ee_serdes = (val == AR5K_EEPROM_PCIE_SERDES_SECTION) ? | ||
178 | true : false; | ||
179 | |||
170 | return 0; | 180 | return 0; |
171 | } | 181 | } |
172 | 182 | ||
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h index 64be73a5edae..0123f3521a0b 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.h +++ b/drivers/net/wireless/ath/ath5k/eeprom.h | |||
@@ -19,6 +19,9 @@ | |||
19 | /* | 19 | /* |
20 | * Common ar5xxx EEPROM data offsets (set these on AR5K_EEPROM_BASE) | 20 | * Common ar5xxx EEPROM data offsets (set these on AR5K_EEPROM_BASE) |
21 | */ | 21 | */ |
22 | #define AR5K_EEPROM_PCIE_OFFSET 0x02 /* Contains offset to PCI-E infos */ | ||
23 | #define AR5K_EEPROM_PCIE_SERDES_SECTION 0x40 /* PCIE_OFFSET points here when | ||
24 | * SERDES infos are present */ | ||
22 | #define AR5K_EEPROM_MAGIC 0x003d /* EEPROM Magic number */ | 25 | #define AR5K_EEPROM_MAGIC 0x003d /* EEPROM Magic number */ |
23 | #define AR5K_EEPROM_MAGIC_VALUE 0x5aa5 /* Default - found on EEPROM */ | 26 | #define AR5K_EEPROM_MAGIC_VALUE 0x5aa5 /* Default - found on EEPROM */ |
24 | #define AR5K_EEPROM_MAGIC_5212 0x0000145c /* 5212 */ | 27 | #define AR5K_EEPROM_MAGIC_5212 0x0000145c /* 5212 */ |
@@ -391,6 +394,7 @@ struct ath5k_eeprom_info { | |||
391 | u8 ee_rfkill_pin; | 394 | u8 ee_rfkill_pin; |
392 | bool ee_rfkill_pol; | 395 | bool ee_rfkill_pol; |
393 | bool ee_is_hb63; | 396 | bool ee_is_hb63; |
397 | bool ee_serdes; | ||
394 | u16 ee_misc0; | 398 | u16 ee_misc0; |
395 | u16 ee_misc1; | 399 | u16 ee_misc1; |
396 | u16 ee_misc2; | 400 | u16 ee_misc2; |