Support for AR9271 chipset.
PATCH 1/3 Support for AR9271 chipset.
From: Sujith <[email protected]>
Features:
* Station mode
* IBSS mode
* Monitor mode
* Legacy support
* HT support
* TX/RX 11n Aggregation
* HW encryption
* LED
For more information: http://wireless.kernel.org/en/users/Drivers/ath9k_htc
--- drivers/net/wireless/ath/Kconfig | 2 +- drivers/net/wireless/ath/ath9k/Kconfig | 21 + drivers/net/wireless/ath/ath9k/Makefile | 10 + drivers/net/wireless/ath/ath9k/common.c | 421 ++++++ drivers/net/wireless/ath/ath9k/common.h | 17 + drivers/net/wireless/ath/ath9k/hif_usb.c | 936 +++++++++++++ drivers/net/wireless/ath/ath9k/hif_usb.h | 105 ++ drivers/net/wireless/ath/ath9k/htc.h | 439 +++++++ drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | 260 ++++ drivers/net/wireless/ath/ath9k/htc_drv_init.c | 699 ++++++++++ drivers/net/wireless/ath/ath9k/htc_drv_main.c | 1590 +++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 605 +++++++++ drivers/net/wireless/ath/ath9k/htc_hst.c | 463 +++++++ drivers/net/wireless/ath/ath9k/htc_hst.h | 246 ++++ drivers/net/wireless/ath/ath9k/mac.h | 26 + drivers/net/wireless/ath/ath9k/wmi.c | 319 +++++ drivers/net/wireless/ath/ath9k/wmi.h | 126 ++ drivers/net/wireless/ath/debug.h | 1 + 18 files changed, 6285 insertions(+), 1 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/hif_usb.c create mode 100644 drivers/net/wireless/ath/ath9k/hif_usb.h create mode 100644 drivers/net/wireless/ath/ath9k/htc.h create mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c create mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_init.c create mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_main.c create mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c create mode 100644 drivers/net/wireless/ath/ath9k/htc_hst.c create mode 100644 drivers/net/wireless/ath/ath9k/htc_hst.h create mode 100644 drivers/net/wireless/ath/ath9k/wmi.c create mode 100644 drivers/net/wireless/ath/ath9k/wmi.h
drivers/net/wireless/ath/Kconfig +1 -1
@@ -3,7 +3,7 @@ menuconfig ATH_COMMON depends on CFG80211 ---help--- This will enable the support for the Atheros wireless drivers. - ath5k, ath9k and ar9170 drivers share some common code, this option + ath5k, ath9k, ath9k_htc and ar9170 drivers share some common code, this option enables the common ath.ko module which shares common helpers. For more information and documentation on this module you can visit:
drivers/net/wireless/ath/ath9k/Kconfig +21 -0
@@ -32,3 +32,24 @@ config ATH9K_DEBUGFS Also required for changing debug message flags at run time. +config ATH9K_HTC + tristate "Atheros HTC based wireless cards support" + depends on USB && MAC80211 + select ATH9K_HW + select MAC80211_LEDS + select LEDS_CLASS + select NEW_LEDS + select ATH9K_COMMON + ---help--- + Support for Atheros HTC based cards. + Chipsets supported: AR9271 + + For more information: http://wireless.kernel.org/en/users/Drivers/ath9k_htc + + The built module will be ath9k_htc. + +config ATH9K_HTC_DEBUGFS + bool "Atheros ath9k_htc debugging" + depends on ATH9K_HTC && DEBUG_FS + ---help--- + Say Y, if you need access to ath9k_htc's statistics.
drivers/net/wireless/ath/ath9k/Makefile +10 -0
@@ -28,3 +28,13 @@ obj-$(CONFIG_ATH9K_HW) += ath9k_hw.o obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o ath9k_common-y:= common.o + +ath9k_htc-y += htc_hst.o \ + hif_usb.o \ + wmi.o \ + htc_drv_txrx.o \ + htc_drv_main.o \ + htc_drv_beacon.o \ + htc_drv_init.o + +obj-$(CONFIG_ATH9K_HTC) += ath9k_htc.o
drivers/net/wireless/ath/ath9k/common.c +421 -0
427 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/common.h +17 -0
@@ -23,6 +23,8 @@/* Common header for Atheros 802.11n base driver cores */ +#define IEEE80211_WEP_NKID 4 +#define WME_NUM_TID 16#define WME_BA_BMP_SIZE 64#define WME_MAX_BA WME_BA_BMP_SIZE
@@ -125,3 +127,18 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common, bool decrypt_error);int ath9k_cmn_padpos (__le16 frame_control); +int ath9k_cmn_get_hw_crypto_keytype (struct sk_buff *skb); +u32 ath9k_cmn_calcrxfilter (struct ieee80211_hw *hw,struct ath_hw *ah, +unsigned int rxfilter); +void ath9k_cmn_opmode_init (struct ieee80211_hw *hw,struct ath_hw *ah, +unsigned int rxfilter); +void ath9k_cmn_update_ichannel (struct ieee80211_hw *hw, +struct ath9k_channel *ichan); +struct ath9k_channel *ath9k_cmn_get_curchannel (struct ieee80211_hw *hw, +struct ath_hw *ah); +int ath9k_cmn_key_config (struct ath_common *common, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta, +struct ieee80211_key_conf *key); +void ath9k_cmn_key_delete (struct ath_common *common, +struct ieee80211_key_conf *key);
drivers/net/wireless/ath/ath9k/hif_usb.c new file +936 -0
936 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/hif_usb.h new file +105 -0
105 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc.h new file +439 -0
439 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c new file +260 -0
260 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc_drv_init.c new file +699 -0
699 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc_drv_main.c new file +1590 -0
63 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c new file +605 -0
605 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc_hst.c new file +463 -0
463 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc_hst.h new file +246 -0
246 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/wmi.c new file +319 -0
319 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/wmi.h new file +126 -0
126 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.3.3
Part of the diff is not shown here. View the raw message.
PATCH 2/3 ath9k_hw: HW fixes for ath9k_htc
From: Sujith <[email protected]>
* Update initvals and set them up properly during initialization.
* Assign number of GPIO pins for AR9271.
* Chip test is not required for host driver
Target will do the test internally.
* Do not setup/Free RF banks for AR9271.
* Use 9280 channel set routine for AR9271.
* Set TX descriptors properly.
* Fix FULLSLEEP mode for AR9271.
* Fix PLL/INI override for AR9271.
* Fix byte swap for descriptors
* Set set NF value to -116 when the actual value exceeds -114. Also no need to read NF value on chain 1 for single chain chips.
* Configure correct chainmask in ath9k_hw_loadnf().
* Initialize default nf value.
* Use skip counts for PA calibration.
* Don't fiddle with initvals for AR9271.
Manipulating ACK/CTS timeout values results in association problems.
--- drivers/net/wireless/ath/ath9k/calib.c | 27 ++++- drivers/net/wireless/ath/ath9k/calib.h | 1 + drivers/net/wireless/ath/ath9k/hw.c | 145 +++++++++++++++-------------- drivers/net/wireless/ath/ath9k/hw.h | 8 ++ drivers/net/wireless/ath/ath9k/initvals.h | 141 ++++++++++++++++++++-------- drivers/net/wireless/ath/ath9k/mac.c | 2 +- drivers/net/wireless/ath/ath9k/phy.c | 6 +- drivers/net/wireless/ath/ath9k/reg.h | 3 + 8 files changed, 212 insertions(+), 121 deletions(-)
drivers/net/wireless/ath/ath9k/calib.c +21 -6
@@ -101,9 +101,13 @@ static void ath9k_hw_do_getnf(struct ath_hw *ah, nf =0 - ((nf ^0x1ff ) +1 );ath_print (common,ATH_DBG_CALIBRATE ,"NF calibrated [ctl] [chain 0] is %d\n" , nf); + +if (AR_SREV_9271 (ah)) +if (nf >=-114 ) + nf =-116 ; nfarray[0 ] = nf; -if (!AR_SREV_9285 (ah)) { +if (!AR_SREV_9285 (ah) && !AR_SREV_9271 (ah)) {if (AR_SREV_9280_10_OR_LATER (ah)) nf =MS (REG_READ (ah,AR_PHY_CH1_CCA ),AR9280_PHY_CH1_MINCCA_PWR );
@@ -139,6 +143,11 @@ static void ath9k_hw_do_getnf(struct ath_hw *ah, nf =0 - ((nf ^0x1ff ) +1 );ath_print (common,ATH_DBG_CALIBRATE ,"NF calibrated [ext] [chain 0] is %d\n" , nf); + +if (AR_SREV_9271 (ah)) +if (nf >=-114 ) + nf =-116 ; + nfarray[3 ] = nf;if (!AR_SREV_9285 (ah)) {
@@ -621,7 +630,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)u8 chainmask, rx_chain_status; rx_chain_status =REG_READ (ah,AR_PHY_RX_CHAINMASK ); -if (AR_SREV_9285 (ah)) +if (AR_SREV_9285 (ah) ||AR_SREV_9271 (ah)) chainmask =0x9 ;else if (AR_SREV_9280 (ah) ||AR_SREV_9287 (ah)) {if ((rx_chain_status &0x2 ) || (rx_chain_status &0x4 ))
@@ -715,7 +724,7 @@ void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah)if (AR_SREV_9280 (ah)) noise_floor =AR_PHY_CCA_MAX_AR9280_GOOD_VALUE ; -else if (AR_SREV_9285 (ah)) +else if (AR_SREV_9285 (ah) ||AR_SREV_9271 (ah)) noise_floor =AR_PHY_CCA_MAX_AR9285_GOOD_VALUE ;else if (AR_SREV_9287 (ah)) noise_floor =AR_PHY_CCA_MAX_AR9287_GOOD_VALUE ;
@@ -815,6 +824,7 @@ static void ath9k_olc_temp_compensation(struct ath_hw *ah)static void ath9k_hw_9271_pa_cal (struct ath_hw *ah,bool is_reset) { +struct ath_common *common =ath9k_hw_common (ah);u32 regVal;unsigned int i;u32 regList [][2 ] = {
@@ -828,6 +838,8 @@ static void ath9k_hw_9271_pa_cal(struct ath_hw *ah, bool is_reset) { 0x7828, 0 } , }; +ath_print (common,ATH_DBG_CALIBRATE ,"Running PA Calibration\n" ); +for (i =0 ; i <ARRAY_SIZE (regList); i++) regList[i][1 ] =REG_READ (ah, regList[i][0 ]);
@@ -1051,9 +1063,12 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,/* Do NF cal only at longer intervals */ if (longcal) {/* Do periodic PAOffset Cal */ -if (AR_SREV_9271 (ah)) -ath9k_hw_9271_pa_cal (ah, false); -else if (AR_SREV_9285_11_OR_LATER (ah)) { +if (AR_SREV_9271 (ah)) { +if (!ah->pacal_info.skipcount) +ath9k_hw_9271_pa_cal (ah, false); +else + ah->pacal_info.skipcount--; + }else if (AR_SREV_9285_11_OR_LATER (ah)) {if (!ah->pacal_info.skipcount)ath9k_hw_9285_pa_cal (ah, false);else
drivers/net/wireless/ath/ath9k/calib.h +1 -0
@@ -114,6 +114,7 @@ struct ath9k_nfcal_hist { };#define MAX_PACAL_SKIPCOUNT 8 +struct ath9k_pacal_info {int32_t prev_offset;/* Previous value of PA offset value */ int8_t max_skipcount;/* Max No. of times PACAL can be skipped */
drivers/net/wireless/ath/ath9k/hw.c +75 -70
301 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/hw.h +8 -0
@@ -599,6 +599,11 @@ struct ath_hw {struct ar5416IniArray iniModes_9271_1_0_only;struct ar5416IniArray iniCckfirNormal;struct ar5416IniArray iniCckfirJapan2484; +struct ar5416IniArray iniCommon_normal_cck_fir_coeff_9271; +struct ar5416IniArray iniCommon_japan_2484_cck_fir_coeff_9271; +struct ar5416IniArray iniModes_9271_ANI_reg; +struct ar5416IniArray iniModes_high_power_tx_gain_9271; +struct ar5416IniArray iniModes_normal_power_tx_gain_9271;u32 intr_gen_timer_trigger;u32 intr_gen_timer_thresh;
@@ -702,6 +707,9 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah);void ath9k_hw_name (struct ath_hw *ah,char *hw_name,size_t len); +/* HTC */ +void ath9k_hw_htc_resetinit (struct ath_hw *ah); +#define ATH_PCIE_CAP_LINK_CTRL 0x70#define ATH_PCIE_CAP_LINK_L0S 1#define ATH_PCIE_CAP_LINK_L1 2
drivers/net/wireless/ath/ath9k/initvals.h +102 -39
221 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/mac.c +1 -1
@@ -351,7 +351,7 @@ void ath9k_hw_set11n_txdesc(struct ath_hw *ah, struct ath_desc *ds, ads->ds_ctl6 =SM (keyType, AR_EncrType); -if (AR_SREV_9285 (ah)) { +if (AR_SREV_9285 (ah) ||AR_SREV_9271 (ah)) { ads->ds_ctl8 =0 ; ads->ds_ctl9 =0 ; ads->ds_ctl10 =0 ;
drivers/net/wireless/ath/ath9k/phy.c +1 -5
@@ -839,8 +839,6 @@ int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)struct ath_common *common =ath9k_hw_common (ah); -BUG_ON (AR_SREV_9280_10_OR_LATER (ah)); -ATH_ALLOC_BANK (ah->analogBank0Data, ah->iniBank0.ia_rows);ATH_ALLOC_BANK (ah->analogBank1Data, ah->iniBank1.ia_rows);ATH_ALLOC_BANK (ah->analogBank2Data, ah->iniBank2.ia_rows);
@@ -870,8 +868,6 @@ ath9k_hw_rf_free_ext_banks(struct ath_hw *ah) bank =NULL ; \ }while (0 ); -BUG_ON (AR_SREV_9280_10_OR_LATER (ah)); -ATH_FREE_BANK (ah->analogBank0Data);ATH_FREE_BANK (ah->analogBank1Data);ATH_FREE_BANK (ah->analogBank2Data);
@@ -910,7 +906,7 @@ bool ath9k_hw_set_rf_regs(struct ath_hw *ah, struct ath9k_channel *chan,* for single chip devices, that is AR9280 or anything * after that. */ -if (AR_SREV_9280_10_OR_LATER (ah)) +if (AR_SREV_9280_10_OR_LATER (ah) ||AR_SREV_9271 (ah))return true;/* Setup rf parameters */
drivers/net/wireless/ath/ath9k/reg.h +3 -0
@@ -940,6 +940,7 @@ enum {#define AR928X_NUM_GPIO 10#define AR9285_NUM_GPIO 12#define AR9287_NUM_GPIO 11 +#define AR9271_NUM_GPIO 16#define AR_GPIO_IN_OUT 0x4048#define AR_GPIO_IN_VAL 0x0FFFC000
@@ -950,6 +951,8 @@ enum {#define AR9285_GPIO_IN_VAL_S 12#define AR9287_GPIO_IN_VAL 0x003FF800#define AR9287_GPIO_IN_VAL_S 11 +#define AR9271_GPIO_IN_VAL 0xFFFF0000 +#define AR9271_GPIO_IN_VAL_S 16#define AR_GPIO_OE_OUT 0x404c#define AR_GPIO_OE_OUT_DRV 0x3
Signature · 1 line
1.6.3.3
PATCH 3/3 ath9k: Fix HW deinit
From: Sujith <[email protected]>
Also, free ath_hw instance properly.ath9k_hw_deinit() shouldn't do it.
--- drivers/net/wireless/ath/ath9k/hw.c | 4 +--- drivers/net/wireless/ath/ath9k/init.c | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +1 -3
@@ -1229,7 +1229,7 @@ void ath9k_hw_deinit(struct ath_hw *ah) {struct ath_common *common =ath9k_hw_common (ah); -if (common->state <=ATH_HW_INITIALIZED ) +if (common->state <ATH_HW_INITIALIZED ) goto free_hw;if (!AR_SREV_9100 (ah))
@@ -1240,8 +1240,6 @@ void ath9k_hw_deinit(struct ath_hw *ah) free_hw:if (!AR_SREV_9280_10_OR_LATER (ah) && !AR_SREV_9271 (ah))ath9k_hw_rf_free_ext_banks (ah); -kfree (ah); - ah =NULL ; }EXPORT_SYMBOL (ath9k_hw_deinit);
drivers/net/wireless/ath/ath9k/init.c +3 -0
@@ -758,6 +758,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc)tasklet_kill (&sc->intr_tq);tasklet_kill (&sc->bcon_tasklet); + +kfree (sc->sc_ah); + sc->sc_ah =NULL ; }void ath9k_deinit_device (struct ath_softc *sc)
Signature · 1 line
1.6.3.3
Quoted 13 lines · Senthil Balasubramanian
From: Sujith <[email protected]>
Features:
* Station mode
* IBSS mode
* Monitor mode
* Legacy support
* HT support
* TX/RX 11n Aggregation
* HW encryption
* LED
Quoted 5 lines
For more information: http://wireless.kernel.org/en/users/Drivers/ath9k_htc
Signed-off-by Sujith <[email protected]>Signed-off-by Vasanthakumar Thiagarajan <[email protected]>Signed-off-by Senthil Balasubramanian <[email protected]>
The common stuff was stuffed into common.[ch] but yet ath9k was not made to use it. That is fine if it makes this easier for inclusion into 2.6.34, if it won't get into 2.6.34 I'd prefer that a separate patch be created to stuff the common stuff into common.[ch], make ath9k use it, and then make ath9k_htc use it, through this patch.
John can decide :D
Luis