diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2010-04-15 17:39:18 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-16 15:43:41 -0400 |
commit | ebd5a14a450e31611696dfe96781a3b8915d835c (patch) | |
tree | b44246ca07fcea61e3032325344c74f0685dcf92 /drivers/net | |
parent | 57b98384e5450996300d77ece61739b58325a84f (diff) |
ath9k_hw: move the RF claim stuff to AR9002 hardware family
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9002_hw.c | 43 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 51 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 5 |
3 files changed, 53 insertions, 46 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c index eeaea2631c1..5b21e691438 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c | |||
@@ -483,6 +483,49 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah, | |||
483 | } | 483 | } |
484 | } | 484 | } |
485 | 485 | ||
486 | static int ar9002_hw_get_radiorev(struct ath_hw *ah) | ||
487 | { | ||
488 | u32 val; | ||
489 | int i; | ||
490 | |||
491 | REG_WRITE(ah, AR_PHY(0x36), 0x00007058); | ||
492 | |||
493 | for (i = 0; i < 8; i++) | ||
494 | REG_WRITE(ah, AR_PHY(0x20), 0x00010000); | ||
495 | val = (REG_READ(ah, AR_PHY(256)) >> 24) & 0xff; | ||
496 | val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4); | ||
497 | |||
498 | return ath9k_hw_reverse_bits(val, 8); | ||
499 | } | ||
500 | |||
501 | int ar9002_hw_rf_claim(struct ath_hw *ah) | ||
502 | { | ||
503 | u32 val; | ||
504 | |||
505 | REG_WRITE(ah, AR_PHY(0), 0x00000007); | ||
506 | |||
507 | val = ar9002_hw_get_radiorev(ah); | ||
508 | switch (val & AR_RADIO_SREV_MAJOR) { | ||
509 | case 0: | ||
510 | val = AR_RAD5133_SREV_MAJOR; | ||
511 | break; | ||
512 | case AR_RAD5133_SREV_MAJOR: | ||
513 | case AR_RAD5122_SREV_MAJOR: | ||
514 | case AR_RAD2133_SREV_MAJOR: | ||
515 | case AR_RAD2122_SREV_MAJOR: | ||
516 | break; | ||
517 | default: | ||
518 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, | ||
519 | "Radio Chip Rev 0x%02X not supported\n", | ||
520 | val & AR_RADIO_SREV_MAJOR); | ||
521 | return -EOPNOTSUPP; | ||
522 | } | ||
523 | |||
524 | ah->hw_version.analog5GhzRev = val; | ||
525 | |||
526 | return 0; | ||
527 | } | ||
528 | |||
486 | /* Sets up the AR5008/AR9001/AR9002 hardware familiy callbacks */ | 529 | /* Sets up the AR5008/AR9001/AR9002 hardware familiy callbacks */ |
487 | void ar9002_hw_attach_ops(struct ath_hw *ah) | 530 | void ar9002_hw_attach_ops(struct ath_hw *ah) |
488 | { | 531 | { |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 888a768ee0b..70162db1323 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -264,21 +264,6 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah) | |||
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | static int ath9k_hw_get_radiorev(struct ath_hw *ah) | ||
268 | { | ||
269 | u32 val; | ||
270 | int i; | ||
271 | |||
272 | REG_WRITE(ah, AR_PHY(0x36), 0x00007058); | ||
273 | |||
274 | for (i = 0; i < 8; i++) | ||
275 | REG_WRITE(ah, AR_PHY(0x20), 0x00010000); | ||
276 | val = (REG_READ(ah, AR_PHY(256)) >> 24) & 0xff; | ||
277 | val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4); | ||
278 | |||
279 | return ath9k_hw_reverse_bits(val, 8); | ||
280 | } | ||
281 | |||
282 | /************************************/ | 267 | /************************************/ |
283 | /* HW Attach, Detach, Init Routines */ | 268 | /* HW Attach, Detach, Init Routines */ |
284 | /************************************/ | 269 | /************************************/ |
@@ -438,34 +423,6 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah) | |||
438 | ah->power_mode = ATH9K_PM_UNDEFINED; | 423 | ah->power_mode = ATH9K_PM_UNDEFINED; |
439 | } | 424 | } |
440 | 425 | ||
441 | static int ath9k_hw_rf_claim(struct ath_hw *ah) | ||
442 | { | ||
443 | u32 val; | ||
444 | |||
445 | REG_WRITE(ah, AR_PHY(0), 0x00000007); | ||
446 | |||
447 | val = ath9k_hw_get_radiorev(ah); | ||
448 | switch (val & AR_RADIO_SREV_MAJOR) { | ||
449 | case 0: | ||
450 | val = AR_RAD5133_SREV_MAJOR; | ||
451 | break; | ||
452 | case AR_RAD5133_SREV_MAJOR: | ||
453 | case AR_RAD5122_SREV_MAJOR: | ||
454 | case AR_RAD2133_SREV_MAJOR: | ||
455 | case AR_RAD2122_SREV_MAJOR: | ||
456 | break; | ||
457 | default: | ||
458 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, | ||
459 | "Radio Chip Rev 0x%02X not supported\n", | ||
460 | val & AR_RADIO_SREV_MAJOR); | ||
461 | return -EOPNOTSUPP; | ||
462 | } | ||
463 | |||
464 | ah->hw_version.analog5GhzRev = val; | ||
465 | |||
466 | return 0; | ||
467 | } | ||
468 | |||
469 | static int ath9k_hw_init_macaddr(struct ath_hw *ah) | 426 | static int ath9k_hw_init_macaddr(struct ath_hw *ah) |
470 | { | 427 | { |
471 | struct ath_common *common = ath9k_hw_common(ah); | 428 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -496,9 +453,11 @@ static int ath9k_hw_post_init(struct ath_hw *ah) | |||
496 | return -ENODEV; | 453 | return -ENODEV; |
497 | } | 454 | } |
498 | 455 | ||
499 | ecode = ath9k_hw_rf_claim(ah); | 456 | if (!AR_SREV_9300_20_OR_LATER(ah)) { |
500 | if (ecode != 0) | 457 | ecode = ar9002_hw_rf_claim(ah); |
501 | return ecode; | 458 | if (ecode != 0) |
459 | return ecode; | ||
460 | } | ||
502 | 461 | ||
503 | ecode = ath9k_hw_eeprom_init(ah); | 462 | ecode = ath9k_hw_eeprom_init(ah); |
504 | if (ecode != 0) | 463 | if (ecode != 0) |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index fcf78424bfa..16f0f982079 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -844,7 +844,12 @@ void ath9k_hw_htc_resetinit(struct ath_hw *ah); | |||
844 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, | 844 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, |
845 | u32 *coef_mantissa, u32 *coef_exponent); | 845 | u32 *coef_mantissa, u32 *coef_exponent); |
846 | 846 | ||
847 | /* | ||
848 | * Code Specific to AR5008, AR9001 or AR9002, | ||
849 | * we stuff these here to avoid callbacks for AR9003. | ||
850 | */ | ||
847 | void ar9002_hw_cck_chan14_spread(struct ath_hw *ah); | 851 | void ar9002_hw_cck_chan14_spread(struct ath_hw *ah); |
852 | int ar9002_hw_rf_claim(struct ath_hw *ah); | ||
848 | 853 | ||
849 | /* | 854 | /* |
850 | * Code specifric to AR9003, we stuff these here to avoid callbacks | 855 | * Code specifric to AR9003, we stuff these here to avoid callbacks |