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>
This commit is contained in:
parent
b67b4397cf
commit
574d6b122d
3 changed files with 17 additions and 32 deletions
|
@ -454,21 +454,6 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
|
||||||
ah->power_mode = ATH9K_PM_UNDEFINED;
|
ah->power_mode = ATH9K_PM_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ath9k_hw_rfattach(struct ath_hw *ah)
|
|
||||||
{
|
|
||||||
bool rfStatus = false;
|
|
||||||
int ecode = 0;
|
|
||||||
|
|
||||||
rfStatus = ath9k_hw_init_rf(ah, &ecode);
|
|
||||||
if (!rfStatus) {
|
|
||||||
ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
|
|
||||||
"RF setup failed, status: %u\n", ecode);
|
|
||||||
return ecode;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ath9k_hw_rf_claim(struct ath_hw *ah)
|
static int ath9k_hw_rf_claim(struct ath_hw *ah)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
@ -585,9 +570,15 @@ static int ath9k_hw_post_init(struct ath_hw *ah)
|
||||||
ah->eep_ops->get_eeprom_ver(ah),
|
ah->eep_ops->get_eeprom_ver(ah),
|
||||||
ah->eep_ops->get_eeprom_rev(ah));
|
ah->eep_ops->get_eeprom_rev(ah));
|
||||||
|
|
||||||
ecode = ath9k_hw_rfattach(ah);
|
if (!AR_SREV_9280_10_OR_LATER(ah)) {
|
||||||
if (ecode != 0)
|
ecode = ath9k_hw_rf_alloc_ext_banks(ah);
|
||||||
|
if (ecode) {
|
||||||
|
ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
|
||||||
|
"Failed allocating banks for "
|
||||||
|
"external radio\n");
|
||||||
return ecode;
|
return ecode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!AR_SREV_9100(ah)) {
|
if (!AR_SREV_9100(ah)) {
|
||||||
ath9k_hw_ani_setup(ah);
|
ath9k_hw_ani_setup(ah);
|
||||||
|
|
|
@ -409,18 +409,16 @@ ath9k_hw_rf_free(struct ath_hw *ah)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ath9k_hw_init_rf - initialize external radio structures
|
* ath9k_hw_rf_alloc_ext_banks - allocates banks for external radio programming
|
||||||
* @ah: atheros hardware structure
|
* @ah: atheros hardware structure
|
||||||
* @status:
|
|
||||||
*
|
*
|
||||||
* Only required for older devices with external AR2133/AR5133 radios.
|
* Only required for older devices with external AR2133/AR5133 radios.
|
||||||
*/
|
*/
|
||||||
bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)
|
int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
|
||||||
{
|
{
|
||||||
struct ath_common *common = ath9k_hw_common(ah);
|
struct ath_common *common = ath9k_hw_common(ah);
|
||||||
|
|
||||||
if (AR_SREV_9280_10_OR_LATER(ah))
|
BUG_ON(AR_SREV_9280_10_OR_LATER(ah));
|
||||||
return true;
|
|
||||||
|
|
||||||
ah->analogBank0Data =
|
ah->analogBank0Data =
|
||||||
kzalloc((sizeof(u32) *
|
kzalloc((sizeof(u32) *
|
||||||
|
@ -453,8 +451,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)
|
||||||
|| ah->analogBank7Data == NULL) {
|
|| ah->analogBank7Data == NULL) {
|
||||||
ath_print(common, ATH_DBG_FATAL,
|
ath_print(common, ATH_DBG_FATAL,
|
||||||
"Cannot allocate RF banks\n");
|
"Cannot allocate RF banks\n");
|
||||||
*status = -ENOMEM;
|
return -ENOMEM;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ah->addac5416_21 =
|
ah->addac5416_21 =
|
||||||
|
@ -464,8 +461,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)
|
||||||
if (ah->addac5416_21 == NULL) {
|
if (ah->addac5416_21 == NULL) {
|
||||||
ath_print(common, ATH_DBG_FATAL,
|
ath_print(common, ATH_DBG_FATAL,
|
||||||
"Cannot allocate addac5416_21\n");
|
"Cannot allocate addac5416_21\n");
|
||||||
*status = -ENOMEM;
|
return -ENOMEM;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ah->bank6Temp =
|
ah->bank6Temp =
|
||||||
|
@ -474,11 +470,10 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)
|
||||||
if (ah->bank6Temp == NULL) {
|
if (ah->bank6Temp == NULL) {
|
||||||
ath_print(common, ATH_DBG_FATAL,
|
ath_print(common, ATH_DBG_FATAL,
|
||||||
"Cannot allocate bank6Temp\n");
|
"Cannot allocate bank6Temp\n");
|
||||||
*status = -ENOMEM;
|
return -ENOMEM;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,8 +29,7 @@ bool ath9k_hw_set_rf_regs(struct ath_hw *ah,
|
||||||
u16 modesIndex);
|
u16 modesIndex);
|
||||||
void ath9k_hw_decrease_chain_power(struct ath_hw *ah,
|
void ath9k_hw_decrease_chain_power(struct ath_hw *ah,
|
||||||
struct ath9k_channel *chan);
|
struct ath9k_channel *chan);
|
||||||
bool ath9k_hw_init_rf(struct ath_hw *ah,
|
int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah);
|
||||||
int *status);
|
|
||||||
|
|
||||||
#define AR_PHY_BASE 0x9800
|
#define AR_PHY_BASE 0x9800
|
||||||
#define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2))
|
#define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2))
|
||||||
|
|
Loading…
Reference in a new issue