diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-10-19 02:33:37 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-30 16:50:37 -0400 |
commit | 574d6b122d37549bc2817a4939d238f3d8b41da4 (patch) | |
tree | 85de91f82240ea923478b09281502508bc35952c /drivers/net/wireless/ath | |
parent | b67b4397cfbfca8f5c4fff2a36e00d81ef6a28c2 (diff) |
ath9k_hw: simplify rf attach and rename to ath9k_hw_rf_alloc_ext_banks()
ath9k_hw_rfattach() was just calling a helper and this helper was
doing nothing for single-chip devices, and for non single-chip devices
it is just allocating memory for banks to program the RF registers
at a later time. Simplify this by having the hw initialization call
the rf bank allocation directly for external radios.
Also, propagate an -ENOMEM properly now upon failure.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/phy.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/phy.h | 3 |
3 files changed, 17 insertions, 32 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index be9c0b691885..2e2516e1cd4a 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -454,21 +454,6 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah) | |||
454 | ah->power_mode = ATH9K_PM_UNDEFINED; | 454 | ah->power_mode = ATH9K_PM_UNDEFINED; |
455 | } | 455 | } |
456 | 456 | ||
457 | static int ath9k_hw_rfattach(struct ath_hw *ah) | ||
458 | { | ||
459 | bool rfStatus = false; | ||
460 | int ecode = 0; | ||
461 | |||
462 | rfStatus = ath9k_hw_init_rf(ah, &ecode); | ||
463 | if (!rfStatus) { | ||
464 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, | ||
465 | "RF setup failed, status: %u\n", ecode); | ||
466 | return ecode; | ||
467 | } | ||
468 | |||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | static int ath9k_hw_rf_claim(struct ath_hw *ah) | 457 | static int ath9k_hw_rf_claim(struct ath_hw *ah) |
473 | { | 458 | { |
474 | u32 val; | 459 | u32 val; |
@@ -585,9 +570,15 @@ static int ath9k_hw_post_init(struct ath_hw *ah) | |||
585 | ah->eep_ops->get_eeprom_ver(ah), | 570 | ah->eep_ops->get_eeprom_ver(ah), |
586 | ah->eep_ops->get_eeprom_rev(ah)); | 571 | ah->eep_ops->get_eeprom_rev(ah)); |
587 | 572 | ||
588 | ecode = ath9k_hw_rfattach(ah); | 573 | if (!AR_SREV_9280_10_OR_LATER(ah)) { |
589 | if (ecode != 0) | 574 | ecode = ath9k_hw_rf_alloc_ext_banks(ah); |
590 | return ecode; | 575 | if (ecode) { |
576 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, | ||
577 | "Failed allocating banks for " | ||
578 | "external radio\n"); | ||
579 | return ecode; | ||
580 | } | ||
581 | } | ||
591 | 582 | ||
592 | if (!AR_SREV_9100(ah)) { | 583 | if (!AR_SREV_9100(ah)) { |
593 | ath9k_hw_ani_setup(ah); | 584 | ath9k_hw_ani_setup(ah); |
diff --git a/drivers/net/wireless/ath/ath9k/phy.c b/drivers/net/wireless/ath/ath9k/phy.c index bd4fb076cb08..f3136b2dfb75 100644 --- a/drivers/net/wireless/ath/ath9k/phy.c +++ b/drivers/net/wireless/ath/ath9k/phy.c | |||
@@ -409,18 +409,16 @@ ath9k_hw_rf_free(struct ath_hw *ah) | |||
409 | } | 409 | } |
410 | 410 | ||
411 | /** | 411 | /** |
412 | * ath9k_hw_init_rf - initialize external radio structures | 412 | * ath9k_hw_rf_alloc_ext_banks - allocates banks for external radio programming |
413 | * @ah: atheros hardware structure | 413 | * @ah: atheros hardware structure |
414 | * @status: | ||
415 | * | 414 | * |
416 | * Only required for older devices with external AR2133/AR5133 radios. | 415 | * Only required for older devices with external AR2133/AR5133 radios. |
417 | */ | 416 | */ |
418 | bool ath9k_hw_init_rf(struct ath_hw *ah, int *status) | 417 | int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah) |
419 | { | 418 | { |
420 | struct ath_common *common = ath9k_hw_common(ah); | 419 | struct ath_common *common = ath9k_hw_common(ah); |
421 | 420 | ||
422 | if (AR_SREV_9280_10_OR_LATER(ah)) | 421 | BUG_ON(AR_SREV_9280_10_OR_LATER(ah)); |
423 | return true; | ||
424 | 422 | ||
425 | ah->analogBank0Data = | 423 | ah->analogBank0Data = |
426 | kzalloc((sizeof(u32) * | 424 | kzalloc((sizeof(u32) * |
@@ -453,8 +451,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status) | |||
453 | || ah->analogBank7Data == NULL) { | 451 | || ah->analogBank7Data == NULL) { |
454 | ath_print(common, ATH_DBG_FATAL, | 452 | ath_print(common, ATH_DBG_FATAL, |
455 | "Cannot allocate RF banks\n"); | 453 | "Cannot allocate RF banks\n"); |
456 | *status = -ENOMEM; | 454 | return -ENOMEM; |
457 | return false; | ||
458 | } | 455 | } |
459 | 456 | ||
460 | ah->addac5416_21 = | 457 | ah->addac5416_21 = |
@@ -464,8 +461,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status) | |||
464 | if (ah->addac5416_21 == NULL) { | 461 | if (ah->addac5416_21 == NULL) { |
465 | ath_print(common, ATH_DBG_FATAL, | 462 | ath_print(common, ATH_DBG_FATAL, |
466 | "Cannot allocate addac5416_21\n"); | 463 | "Cannot allocate addac5416_21\n"); |
467 | *status = -ENOMEM; | 464 | return -ENOMEM; |
468 | return false; | ||
469 | } | 465 | } |
470 | 466 | ||
471 | ah->bank6Temp = | 467 | ah->bank6Temp = |
@@ -474,11 +470,10 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status) | |||
474 | if (ah->bank6Temp == NULL) { | 470 | if (ah->bank6Temp == NULL) { |
475 | ath_print(common, ATH_DBG_FATAL, | 471 | ath_print(common, ATH_DBG_FATAL, |
476 | "Cannot allocate bank6Temp\n"); | 472 | "Cannot allocate bank6Temp\n"); |
477 | *status = -ENOMEM; | 473 | return -ENOMEM; |
478 | return false; | ||
479 | } | 474 | } |
480 | 475 | ||
481 | return true; | 476 | return 0; |
482 | } | 477 | } |
483 | 478 | ||
484 | /** | 479 | /** |
diff --git a/drivers/net/wireless/ath/ath9k/phy.h b/drivers/net/wireless/ath/ath9k/phy.h index b64bc69d7bbb..0bbbfbcfe3f4 100644 --- a/drivers/net/wireless/ath/ath9k/phy.h +++ b/drivers/net/wireless/ath/ath9k/phy.h | |||
@@ -29,8 +29,7 @@ bool ath9k_hw_set_rf_regs(struct ath_hw *ah, | |||
29 | u16 modesIndex); | 29 | u16 modesIndex); |
30 | void ath9k_hw_decrease_chain_power(struct ath_hw *ah, | 30 | void ath9k_hw_decrease_chain_power(struct ath_hw *ah, |
31 | struct ath9k_channel *chan); | 31 | struct ath9k_channel *chan); |
32 | bool ath9k_hw_init_rf(struct ath_hw *ah, | 32 | int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah); |
33 | int *status); | ||
34 | 33 | ||
35 | #define AR_PHY_BASE 0x9800 | 34 | #define AR_PHY_BASE 0x9800 |
36 | #define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2)) | 35 | #define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2)) |