aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kossifidis <mick@madwifi.org>2008-07-19 23:34:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-01 15:31:31 -0400
commite5a4ad0dda8f79a984ba6391af65274b482b6703 (patch)
tree61b651238907073490b35809a0e692eeaaf16890
parentba37746e547e14703a5ac86560c6e056620bc4cf (diff)
ath5k: Misc hw_attach fixes
* Correctly attach RF2425 * Update SREV values for Radio chips * Update hw_attach to use new SPENDING values * Write a bit after POST for some chips Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath5k/ath5k.h8
-rw-r--r--drivers/net/wireless/ath5k/hw.c62
2 files changed, 26 insertions, 44 deletions
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index ba35c30d203c..9102eea3c8bf 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -186,11 +186,13 @@ struct ath5k_srev_name {
186#define AR5K_SREV_RAD_2111 0x20 186#define AR5K_SREV_RAD_2111 0x20
187#define AR5K_SREV_RAD_5112 0x30 187#define AR5K_SREV_RAD_5112 0x30
188#define AR5K_SREV_RAD_5112A 0x35 188#define AR5K_SREV_RAD_5112A 0x35
189#define AR5K_SREV_RAD_5112B 0x36
189#define AR5K_SREV_RAD_2112 0x40 190#define AR5K_SREV_RAD_2112 0x40
190#define AR5K_SREV_RAD_2112A 0x45 191#define AR5K_SREV_RAD_2112A 0x45
191#define AR5K_SREV_RAD_SC0 0x56 /* Found on 2413/2414 */ 192#define AR5K_SREV_RAD_2112B 0x46
192#define AR5K_SREV_RAD_SC1 0x63 /* Found on 5413/5414 */ 193#define AR5K_SREV_RAD_SC0 0x50 /* Found on 2413/2414 */
193#define AR5K_SREV_RAD_SC2 0xa2 /* Found on 2424-5/5424 */ 194#define AR5K_SREV_RAD_SC1 0x60 /* Found on 5413/5414 */
195#define AR5K_SREV_RAD_SC2 0xa0 /* Found on 2424-5/5424 */
194#define AR5K_SREV_RAD_5133 0xc0 /* MIMO found on 5418 */ 196#define AR5K_SREV_RAD_5133 0xc0 /* MIMO found on 5418 */
195 197
196/* IEEE defs */ 198/* IEEE defs */
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index b3b9baa551bc..8cd8659e9128 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -293,67 +293,42 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
293 /* Identify the radio chip*/ 293 /* Identify the radio chip*/
294 if (ah->ah_version == AR5K_AR5210) { 294 if (ah->ah_version == AR5K_AR5210) {
295 ah->ah_radio = AR5K_RF5110; 295 ah->ah_radio = AR5K_RF5110;
296 /*
297 * Register returns 0x0/0x04 for radio revision
298 * so ath5k_hw_radio_revision doesn't parse the value
299 * correctly. For now we are based on mac's srev to
300 * identify RF2425 radio.
301 */
302 } else if (srev == AR5K_SREV_VER_AR2425) {
303 ah->ah_radio = AR5K_RF2425;
304 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425;
296 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112) { 305 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112) {
297 ah->ah_radio = AR5K_RF5111; 306 ah->ah_radio = AR5K_RF5111;
298 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111; 307 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111;
299 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC0) { 308 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC0) {
300
301 ah->ah_radio = AR5K_RF5112; 309 ah->ah_radio = AR5K_RF5112;
302 310 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
303 if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112A) {
304 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
305 } else {
306 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A;
307 }
308
309 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC1) { 311 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC1) {
310 ah->ah_radio = AR5K_RF2413; 312 ah->ah_radio = AR5K_RF2413;
311 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A; 313 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
312 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC2) { 314 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC2) {
313 ah->ah_radio = AR5K_RF5413; 315 ah->ah_radio = AR5K_RF5413;
314 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A; 316 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
315 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5133) { 317 } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5133) {
316
317 /* AR5424 */ 318 /* AR5424 */
318 if (srev >= AR5K_SREV_VER_AR5424) { 319 if (srev >= AR5K_SREV_VER_AR5424) {
319 ah->ah_radio = AR5K_RF5413; 320 ah->ah_radio = AR5K_RF5413;
320 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5424; 321 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
321 /* AR2424 */ 322 /* AR2424 */
322 } else { 323 } else {
323 ah->ah_radio = AR5K_RF2413; /* For testing */ 324 ah->ah_radio = AR5K_RF2413; /* For testing */
324 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A; 325 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
325 } 326 }
326
327 /*
328 * Register returns 0x4 for radio revision
329 * so ath5k_hw_radio_revision doesn't parse the value
330 * correctly. For now we are based on mac's srev to
331 * identify RF2425 radio.
332 */
333 } else if (srev == AR5K_SREV_VER_AR2425) {
334 ah->ah_radio = AR5K_RF2425;
335 ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
336 } 327 }
337
338 ah->ah_phy = AR5K_PHY(0); 328 ah->ah_phy = AR5K_PHY(0);
339 329
340 /* 330 /*
341 * Identify AR5212-based PCI-E cards 331 * Write PCI-E power save settings
342 * And write some initial settings.
343 *
344 * (doing a "strings" on ndis driver
345 * -ar5211.sys- reveals the following
346 * pci-e related functions:
347 *
348 * pcieClockReq
349 * pcieRxErrNotify
350 * pcieL1SKPEnable
351 * pcieAspm
352 * pcieDisableAspmOnRfWake
353 * pciePowerSaveEnable
354 *
355 * I guess these point to ClockReq but
356 * i'm not sure.)
357 */ 332 */
358 if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { 333 if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) {
359 ath5k_hw_reg_write(ah, 0x9248fc00, 0x4080); 334 ath5k_hw_reg_write(ah, 0x9248fc00, 0x4080);
@@ -375,10 +350,15 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
375 if (ret) 350 if (ret)
376 goto err_free; 351 goto err_free;
377 352
353 /* Write AR5K_PCICFG_UNK on 2112B and later chips */
354 if (ah->ah_radio_5ghz_revision > AR5K_SREV_RAD_2112B ||
355 srev > AR5K_SREV_VER_AR2413) {
356 ath5k_hw_reg_write(ah, AR5K_PCICFG_UNK, AR5K_PCICFG);
357 }
358
378 /* 359 /*
379 * Get card capabilities, values, ... 360 * Get card capabilities, values, ...
380 */ 361 */
381
382 ret = ath5k_eeprom_init(ah); 362 ret = ath5k_eeprom_init(ah);
383 if (ret) { 363 if (ret) {
384 ATH5K_ERR(sc, "unable to init EEPROM\n"); 364 ATH5K_ERR(sc, "unable to init EEPROM\n");