ath9k: Move INI overrides to ar9003_hw_override_ini
PATCH 1/6 ath9k: Move INI overrides to ar9003_hw_override_ini
From: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/ar9003_phy.c | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_phy.c +16 -17
@@ -632,6 +632,22 @@ static void ar9003_hw_override_ini(struct ath_hw *ah)REG_SET_BIT (ah,AR_PHY_CCK_DETECT ,AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV ); + +if (AR_SREV_9462 (ah) ||AR_SREV_9565 (ah)) { +REG_WRITE (ah,AR_GLB_SWREG_DISCONT_MODE , +AR_GLB_SWREG_DISCONT_EN_BT_WLAN ); + +if (REG_READ_FIELD (ah,AR_PHY_TX_IQCAL_CONTROL_0 , +AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL )) + ah->enabled_cals |=TX_IQ_CAL ; +else + ah->enabled_cals &= ~TX_IQ_CAL ; + +if (REG_READ (ah,AR_PHY_CL_CAL_CTL ) &AR_PHY_CL_CAL_ENABLE ) + ah->enabled_cals |=TX_CL_CAL ; +else + ah->enabled_cals &= ~TX_CL_CAL ; + } } static void ar9003_hw_prog_ini(struct ath_hw *ah,
@@ -814,29 +830,12 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,if (chan->channel ==2484 )ar9003_hw_prog_ini (ah, &ah->iniCckfirJapan2484,1 ); -if (AR_SREV_9462 (ah) ||AR_SREV_9565 (ah)) -REG_WRITE (ah,AR_GLB_SWREG_DISCONT_MODE , -AR_GLB_SWREG_DISCONT_EN_BT_WLAN ); - ah->modes_index = modesIndex;ar9003_hw_override_ini (ah);ar9003_hw_set_channel_regs (ah, chan);ar9003_hw_set_chain_masks (ah, ah->rxchainmask, ah->txchainmask);ath9k_hw_apply_txpower (ah, chan, false); -if (AR_SREV_9462 (ah) ||AR_SREV_9565 (ah)) { -if (REG_READ_FIELD (ah,AR_PHY_TX_IQCAL_CONTROL_0 , -AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL )) - ah->enabled_cals |=TX_IQ_CAL ; -else - ah->enabled_cals &= ~TX_IQ_CAL ; - -if (REG_READ (ah,AR_PHY_CL_CAL_CTL ) &AR_PHY_CL_CAL_ENABLE ) - ah->enabled_cals |=TX_CL_CAL ; -else - ah->enabled_cals &= ~TX_CL_CAL ; - } -return 0 ; }
Signature · 1 line
1.8.3.2
PATCH 2/6 ath9k: Add a HW flag for FCC
From: Sujith Manoharan <[email protected]>
Fast Channel Change across 2G/5G bands is supported only by AR9462 and AR9565. Add a HW capability field to indicate this.
--- drivers/net/wireless/ath/ath9k/hw.c | 7 +++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + 2 files changed, 8 insertions(+)
drivers/net/wireless/ath/ath9k/hw.c +7 -0
@@ -2610,6 +2610,13 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) pCap->hw_caps |=ATH9K_HW_CAP_PAPRD ; +/* +* Fast channel change across bands is available +* only for AR9462 and AR9565. +*/ +if (AR_SREV_9462 (ah) ||AR_SREV_9565 (ah)) + pCap->hw_caps |=ATH9K_HW_CAP_FCC_BAND_SWITCH ; +return 0 ; }
drivers/net/wireless/ath/ath9k/hw.h +1 -0
@@ -247,6 +247,7 @@ enum ath9k_hw_caps {ATH9K_HW_CAP_DFS =BIT (16 ),ATH9K_HW_WOW_DEVICE_CAPABLE =BIT (17 ),ATH9K_HW_CAP_PAPRD =BIT (18 ), + ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(19), };/*
Signature · 1 line
1.8.3.2
PATCH 3/6 ath9k: Fix FastChannelChange for AR9462/AR9565
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Right now, even though these chips support cross-band FCC, the code is non-functional since we bail out early if the channelFlags differ. Fix this so that cross-band FCC works for cards that support this feature.
--- drivers/net/wireless/ath/ath9k/hw.c | 45 ++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +27 -18
@@ -1496,16 +1496,18 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, struct ath9k_channel *chan) {struct ath_common *common =ath9k_hw_common (ah); +struct ath9k_hw_capabilities *pCap = &ah->caps; +bool band_switch = false, mode_diff = false; +u8 ini_reloaded;u32 qnum;int r; -bool edma = !!(ah->caps.hw_caps &ATH9K_HW_CAP_EDMA ); -bool band_switch, mode_diff; -u8 ini_reloaded; - band_switch = (chan->channelFlags & (CHANNEL_2GHZ |CHANNEL_5GHZ )) != - (ah->curchan->channelFlags & (CHANNEL_2GHZ | -CHANNEL_5GHZ )); - mode_diff = (chan->chanmode != ah->curchan->chanmode); +if (pCap->hw_caps &ATH9K_HW_CAP_FCC_BAND_SWITCH ) { +u32 cur = ah->curchan->channelFlags & (CHANNEL_2GHZ |CHANNEL_5GHZ ); +u32 new = chan->channelFlags & (CHANNEL_2GHZ |CHANNEL_5GHZ ); + band_switch = (cur != new); + mode_diff = (chan->chanmode != ah->curchan->chanmode); + }for (qnum =0 ; qnum <AR_NUM_QCU ; qnum++) {if (ath9k_hw_numtxpending (ah, qnum)) {
@@ -1520,7 +1522,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,return false; } -if (edma && (band_switch || mode_diff)) { +if (band_switch || mode_diff) {ath9k_hw_mark_phy_inactive (ah);udelay (5 );
@@ -1548,7 +1550,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,ath9k_hw_spur_mitigate_freq (ah, chan); -if (edma && (band_switch || mode_diff)) { +if (band_switch || mode_diff) { ah->ah_flags |=AH_FASTCC ;if (band_switch || ini_reloaded) ah->eep_ops->set_board_values (ah, chan);
@@ -1778,16 +1780,11 @@ static void ath9k_hw_init_desc(struct ath_hw *ah)/* * Fast channel change: * (Change synthesizer based on channel freq without resetting chip) -* -* Don't do FCC when -* - Flag is not set -* - Chip is just coming out of full sleep -* - Channel to be set is same as current channel -* - Channel flags are different, (eg.,moving from 2GHz to 5GHz channel) */ static int ath9k_hw_do_fastcc (struct ath_hw *ah,struct ath9k_channel *chan) {struct ath_common *common =ath9k_hw_common (ah); +struct ath9k_hw_capabilities *pCap = &ah->caps;int ret;if (AR_SREV_9280 (ah) && common->bus_ops->ath_bus_type ==ATH_PCI )
@@ -1806,9 +1803,21 @@ static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan) (CHANNEL_HALF | CHANNEL_QUARTER)) goto fail; -if ((chan->channelFlags &CHANNEL_ALL ) != - (ah->curchan->channelFlags &CHANNEL_ALL )) - goto fail; +/* +* If cross-band fcc is not supoprted, bail out if +* either channelFlags or chanmode differ. +* +* chanmode will be different if the HT operating mode +* changes because of CSA. +*/ +if (!(pCap->hw_caps &ATH9K_HW_CAP_FCC_BAND_SWITCH )) { +if ((chan->channelFlags &CHANNEL_ALL ) != + (ah->curchan->channelFlags &CHANNEL_ALL )) + goto fail; + +if (chan->chanmode != ah->curchan->chanmode) + goto fail; + }if (!ath9k_hw_check_alive (ah)) goto fail;
Signature · 1 line
1.8.3.2
PATCH 4/6 ath9k: Use correct channel when switching bands
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/hw.c +2 -1
@@ -1526,7 +1526,8 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,ath9k_hw_mark_phy_inactive (ah);udelay (5 ); -ath9k_hw_init_pll (ah,NULL ); +if (band_switch) +ath9k_hw_init_pll (ah, chan);if (ath9k_hw_fast_chan_change (ah, chan, &ini_reloaded)) {ath_err (common,"Failed to do fast channel change\n" );
Signature · 1 line
1.8.3.2
PATCH 5/6 ath9k: Program correct initvals for FCC
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
* CUS217 specific initvals have to be programmed.
* iniAdditional is not used for AR9462/AR9565, remove it.
* Handle channel 2484 for regulatory compliance.
--- drivers/net/wireless/ath/ath9k/ar9003_phy.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_phy.c +17 -1
@@ -1517,6 +1517,18 @@ static int ar9003_hw_fast_chan_change(struct ath_hw *ah,REG_WRITE_ARRAY (&ah->iniModesTxGain, modesIndex, regWrites); +if (AR_SREV_9462_20_OR_LATER (ah)) { +/* +* CUS217 mix LNA mode. +*/ +if (ar9003_hw_get_rx_gain_idx (ah) ==2 ) { +REG_WRITE_ARRAY (&ah->ini_modes_rxgain_bb_core, +1 , regWrites); +REG_WRITE_ARRAY (&ah->ini_modes_rxgain_bb_postamble, + modesIndex, regWrites); + } + } +/* * For 5GHz channels requiring Fast Clock, apply * different modal values.
@@ -1527,7 +1539,11 @@ static int ar9003_hw_fast_chan_change(struct ath_hw *ah,if (AR_SREV_9565 (ah))REG_WRITE_ARRAY (&ah->iniModesFastClock,1 , regWrites); -REG_WRITE_ARRAY (&ah->iniAdditional,1 , regWrites); +/* +* JAPAN regulatory. +*/ +if (chan->channel ==2484 ) +ar9003_hw_prog_ini (ah, &ah->iniCckfirJapan2484,1 ); ah->modes_index = modesIndex; *ini_reloaded = true;
Signature · 1 line
1.8.3.2
PATCH 6/6 ath9k: Release the RF bus after setting board values
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/hw.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +8 -9
@@ -1498,7 +1498,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,struct ath_common *common =ath9k_hw_common (ah);struct ath9k_hw_capabilities *pCap = &ah->caps;bool band_switch = false, mode_diff = false; -u8 ini_reloaded; +u8 ini_reloaded =0 ;u32 qnum;int r;
@@ -1544,22 +1544,21 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, }ath9k_hw_set_clockrate (ah);ath9k_hw_apply_txpower (ah, chan, false); -ath9k_hw_rfbus_done (ah);if (IS_CHAN_OFDM (chan) ||IS_CHAN_HT (chan))ath9k_hw_set_delta_slope (ah, chan);ath9k_hw_spur_mitigate_freq (ah, chan); -if (band_switch || mode_diff) { - ah->ah_flags |=AH_FASTCC ; -if (band_switch || ini_reloaded) - ah->eep_ops->set_board_values (ah, chan); +if (band_switch || ini_reloaded) + ah->eep_ops->set_board_values (ah, chan); -ath9k_hw_init_bb (ah, chan); +ath9k_hw_init_bb (ah, chan); +ath9k_hw_rfbus_done (ah); -if (band_switch || ini_reloaded) -ath9k_hw_init_cal (ah, chan); +if (band_switch || ini_reloaded) { + ah->ah_flags |=AH_FASTCC ; +ath9k_hw_init_cal (ah, chan); ah->ah_flags &= ~AH_FASTCC ; }
Signature · 1 line
1.8.3.2