ath9k: WLAN-BT coexistence clean up and 3-wire support
cover ath9k: WLAN-BT coexistence clean up and 3-wire support
John,
This series has WLAN-BT coex 3-wire support and clean ups in BT coex part.
Vasanth
Vasanthakumar Thiagarajan (8):
ath9k: Split ath9k_hw_btcoex_enable() into two logical pieces
ath9k: Move btcoex stuff from hw.[ch] to new btcoex.[ch]
ath9k: Configure btcoex register during every reset
ath9k: Move btcoex related data to a separate struct
ath9k: Determine btcoex scheme type based on chip version
ath9k: Remove hw capability bit meant for btcoex
ath9k: Add infrastructure for generic hw timers
ath9k: Add Bluetooth Coexistence 3-wire support
drivers/net/wireless/ath/ath9k/Makefile | 3 +- drivers/net/wireless/ath/ath9k/ath9k.h | 5 + drivers/net/wireless/ath/ath9k/btcoex.c | 319 +++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/btcoex.h | 98 ++++++++++ drivers/net/wireless/ath/ath9k/debug.h | 2 + drivers/net/wireless/ath/ath9k/hw.c | 239 +++++++++++++++++++++-- drivers/net/wireless/ath/ath9k/hw.h | 57 +++++- drivers/net/wireless/ath/ath9k/main.c | 33 +++- drivers/net/wireless/ath/ath9k/reg.h | 64 ++++++- drivers/net/wireless/ath/ath9k/xmit.c | 9 +- 10 files changed, 795 insertions(+), 34 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/btcoex.c create mode 100644 drivers/net/wireless/ath/ath9k/btcoex.h
PATCH 1/8 ath9k: Split ath9k_hw_btcoex_enable() into two logical pieces
This function currently does initialization + enable the btcoex support. Split it into two logical functions which does the above operations separately. Btcoex initialization is done during attach time and enabling this feature is done in start(). Also, add code to disable btcoex support in stop().
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/hw.c | 17 ++++++++++++++++- drivers/net/wireless/ath/ath9k/hw.h | 2 ++ drivers/net/wireless/ath/ath9k/main.c | 11 +++++++++-- 4 files changed, 28 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
@@ -521,6 +521,7 @@ struct ath_led {#define SC_OP_WAIT_FOR_PSPOLL_DATA BIT(17)#define SC_OP_WAIT_FOR_TX_ACK BIT(18)#define SC_OP_BEACON_SYNC BIT(19) +#define SC_OP_BTCOEX_ENABLED BIT(20)struct ath_bus_ops {void (*read_cachesize)(struct ath_softc *sc,int *csz);
drivers/net/wireless/ath/ath9k/hw.c +16 -1
@@ -4073,7 +4073,7 @@ void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode)/* Bluetooth Coexistence */ /***************************/ -void ath9k_hw_btcoex_enable (struct ath_hw *ah) +void ath9k_hw_btcoex_init (struct ath_hw *ah) {/* connect bt_active to baseband */ REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL,
@@ -4090,8 +4090,23 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)/* Configure the desired gpio port for input */ ath9k_hw_cfg_gpio_input (ah, ah->btactive_gpio); +} +void ath9k_hw_btcoex_enable (struct ath_hw *ah) +{/* Configure the desired GPIO port for TX_FRAME output */ ath9k_hw_cfg_output (ah, ah->wlanactive_gpio,AR_GPIO_OUTPUT_MUX_AS_TX_FRAME ); + + ah->ah_sc->sc_flags |=SC_OP_BTCOEX_ENABLED ; +} + +void ath9k_hw_btcoex_disable (struct ath_hw *ah) +{ +ath9k_hw_set_gpio (ah, ah->wlanactive_gpio,0 ); + +ath9k_hw_cfg_output (ah, ah->wlanactive_gpio, +AR_GPIO_OUTPUT_MUX_AS_OUTPUT ); + + ah->ah_sc->sc_flags &= ~SC_OP_BTCOEX_ENABLED ; }
drivers/net/wireless/ath/ath9k/hw.h +2 -0
@@ -614,6 +614,8 @@ bool ath9k_hw_intrpend(struct ath_hw *ah);bool ath9k_hw_getisr (struct ath_hw *ah,enum ath9k_int *masked);enum ath9k_int ath9k_hw_set_interrupts (struct ath_hw *ah,enum ath9k_int ints); +void ath9k_hw_btcoex_init (struct ath_hw *ah);void ath9k_hw_btcoex_enable (struct ath_hw *ah); +void ath9k_hw_btcoex_disable (struct ath_hw *ah);#endif
drivers/net/wireless/ath/ath9k/main.c +9 -2
@@ -1509,8 +1509,8 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc)ARRAY_SIZE (ath9k_5ghz_chantable); } -if (sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX ) -ath9k_hw_btcoex_enable (sc->sc_ah); +if (ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX ) +ath9k_hw_btcoex_init (ah);return 0 ; bad2:
@@ -1992,6 +1992,10 @@ static int ath9k_start(struct ieee80211_hw *hw)ieee80211_queue_delayed_work (sc->hw, &sc->tx_complete_work,0 ); +if ((sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX ) && + !(sc->sc_flags &SC_OP_BTCOEX_ENABLED )) +ath9k_hw_btcoex_enable (sc->sc_ah); + mutex_unlock:mutex_unlock (&sc->mutex);
@@ -2138,6 +2142,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)wiphy_rfkill_stop_polling (sc->hw->wiphy); +if (sc->sc_flags &SC_OP_BTCOEX_ENABLED ) +ath9k_hw_btcoex_disable (sc->sc_ah); +/* disable HAL and put h/w to sleep */ ath9k_hw_disable (sc->sc_ah);ath9k_hw_configpcipowersave (sc->sc_ah,1 );
Signature · 1 line
1.5.5.1
PATCH 2/8 ath9k: Move btcoex stuff from hw.[ch] to new btcoex.[ch]
--- drivers/net/wireless/ath/ath9k/Makefile | 3 +- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/btcoex.c | 55 +++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/btcoex.h | 24 +++++++++++++ drivers/net/wireless/ath/ath9k/hw.c | 42 ----------------------- drivers/net/wireless/ath/ath9k/hw.h | 4 -- 6 files changed, 82 insertions(+), 47 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/btcoex.c create mode 100644 drivers/net/wireless/ath/ath9k/btcoex.h
drivers/net/wireless/ath/ath9k/Makefile +2 -1
@@ -12,7 +12,8 @@ ath9k-y += hw.o \ recv.o \ xmit.o \ virtual.o \ - rc.o + rc.o \ + btcoex.o ath9k-$(CONFIG_PCI) += pci.o ath9k-$(CONFIG_ATHEROS_AR71XX) += ahb.o
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
@@ -26,6 +26,7 @@#include "rc.h" #include "debug.h" #include "../ath.h" +#include "btcoex.h" struct ath_node ;
drivers/net/wireless/ath/ath9k/btcoex.c new file +55 -0
55 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/btcoex.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Atheros Communications Inc. +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef BTCOEX_H +#define BTCOEX_H + +void ath9k_hw_btcoex_init (struct ath_hw *ah); +void ath9k_hw_btcoex_enable (struct ath_hw *ah); +void ath9k_hw_btcoex_disable (struct ath_hw *ah); + +#endif
drivers/net/wireless/ath/ath9k/hw.c +0 -42
45 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/hw.h +0 -4
@@ -614,8 +614,4 @@ bool ath9k_hw_intrpend(struct ath_hw *ah);bool ath9k_hw_getisr (struct ath_hw *ah,enum ath9k_int *masked);enum ath9k_int ath9k_hw_set_interrupts (struct ath_hw *ah,enum ath9k_int ints); -void ath9k_hw_btcoex_init (struct ath_hw *ah); -void ath9k_hw_btcoex_enable (struct ath_hw *ah); -void ath9k_hw_btcoex_disable (struct ath_hw *ah); -#endif
Signature · 1 line
1.5.5.1
PATCH 3/8 ath9k: Configure btcoex register during every reset
Make sure btcoex register configured with appropriate values after it is initialized with the default values from initvals.h during reset.
--- drivers/net/wireless/ath/ath9k/hw.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +3 -0
@@ -2555,6 +2555,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,#endif } +if (ah->ah_sc->sc_flags &SC_OP_BTCOEX_ENABLED ) +ath9k_hw_btcoex_enable (ah); +return 0 ; }
Signature · 1 line
1.5.5.1
PATCH 4/8 ath9k: Move btcoex related data to a separate struct
Also define macros for wlanactive and btactive (5 & 6) gpios.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/btcoex.c | 16 +++++++++++----- drivers/net/wireless/ath/ath9k/btcoex.h | 8 ++++++++ drivers/net/wireless/ath/ath9k/hw.c | 4 ++-- drivers/net/wireless/ath/ath9k/hw.h | 2 -- 5 files changed, 22 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
@@ -611,6 +611,7 @@ struct ath_softc {struct ath_bus_ops *bus_ops;struct ath_beacon_config cur_beacon_conf;struct delayed_work tx_complete_work; +struct ath_btcoex_info btcoex_info; };struct ath_wiphy {
drivers/net/wireless/ath/ath9k/btcoex.c +11 -5
@@ -18,6 +18,8 @@void ath9k_hw_btcoex_init (struct ath_hw *ah) { +struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; +/* connect bt_active to baseband */ REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL, (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF |
@@ -29,16 +31,18 @@ void ath9k_hw_btcoex_init(struct ath_hw *ah)/* Set input mux for bt_active to gpio pin */ REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 ,AR_GPIO_INPUT_MUX1_BT_ACTIVE , - ah->btactive_gpio); + btcoex_info->btactive_gpio);/* Configure the desired gpio port for input */ -ath9k_hw_cfg_gpio_input (ah, ah->btactive_gpio); +ath9k_hw_cfg_gpio_input (ah, btcoex_info->btactive_gpio); }void ath9k_hw_btcoex_enable (struct ath_hw *ah) { +struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; +/* Configure the desired GPIO port for TX_FRAME output */ -ath9k_hw_cfg_output (ah, ah->wlanactive_gpio, +ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio,AR_GPIO_OUTPUT_MUX_AS_TX_FRAME ); ah->ah_sc->sc_flags |=SC_OP_BTCOEX_ENABLED ;
@@ -46,9 +50,11 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)void ath9k_hw_btcoex_disable (struct ath_hw *ah) { -ath9k_hw_set_gpio (ah, ah->wlanactive_gpio,0 ); +struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; + +ath9k_hw_set_gpio (ah, btcoex_info->wlanactive_gpio,0 ); -ath9k_hw_cfg_output (ah, ah->wlanactive_gpio, +ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio,AR_GPIO_OUTPUT_MUX_AS_OUTPUT ); ah->ah_sc->sc_flags &= ~SC_OP_BTCOEX_ENABLED ;
drivers/net/wireless/ath/ath9k/btcoex.h +8 -0
@@ -17,6 +17,14 @@#ifndef BTCOEX_H #define BTCOEX_H +#define ATH_WLANACTIVE_GPIO 5 +#define ATH_BTACTIVE_GPIO 6 + +struct ath_btcoex_info { +u8 wlanactive_gpio; +u8 btactive_gpio; +}; +void ath9k_hw_btcoex_init (struct ath_hw *ah);void ath9k_hw_btcoex_enable (struct ath_hw *ah);void ath9k_hw_btcoex_disable (struct ath_hw *ah);
drivers/net/wireless/ath/ath9k/hw.c +2 -2
@@ -3666,8 +3666,8 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)if (AR_SREV_9280_10_OR_LATER (ah) && btcoex_enable) { pCap->hw_caps |=ATH9K_HW_CAP_BT_COEX ; - ah->btactive_gpio =6 ; - ah->wlanactive_gpio =5 ; + ah->ah_sc->btcoex_info.btactive_gpio =ATH_BTACTIVE_GPIO ; + ah->ah_sc->btcoex_info.wlanactive_gpio =ATH_WLANACTIVE_GPIO ; } }
drivers/net/wireless/ath/ath9k/hw.h +0 -2
@@ -414,8 +414,6 @@ struct ath_hw {u16 rfsilent;u32 rfkill_gpio;u32 rfkill_polarity; -u32 btactive_gpio; -u32 wlanactive_gpio;u32 ah_flags;bool htc_reset_init;
Signature · 1 line
1.5.5.1
PATCH 5/8 ath9k: Determine btcoex scheme type based on chip version
--- drivers/net/wireless/ath/ath9k/btcoex.h | 7 +++++++ drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++-- drivers/net/wireless/ath/ath9k/main.c | 4 +++- 3 files changed, 20 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.h +7 -0
@@ -20,7 +20,14 @@#define ATH_WLANACTIVE_GPIO 5#define ATH_BTACTIVE_GPIO 6 +enum ath_btcoex_scheme { +ATH_BTCOEX_CFG_NONE , +ATH_BTCOEX_CFG_2WIRE , +ATH_BTCOEX_CFG_3WIRE , +}; +struct ath_btcoex_info { +enum ath_btcoex_scheme btcoex_scheme;u8 wlanactive_gpio;u8 btactive_gpio; };
drivers/net/wireless/ath/ath9k/hw.c +10 -2
@@ -3489,6 +3489,7 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) {struct ath9k_hw_capabilities *pCap = &ah->caps;struct ath_regulatory *regulatory =ath9k_hw_regulatory (ah); +struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;u16 capField =0 , eeval;
@@ -3666,8 +3667,15 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)if (AR_SREV_9280_10_OR_LATER (ah) && btcoex_enable) { pCap->hw_caps |=ATH9K_HW_CAP_BT_COEX ; - ah->ah_sc->btcoex_info.btactive_gpio =ATH_BTACTIVE_GPIO ; - ah->ah_sc->btcoex_info.wlanactive_gpio =ATH_WLANACTIVE_GPIO ; + btcoex_info->btactive_gpio =ATH_BTACTIVE_GPIO ; + btcoex_info->wlanactive_gpio =ATH_WLANACTIVE_GPIO ; + +if (AR_SREV_9285 (ah)) + btcoex_info->btcoex_scheme =ATH_BTCOEX_CFG_3WIRE ; +else + btcoex_info->btcoex_scheme =ATH_BTCOEX_CFG_2WIRE ; + }else { + btcoex_info->btcoex_scheme =ATH_BTCOEX_CFG_NONE ; } }
drivers/net/wireless/ath/ath9k/main.c +3 -1
@@ -1509,7 +1509,8 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc)ARRAY_SIZE (ath9k_5ghz_chantable); } -if (ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX ) +if ((ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX ) && + (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ))ath9k_hw_btcoex_init (ah);return 0 ;
@@ -1993,6 +1994,7 @@ static int ath9k_start(struct ieee80211_hw *hw)ieee80211_queue_delayed_work (sc->hw, &sc->tx_complete_work,0 );if ((sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX ) && + (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ) && !(sc->sc_flags &SC_OP_BTCOEX_ENABLED ))ath9k_hw_btcoex_enable (sc->sc_ah);
Signature · 1 line
1.5.5.1
PATCH 6/8 ath9k: Remove hw capability bit meant for btcoex
We don't need a hw cap bit for btcoex anymore as btcoex scheme type is enough to do this.
--- drivers/net/wireless/ath/ath9k/hw.c | 1 - drivers/net/wireless/ath/ath9k/hw.h | 1 - drivers/net/wireless/ath/ath9k/main.c | 8 +++----- 3 files changed, 3 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +0 -1
@@ -3666,7 +3666,6 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) ah->eep_ops->get_num_ant_config (ah,ATH9K_HAL_FREQ_BAND_2GHZ );if (AR_SREV_9280_10_OR_LATER (ah) && btcoex_enable) { - pCap->hw_caps |=ATH9K_HW_CAP_BT_COEX ; btcoex_info->btactive_gpio =ATH_BTACTIVE_GPIO ; btcoex_info->wlanactive_gpio =ATH_WLANACTIVE_GPIO ;
drivers/net/wireless/ath/ath9k/hw.h +0 -1
@@ -151,7 +151,6 @@ enum ath9k_hw_caps {ATH9K_HW_CAP_ENHANCEDPM =BIT (14 ),ATH9K_HW_CAP_AUTOSLEEP =BIT (15 ), ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(16), -ATH9K_HW_CAP_BT_COEX =BIT (17 ) }; enum ath9k_capability_type {
drivers/net/wireless/ath/ath9k/main.c +3 -5
@@ -440,7 +440,7 @@ static void ath_start_ani(struct ath_softc *sc)void ath_update_chainmask (struct ath_softc *sc,int is_ht) {if ((sc->sc_flags &SC_OP_SCANNING ) || is_ht || - (sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX )) { + (sc->btcoex_info.btcoex_scheme !=ATH_BTCOEX_CFG_NONE )) { sc->tx_chainmask = sc->sc_ah->caps.tx_chainmask; sc->rx_chainmask = sc->sc_ah->caps.rx_chainmask; }else {
@@ -1509,8 +1509,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc)ARRAY_SIZE (ath9k_5ghz_chantable); } -if ((ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX ) && - (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE )) +if (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE )ath9k_hw_btcoex_init (ah);return 0 ;
@@ -1993,8 +1992,7 @@ static int ath9k_start(struct ieee80211_hw *hw)ieee80211_queue_delayed_work (sc->hw, &sc->tx_complete_work,0 ); -if ((sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_BT_COEX ) && - (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ) && +if ((sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ) && !(sc->sc_flags &SC_OP_BTCOEX_ENABLED ))ath9k_hw_btcoex_enable (sc->sc_ah);
Signature · 1 line
1.5.5.1
PATCH 7/8 ath9k: Add infrastructure for generic hw timers
--- drivers/net/wireless/ath/ath9k/debug.h | 1 + drivers/net/wireless/ath/ath9k/hw.c | 212 ++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 52 ++++++++ drivers/net/wireless/ath/ath9k/reg.h | 15 ++- 4 files changed, 278 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/debug.h +1 -0
@@ -30,6 +30,7 @@ enum ATH_DEBUG {ATH_DBG_CONFIG =0x00000200 ,ATH_DBG_FATAL =0x00000400 ,ATH_DBG_PS =0x00000800 , +ATH_DBG_HWTIMER =0x00001000 , ATH_DBG_ANY = 0xffffffff };
drivers/net/wireless/ath/ath9k/hw.c +212 -0
221 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/hw.h +52 -0
74 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/reg.h +13 -2
@@ -234,7 +234,15 @@#define AR_IMR_S5 0x00b8#define AR_IMR_S5_TIM_TIMER 0x00000010#define AR_IMR_S5_DTIM_TIMER 0x00000020 - +#define AR_ISR_S5_GENTIMER_TRIG 0x0000FF80 +#define AR_ISR_S5_GENTIMER_TRIG_S 0 +#define AR_ISR_S5_GENTIMER_THRESH 0xFF800000 +#define AR_ISR_S5_GENTIMER_THRESH_S 16 +#define AR_ISR_S5_S 0x00d8 +#define AR_IMR_S5_GENTIMER_TRIG 0x0000FF80 +#define AR_IMR_S5_GENTIMER_TRIG_S 0 +#define AR_IMR_S5_GENTIMER_THRESH 0xFF800000 +#define AR_IMR_S5_GENTIMER_THRESH_S 16#define AR_IMR 0x00a0#define AR_IMR_RXOK 0x00000001
@@ -1516,7 +1524,10 @@ enum {#define AR_TXOP_8_11 0x81f8#define AR_TXOP_12_15 0x81fc - +#define AR_NEXT_NDP2_TIMER 0x8180 +#define AR_FIRST_NDP_TIMER 7 +#define AR_NDP2_PERIOD 0x81a0 +#define AR_NDP2_TIMER_MODE 0x81c0#define AR_NEXT_TBTT_TIMER 0x8200#define AR_NEXT_DMA_BEACON_ALERT 0x8204#define AR_NEXT_SWBA 0x8208
Signature · 1 line
1.5.5.1
PATCH 8/8 ath9k: Add Bluetooth Coexistence 3-wire support
This patch adds 3-wire bluetooth coex support for AR9285. This support can be enabled through btcoex_enable modparam.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 + drivers/net/wireless/ath/ath9k/btcoex.c | 290 +++++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath9k/btcoex.h | 61 +++++++- drivers/net/wireless/ath/ath9k/debug.h | 1 + drivers/net/wireless/ath/ath9k/hw.c | 2 +- drivers/net/wireless/ath/ath9k/hw.h | 2 + drivers/net/wireless/ath/ath9k/main.c | 34 +++- drivers/net/wireless/ath/ath9k/reg.h | 49 +++++ drivers/net/wireless/ath/ath9k/xmit.c | 9 +- 9 files changed, 423 insertions(+), 27 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +2 -0
@@ -523,6 +523,7 @@ struct ath_led {#define SC_OP_WAIT_FOR_TX_ACK BIT(18)#define SC_OP_BEACON_SYNC BIT(19)#define SC_OP_BTCOEX_ENABLED BIT(20) +#define SC_OP_BT_PRIORITY_DETECTED BIT(21)struct ath_bus_ops {void (*read_cachesize)(struct ath_softc *sc,int *csz);
@@ -708,4 +709,5 @@ bool ath9k_all_wiphys_idle(struct ath_softc *sc);void ath9k_iowrite32 (struct ath_hw *ah,u32 reg_offset,u32 val);unsigned int ath9k_ioread32 (struct ath_hw *ah,u32 reg_offset); +int ath_tx_get_qnum (struct ath_softc *sc,int qtype,int haltype);#endif /* ATH9K_H */
drivers/net/wireless/ath/ath9k/btcoex.c +274 -16
313 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/btcoex.h +60 -1
80 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/debug.h +1 -0
@@ -31,6 +31,7 @@ enum ATH_DEBUG {ATH_DBG_FATAL =0x00000400 ,ATH_DBG_PS =0x00000800 ,ATH_DBG_HWTIMER =0x00001000 , +ATH_DBG_BTCOEX =0x00002000 , ATH_DBG_ANY = 0xffffffff };
drivers/net/wireless/ath/ath9k/hw.c +1 -1
@@ -4141,7 +4141,7 @@ static u32 rightmost_index(struct ath_gen_timer_table *timer_table, u32 *mask)return timer_table->gen_timer_index[b]; } -static u32 ath9k_hw_gettsf32 (struct ath_hw *ah) +u32 ath9k_hw_gettsf32 (struct ath_hw *ah) {return REG_READ (ah,AR_TSF_L32 ); }
drivers/net/wireless/ath/ath9k/hw.h +2 -0
@@ -79,6 +79,7 @@#define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1#define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2#define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME 3 +#define AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL 4#define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5#define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6
@@ -662,5 +663,6 @@ void ath_gen_timer_start(struct ath_hw *ah, struct ath_gen_timer *timer,void ath_gen_timer_stop (struct ath_hw *ah,struct ath_gen_timer *timer);void ath_gen_timer_free (struct ath_hw *ah,struct ath_gen_timer *timer);void ath_gen_timer_isr (struct ath_hw *hw); +u32 ath9k_hw_gettsf32 (struct ath_hw *ah);#endif
drivers/net/wireless/ath/ath9k/main.c +27 -7
@@ -602,6 +602,10 @@ irqreturn_t ath_isr(int irq, void *dev) sc->sc_flags |=SC_OP_WAIT_FOR_BEACON ; } +if (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) +if (status &ATH9K_INT_GENTIMER ) +ath_gen_timer_isr (ah); + chip_reset:ath_debug_stat_interrupt (sc, status);
@@ -1279,6 +1283,10 @@ void ath_detach(struct ath_softc *sc)if (ATH_TXQ_SETUP (sc, i))ath_tx_cleanupq (sc, &sc->tx.txq[i]); +if ((sc->btcoex_info.no_stomp_timer) && + sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) +ath_gen_timer_free (sc->sc_ah, sc->btcoex_info.no_stomp_timer); +ath9k_hw_detach (sc->sc_ah); sc->sc_ah =NULL ;ath9k_exit_debug (sc);
@@ -1509,8 +1517,11 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc)ARRAY_SIZE (ath9k_5ghz_chantable); } -if (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ) -ath9k_hw_btcoex_init (ah); +if (sc->btcoex_info.btcoex_scheme !=ATH_BTCOEX_CFG_NONE ) { + r =ath9k_hw_btcoex_init (ah); +if (r) + goto bad2; + }return 0 ; bad2:
@@ -1992,10 +2003,16 @@ static int ath9k_start(struct ieee80211_hw *hw)ieee80211_queue_delayed_work (sc->hw, &sc->tx_complete_work,0 ); -if ((sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ) && - !(sc->sc_flags &SC_OP_BTCOEX_ENABLED )) +if ((sc->btcoex_info.btcoex_scheme !=ATH_BTCOEX_CFG_NONE ) && + !(sc->sc_flags &SC_OP_BTCOEX_ENABLED )) { +ath_btcoex_set_weight (&sc->btcoex_info,AR_BT_COEX_WGHT , +AR_STOMP_LOW_WLAN_WGHT );ath9k_hw_btcoex_enable (sc->sc_ah); +if (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) +ath_btcoex_timer_resume (sc, &sc->btcoex_info); + } + mutex_unlock:mutex_unlock (&sc->mutex);
@@ -2129,6 +2146,12 @@ static void ath9k_stop(struct ieee80211_hw *hw)return ;/* another wiphy still in use */ } +if (sc->sc_flags &SC_OP_BTCOEX_ENABLED ) { +ath9k_hw_btcoex_disable (sc->sc_ah); +if (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) +ath_btcoex_timer_pause (sc, &sc->btcoex_info); + } +/* make sure h/w will not generate any interrupt * before setting the invalid flag. */ ath9k_hw_set_interrupts (sc->sc_ah,0 );
@@ -2142,9 +2165,6 @@ static void ath9k_stop(struct ieee80211_hw *hw)wiphy_rfkill_stop_polling (sc->hw->wiphy); -if (sc->sc_flags &SC_OP_BTCOEX_ENABLED ) -ath9k_hw_btcoex_disable (sc->sc_ah); -/* disable HAL and put h/w to sleep */ ath9k_hw_disable (sc->sc_ah);ath9k_hw_configpcipowersave (sc->sc_ah,1 );
drivers/net/wireless/ath/ath9k/reg.h +49 -0
85 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/xmit.c +7 -2
@@ -493,7 +493,12 @@ static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf,if (tx_info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE || legacy)return 0 ; - aggr_limit =min (max_4ms_framelen, (u32 )ATH_AMPDU_LIMIT_MAX ); +if (sc->sc_flags &SC_OP_BT_PRIORITY_DETECTED ) + aggr_limit =min ((max_4ms_framelen *3 ) /8 , + (u32 )ATH_AMPDU_LIMIT_MAX ); +else + aggr_limit =min (max_4ms_framelen, + (u32 )ATH_AMPDU_LIMIT_MAX );/* * h/w can accept aggregates upto 16 bit lengths (65535).
@@ -872,7 +877,7 @@ struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype)return &sc->tx.txq[qnum]; } -static int ath_tx_get_qnum (struct ath_softc *sc,int qtype,int haltype) +int ath_tx_get_qnum (struct ath_softc *sc,int qtype,int haltype) {int qnum;
Signature · 1 line
1.5.5.1