From: Mohammed Shafi <mshajakhan@atheros.com>
To: Vasanth Thiagarajan <Vasanth.Thiagarajan@Atheros.com>
Cc: Mohammed Shajakhan <Mohammed.Shajakhan@Atheros.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linville@tuxdriver.com" <linville@tuxdriver.com>,
Luis Rodriguez <Luis.Rodriguez@Atheros.com>,
Senthilkumar Balasubramanian
<Senthilkumar.Balasubramanian@Atheros.com>
Subject: Re: [RFC/RFT 4/9] ath9k_hw: config diversity based on eeprom contents
Date: Fri, 29 Apr 2011 12:19:23 +0530 [thread overview]
Message-ID: <4DBA5F73.1080800@atheros.com> (raw)
In-Reply-To: <20110429044301.GC26690@vasanth-laptop>
On Friday 29 April 2011 10:13 AM, Vasanth Thiagarajan wrote:
> On Thu, Apr 28, 2011 at 07:52:54PM +0530, Mohammed Shafi Shajakhan wrote:
>
>> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>>
>> * enable LNA-diversity, fast-diversity based on the value read from
>> EEPROM content
>> * if antenna diversity/combining is supported set LNA1 for the main
>> antenna and LNA2 for the alternate antenna based on the new diversity
>> algorithm
>>
>> Signed-off-by: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>> ---
>> drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 50 +++++++++++++++++++++---
>> 1 files changed, 44 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
>> index fb892e5..d43e62c 100644
>> --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
>> +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
>> @@ -3500,6 +3500,8 @@ static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah,
>> static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
>> {
>> int chain;
>> + u32 regval;
>> + u32 ant_div_ctl1;
>> static const u32 switch_chain_reg[AR9300_MAX_CHAINS] = {
>> AR_PHY_SWITCH_CHAIN_0,
>> AR_PHY_SWITCH_CHAIN_1,
>> @@ -3525,13 +3527,49 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
>>
>> if (AR_SREV_9485(ah)) {
>> value = ath9k_hw_ar9300_get_eeprom(ah, EEP_ANT_DIV_CTL1);
>> - REG_RMW_FIELD(ah, AR_PHY_MC_GAIN_CTRL, AR_ANT_DIV_CTRL_ALL,
>> - value);
>> - REG_RMW_FIELD(ah, AR_PHY_MC_GAIN_CTRL, AR_ANT_DIV_ENABLE,
>> - value>> 6);
>> - REG_RMW_FIELD(ah, AR_PHY_CCK_DETECT, AR_FAST_DIV_ENABLE,
>> - value>> 7);
>> + /*
>> + * main_lnaconf, alt_lnaconf, main_tb, alt_tb
>> + * are the fields present
>> + */
>> + regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
>> + regval&= (~AR_ANT_DIV_CTRL_ALL);
>> + regval |= (value& 0x3f)<< AR_ANT_DIV_CTRL_ALL_S;
>> + /* enable_lnadiv */
>> + regval&= (~AR_PHY_9485_ANT_DIV_LNADIV);
>> + regval |= ((value>> 6)& 0x1)<<
>> + AR_PHY_9485_ANT_DIV_LNADIV_S;
>> + REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
>> +
>> + /*enable fast_div */
>> + regval = REG_READ(ah, AR_PHY_CCK_DETECT);
>> + regval&= (~AR_BBB_SIG_DETECT_ANT_FAST_DIV);
>> + regval |= ((value>> 7)& 0x1)<<
>> + AR_BBB_SIG_DETECT_ANT_FAST_DIV_S;
>> + REG_WRITE(ah, AR_PHY_CCK_DETECT, regval);
>>
> Can these be simplified with REG_RMW()?.
>
>> + ant_div_ctl1 =
>> + ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1);
>> + /* check whether antenna diversity is enabled */
>> + if ((ant_div_ctl1>> 0x6) == 0x3) {
>> + regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
>> + /*
>> + * clear bits 25-30 main_lnaconf, alt_lnaconf,
>> + * main_tb, alt_tb
>> + */
>> + regval&= (~(AR_PHY_9485_ANT_DIV_MAIN_LNACONF |
>> + AR_PHY_9485_ANT_DIV_ALT_LNACONF |
>> + AR_PHY_9485_ANT_DIV_ALT_GAINTB |
>> + AR_PHY_9485_ANT_DIV_MAIN_GAINTB));
>> + /* by default use LNA1 for the main antenna */
>> + regval |= (AR_PHY_9485_ANT_DIV_LNA1<<
>> + AR_PHY_9485_ANT_DIV_MAIN_LNACONF_S);
>> + regval |= (AR_PHY_9485_ANT_DIV_LNA2<<
>> + AR_PHY_9485_ANT_DIV_ALT_LNACONF_S);
>> + REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
>>
> same here.
>
Vasanth, as you had said it can be further optimized and few macros are
redundant. Thanks a lot for the review.
regards,
shafi
> Vasanth
> .
>
>
next prev parent reply other threads:[~2011-04-29 6:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 14:22 [RFC/RFT 0/9] ath9k: Add Antenna diversity support for AR9485 Mohammed Shafi Shajakhan
2011-04-28 14:22 ` [RFC/RFT 1/9] ath9k_hw: make antenna diversity modules chip specific Mohammed Shafi Shajakhan
2011-04-29 4:10 ` Vasanthakumar Thiagarajan
2011-04-29 5:21 ` Mohammed Shafi
2011-04-28 14:22 ` [RFC/RFT 2/9] ath9k_hw: enable Antenna diversity for AR9485 Mohammed Shafi Shajakhan
2011-04-28 14:22 ` [RFC/RFT 3/9] ath9k_hw: define registers/macros to support Antenna diversity Mohammed Shafi Shajakhan
2011-04-29 4:20 ` Vasanthakumar Thiagarajan
2011-04-29 4:53 ` Mohammed Shafi
2011-04-28 14:22 ` [RFC/RFT 4/9] ath9k_hw: config diversity based on eeprom contents Mohammed Shafi Shajakhan
2011-04-28 17:39 ` Luis R. Rodriguez
2011-04-29 4:52 ` Mohammed Shafi
2011-04-29 4:43 ` Vasanthakumar Thiagarajan
2011-04-29 6:34 ` Mohammed Shafi
2011-04-29 6:49 ` Mohammed Shafi [this message]
2011-04-28 14:22 ` [RFC/RFT 5/9] ath9k_hw: define modules to get/set Antenna diversity paramaters Mohammed Shafi Shajakhan
2011-04-28 14:22 ` [RFC/RFT 6/9] ath9k_hw: define antenna diversity group Mohammed Shafi Shajakhan
2011-04-28 14:22 ` [RFC/RFT 7/9] ath9k: Implement an API to swap main/ALT LNA's Mohammed Shafi Shajakhan
2011-04-28 14:22 ` [RFC/RFT 8/9] ath9k: configure fast_div_bias based on diversity group Mohammed Shafi Shajakhan
2011-04-28 14:22 ` [RFC/RFT 9/9] ath9k: make sure main_rssi is positive Mohammed Shafi Shajakhan
2011-04-28 18:12 ` [RFC/RFT 0/9] ath9k: Add Antenna diversity support for AR9485 Luis R. Rodriguez
2011-04-28 18:12 ` Luis R. Rodriguez
2011-04-29 4:52 ` Mohammed Shafi
2011-05-12 16:59 ` John W. Linville
2011-05-13 4:22 ` Mohammed Shafi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DBA5F73.1080800@atheros.com \
--to=mshajakhan@atheros.com \
--cc=Luis.Rodriguez@Atheros.com \
--cc=Mohammed.Shajakhan@Atheros.com \
--cc=Senthilkumar.Balasubramanian@Atheros.com \
--cc=Vasanth.Thiagarajan@Atheros.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).