ath5k updates
cover ath5k updates
Hi John,
This series has Nick's patches for tx power, AP mode, beacon fixes, and antenna diversity that were posted earlier in patches 1-7. I corrected the overly long changelogs, fixed one sparse warning, and tacked another txpower and an LED patch onto the end.
Bob Copeland (1):
ath5k: use ctl settings based on current regdomain
Jiri Slaby (1):
ath5k: Enable AP mode
Nick Kossifidis (6):
ath5k: Allow user/driver to set txpower
ath5k: Read Spur channels from EEPROM
ath5k: Put remaining EEPROM data on ee struct
ath5k: Beaconing fixes
ath5k: Implement antenna control
ath5k: Add Spur filter support on newer chips
Paride Legovini (1):
Add LED support for AR5BXB6 IBM Thinkpad PCIe adapters
drivers/net/wireless/ath/ath5k/ath5k.h | 37 ++- drivers/net/wireless/ath/ath5k/attach.c | 1 - drivers/net/wireless/ath/ath5k/base.c | 140 ++++++--- drivers/net/wireless/ath/ath5k/eeprom.c | 69 ++++-- drivers/net/wireless/ath/ath5k/eeprom.h | 46 +++- drivers/net/wireless/ath/ath5k/led.c | 6 +- drivers/net/wireless/ath/ath5k/pcu.c | 4 +- drivers/net/wireless/ath/ath5k/phy.c | 493 +++++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath5k/qcu.c | 7 +- drivers/net/wireless/ath/ath5k/reg.h | 9 +- drivers/net/wireless/ath/ath5k/reset.c | 70 ++--- 11 files changed, 724 insertions(+), 158 deletions(-)
PATCH 1/9 ath5k: Allow user/driver to set txpower
From: Nick Kossifidis <[email protected]>
* Now that we have regulatory control enable the driver to set txpower on hw
* Also use txpower table offset so that we can match power range set by user/driver with indices on power table.
Tested 2 different cards (a CM9 and an RF5112-based ubnt) and got the same output using a remote machine to measure per-packet rssi (conected the cards using attenuators). I also switched between various tx power levels and i saw an equal power change on the remote machine (so txpower changes as expected) and verified that we have the same output on each rate.
--- drivers/net/wireless/ath/ath5k/ath5k.h | 7 +++-- drivers/net/wireless/ath/ath5k/base.c | 11 +++++++- drivers/net/wireless/ath/ath5k/phy.c | 45 ++++++++++++++++++++++++++----- drivers/net/wireless/ath/ath5k/reset.c | 2 +- 4 files changed, 52 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +4 -3
@@ -1100,11 +1100,12 @@ struct ath5k_hw {/* Values in 0.25dB units */ s16 txp_min_pwr;s16 txp_max_pwr; +/* Values in 0.5dB units */ s16 txp_offset;s16 txp_ofdm; -/* Values in dB units */ -s16 txp_cck_ofdm_pwr_delta;s16 txp_cck_ofdm_gainf_delta; +/* Value in dB units */ +s16 txp_cck_ofdm_pwr_delta; } ah_txpower;struct {
@@ -1271,7 +1272,7 @@ extern unsigned int ath5k_hw_get_def_antenna(struct ath5k_hw *ah);extern int ath5k_hw_phy_disable (struct ath5k_hw *ah);/* TX power setup */ extern int ath5k_hw_txpower (struct ath5k_hw *ah,struct ieee80211_channel *channel,u8 ee_mode,u8 txpower); -extern int ath5k_hw_set_txpower_limit (struct ath5k_hw *ah,u8 ee_mode,u8 txpower); +extern int ath5k_hw_set_txpower_limit (struct ath5k_hw *ah,u8 txpower);/* * Functions used internaly
drivers/net/wireless/ath/ath5k/base.c +10 -1
@@ -2747,12 +2747,21 @@ static int ath5k_config(struct ieee80211_hw *hw, u32 changed) {struct ath5k_softc *sc = hw->priv; +struct ath5k_hw *ah = sc->ah;struct ieee80211_conf *conf = &hw->conf;int ret;mutex_lock (&sc->lock); - sc->power_level = conf->power_level; + sc->bintval = conf->beacon_int; + +if ((changed &IEEE80211_CONF_CHANGE_POWER ) && + (sc->power_level != conf->power_level)) { + sc->power_level = conf->power_level; + +/* Half dB steps */ +ath5k_hw_set_txpower_limit (ah, (conf->power_level *2 )); + } ret =ath5k_chan_set (sc, conf->channel);
drivers/net/wireless/ath/ath5k/phy.c +37 -8
77 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/reset.c +1 -1
@@ -1001,7 +1001,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,* Set TX power (FIXME) */ ret =ath5k_hw_txpower (ah, channel, ee_mode, -AR5K_TUNE_DEFAULT_TXPOWER ); + ah->ah_txpower.txp_max_pwr /2 );if (ret)return ret;
Signature · 1 line
1.6.0.6
PATCH 2/9 ath5k: Read Spur channels from EEPROM
In reply to Bob CopelandFrom: Nick Kossifidis <[email protected]>
* Read Spur channel information from EEPROM and use default channels for RF5413 compatible chips that don't have this info on EEPROM.
--- drivers/net/wireless/ath/ath5k/eeprom.c | 37 ++++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath5k/eeprom.h | 20 ++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath5k/eeprom.c +36 -1
@@ -1694,9 +1694,40 @@ ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah)return 0 ; } +static int +ath5k_eeprom_read_spur_chans (struct ath5k_hw *ah) +{ +struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; +u32 offset; +u16 val; +int ret =0 , i; + + offset =AR5K_EEPROM_CTL (ee->ee_version) + +AR5K_EEPROM_N_CTLS (ee->ee_version); + +if (ee->ee_version <AR5K_EEPROM_VERSION_5_3 ) { +/* No spur info for 5GHz */ + ee->ee_spur_chans[0 ][0 ] =AR5K_EEPROM_NO_SPUR ; +/* 2 channels for 2GHz (2464/2420) */ + ee->ee_spur_chans[0 ][1 ] =AR5K_EEPROM_5413_SPUR_CHAN_1 ; + ee->ee_spur_chans[1 ][1 ] =AR5K_EEPROM_5413_SPUR_CHAN_2 ; + ee->ee_spur_chans[2 ][1 ] =AR5K_EEPROM_NO_SPUR ; + }else if (ee->ee_version >=AR5K_EEPROM_VERSION_5_3 ) { +for (i =0 ; i <AR5K_EEPROM_N_SPUR_CHANS ; i++) { +AR5K_EEPROM_READ (offset, val); + ee->ee_spur_chans[i][0 ] = val; +AR5K_EEPROM_READ (offset +AR5K_EEPROM_N_SPUR_CHANS , + val); + ee->ee_spur_chans[i][1 ] = val; + offset++; + } + } + +return ret; +}/* -* Initialize eeprom power tables +* Initialize eeprom data structure */ int ath5k_eeprom_init (struct ath5k_hw *ah)
@@ -1719,6 +1750,10 @@ ath5k_eeprom_init(struct ath5k_hw *ah)if (err <0 )return err; + err =ath5k_eeprom_read_spur_chans (ah); +if (err <0 ) +return err; +return 0 ; }
drivers/net/wireless/ath/ath5k/eeprom.h +20 -0
@@ -211,6 +211,23 @@#define AR5K_EEPROM_I_GAIN 10#define AR5K_EEPROM_CCK_OFDM_DELTA 15#define AR5K_EEPROM_N_IQ_CAL 2 +/* 5GHz/2GHz */ +enum ath5k_eeprom_freq_bands { +AR5K_EEPROM_BAND_5GHZ =0 , +AR5K_EEPROM_BAND_2GHZ =1 , +AR5K_EEPROM_N_FREQ_BANDS , +}; +/* Spur chans per freq band */ +#define AR5K_EEPROM_N_SPUR_CHANS 5 +/* fbin value for chan 2464 x2 */ +#define AR5K_EEPROM_5413_SPUR_CHAN_1 1640 +/* fbin value for chan 2420 x2 */ +#define AR5K_EEPROM_5413_SPUR_CHAN_2 1200 +#define AR5K_EEPROM_SPUR_CHAN_MASK 0x3FFF +#define AR5K_EEPROM_NO_SPUR 0x8000 +#define AR5K_SPUR_CHAN_WIDTH 87 +#define AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz 3125 +#define AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz 6250#define AR5K_EEPROM_READ (_o, _v) do { \ ret = ath5k_hw_eeprom_read(ah, (_o), &(_v)); \
@@ -436,6 +453,9 @@ struct ath5k_eeprom_info {s8 ee_pga_desired_size_turbo[AR5K_EEPROM_N_MODES ];s8 ee_pd_gain_overlap; +/* Spur mitigation data (fbin values for spur channels) */ +u16 ee_spur_chans[AR5K_EEPROM_N_SPUR_CHANS ][AR5K_EEPROM_N_FREQ_BANDS ]; +u32 ee_antenna[AR5K_EEPROM_N_MODES ][AR5K_ANT_MAX ]; };
Signature · 1 line
1.6.0.6
PATCH 3/9 ath5k: Put remaining EEPROM data on ee struct
In reply to Bob CopelandFrom: Nick Kossifidis <[email protected]>
* Put remaining EEPROM information on ee struct and remove is_hb63 function.
Now we also have rfkill stuff available.
--- drivers/net/wireless/ath/ath5k/eeprom.c | 24 +++++++++++------------- drivers/net/wireless/ath/ath5k/eeprom.h | 15 ++++++++++----- drivers/net/wireless/ath/ath5k/reset.c | 5 +++-- 3 files changed, 24 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath5k/eeprom.c +11 -13
@@ -156,6 +156,17 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah) ee->ee_db[AR5K_EEPROM_MODE_11G ][0 ] = (val >>3 ) &0x7 ; } +AR5K_EEPROM_READ (AR5K_EEPROM_IS_HB63 , val); + +if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >>4 )) && val) + ee->ee_is_hb63 = true; +else + ee->ee_is_hb63 = false; + +AR5K_EEPROM_READ (AR5K_EEPROM_RFKILL , val); + ee->ee_rfkill_pin = (u8 )AR5K_REG_MS (val,AR5K_EEPROM_RFKILL_GPIO_SEL ); + ee->ee_rfkill_pol = val &AR5K_EEPROM_RFKILL_POLARITY ? true : false; +return 0 ; }
@@ -1789,16 +1800,3 @@ int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)return 0 ; } - -bool ath5k_eeprom_is_hb63 (struct ath5k_hw *ah) -{ -u16 data; - -ath5k_hw_eeprom_read (ah,AR5K_EEPROM_IS_HB63 , &data); - -if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >>4 )) && data) -return true; -else -return false; -} -
drivers/net/wireless/ath/ath5k/eeprom.h +10 -5
@@ -26,6 +26,13 @@#define AR5K_EEPROM_MAGIC_5210 0x0000145a/* 5210 */ #define AR5K_EEPROM_IS_HB63 0x000b/* Talon detect */ + +#define AR5K_EEPROM_RFKILL 0x0f +#define AR5K_EEPROM_RFKILL_GPIO_SEL 0x0000001c +#define AR5K_EEPROM_RFKILL_GPIO_SEL_S 2 +#define AR5K_EEPROM_RFKILL_POLARITY 0x00000002 +#define AR5K_EEPROM_RFKILL_POLARITY_S 1 +#define AR5K_EEPROM_REG_DOMAIN 0x00bf/* EEPROM regdom */ #define AR5K_EEPROM_CHECKSUM 0x00c0/* EEPROM checksum */ #define AR5K_EEPROM_INFO_BASE 0x00c0/* EEPROM header */
@@ -66,11 +73,6 @@#define AR5K_EEPROM_HDR_RFKILL (_v) (((_v) >> 14) & 0x1)/* Device has RFKill support */ #define AR5K_EEPROM_HDR_T_5GHZ_DIS (_v) (((_v) >> 15) & 0x1)/* Disable turbo for 5Ghz */ -#define AR5K_EEPROM_RFKILL_GPIO_SEL 0x0000001c -#define AR5K_EEPROM_RFKILL_GPIO_SEL_S 2 -#define AR5K_EEPROM_RFKILL_POLARITY 0x00000002 -#define AR5K_EEPROM_RFKILL_POLARITY_S 1 -/* Newer EEPROMs are using a different offset */ #define AR5K_EEPROM_OFF (_v, _v3_0, _v3_3) \ (((_v) >= AR5K_EEPROM_VERSION_3_3) ? _v3_3 : _v3_0)
@@ -386,6 +388,9 @@ struct ath5k_eeprom_info {u16 ee_version;u16 ee_header;u16 ee_ant_gain; +u8 ee_rfkill_pin; +bool ee_rfkill_pol; +bool ee_is_hb63;u16 ee_misc0;u16 ee_misc1;u16 ee_misc2;
drivers/net/wireless/ath/ath5k/reset.c +3 -2
@@ -508,7 +508,7 @@ static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)if (ah->ah_mac_version == (AR5K_SREV_AR2417 >>4 )) scal =AR5K_PHY_SCAL_32MHZ_2417 ; -else if (ath5k_eeprom_is_hb63 (ah)) +else if (ee->ee_is_hb63) scal =AR5K_PHY_SCAL_32MHZ_HB63 ;else scal =AR5K_PHY_SCAL_32MHZ ;
@@ -599,9 +599,10 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,/* Set DAC/ADC delays */ if (ah->ah_version ==AR5K_AR5212 ) {u32 scal; +struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;if (ah->ah_mac_version == (AR5K_SREV_AR2417 >>4 )) scal =AR5K_PHY_SCAL_32MHZ_2417 ; -else if (ath5k_eeprom_is_hb63 (ah)) +else if (ee->ee_is_hb63) scal =AR5K_PHY_SCAL_32MHZ_HB63 ;else scal =AR5K_PHY_SCAL_32MHZ ;
Signature · 1 line
1.6.0.6
PATCH 4/9 ath5k: Beaconing fixes
In reply to Bob CopelandFrom: Nick Kossifidis <[email protected]>
* Write next beacon timer even on AP mode since without this we get no beacons + ath9k does it too. Docs say that we must write 0 on this register on AP mode to start TSF increment, we do both to be on the safe side.
* Fix num_tx_pending function, we never read the register :P that's why we got all those "beacon queue 7 didn't stop messages".
* Put full prioriy on beacon queue, lock all queues with lower priority using the arblock and also bypass any arblock by seting the arblock ignore flag.
* For the CAB queue (do we need this thing ?, it seems crap) since it's supposed to fire up after each beacon (we don't use it on driver part, ath9k/MadWiFi does), don't make it DBA gated but instead make it fire after each beacon by using the beacon sent gated flag.
* Increase bmiss threshold to 10, that's what we used on MadWiFi for a long time. Also when we have pending frames on the beacon queue (we got a beacon that didn't make it on the air) it's more likely that the beacon queue never started, probably due to faulty DBA setting, so change that "beacon queue didn't stop" message.
Tested this with AP mode and IBSS mode and seems to work fine ;-)
--- drivers/net/wireless/ath/ath5k/base.c | 64 +++++++++++++++++---------------- drivers/net/wireless/ath/ath5k/pcu.c | 4 +- drivers/net/wireless/ath/ath5k/qcu.c | 7 +++- 3 files changed, 40 insertions(+), 35 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +33 -31
@@ -1738,35 +1738,6 @@ ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb, } } -static void ath5k_tasklet_beacon (unsigned long data) -{ -struct ath5k_softc *sc = (struct ath5k_softc *) data; - -/* -* Software beacon alert--time to send a beacon. -* -* In IBSS mode we use this interrupt just to -* keep track of the next TBTT (target beacon -* transmission time) in order to detect wether -* automatic TSF updates happened. -*/ -if (sc->opmode ==NL80211_IFTYPE_ADHOC ) { -/* XXX: only if VEOL suppported */ -u64 tsf =ath5k_hw_get_tsf64 (sc->ah); - sc->nexttbtt += sc->bintval; -ATH5K_DBG (sc,ATH5K_DEBUG_BEACON , -"SWBA nexttbtt: %x hw_tu: %x " -"TSF: %llx\n" , - sc->nexttbtt, -TSF_TO_TU (tsf), - (unsigned long long ) tsf); - }else { -spin_lock (&sc->block); -ath5k_beacon_send (sc); -spin_unlock (&sc->block); - } -} -static void ath5k_tasklet_rx (unsigned long data) {
@@ -2120,7 +2091,7 @@ ath5k_beacon_send(struct ath5k_softc *sc) sc->bmisscount++;ATH5K_DBG (sc,ATH5K_DEBUG_BEACON ,"missed %u consecutive beacons\n" , sc->bmisscount); -if (sc->bmisscount >3 ) {/* NB: 3 is a guess */ +if (sc->bmisscount >10 ) {/* NB: 10 is a guess */ ATH5K_DBG (sc,ATH5K_DEBUG_BEACON ,"stuck beacon time (%u missed)\n" , sc->bmisscount);
@@ -2141,10 +2112,12 @@ ath5k_beacon_send(struct ath5k_softc *sc)* are still pending on the queue. */ if (unlikely (ath5k_hw_stop_tx_dma (ah, sc->bhalq))) { -ATH5K_WARN (sc,"beacon queue %u didn't stop?\n" , sc->bhalq); +ATH5K_WARN (sc,"beacon queue %u didn't start/stop ?\n" , sc->bhalq);/* NB: hw still stops DMA, so proceed */ } +/* Note: Beacon buffer is updated on beacon_update when mac80211 +* calls config_interface */ ath5k_hw_set_txdp (ah, sc->bhalq, bf->daddr);ath5k_hw_start_tx_dma (ah, sc->bhalq); ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "TXDP[%u] = %llx (%p)\n",
@@ -2301,6 +2274,35 @@ ath5k_beacon_config(struct ath5k_softc *sc)ath5k_hw_set_imr (ah, sc->imask); } +static void ath5k_tasklet_beacon (unsigned long data) +{ +struct ath5k_softc *sc = (struct ath5k_softc *) data; + +/* +* Software beacon alert--time to send a beacon. +* +* In IBSS mode we use this interrupt just to +* keep track of the next TBTT (target beacon +* transmission time) in order to detect wether +* automatic TSF updates happened. +*/ +if (sc->opmode ==NL80211_IFTYPE_ADHOC ) { +/* XXX: only if VEOL suppported */ +u64 tsf =ath5k_hw_get_tsf64 (sc->ah); + sc->nexttbtt += sc->bintval; +ATH5K_DBG (sc,ATH5K_DEBUG_BEACON , +"SWBA nexttbtt: %x hw_tu: %x " +"TSF: %llx\n" , + sc->nexttbtt, +TSF_TO_TU (tsf), + (unsigned long long ) tsf); + }else { +spin_lock (&sc->block); +ath5k_beacon_send (sc); +spin_unlock (&sc->block); + } +} +/********************\ * Interrupt handling *
drivers/net/wireless/ath/ath5k/pcu.c +2 -2
@@ -736,8 +736,8 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)/* When in AP mode zero timer0 to start TSF */ if (ah->ah_op_mode ==NL80211_IFTYPE_AP )ath5k_hw_reg_write (ah,0 ,AR5K_TIMER0 ); -else -ath5k_hw_reg_write (ah, next_beacon,AR5K_TIMER0 ); + +ath5k_hw_reg_write (ah, next_beacon,AR5K_TIMER0 );ath5k_hw_reg_write (ah, timer1,AR5K_TIMER1 );ath5k_hw_reg_write (ah, timer2,AR5K_TIMER2 );ath5k_hw_reg_write (ah, timer3,AR5K_TIMER3 );
drivers/net/wireless/ath/ath5k/qcu.c +5 -2
@@ -160,7 +160,8 @@ u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue)if (ah->ah_version ==AR5K_AR5210 )return false; - pending = (AR5K_QUEUE_STATUS (queue) &AR5K_QCU_STS_FRMPENDCNT ); + pending =ath5k_hw_reg_read (ah,AR5K_QUEUE_STATUS (queue)); + pending &=AR5K_QCU_STS_FRMPENDCNT ;/* It's possible to have no frames pending even if TXE * is set. To indicate that q has not stopped return
@@ -401,14 +402,16 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)AR5K_REG_ENABLE_BITS (ah,AR5K_QUEUE_DFS_MISC (queue), (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL <<AR5K_DCU_MISC_ARBLOCK_CTL_S ) | +AR5K_DCU_MISC_ARBLOCK_IGNORE |AR5K_DCU_MISC_POST_FR_BKOFF_DIS |AR5K_DCU_MISC_BCN_ENABLE );break ;case AR5K_TX_QUEUE_CAB :AR5K_REG_ENABLE_BITS (ah,AR5K_QUEUE_MISC (queue), -AR5K_QCU_MISC_FRSHED_DBA_GT | +AR5K_QCU_MISC_FRSHED_BCN_SENT_GT |AR5K_QCU_MISC_CBREXP_DIS | +AR5K_QCU_MISC_RDY_VEOL_POLICY |AR5K_QCU_MISC_CBREXP_BCN_DIS ); ath5k_hw_reg_write(ah, ((AR5K_TUNE_BEACON_INTERVAL -
Signature · 1 line
1.6.0.6
PATCH 5/9 ath5k: Enable AP mode
In reply to Bob CopelandFrom: Jiri Slaby <[email protected]>
After some debuging we were hitting the following bugs so far...
* Due to huge channel list hostapd couldn't get infos from the driver and couldn't set the channel. If we manualy set the channel after hostapd starts (by setting channel to 0 -auto), beacons are sent but they wont show up on scan because they are malformed (they have channel = 0 because hostapd doesn't update the channel info -this is probably a hostapd bug so i'm CCing Jouni) and they get dropped. Bob fixed this by only allowing standard channels to be registered so now hostapd works as expected.
* Docs (and HAL source) say that we must write 0 on timer0 when operating on AP mode to start TSF increment but this seems to mess with DBA in many cases and beacon queue never gets started. We fixed that on the previous patch.
We have some more things to deal with...
* For some reason (hw bug or something else) after restarting hostapd a few times, beacon inteval seems to change from 100ms to a sec (we get one beacon per sec).
* We need to set sleep timers on STA mode and enable power saving + support PCF.
...but i think it's time we enable AP support "officialy" so that we can get more feedback from users. I ran ath5k with the mentioned patches + hostapd 0.6.8 and AP mode worked fine (it had some less throughput on my tests than IBSS but it worked).
--- drivers/net/wireless/ath/ath5k/base.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +1 -0
@@ -516,6 +516,7 @@ ath5k_pci_probe(struct pci_dev *pdev,IEEE80211_HW_NOISE_DBM ; hw->wiphy->interface_modes = +BIT (NL80211_IFTYPE_AP ) |BIT (NL80211_IFTYPE_STATION ) |BIT (NL80211_IFTYPE_ADHOC ) |BIT (NL80211_IFTYPE_MESH_POINT );
Signature · 1 line
1.6.0.6
PATCH 6/9 ath5k: Implement antenna control
In reply to Bob CopelandFrom: Nick Kossifidis <[email protected]>
* Add code to support the various antenna scenarios supported by hw
* For now hardcode the default scenario (single or dual omnis with tx/rx diversity working and tx antenna handled by session -hw keeps track on which antenna it got ack from each ap/station and maps each ap/station to one of the antennas-).
--- drivers/net/wireless/ath/ath5k/ath5k.h | 25 ++++- drivers/net/wireless/ath/ath5k/attach.c | 1 - drivers/net/wireless/ath/ath5k/base.c | 66 +++++++++--- drivers/net/wireless/ath/ath5k/eeprom.c | 8 +- drivers/net/wireless/ath/ath5k/eeprom.h | 11 +- drivers/net/wireless/ath/ath5k/phy.c | 174 ++++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath5k/reg.h | 9 ++- drivers/net/wireless/ath/ath5k/reset.c | 28 +++--- 8 files changed, 271 insertions(+), 51 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +20 -5
@@ -209,7 +209,6 @@#define AR5K_TUNE_MAX_TXPOWER 63#define AR5K_TUNE_DEFAULT_TXPOWER 25#define AR5K_TUNE_TPC_TXPOWER false -#define AR5K_TUNE_ANT_DIVERSITY true#define AR5K_TUNE_HWTXTRIES 4#define AR5K_INIT_CARR_SENSE_EN 1
@@ -420,6 +419,17 @@ enum ath5k_driver_mode { AR5K_MODE_MAX = 5 }; +enum ath5k_ant_mode { +AR5K_ANTMODE_DEFAULT =0 ,/* default antenna setup */ +AR5K_ANTMODE_FIXED_A =1 ,/* only antenna A is present */ +AR5K_ANTMODE_FIXED_B =2 ,/* only antenna B is present */ +AR5K_ANTMODE_SINGLE_AP =3 ,/* sta locked on a single ap */ +AR5K_ANTMODE_SECTOR_AP =4 ,/* AP with tx antenna set on tx desc */ +AR5K_ANTMODE_SECTOR_STA =5 ,/* STA with tx antenna set on tx desc */ +AR5K_ANTMODE_DEBUG =6 ,/* Debug mode -A -> Rx, B-> Tx- */ +AR5K_ANTMODE_MAX , +}; +/****************\ TX DEFINITIONS
@@ -1051,8 +1061,11 @@ struct ath5k_hw {bool ah_software_retry;u32 ah_limit_tx_retries; -u32 ah_antenna[AR5K_EEPROM_N_MODES ][AR5K_ANT_MAX ]; -bool ah_ant_diversity; +/* Antenna Control */ +u32 ah_ant_ctl[AR5K_EEPROM_N_MODES ][AR5K_ANT_MAX ]; +u8 ah_ant_mode; +u8 ah_tx_ant; +u8 ah_def_ant;u8 ah_sta_id[ETH_ALEN ];
@@ -1267,9 +1280,11 @@ extern int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, struct ieee80211_channelextern int ath5k_hw_noise_floor_calibration (struct ath5k_hw *ah,short freq);/* Misc PHY functions */ extern u16 ath5k_hw_radio_revision (struct ath5k_hw *ah,unsigned int chan); -extern void ath5k_hw_set_def_antenna (struct ath5k_hw *ah,unsigned int ant); -extern unsigned int ath5k_hw_get_def_antenna (struct ath5k_hw *ah);extern int ath5k_hw_phy_disable (struct ath5k_hw *ah); +/* Antenna control */ +extern void ath5k_hw_set_antenna_mode (struct ath5k_hw *ah,u8 ant_mode); +extern void ath5k_hw_set_def_antenna (struct ath5k_hw *ah,u8 ant); +extern unsigned int ath5k_hw_get_def_antenna (struct ath5k_hw *ah);/* TX power setup */ extern int ath5k_hw_txpower (struct ath5k_hw *ah,struct ieee80211_channel *channel,u8 ee_mode,u8 txpower);extern int ath5k_hw_set_txpower_limit (struct ath5k_hw *ah,u8 txpower);
drivers/net/wireless/ath/ath5k/attach.c +0 -1
@@ -133,7 +133,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) ah->ah_cw_min =AR5K_TUNE_CWMIN ; ah->ah_limit_tx_retries =AR5K_INIT_TX_RETRY ; ah->ah_software_retry = false; - ah->ah_ant_diversity =AR5K_TUNE_ANT_DIVERSITY ;/* * Set the mac version based on the pci id
drivers/net/wireless/ath/ath5k/base.c +50 -16
109 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/eeprom.c +4 -4
@@ -208,16 +208,16 @@ static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset, ee->ee_ant_control[mode][i++] = (val >>6 ) &0x3f ; ee->ee_ant_control[mode][i++] = val &0x3f ; -/* Get antenna modes */ - ah->ah_antenna[mode][0 ] = +/* Get antenna switch tables */ + ah->ah_ant_ctl[mode][AR5K_ANT_CTL ] = (ee->ee_ant_control[mode][0 ] <<4 ); - ah->ah_antenna[mode][AR5K_ANT_FIXED_A ] = + ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_A ] = ee->ee_ant_control[mode][1 ] | (ee->ee_ant_control[mode][2 ] <<6 ) | (ee->ee_ant_control[mode][3 ] <<12 ) | (ee->ee_ant_control[mode][4 ] <<18 ) | (ee->ee_ant_control[mode][5 ] <<24 ); - ah->ah_antenna[mode][AR5K_ANT_FIXED_B ] = + ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_B ] = ee->ee_ant_control[mode][6 ] | (ee->ee_ant_control[mode][7 ] <<6 ) | (ee->ee_ant_control[mode][8] << 12) |
drivers/net/wireless/ath/ath5k/eeprom.h +6 -5
@@ -240,11 +240,11 @@ enum ath5k_eeprom_freq_bands{#define AR5K_EEPROM_READ_HDR (_o, _v) \ AR5K_EEPROM_READ(_o, ah->ah_capabilities.cap_eeprom._v); \ -enum ath5k_ant_setting { -AR5K_ANT_VARIABLE =0 ,/* variable by programming */ -AR5K_ANT_FIXED_A =1 ,/* fixed to 11a frequencies */ -AR5K_ANT_FIXED_B =2 ,/* fixed to 11b frequencies */ -AR5K_ANT_MAX =3 , +enum ath5k_ant_table { +AR5K_ANT_CTL =0 ,/* Idle switch table settings */ +AR5K_ANT_SWTABLE_A =1 ,/* Switch table for antenna A */ +AR5K_ANT_SWTABLE_B =2 ,/* Switch table for antenna B */ +AR5K_ANT_MAX , };enum ath5k_ctl_mode {
@@ -461,6 +461,7 @@ struct ath5k_eeprom_info {/* Spur mitigation data (fbin values for spur channels) */ u16 ee_spur_chans[AR5K_EEPROM_N_SPUR_CHANS ][AR5K_EEPROM_N_FREQ_BANDS ]; +/* Antenna raw switch tables */ u32 ee_antenna[AR5K_EEPROM_N_MODES ][AR5K_ANT_MAX ]; };
drivers/net/wireless/ath/ath5k/phy.c +169 -5
194 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/reg.h +8 -1
@@ -1148,6 +1148,11 @@#define AR5K_STA_ID1_CBCIV_ENDIAN 0x40000000/* ??? */ #define AR5K_STA_ID1_KEYSRCH_MCAST 0x80000000/* Do key cache search for mcast frames */ +#define AR5K_STA_ID1_ANTENNA_SETTINGS (AR5K_STA_ID1_DEFAULT_ANTENNA | \ + AR5K_STA_ID1_DESC_ANTENNA | \ + AR5K_STA_ID1_RTS_DEF_ANTENNA | \ + AR5K_STA_ID1_SELFGEN_DEF_ANT) +/* * First BSSID register (MAC address, lower 32bits) */
@@ -2028,7 +2033,9 @@#define AR5K_PHY_AGCCTL 0x9860/* Register address */ #define AR5K_PHY_AGCCTL_CAL 0x00000001/* Enable PHY calibration */ #define AR5K_PHY_AGCCTL_NF 0x00000002/* Enable Noise Floor calibration */ +#define AR5K_PHY_AGCCTL_OFDM_DIV_DIS 0x00000008/* Disable antenna diversity on OFDM modes */ #define AR5K_PHY_AGCCTL_NF_EN 0x00008000/* Enable nf calibration to happen (?) */ +#define AR5K_PHY_AGCTL_FLTR_CAL 0x00010000/* Allow filter calibration (?) */ #define AR5K_PHY_AGCCTL_NF_NOUPDATE 0x00020000/* Don't update nf automaticaly */ /*
@@ -2528,7 +2535,7 @@* PHY CCK Cross-correlator Barker RSSI threshold register [5212+] */ #define AR5K_PHY_CCK_CROSSCORR 0xa208 -#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR 0x0000000f +#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR 0x0000003f#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR_S 0/* Same address is used for antenna diversity activation */
drivers/net/wireless/ath/ath5k/reset.c +14 -14
@@ -699,13 +699,13 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,/* Set antenna idle switch table */ AR5K_REG_WRITE_BITS (ah,AR5K_PHY_ANT_CTL ,AR5K_PHY_ANT_CTL_SWTABLE_IDLE , - (ah->ah_antenna[ee_mode][0 ] | + (ah->ah_ant_ctl[ee_mode][0 ] |AR5K_PHY_ANT_CTL_TXRX_EN )); -/* Set antenna switch table */ -ath5k_hw_reg_write (ah, ah->ah_antenna[ee_mode][ant[0 ]], +/* Set antenna switch tables */ +ath5k_hw_reg_write (ah, ah->ah_ant_ctl[ee_mode][ant[0 ]],AR5K_PHY_ANT_SWITCH_TABLE_0 ); -ath5k_hw_reg_write (ah, ah->ah_antenna[ee_mode][ant[1 ]], +ath5k_hw_reg_write (ah, ah->ah_ant_ctl[ee_mode][ant[1 ]],AR5K_PHY_ANT_SWITCH_TABLE_1 );/* Noise floor threshold */
@@ -1043,17 +1043,15 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,/* * In case a fixed antenna was set as default -* write the same settings on both AR5K_PHY_ANT_SWITCH_TABLE -* registers. +* use the same switch table twice. */ -if (s_ant !=0 ) { -if (s_ant ==AR5K_ANT_FIXED_A )/* 1 - Main */ - ant[0 ] = ant[1 ] =AR5K_ANT_FIXED_A ; -else /* 2 - Aux */ - ant[0 ] = ant[1 ] =AR5K_ANT_FIXED_B ; - }else { - ant[0 ] =AR5K_ANT_FIXED_A ; - ant[1 ] =AR5K_ANT_FIXED_B ; +if (ah->ah_ant_mode ==AR5K_ANTMODE_FIXED_A ) + ant[0 ] = ant[1 ] =AR5K_ANT_SWTABLE_A ; +else if (ah->ah_ant_mode ==AR5K_ANTMODE_FIXED_B ) + ant[0 ] = ant[1 ] =AR5K_ANT_SWTABLE_B ; +else { + ant[0 ] =AR5K_ANT_SWTABLE_A ; + ant[1 ] =AR5K_ANT_SWTABLE_B ; }/* Commit values from EEPROM */
@@ -1261,6 +1259,8 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,*/ ath5k_hw_noise_floor_calibration (ah, channel->center_freq); +/* Restore antenna mode */ +ath5k_hw_set_antenna_mode (ah, ah->ah_ant_mode);/* * Configure QCUs/DCUs
Signature · 1 line
1.6.0.6
PATCH 7/9 ath5k: Add Spur filter support on newer chips
In reply to Bob CopelandFrom: Nick Kossifidis <[email protected]>
* Add spur filter support for RF5413 and later chips
--- drivers/net/wireless/ath/ath5k/ath5k.h | 5 + drivers/net/wireless/ath/ath5k/phy.c | 255 +++++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath5k/reset.c | 35 ++--- 3 files changed, 270 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +5 -0
@@ -1278,6 +1278,11 @@ extern int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *chann/* PHY calibration */ extern int ath5k_hw_phy_calibrate (struct ath5k_hw *ah,struct ieee80211_channel *channel);extern int ath5k_hw_noise_floor_calibration (struct ath5k_hw *ah,short freq); +/* Spur mitigation */ +bool ath5k_hw_chan_has_spur_noise (struct ath5k_hw *ah, +struct ieee80211_channel *channel); +void ath5k_hw_set_spur_mitigation_filter (struct ath5k_hw *ah, +struct ieee80211_channel *channel);/* Misc PHY functions */ extern u16 ath5k_hw_radio_revision (struct ath5k_hw *ah,unsigned int chan);extern int ath5k_hw_phy_disable (struct ath5k_hw *ah);
drivers/net/wireless/ath/ath5k/phy.c +251 -4
267 lines not on this page · raw message
drivers/net/wireless/ath/ath5k/reset.c +14 -21
@@ -537,26 +537,6 @@ static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)return ; } -static bool ath5k_hw_chan_has_spur_noise (struct ath5k_hw *ah, -struct ieee80211_channel *channel) -{ -u8 refclk_freq; - -if ((ah->ah_radio ==AR5K_RF5112 ) || - (ah->ah_radio ==AR5K_RF5413 ) || - (ah->ah_mac_version == (AR5K_SREV_AR2417 >>4 ))) - refclk_freq =40 ; -else - refclk_freq =32 ; - -if ((channel->center_freq % refclk_freq !=0 ) && - ((channel->center_freq % refclk_freq <10 ) || - (channel->center_freq % refclk_freq >22 ))) -return true; -else -return false; -} -/* TODO: Half/Quarter rate */ static void ath5k_hw_tweak_initval_settings (struct ath5k_hw *ah,struct ieee80211_channel *channel)
@@ -999,7 +979,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,ath5k_hw_tweak_initval_settings (ah, channel);/* -* Set TX power (FIXME) +* Set TX power */ ret =ath5k_hw_txpower (ah, channel, ee_mode, ah->ah_txpower.txp_max_pwr /2 );
@@ -1025,9 +1005,22 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,/* Write OFDM timings on 5212*/ if (ah->ah_version ==AR5K_AR5212 && channel->hw_value &CHANNEL_OFDM ) { +struct ath5k_eeprom_info *ee = + &ah->ah_capabilities.cap_eeprom; + ret =ath5k_hw_write_ofdm_timings (ah, channel);if (ret)return ret; + +/* Note: According to docs we can have a newer +* EEPROM on old hardware, so we need to verify +* that our hardware is new enough to have spur +* mitigation registers (delta phase etc) */ +if (ah->ah_mac_srev >=AR5K_SREV_AR5424 || + (ah->ah_mac_srev >=AR5K_SREV_AR5424 && + ee->ee_version >=AR5K_EEPROM_VERSION_5_3 )) +ath5k_hw_set_spur_mitigation_filter (ah, + channel); }/*Enable/disable 802.11b mode on 5111
Signature · 1 line
1.6.0.6
PATCH 8/9 ath5k: use ctl settings based on current regdomain
In reply to Bob CopelandUpdate ath5k to use the ctl settings for tx power based on current regulatory domain.
--- drivers/net/wireless/ath/ath5k/phy.c | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath5k/phy.c +7 -12
@@ -2158,8 +2158,6 @@ done:* Get the max edge power for this channel if * we have such data from EEPROM's Conformance Test * Limits (CTL), and limit max power if needed. -* -* FIXME: Only works for world regulatory domains */ static void ath5k_get_max_ctl_power(struct ath5k_hw *ah,
@@ -2175,26 +2173,23 @@ ath5k_get_max_ctl_power(struct ath5k_hw *ah,u8 ctl_idx =0xFF ;u32 target = channel->center_freq; -/* Find out a CTL for our mode that's not mapped -* on a specific reg domain. -* -* TODO: Map our current reg domain to one of the 3 available -* reg domain ids so that we can support more CTLs. */ + ctl_mode =ath_regd_get_band_ctl (&ah->ah_regulatory, channel->band); +switch (channel->hw_value &CHANNEL_MODES ) {case CHANNEL_A : - ctl_mode =AR5K_CTL_11A |AR5K_CTL_NO_REGDOMAIN ; + ctl_mode |=AR5K_CTL_11A ;break ;case CHANNEL_G : - ctl_mode =AR5K_CTL_11G |AR5K_CTL_NO_REGDOMAIN ; + ctl_mode |=AR5K_CTL_11G ;break ;case CHANNEL_B : - ctl_mode =AR5K_CTL_11B |AR5K_CTL_NO_REGDOMAIN ; + ctl_mode |=AR5K_CTL_11B ;break ;case CHANNEL_T : - ctl_mode =AR5K_CTL_TURBO |AR5K_CTL_NO_REGDOMAIN ; + ctl_mode |=AR5K_CTL_TURBO ;break ;case CHANNEL_TG : - ctl_mode =AR5K_CTL_TURBOG |AR5K_CTL_NO_REGDOMAIN ; + ctl_mode |=AR5K_CTL_TURBOG ;break ;case CHANNEL_XR :/* Fall through */
Signature · 1 line
1.6.0.6
PATCH 9/9 Add LED support for AR5BXB6 IBM Thinkpad PCIe adapters
In reply to Bob CopelandFrom: Paride Legovini <[email protected]>
Add LED support on the IBM ThinkPad 11a/b/g Wireless LAN Mini Express Adapter (AR5BXB6), found on the IBM/Lenovo Thinkpad X60/T60/Z60 series.
--- drivers/net/wireless/ath/ath5k/led.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath5k/led.c +4 -2
@@ -53,8 +53,6 @@/* Devices we match on for LED config info (typically laptops) */ static const struct pci_device_id ath5k_led_devices[] = { -/* IBM-specific AR5212 */ - {PCI_VDEVICE (ATHEROS ,PCI_DEVICE_ID_ATHEROS_AR5212_IBM ),ATH_LED (0 ,0 ) },/* AR5211 */ {PCI_VDEVICE (ATHEROS ,PCI_DEVICE_ID_ATHEROS_AR5211 ),ATH_LED (0 ,0 ) },/* HP Compaq nc6xx, nc4000, nx6000 */
@@ -69,6 +67,10 @@ static const struct pci_device_id ath5k_led_devices[] = { { ATH_SDEVICE(PCI_VENDOR_ID_QMI, 0x0105), ATH_LED(3, 0) },/* Fukato Datacask Jupiter 1014a ([email protected]) */ { ATH_SDEVICE(PCI_VENDOR_ID_AZWAVE, 0x1026), ATH_LED(3, 0) }, +/* IBM ThinkPad AR5BXB6 ([email protected]) */ + { ATH_SDEVICE(PCI_VENDOR_ID_IBM, 0x058a), ATH_LED(1, 0) }, +/* IBM-specific AR5212 (all others) */ + { PCI_VDEVICE(ATHEROS, PCI_DEVICE_ID_ATHEROS_AR5212_IBM), ATH_LED(0, 0) }, { } };
Signature · 1 line
1.6.0.6