AR9285 INI update plus minor bug fixes
cover AR9285 INI update plus minor bug fixes
John,
This series contains INI update for AR9285 chipset and has got ath9k bug fixes.
Senthil
PATCH 1/4 ath9k: Get rid of unnecessary ATOMIC memory alloc during init time
We can sleep for memory during init time and so allocating rx buffers, descriptro buffers with GFP_KERNEL should help us to get rid of transient alloc fails.
--- drivers/net/wireless/ath9k/main.c | 5 ++--- drivers/net/wireless/ath9k/recv.c | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-)
drivers/net/wireless/ath9k/main.c +2 -3
@@ -1804,7 +1804,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,/* allocate descriptors */ dd->dd_desc =dma_alloc_coherent (sc->dev, dd->dd_desc_len, - &dd->dd_desc_paddr,GFP_ATOMIC ); + &dd->dd_desc_paddr,GFP_KERNEL );if (dd->dd_desc ==NULL ) { error = -ENOMEM ; goto fail;
@@ -1816,12 +1816,11 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,/* allocate buffers */ bsize =sizeof (struct ath_buf ) * nbuf; - bf =kmalloc (bsize,GFP_KERNEL ); + bf =kzalloc (bsize,GFP_KERNEL );if (bf ==NULL ) { error = -ENOMEM ; goto fail2; } -memset (bf,0 , bsize); dd->dd_bufptr = bf;INIT_LIST_HEAD (head);
drivers/net/wireless/ath9k/recv.c +4 -4
@@ -100,7 +100,7 @@ static u64 ath_extend_tsf(struct ath_softc *sc, u32 rstamp)return (tsf & ~0x7fff ) | rstamp; } -static struct sk_buff *ath_rxbuf_alloc (struct ath_softc *sc,u32 len) +static struct sk_buff *ath_rxbuf_alloc (struct ath_softc *sc,u32 len,gfp_t gfp_mask) {struct sk_buff *skb;u32 off;
@@ -118,7 +118,7 @@ static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, u32 len)* Unfortunately this means we may get 8 KB here from the * kernel... and that is actually what is observed on some * systems :( */ - skb =dev_alloc_skb (len + sc->cachelsz -1 ); + skb =__dev_alloc_skb (len + sc->cachelsz -1 , gfp_mask);if (skb !=NULL ) { off = ((unsigned long ) skb->data) % sc->cachelsz;if (off !=0 )
@@ -306,7 +306,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) }list_for_each_entry (bf, &sc->rx.rxbuf, list) { - skb =ath_rxbuf_alloc (sc, sc->rx.bufsize); + skb =ath_rxbuf_alloc (sc, sc->rx.bufsize,GFP_KERNEL );if (skb ==NULL ) { error = -ENOMEM ;break ;
@@ -580,7 +580,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)/* Ensure we always have an skb to requeue once we are done * processing the current buffer's skb */ - requeue_skb =ath_rxbuf_alloc (sc, sc->rx.bufsize); + requeue_skb =ath_rxbuf_alloc (sc, sc->rx.bufsize,GFP_ATOMIC );/* If there is no memory we ignore the current RX'd frame, * tell hardware it can give us a new frame using the old
Signature · 1 line
1.6.0.4
PATCH 2/4 ath9k: RX buffers may be accessed/freed even before initialized/alloced.
accessing RXBUF list in ath_rx_cleanup may cause panic if ath_descdma_setup fails even before RXBUF list is initialized.
--- drivers/net/wireless/ath9k/main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/ath9k/main.c +1 -1
@@ -1773,6 +1773,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,DPRINTF (sc,ATH_DBG_CONFIG ,"%s DMA: %u buffers %u desc/buf\n" , name, nbuf, ndesc); +INIT_LIST_HEAD (head);/* ath_desc must be a multiple of DWORDs */ if ((sizeof (struct ath_desc ) %4 ) !=0 ) {DPRINTF (sc,ATH_DBG_FATAL ,"ath_desc not DWORD aligned\n" );
@@ -1823,7 +1824,6 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, } dd->dd_bufptr = bf; -INIT_LIST_HEAD (head);for (i =0 ; i < nbuf; i++, bf++, ds += ndesc) { bf->bf_desc = ds; bf->bf_daddr =DS2PHYS (dd, ds);
Signature · 1 line
1.6.0.4
PATCH 3/4 ath9k: INI update for AR9285 and periodic PA offset caliberation
This patch updates the initvalues for AR9285 chipset and also adds periodic PA offset caliberation.
--- drivers/net/wireless/ath9k/calib.c | 145 +++++++++++++++++++++----------- drivers/net/wireless/ath9k/eeprom.h | 2 +- drivers/net/wireless/ath9k/hw.c | 20 +++++- drivers/net/wireless/ath9k/initvals.h | 107 +++++++++++++++++------- drivers/net/wireless/ath9k/phy.h | 4 + 5 files changed, 195 insertions(+), 83 deletions(-)
drivers/net/wireless/ath9k/calib.c +95 -50
@@ -745,43 +745,6 @@ static void ath9k_olc_temp_compensation(struct ath_hw *ah) } } -bool ath9k_hw_calibrate (struct ath_hw *ah,struct ath9k_channel *chan, -u8 rxchainmask,bool longcal, -bool *isCalDone) -{ -struct hal_cal_list *currCal = ah->cal_list_curr; - - *isCalDone = true; - -if (currCal && - (currCal->calState ==CAL_RUNNING || - currCal->calState ==CAL_WAITING )) { -ath9k_hw_per_calibration (ah, chan, rxchainmask, currCal, - isCalDone); -if (*isCalDone) { - ah->cal_list_curr = currCal = currCal->calNext; - -if (currCal->calState ==CAL_WAITING ) { - *isCalDone = false; -ath9k_hw_reset_calibration (ah, currCal); - } - } - } - -if (longcal) { -if (OLC_FOR_AR9280_20_LATER ) -ath9k_olc_temp_compensation (ah); -ath9k_hw_getnf (ah, chan); -ath9k_hw_loadnf (ah, ah->curchan); -ath9k_hw_start_nfcal (ah); - -if (chan->channelFlags &CHANNEL_CW_INT ) - chan->channelFlags &= ~CHANNEL_CW_INT ; - } - -return true; -} -static inline void ath9k_hw_9285_pa_cal (struct ath_hw *ah) {
@@ -877,22 +840,104 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah) } +bool ath9k_hw_calibrate (struct ath_hw *ah,struct ath9k_channel *chan, +u8 rxchainmask,bool longcal, +bool *isCalDone) +{ +struct hal_cal_list *currCal = ah->cal_list_curr; + + *isCalDone = true; + +if (currCal && + (currCal->calState ==CAL_RUNNING || + currCal->calState ==CAL_WAITING )) { +ath9k_hw_per_calibration (ah, chan, rxchainmask, currCal, + isCalDone); +if (*isCalDone) { + ah->cal_list_curr = currCal = currCal->calNext; + +if (currCal->calState ==CAL_WAITING ) { + *isCalDone = false; +ath9k_hw_reset_calibration (ah, currCal); + } + } + } + +if (longcal) { +if (AR_SREV_9285 (ah) &&AR_SREV_9285_11_OR_LATER (ah)) +ath9k_hw_9285_pa_cal (ah); + +if (OLC_FOR_AR9280_20_LATER ) +ath9k_olc_temp_compensation (ah); +ath9k_hw_getnf (ah, chan); +ath9k_hw_loadnf (ah, ah->curchan); +ath9k_hw_start_nfcal (ah); + +if (chan->channelFlags &CHANNEL_CW_INT ) + chan->channelFlags &= ~CHANNEL_CW_INT ; + } + +return true; +} + +bool ar9285_clc (struct ath_hw *ah,struct ath9k_channel *chan) +{ +REG_SET_BIT (ah,AR_PHY_CL_CAL_CTL ,AR_PHY_CL_CAL_ENABLE ); +if (chan->channelFlags &CHANNEL_HT20 ) { +REG_SET_BIT (ah,AR_PHY_CL_CAL_CTL ,AR_PHY_PARALLEL_CAL_ENABLE ); +REG_SET_BIT (ah,AR_PHY_TURBO ,AR_PHY_FC_DYN2040_EN ); +REG_CLR_BIT (ah,AR_PHY_AGC_CONTROL , +AR_PHY_AGC_CONTROL_FLTR_CAL ); +REG_CLR_BIT (ah,AR_PHY_TPCRG1 ,AR_PHY_TPCRG1_PD_CAL_ENABLE ); +REG_SET_BIT (ah,AR_PHY_AGC_CONTROL ,AR_PHY_AGC_CONTROL_CAL ); +if (!ath9k_hw_wait (ah,AR_PHY_AGC_CONTROL , +AR_PHY_AGC_CONTROL_CAL ,0 ,AH_WAIT_TIMEOUT )) { +DPRINTF (ah->ah_sc,ATH_DBG_CALIBRATE ,"offset " +"calibration failed to complete in " +"1ms; noisy ??\n" ); +return false; + } +REG_CLR_BIT (ah,AR_PHY_TURBO ,AR_PHY_FC_DYN2040_EN ); +REG_CLR_BIT (ah,AR_PHY_CL_CAL_CTL ,AR_PHY_PARALLEL_CAL_ENABLE ); +REG_CLR_BIT (ah,AR_PHY_CL_CAL_CTL ,AR_PHY_CL_CAL_ENABLE ); + } +REG_CLR_BIT (ah,AR_PHY_ADC_CTL ,AR_PHY_ADC_CTL_OFF_PWDADC ); +REG_SET_BIT (ah,AR_PHY_AGC_CONTROL ,AR_PHY_AGC_CONTROL_FLTR_CAL ); +REG_SET_BIT (ah,AR_PHY_TPCRG1 ,AR_PHY_TPCRG1_PD_CAL_ENABLE ); +REG_SET_BIT (ah,AR_PHY_AGC_CONTROL ,AR_PHY_AGC_CONTROL_CAL ); +if (!ath9k_hw_wait (ah,AR_PHY_AGC_CONTROL ,AR_PHY_AGC_CONTROL_CAL , +0 ,AH_WAIT_TIMEOUT )) { +DPRINTF (ah->ah_sc,ATH_DBG_CALIBRATE ,"offset calibration " +"failed to complete in 1ms; noisy ??\n" ); +return false; + } + +REG_SET_BIT (ah,AR_PHY_ADC_CTL ,AR_PHY_ADC_CTL_OFF_PWDADC ); +REG_CLR_BIT (ah,AR_PHY_CL_CAL_CTL ,AR_PHY_CL_CAL_ENABLE ); +REG_CLR_BIT (ah,AR_PHY_AGC_CONTROL ,AR_PHY_AGC_CONTROL_FLTR_CAL ); + +return true; +} +bool ath9k_hw_init_cal (struct ath_hw *ah,struct ath9k_channel *chan) { -if (AR_SREV_9280_10_OR_LATER (ah)) { +if (AR_SREV_9285 (ah) &&AR_SREV_9285_12_OR_LATER (ah)) { +if (!ar9285_clc (ah, chan)) +return false; + }else if (AR_SREV_9280_10_OR_LATER (ah)) {REG_CLR_BIT (ah,AR_PHY_ADC_CTL ,AR_PHY_ADC_CTL_OFF_PWDADC );REG_SET_BIT (ah,AR_PHY_AGC_CONTROL ,AR_PHY_AGC_CONTROL_FLTR_CAL );REG_CLR_BIT (ah,AR_PHY_CL_CAL_CTL ,AR_PHY_CL_CAL_ENABLE );/* Kick off the cal */ REG_WRITE (ah,AR_PHY_AGC_CONTROL , -REG_READ (ah,AR_PHY_AGC_CONTROL ) | -AR_PHY_AGC_CONTROL_CAL ); +REG_READ (ah,AR_PHY_AGC_CONTROL ) | +AR_PHY_AGC_CONTROL_CAL );if (!ath9k_hw_wait (ah,AR_PHY_AGC_CONTROL , -AR_PHY_AGC_CONTROL_CAL ,0 , -AH_WAIT_TIMEOUT )) { +AR_PHY_AGC_CONTROL_CAL ,0 , +AH_WAIT_TIMEOUT )) {DPRINTF (ah->ah_sc,ATH_DBG_CALIBRATE ,"offset calibration failed to complete in 1ms; " "noisy environment?\n" );
@@ -906,11 +951,11 @@ bool ath9k_hw_init_cal(struct ath_hw *ah,/* Calibrate the AGC */ REG_WRITE (ah,AR_PHY_AGC_CONTROL , -REG_READ (ah,AR_PHY_AGC_CONTROL ) | -AR_PHY_AGC_CONTROL_CAL ); +REG_READ (ah,AR_PHY_AGC_CONTROL ) | +AR_PHY_AGC_CONTROL_CAL );if (!ath9k_hw_wait (ah,AR_PHY_AGC_CONTROL ,AR_PHY_AGC_CONTROL_CAL , -0 ,AH_WAIT_TIMEOUT )) { +0 ,AH_WAIT_TIMEOUT )) {DPRINTF (ah->ah_sc,ATH_DBG_CALIBRATE ,"offset calibration failed to complete in 1ms; " "noisy environment?\n" );
@@ -928,8 +973,8 @@ bool ath9k_hw_init_cal(struct ath_hw *ah,/* Do NF Calibration */ REG_WRITE (ah,AR_PHY_AGC_CONTROL , -REG_READ (ah,AR_PHY_AGC_CONTROL ) | -AR_PHY_AGC_CONTROL_NF ); +REG_READ (ah,AR_PHY_AGC_CONTROL ) | +AR_PHY_AGC_CONTROL_NF ); ah->cal_list = ah->cal_list_last = ah->cal_list_curr =NULL ;
@@ -938,19 +983,19 @@ bool ath9k_hw_init_cal(struct ath_hw *ah,INIT_CAL (&ah->adcgain_caldata);INSERT_CAL (ah, &ah->adcgain_caldata);DPRINTF (ah->ah_sc,ATH_DBG_CALIBRATE , -"enabling ADC Gain Calibration.\n" ); +"enabling ADC Gain Calibration.\n" ); }if (ath9k_hw_iscal_supported (ah,ADC_DC_CAL )) {INIT_CAL (&ah->adcdc_caldata);INSERT_CAL (ah, &ah->adcdc_caldata);DPRINTF (ah->ah_sc,ATH_DBG_CALIBRATE , -"enabling ADC DC Calibration.\n" ); +"enabling ADC DC Calibration.\n" ); }if (ath9k_hw_iscal_supported (ah,IQ_MISMATCH_CAL )) {INIT_CAL (&ah->iq_caldata);INSERT_CAL (ah, &ah->iq_caldata);DPRINTF (ah->ah_sc,ATH_DBG_CALIBRATE , -"enabling IQ Calibration.\n" ); +"enabling IQ Calibration.\n" ); } ah->cal_list_curr = ah->cal_list;
drivers/net/wireless/ath9k/eeprom.h +1 -1
@@ -261,7 +261,7 @@ struct base_eep_header_4k {u16 deviceCap;u32 binBuildNumber;u8 deviceType; -u8 futureBase[1 ]; +u8 txGainType; } __packed;
drivers/net/wireless/ath9k/hw.c +19 -1
@@ -678,6 +678,7 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc, ah->hw_version.macVersion, ah->hw_version.macRev);if (AR_SREV_9285_12_OR_LATER (ah)) { +INIT_INI_ARRAY (&ah->iniModes, ar9285Modes_9285_1_2,ARRAY_SIZE (ar9285Modes_9285_1_2),6 ); INIT_INI_ARRAY(&ah->iniCommon, ar9285Common_9285_1_2,
@@ -817,6 +818,22 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,if (ecode !=0 ) goto bad; +if (AR_SREV_9285_12_OR_LATER (ah)) { +u32 txgain_type = ah->eep_ops->get_eeprom (ah,EEP_TXGAIN_TYPE ); + +/* txgain table */ +if (txgain_type ==AR5416_EEP_TXGAIN_HIGH_POWER ) { +INIT_INI_ARRAY (&ah->iniModesTxGain, + ar9285Modes_high_power_tx_gain_9285_1_2, +ARRAY_SIZE (ar9285Modes_high_power_tx_gain_9285_1_2),6 ); + }else { +INIT_INI_ARRAY (&ah->iniModesTxGain, + ar9285Modes_original_tx_gain_9285_1_2, +ARRAY_SIZE (ar9285Modes_original_tx_gain_9285_1_2),6 ); + } + + } +/* rxgain table */ if (AR_SREV_9280_20 (ah))ath9k_hw_init_rxgain_ini (ah);
@@ -1293,7 +1310,8 @@ static int ath9k_hw_process_ini(struct ath_hw *ah,if (AR_SREV_9280 (ah))REG_WRITE_ARRAY (&ah->iniModesRxGain, modesIndex, regWrites); -if (AR_SREV_9280 (ah)) +if (AR_SREV_9280 (ah) || (AR_SREV_9285 (ah) && +AR_SREV_9285_12_OR_LATER (ah)))REG_WRITE_ARRAY (&ah->iniModesTxGain, modesIndex, regWrites);for (i =0 ; i < ah->iniCommon.ia_rows; i++) {
drivers/net/wireless/ath9k/initvals.h +76 -31
175 lines not on this page · raw message
drivers/net/wireless/ath9k/phy.h +4 -0
@@ -446,6 +446,9 @@ bool ath9k_hw_init_rf(struct ath_hw *ah,#define AR_PHY_TPCRG1_PD_GAIN_3 0x00300000#define AR_PHY_TPCRG1_PD_GAIN_3_S 20 +#define AR_PHY_TPCRG1_PD_CAL_ENABLE 0x00400000 +#define AR_PHY_TPCRG1_PD_CAL_ENABLE_S 22 +#define AR_PHY_TX_PWRCTRL4 0xa264#define AR_PHY_TX_PWRCTRL_PD_AVG_VALID 0x00000001#define AR_PHY_TX_PWRCTRL_PD_AVG_VALID_S 0
@@ -513,6 +516,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah,/* Carrier leak calibration control, do it after AGC calibration */ #define AR_PHY_CL_CAL_CTL 0xA358#define AR_PHY_CL_CAL_ENABLE 0x00000002 +#define AR_PHY_PARALLEL_CAL_ENABLE 0x00000001#define AR_PHY_POWER_TX_RATE5 0xA38C#define AR_PHY_POWER_TX_RATE6 0xA390
Signature · 1 line
1.6.0.4
PATCH 4/4 ath9k: Incorrect AR9285 version check macro
Fix AR9285 1.1 and 1.2 version check macro.
--- drivers/net/wireless/ath9k/reg.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath9k/reg.h +2 -2
@@ -780,14 +780,14 @@#define AR_SREV_9285_10_OR_LATER (_ah) \ (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9285))#define AR_SREV_9285_11 (_ah) \ - (AR_SREV_9280(ah) && \ + (AR_SREV_9285(ah) && \ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9285_11))#define AR_SREV_9285_11_OR_LATER (_ah) \ (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9285) || \ (AR_SREV_9285(ah) && ((_ah)->hw_version.macRev >= \ AR_SREV_REVISION_9285_11)))#define AR_SREV_9285_12 (_ah) \ - (AR_SREV_9280(ah) && \ + (AR_SREV_9285(ah) && \ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9285_12))#define AR_SREV_9285_12_OR_LATER (_ah) \ (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9285) || \
Signature · 1 line
1.6.0.4