Bring over the initial 802.11n bluetooth coexistence support code.
The Linux ath9k btcoex code is based off of this code. Note this doesn't actually implement functional btcoex; there's some driver glue and a whole lot of verification that is required. On the other hand, I do have the AR9285+BT and AR9287+BT NICs which this code supports.. Obtained from: Qualcomm Atheros, Linux ath9k
This commit is contained in:
parent
21928e9125
commit
f6d1a69477
@ -421,13 +421,13 @@ typedef enum {
|
||||
} HAL_INT;
|
||||
|
||||
typedef enum {
|
||||
HAL_GPIO_MUX_OUTPUT = 0,
|
||||
HAL_GPIO_MUX_PCIE_ATTENTION_LED = 1,
|
||||
HAL_GPIO_MUX_PCIE_POWER_LED = 2,
|
||||
HAL_GPIO_MUX_TX_FRAME = 3,
|
||||
HAL_GPIO_MUX_RX_CLEAR_EXTERNAL = 4,
|
||||
HAL_GPIO_MUX_MAC_NETWORK_LED = 5,
|
||||
HAL_GPIO_MUX_MAC_POWER_LED = 6
|
||||
HAL_GPIO_OUTPUT_MUX_AS_OUTPUT = 0,
|
||||
HAL_GPIO_OUTPUT_MUX_PCIE_ATTENTION_LED = 1,
|
||||
HAL_GPIO_OUTPUT_MUX_PCIE_POWER_LED = 2,
|
||||
HAL_GPIO_OUTPUT_MUX_MAC_NETWORK_LED = 3,
|
||||
HAL_GPIO_OUTPUT_MUX_MAC_POWER_LED = 4,
|
||||
HAL_GPIO_OUTPUT_MUX_AS_WLAN_ACTIVE = 5,
|
||||
HAL_GPIO_OUTPUT_MUX_AS_TX_FRAME = 6
|
||||
} HAL_GPIO_MUX_TYPE;
|
||||
|
||||
typedef enum {
|
||||
@ -777,6 +777,139 @@ struct hal_dfs_event {
|
||||
};
|
||||
typedef struct hal_dfs_event HAL_DFS_EVENT;
|
||||
|
||||
/*
|
||||
* BT Co-existence definitions
|
||||
*/
|
||||
typedef enum {
|
||||
HAL_BT_MODULE_CSR_BC4 = 0, /* CSR BlueCore v4 */
|
||||
HAL_BT_MODULE_JANUS = 1, /* Kite + Valkyrie combo */
|
||||
HAL_BT_MODULE_HELIUS = 2, /* Kiwi + Valkyrie combo */
|
||||
HAL_MAX_BT_MODULES
|
||||
} HAL_BT_MODULE;
|
||||
|
||||
typedef struct {
|
||||
HAL_BT_MODULE bt_module;
|
||||
u_int8_t bt_coex_config;
|
||||
u_int8_t bt_gpio_bt_active;
|
||||
u_int8_t bt_gpio_bt_priority;
|
||||
u_int8_t bt_gpio_wlan_active;
|
||||
u_int8_t bt_active_polarity;
|
||||
HAL_BOOL bt_single_ant;
|
||||
u_int8_t bt_dutyCycle;
|
||||
u_int8_t bt_isolation;
|
||||
u_int8_t bt_period;
|
||||
} HAL_BT_COEX_INFO;
|
||||
|
||||
typedef enum {
|
||||
HAL_BT_COEX_MODE_LEGACY = 0, /* legacy rx_clear mode */
|
||||
HAL_BT_COEX_MODE_UNSLOTTED = 1, /* untimed/unslotted mode */
|
||||
HAL_BT_COEX_MODE_SLOTTED = 2, /* slotted mode */
|
||||
HAL_BT_COEX_MODE_DISALBED = 3, /* coexistence disabled */
|
||||
} HAL_BT_COEX_MODE;
|
||||
|
||||
typedef enum {
|
||||
HAL_BT_COEX_CFG_NONE, /* No bt coex enabled */
|
||||
HAL_BT_COEX_CFG_2WIRE_2CH, /* 2-wire with 2 chains */
|
||||
HAL_BT_COEX_CFG_2WIRE_CH1, /* 2-wire with ch1 */
|
||||
HAL_BT_COEX_CFG_2WIRE_CH0, /* 2-wire with ch0 */
|
||||
HAL_BT_COEX_CFG_3WIRE, /* 3-wire */
|
||||
HAL_BT_COEX_CFG_MCI /* MCI */
|
||||
} HAL_BT_COEX_CFG;
|
||||
|
||||
typedef enum {
|
||||
HAL_BT_COEX_SET_ACK_PWR = 0, /* Change ACK power setting */
|
||||
HAL_BT_COEX_LOWER_TX_PWR, /* Change transmit power */
|
||||
HAL_BT_COEX_ANTENNA_DIVERSITY, /* Enable RX diversity for Kite */
|
||||
} HAL_BT_COEX_SET_PARAMETER;
|
||||
|
||||
#define HAL_BT_COEX_FLAG_LOW_ACK_PWR 0x00000001
|
||||
#define HAL_BT_COEX_FLAG_LOWER_TX_PWR 0x00000002
|
||||
/* Check Rx Diversity is allowed */
|
||||
#define HAL_BT_COEX_FLAG_ANT_DIV_ALLOW 0x00000004
|
||||
/* Check Diversity is on or off */
|
||||
#define HAL_BT_COEX_FLAG_ANT_DIV_ENABLE 0x00000008
|
||||
|
||||
#define HAL_BT_COEX_ANTDIV_CONTROL1_ENABLE 0x0b
|
||||
/* main: LNA1, alt: LNA2 */
|
||||
#define HAL_BT_COEX_ANTDIV_CONTROL2_ENABLE 0x09
|
||||
#define HAL_BT_COEX_ANTDIV_CONTROL1_FIXED_A 0x04
|
||||
#define HAL_BT_COEX_ANTDIV_CONTROL2_FIXED_A 0x09
|
||||
#define HAL_BT_COEX_ANTDIV_CONTROL1_FIXED_B 0x02
|
||||
#define HAL_BT_COEX_ANTDIV_CONTROL2_FIXED_B 0x06
|
||||
|
||||
#define HAL_BT_COEX_ISOLATION_FOR_NO_COEX 30
|
||||
|
||||
#define HAL_BT_COEX_ANT_DIV_SWITCH_COM 0x66666666
|
||||
|
||||
#define HAL_BT_COEX_HELIUS_CHAINMASK 0x02
|
||||
|
||||
#define HAL_BT_COEX_LOW_ACK_POWER 0x0
|
||||
#define HAL_BT_COEX_HIGH_ACK_POWER 0x3f3f3f
|
||||
|
||||
typedef enum {
|
||||
HAL_BT_COEX_NO_STOMP = 0,
|
||||
HAL_BT_COEX_STOMP_ALL,
|
||||
HAL_BT_COEX_STOMP_LOW,
|
||||
HAL_BT_COEX_STOMP_NONE,
|
||||
HAL_BT_COEX_STOMP_ALL_FORCE,
|
||||
HAL_BT_COEX_STOMP_LOW_FORCE,
|
||||
} HAL_BT_COEX_STOMP_TYPE;
|
||||
|
||||
typedef struct {
|
||||
/* extend rx_clear after tx/rx to protect the burst (in usec). */
|
||||
u_int8_t bt_time_extend;
|
||||
|
||||
/*
|
||||
* extend rx_clear as long as txsm is
|
||||
* transmitting or waiting for ack.
|
||||
*/
|
||||
HAL_BOOL bt_txstate_extend;
|
||||
|
||||
/*
|
||||
* extend rx_clear so that when tx_frame
|
||||
* is asserted, rx_clear will drop.
|
||||
*/
|
||||
HAL_BOOL bt_txframe_extend;
|
||||
|
||||
/*
|
||||
* coexistence mode
|
||||
*/
|
||||
HAL_BT_COEX_MODE bt_mode;
|
||||
|
||||
/*
|
||||
* treat BT high priority traffic as
|
||||
* a quiet collision
|
||||
*/
|
||||
HAL_BOOL bt_quiet_collision;
|
||||
|
||||
/*
|
||||
* invert rx_clear as WLAN_ACTIVE
|
||||
*/
|
||||
HAL_BOOL bt_rxclear_polarity;
|
||||
|
||||
/*
|
||||
* slotted mode only. indicate the time in usec
|
||||
* from the rising edge of BT_ACTIVE to the time
|
||||
* BT_PRIORITY can be sampled to indicate priority.
|
||||
*/
|
||||
u_int8_t bt_priority_time;
|
||||
|
||||
/*
|
||||
* slotted mode only. indicate the time in usec
|
||||
* from the rising edge of BT_ACTIVE to the time
|
||||
* BT_PRIORITY can be sampled to indicate tx/rx and
|
||||
* BT_FREQ is sampled.
|
||||
*/
|
||||
u_int8_t bt_first_slot_time;
|
||||
|
||||
/*
|
||||
* slotted mode only. rx_clear and bt_ant decision
|
||||
* will be held the entire time that BT_ACTIVE is asserted,
|
||||
* otherwise the decision is made before every slot boundry.
|
||||
*/
|
||||
HAL_BOOL bt_hold_rxclear;
|
||||
} HAL_BT_COEX_CONFIG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ah_debug; /* only used if AH_DEBUG is defined */
|
||||
|
@ -132,6 +132,28 @@ struct ath_hal_5416 {
|
||||
int initPDADC;
|
||||
|
||||
int ah_need_an_top2_fixup; /* merlin or later chips that may need this workaround */
|
||||
|
||||
/*
|
||||
* Bluetooth coexistence static setup according to the registry
|
||||
*/
|
||||
HAL_BT_MODULE ah_btModule; /* Bluetooth module identifier */
|
||||
uint8_t ah_btCoexConfigType; /* BT coex configuration */
|
||||
uint8_t ah_btActiveGpioSelect; /* GPIO pin for BT_ACTIVE */
|
||||
uint8_t ah_btPriorityGpioSelect; /* GPIO pin for BT_PRIORITY */
|
||||
uint8_t ah_wlanActiveGpioSelect; /* GPIO pin for WLAN_ACTIVE */
|
||||
uint8_t ah_btActivePolarity; /* Polarity of BT_ACTIVE */
|
||||
HAL_BOOL ah_btCoexSingleAnt; /* Single or dual antenna configuration */
|
||||
uint8_t ah_btWlanIsolation; /* Isolation between BT and WLAN in dB */
|
||||
|
||||
/*
|
||||
* Bluetooth coexistence runtime settings
|
||||
*/
|
||||
HAL_BOOL ah_btCoexEnabled; /* If Bluetooth coexistence is enabled */
|
||||
uint32_t ah_btCoexMode; /* Register setting for AR_BT_COEX_MODE */
|
||||
uint32_t ah_btCoexBTWeight; /* Register setting for AR_BT_COEX_WEIGHT */
|
||||
uint32_t ah_btCoexWLANWeight; /* Register setting for AR_BT_COEX_WEIGHT */
|
||||
uint32_t ah_btCoexMode2; /* Register setting for AR_BT_COEX_MODE2 */
|
||||
uint32_t ah_btCoexFlag; /* Special tuning flags for BT coex */
|
||||
};
|
||||
#define AH5416(_ah) ((struct ath_hal_5416 *)(_ah))
|
||||
|
||||
@ -173,6 +195,21 @@ extern void ar5416SetStaBeaconTimers(struct ath_hal *ah,
|
||||
const HAL_BEACON_STATE *);
|
||||
extern uint64_t ar5416GetNextTBTT(struct ath_hal *);
|
||||
|
||||
/* ar5416_btcoex.c */
|
||||
extern void ar5416SetBTCoexInfo(struct ath_hal *ah,
|
||||
HAL_BT_COEX_INFO *btinfo);
|
||||
extern void ar5416BTCoexConfig(struct ath_hal *ah,
|
||||
HAL_BT_COEX_CONFIG *btconf);
|
||||
extern void ar5416BTCoexSetQcuThresh(struct ath_hal *ah, int qnum);
|
||||
extern void ar5416BTCoexSetWeights(struct ath_hal *ah, uint32_t stompType);
|
||||
extern void ar5416BTCoexSetupBmissThresh(struct ath_hal *ah,
|
||||
uint32_t thresh);
|
||||
extern void ar5416BTCoexSetParameter(struct ath_hal *ah, uint32_t type,
|
||||
uint32_t value);
|
||||
extern void ar5416BTCoexDisable(struct ath_hal *ah);
|
||||
extern int ar5416BTCoexEnable(struct ath_hal *ah);
|
||||
extern void ar5416InitBTCoex(struct ath_hal *ah);
|
||||
|
||||
extern HAL_BOOL ar5416EepromRead(struct ath_hal *, u_int off, uint16_t *data);
|
||||
extern HAL_BOOL ar5416EepromWrite(struct ath_hal *, u_int off, uint16_t data);
|
||||
|
||||
|
385
sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c
Normal file
385
sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c
Normal file
@ -0,0 +1,385 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
* Copyright (c) 2002-2005 Atheros Communications, Inc.
|
||||
* Copyright (c) 2008-2010, 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "opt_ah.h"
|
||||
|
||||
#include "ah.h"
|
||||
#include "ah_internal.h"
|
||||
#include "ah_devid.h"
|
||||
#ifdef AH_DEBUG
|
||||
#include "ah_desc.h" /* NB: for HAL_PHYERR* */
|
||||
#endif
|
||||
|
||||
#include "ar5416/ar5416.h"
|
||||
#include "ar5416/ar5416reg.h"
|
||||
#include "ar5416/ar5416phy.h"
|
||||
#include "ar5416/ar5416desc.h" /* AR5416_CONTTXMODE */
|
||||
#include "ar5416/ar5416_btcoex.h"
|
||||
|
||||
void
|
||||
ar5416SetBTCoexInfo(struct ath_hal *ah, HAL_BT_COEX_INFO *btinfo)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
ahp->ah_btModule = btinfo->bt_module;
|
||||
ahp->ah_btCoexConfigType = btinfo->bt_coex_config;
|
||||
ahp->ah_btActiveGpioSelect = btinfo->bt_gpio_bt_active;
|
||||
ahp->ah_btPriorityGpioSelect = btinfo->bt_gpio_bt_priority;
|
||||
ahp->ah_wlanActiveGpioSelect = btinfo->bt_gpio_wlan_active;
|
||||
ahp->ah_btActivePolarity = btinfo->bt_active_polarity;
|
||||
ahp->ah_btCoexSingleAnt = btinfo->bt_single_ant;
|
||||
ahp->ah_btWlanIsolation = btinfo->bt_isolation;
|
||||
}
|
||||
|
||||
void
|
||||
ar5416BTCoexConfig(struct ath_hal *ah, HAL_BT_COEX_CONFIG *btconf)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
HAL_BOOL rxClearPolarity = btconf->bt_rxclear_polarity;
|
||||
|
||||
/*
|
||||
* For Kiwi and Osprey, the polarity of rx_clear is active high.
|
||||
* The bt_rxclear_polarity flag from ath(4) needs to be inverted.
|
||||
*/
|
||||
if (AR_SREV_KIWI(ah)) {
|
||||
rxClearPolarity = !btconf->bt_rxclear_polarity;
|
||||
}
|
||||
|
||||
ahp->ah_btCoexMode = (ahp->ah_btCoexMode & AR_BT_QCU_THRESH) |
|
||||
SM(btconf->bt_time_extend, AR_BT_TIME_EXTEND) |
|
||||
SM(btconf->bt_txstate_extend, AR_BT_TXSTATE_EXTEND) |
|
||||
SM(btconf->bt_txframe_extend, AR_BT_TX_FRAME_EXTEND) |
|
||||
SM(btconf->bt_mode, AR_BT_MODE) |
|
||||
SM(btconf->bt_quiet_collision, AR_BT_QUIET) |
|
||||
SM(rxClearPolarity, AR_BT_RX_CLEAR_POLARITY) |
|
||||
SM(btconf->bt_priority_time, AR_BT_PRIORITY_TIME) |
|
||||
SM(btconf->bt_first_slot_time, AR_BT_FIRST_SLOT_TIME);
|
||||
|
||||
ahp->ah_btCoexMode2 |= SM(btconf->bt_hold_rxclear,
|
||||
AR_BT_HOLD_RX_CLEAR);
|
||||
|
||||
if (ahp->ah_btCoexSingleAnt == AH_FALSE) {
|
||||
/* Enable ACK to go out even though BT has higher priority. */
|
||||
ahp->ah_btCoexMode2 |= AR_BT_DISABLE_BT_ANT;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ar5416BTCoexSetQcuThresh(struct ath_hal *ah, int qnum)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
ahp->ah_btCoexMode |= SM(qnum, AR_BT_QCU_THRESH);
|
||||
}
|
||||
|
||||
void
|
||||
ar5416BTCoexSetWeights(struct ath_hal *ah, u_int32_t stompType)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
if (AR_SREV_KIWI_10_OR_LATER(ah)) {
|
||||
/* TODO: TX RX seperate is not enabled. */
|
||||
switch (stompType) {
|
||||
case HAL_BT_COEX_STOMP_ALL:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight = AR5416_STOMP_ALL_WLAN_WGHT;
|
||||
break;
|
||||
case HAL_BT_COEX_STOMP_LOW:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight = AR5416_STOMP_LOW_WLAN_WGHT;
|
||||
break;
|
||||
case HAL_BT_COEX_STOMP_ALL_FORCE:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight =
|
||||
AR5416_STOMP_ALL_FORCE_WLAN_WGHT;
|
||||
break;
|
||||
case HAL_BT_COEX_STOMP_LOW_FORCE:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight =
|
||||
AR5416_STOMP_LOW_FORCE_WLAN_WGHT;
|
||||
break;
|
||||
case HAL_BT_COEX_STOMP_NONE:
|
||||
case HAL_BT_COEX_NO_STOMP:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight = AR5416_STOMP_NONE_WLAN_WGHT;
|
||||
break;
|
||||
default:
|
||||
/* There is a forceWeight from registry */
|
||||
ahp->ah_btCoexBTWeight = stompType & 0xffff;
|
||||
ahp->ah_btCoexWLANWeight = stompType >> 16;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (stompType) {
|
||||
case HAL_BT_COEX_STOMP_ALL:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight = AR5416_STOMP_ALL_WLAN_WGHT;
|
||||
break;
|
||||
case HAL_BT_COEX_STOMP_LOW:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight = AR5416_STOMP_LOW_WLAN_WGHT;
|
||||
break;
|
||||
case HAL_BT_COEX_STOMP_ALL_FORCE:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight =
|
||||
AR5416_STOMP_ALL_FORCE_WLAN_WGHT;
|
||||
break;
|
||||
case HAL_BT_COEX_STOMP_LOW_FORCE:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight =
|
||||
AR5416_STOMP_LOW_FORCE_WLAN_WGHT;
|
||||
break;
|
||||
case HAL_BT_COEX_STOMP_NONE:
|
||||
case HAL_BT_COEX_NO_STOMP:
|
||||
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
|
||||
ahp->ah_btCoexWLANWeight = AR5416_STOMP_NONE_WLAN_WGHT;
|
||||
break;
|
||||
default:
|
||||
/* There is a forceWeight from registry */
|
||||
ahp->ah_btCoexBTWeight = stompType & 0xffff;
|
||||
ahp->ah_btCoexWLANWeight = stompType >> 16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ar5416BTCoexSetupBmissThresh(struct ath_hal *ah, u_int32_t thresh)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
ahp->ah_btCoexMode2 |= SM(thresh, AR_BT_BCN_MISS_THRESH);
|
||||
}
|
||||
|
||||
/*
|
||||
* There is no antenna diversity for Owl, Kiwi, etc.
|
||||
*
|
||||
* Kite will override this particular method.
|
||||
*/
|
||||
static void
|
||||
ar5416BTCoexAntennaDiversity(struct ath_hal *ah)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ar5416BTCoexSetParameter(struct ath_hal *ah, u_int32_t type, u_int32_t value)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
switch (type) {
|
||||
case HAL_BT_COEX_SET_ACK_PWR:
|
||||
if (value) {
|
||||
ahp->ah_btCoexFlag |= HAL_BT_COEX_FLAG_LOW_ACK_PWR;
|
||||
OS_REG_WRITE(ah, AR_TPC, HAL_BT_COEX_LOW_ACK_POWER);
|
||||
} else {
|
||||
ahp->ah_btCoexFlag &= ~HAL_BT_COEX_FLAG_LOW_ACK_PWR;
|
||||
OS_REG_WRITE(ah, AR_TPC, HAL_BT_COEX_HIGH_ACK_POWER);
|
||||
}
|
||||
break;
|
||||
case HAL_BT_COEX_ANTENNA_DIVERSITY:
|
||||
/* This is overridden for Kite */
|
||||
break;
|
||||
#if 0
|
||||
case HAL_BT_COEX_LOWER_TX_PWR:
|
||||
if (value) {
|
||||
if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_LOWER_TX_PWR) == 0) {
|
||||
ahp->ah_btCoexFlag |= HAL_BT_COEX_FLAG_LOWER_TX_PWR;
|
||||
AH_PRIVATE(ah)->ah_config.ath_hal_desc_tpc = 1;
|
||||
ar5416SetTxPowerLimit(ah, AH_PRIVATE(ah)->ah_power_limit, AH_PRIVATE(ah)->ah_extra_txpow, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_LOWER_TX_PWR) {
|
||||
ahp->ah_btCoexFlag &= ~HAL_BT_COEX_FLAG_LOWER_TX_PWR;
|
||||
AH_PRIVATE(ah)->ah_config.ath_hal_desc_tpc = 0;
|
||||
ar5416SetTxPowerLimit(ah, AH_PRIVATE(ah)->ah_power_limit, AH_PRIVATE(ah)->ah_extra_txpow, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ar5416BTCoexDisable(struct ath_hal *ah)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
/* Always drive rx_clear_external output as 0 */
|
||||
ar5416GpioSet(ah, ahp->ah_wlanActiveGpioSelect, 0);
|
||||
ar5416GpioCfgOutput(ah, ahp->ah_wlanActiveGpioSelect,
|
||||
HAL_GPIO_OUTPUT_MUX_AS_OUTPUT);
|
||||
|
||||
if (AR_SREV_9271(ah)) {
|
||||
/*
|
||||
* Set wlanActiveGpio to input when disabling BT-COEX to
|
||||
* reduce power consumption
|
||||
*/
|
||||
ar5416GpioCfgInput(ah, ahp->ah_wlanActiveGpioSelect);
|
||||
}
|
||||
|
||||
if (ahp->ah_btCoexSingleAnt == AH_TRUE) {
|
||||
OS_REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE,
|
||||
1);
|
||||
OS_REG_RMW_FIELD(ah, AR_MISC_MODE, AR_PCU_BT_ANT_PREVENT_RX,
|
||||
0);
|
||||
}
|
||||
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_MODE, AR_BT_QUIET | AR_BT_MODE);
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_WEIGHT, 0);
|
||||
if (AR_SREV_KIWI_10_OR_LATER(ah))
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_WEIGHT2, 0);
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_MODE2, 0);
|
||||
|
||||
ahp->ah_btCoexEnabled = AH_FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
ar5416BTCoexEnable(struct ath_hal *ah)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
/* Program coex mode and weight registers to actually enable coex */
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_MODE, ahp->ah_btCoexMode);
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_WEIGHT,
|
||||
SM(ahp->ah_btCoexWLANWeight & 0xFFFF, AR_BT_WL_WGHT) |
|
||||
SM(ahp->ah_btCoexBTWeight & 0xFFFF, AR_BT_BT_WGHT));
|
||||
if (AR_SREV_KIWI_10_OR_LATER(ah)) {
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_WEIGHT2,
|
||||
SM(ahp->ah_btCoexWLANWeight >> 16, AR_BT_WL_WGHT));
|
||||
}
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_MODE2, ahp->ah_btCoexMode2);
|
||||
|
||||
#if 0
|
||||
/* Added Select GPIO5~8 instaed SPI */
|
||||
if (AR_SREV_9271(ah)) {
|
||||
val = OS_REG_READ(ah, AR9271_CLOCK_CONTROL);
|
||||
val &= 0xFFFFFEFF;
|
||||
OS_REG_WRITE(ah, AR9271_CLOCK_CONTROL, val);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_LOW_ACK_PWR)
|
||||
OS_REG_WRITE(ah, AR_TPC, HAL_BT_COEX_LOW_ACK_POWER);
|
||||
else
|
||||
OS_REG_WRITE(ah, AR_TPC, HAL_BT_COEX_HIGH_ACK_POWER);
|
||||
|
||||
if (ahp->ah_btCoexSingleAnt == AH_TRUE) {
|
||||
OS_REG_RMW_FIELD(ah, AR_QUIET1,
|
||||
AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1);
|
||||
/* XXX should update miscMode? */
|
||||
OS_REG_RMW_FIELD(ah, AR_MISC_MODE,
|
||||
AR_PCU_BT_ANT_PREVENT_RX, 1);
|
||||
} else {
|
||||
OS_REG_RMW_FIELD(ah, AR_QUIET1,
|
||||
AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1);
|
||||
/* XXX should update miscMode? */
|
||||
OS_REG_RMW_FIELD(ah, AR_MISC_MODE,
|
||||
AR_PCU_BT_ANT_PREVENT_RX, 0);
|
||||
}
|
||||
|
||||
if (ahp->ah_btCoexConfigType == HAL_BT_COEX_CFG_3WIRE) {
|
||||
/* For 3-wire, configure the desired GPIO port for rx_clear */
|
||||
ar5416GpioCfgOutput(ah, ahp->ah_wlanActiveGpioSelect,
|
||||
HAL_GPIO_OUTPUT_MUX_AS_WLAN_ACTIVE);
|
||||
} else {
|
||||
/*
|
||||
* For 2-wire, configure the desired GPIO port
|
||||
* for TX_FRAME output
|
||||
*/
|
||||
ar5416GpioCfgOutput(ah, ahp->ah_wlanActiveGpioSelect,
|
||||
HAL_GPIO_OUTPUT_MUX_AS_TX_FRAME);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable a weak pull down on BT_ACTIVE.
|
||||
* When BT device is disabled, BT_ACTIVE might be floating.
|
||||
*/
|
||||
OS_REG_RMW(ah, AR_GPIO_PDPU,
|
||||
(0x2 << (ahp->ah_btActiveGpioSelect * 2)),
|
||||
(0x3 << (ahp->ah_btActiveGpioSelect * 2)));
|
||||
|
||||
ahp->ah_btCoexEnabled = AH_TRUE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ar5416InitBTCoex(struct ath_hal *ah)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
if (ahp->ah_btCoexConfigType == HAL_BT_COEX_CFG_3WIRE) {
|
||||
OS_REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
|
||||
(AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB |
|
||||
AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB));
|
||||
|
||||
/*
|
||||
* Set input mux for bt_prority_async and
|
||||
* bt_active_async to GPIO pins
|
||||
*/
|
||||
OS_REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
|
||||
AR_GPIO_INPUT_MUX1_BT_ACTIVE,
|
||||
ahp->ah_btActiveGpioSelect);
|
||||
OS_REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
|
||||
AR_GPIO_INPUT_MUX1_BT_PRIORITY,
|
||||
ahp->ah_btPriorityGpioSelect);
|
||||
|
||||
/*
|
||||
* Configure the desired GPIO ports for input
|
||||
*/
|
||||
ar5416GpioCfgInput(ah, ahp->ah_btActiveGpioSelect);
|
||||
ar5416GpioCfgInput(ah, ahp->ah_btPriorityGpioSelect);
|
||||
|
||||
if (AR_SREV_KITE(ah))
|
||||
ar5416BTCoexAntennaDiversity(ah);
|
||||
|
||||
if (ahp->ah_btCoexEnabled)
|
||||
ar5416BTCoexEnable(ah);
|
||||
else
|
||||
ar5416BTCoexDisable(ah);
|
||||
} else if (ahp->ah_btCoexConfigType != HAL_BT_COEX_CFG_NONE) {
|
||||
/* 2-wire */
|
||||
if (ahp->ah_btCoexEnabled) {
|
||||
/* Connect bt_active_async to baseband */
|
||||
OS_REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL,
|
||||
(AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF |
|
||||
AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF));
|
||||
OS_REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
|
||||
AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB);
|
||||
|
||||
/*
|
||||
* Set input mux for bt_prority_async and
|
||||
* bt_active_async to GPIO pins
|
||||
*/
|
||||
OS_REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
|
||||
AR_GPIO_INPUT_MUX1_BT_ACTIVE,
|
||||
ahp->ah_btActiveGpioSelect);
|
||||
|
||||
/* Configure the desired GPIO ports for input */
|
||||
ar5416GpioCfgInput(ah, ahp->ah_btActiveGpioSelect);
|
||||
|
||||
/* Enable coexistence on initialization */
|
||||
ar5416BTCoexEnable(ah);
|
||||
}
|
||||
}
|
||||
}
|
64
sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.h
Normal file
64
sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2011 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __ATH_AR5416_BTCOEX_H__
|
||||
#define __ATH_AR5416_BTCOEX_H__
|
||||
/*
|
||||
* Weight table configurations.
|
||||
*/
|
||||
#define AR5416_BT_WGHT 0xff55
|
||||
#define AR5416_STOMP_ALL_WLAN_WGHT 0xfcfc
|
||||
#define AR5416_STOMP_LOW_WLAN_WGHT 0xa8a8
|
||||
#define AR5416_STOMP_NONE_WLAN_WGHT 0x0000
|
||||
#define AR5416_STOMP_ALL_FORCE_WLAN_WGHT 0xffff // Stomp BT even when WLAN is idle
|
||||
#define AR5416_STOMP_LOW_FORCE_WLAN_WGHT 0xaaaa // Stomp BT even when WLAN is idle
|
||||
|
||||
#define AR9300_BT_WGHT 0xcccc4444
|
||||
#define AR9300_STOMP_ALL_WLAN_WGHT0 0xfffffff0
|
||||
#define AR9300_STOMP_ALL_WLAN_WGHT1 0xfffffff0
|
||||
#define AR9300_STOMP_LOW_WLAN_WGHT0 0x88888880
|
||||
#define AR9300_STOMP_LOW_WLAN_WGHT1 0x88888880
|
||||
#define AR9300_STOMP_NONE_WLAN_WGHT0 0x00000000
|
||||
#define AR9300_STOMP_NONE_WLAN_WGHT1 0x00000000
|
||||
#define AR9300_STOMP_ALL_FORCE_WLAN_WGHT0 0xffffffff // Stomp BT even when WLAN is idle
|
||||
#define AR9300_STOMP_ALL_FORCE_WLAN_WGHT1 0xffffffff
|
||||
#define AR9300_STOMP_LOW_FORCE_WLAN_WGHT0 0x88888888 // Stomp BT even when WLAN is idle
|
||||
#define AR9300_STOMP_LOW_FORCE_WLAN_WGHT1 0x88888888
|
||||
|
||||
#define JUPITER_STOMP_ALL_WLAN_WGHT0 0x00007d00
|
||||
#define JUPITER_STOMP_ALL_WLAN_WGHT1 0x7d7d7d00
|
||||
#define JUPITER_STOMP_ALL_WLAN_WGHT2 0x7d7d7d00
|
||||
#define JUPITER_STOMP_ALL_WLAN_WGHT3 0x7d7d7d7d
|
||||
#define JUPITER_STOMP_LOW_WLAN_WGHT0 0x00007d00
|
||||
#define JUPITER_STOMP_LOW_WLAN_WGHT1 0x7d3b3b00
|
||||
#define JUPITER_STOMP_LOW_WLAN_WGHT2 0x3b3b3b00
|
||||
#define JUPITER_STOMP_LOW_WLAN_WGHT3 0x3b3b3b3b
|
||||
#define JUPITER_STOMP_NONE_WLAN_WGHT0 0x00007d00
|
||||
#define JUPITER_STOMP_NONE_WLAN_WGHT1 0x7d000000
|
||||
#define JUPITER_STOMP_NONE_WLAN_WGHT2 0x00000000
|
||||
#define JUPITER_STOMP_NONE_WLAN_WGHT3 0x00000000
|
||||
#define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT0 0x00007d7d
|
||||
#define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT1 0x7d7d7d00
|
||||
#define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT2 0x7d7d7d7d
|
||||
#define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT3 0x7d7d7d7d
|
||||
#define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT0 0x00003b3b
|
||||
#define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT1 0x3b3b3b00
|
||||
#define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT2 0x3b3b3b3b
|
||||
#define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT3 0x3b3b3b3b
|
||||
|
||||
#endif /* __ATH_AR5416_BTCOEX_H__ */
|
@ -85,23 +85,49 @@ ar5416GpioCfgOutput(struct ath_hal *ah, uint32_t gpio, HAL_GPIO_MUX_TYPE type)
|
||||
{
|
||||
uint32_t gpio_shift, reg;
|
||||
|
||||
#define N(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
|
||||
|
||||
/*
|
||||
* This table maps the HAL GPIO pins to the actual hardware
|
||||
* values.
|
||||
*/
|
||||
static const u_int32_t MuxSignalConversionTable[] = {
|
||||
AR_GPIO_OUTPUT_MUX_AS_OUTPUT,
|
||||
AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED,
|
||||
AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED,
|
||||
AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED,
|
||||
AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED,
|
||||
AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL,
|
||||
AR_GPIO_OUTPUT_MUX_AS_TX_FRAME,
|
||||
};
|
||||
|
||||
HALDEBUG(ah, HAL_DEBUG_GPIO,
|
||||
"%s: gpio=%d, type=%d\n", __func__, gpio, type);
|
||||
|
||||
/* NB: type maps directly to hardware */
|
||||
/* XXX this may not actually be the case, for anything but output */
|
||||
cfgOutputMux(ah, gpio, type);
|
||||
gpio_shift = gpio << 1; /* 2 bits per output mode */
|
||||
/*
|
||||
* Convert HAL signal type definitions to hardware-specific values.
|
||||
*/
|
||||
if (type >= N(MuxSignalConversionTable)) {
|
||||
ath_hal_printf(ah, "%s: mux %d is invalid!\n",
|
||||
__func__,
|
||||
type);
|
||||
return AH_FALSE;
|
||||
}
|
||||
cfgOutputMux(ah, gpio, MuxSignalConversionTable[type]);
|
||||
|
||||
/* 2 bits per output mode */
|
||||
gpio_shift = gpio << 1;
|
||||
|
||||
/* Always drive, rather than tristate/drive low/drive high */
|
||||
reg = OS_REG_READ(ah, AR_GPIO_OE_OUT);
|
||||
reg &= ~(AR_GPIO_OE_OUT_DRV << gpio_shift);
|
||||
/* Always drive, rather than tristate/drive low/drive high */
|
||||
reg |= AR_GPIO_OE_OUT_DRV_ALL << gpio_shift;
|
||||
OS_REG_WRITE(ah, AR_GPIO_OE_OUT, reg);
|
||||
|
||||
return AH_TRUE;
|
||||
#undef N
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -86,4 +86,9 @@ extern HAL_BOOL ar9285SetTransmitPower(struct ath_hal *,
|
||||
extern HAL_BOOL ar9285SetBoardValues(struct ath_hal *,
|
||||
const struct ieee80211_channel *);
|
||||
|
||||
/* ar9285_btcoex.h */
|
||||
extern void ar9285BTCoexAntennaDiversity(struct ath_hal *ah);
|
||||
extern void ar9285BTCoexSetParameter(struct ath_hal *ah,
|
||||
u_int32_t value, u_int32_t type);
|
||||
|
||||
#endif /* _ATH_AR9285_H_ */
|
||||
|
135
sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c
Normal file
135
sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
* Copyright (c) 2002-2005 Atheros Communications, Inc.
|
||||
* Copyright (c) 2008-2010, 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "opt_ah.h"
|
||||
|
||||
#include "ah.h"
|
||||
#include "ah_internal.h"
|
||||
#include "ah_devid.h"
|
||||
#ifdef AH_DEBUG
|
||||
#include "ah_desc.h" /* NB: for HAL_PHYERR* */
|
||||
#endif
|
||||
|
||||
#include "ar5416/ar5416.h"
|
||||
#include "ar5416/ar5416reg.h"
|
||||
#include "ar5416/ar5416phy.h"
|
||||
#include "ar5416/ar5416desc.h" /* AR5416_CONTTXMODE */
|
||||
|
||||
#include "ar9002/ar9285phy.h"
|
||||
#include "ar9002/ar9285.h"
|
||||
|
||||
/*
|
||||
* This is specific to Kite.
|
||||
*
|
||||
* Kiwi and others don't have antenna diversity like this.
|
||||
*/
|
||||
void
|
||||
ar9285BTCoexAntennaDiversity(struct ath_hal *ah)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
u_int32_t regVal;
|
||||
u_int8_t ant_div_control1, ant_div_control2;
|
||||
|
||||
if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW) ||
|
||||
(AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) {
|
||||
if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE) &&
|
||||
(AH5212(ah)->ah_diversity == HAL_ANT_VARIABLE)) {
|
||||
/* Enable antenna diversity */
|
||||
ant_div_control1 = HAL_BT_COEX_ANTDIV_CONTROL1_ENABLE;
|
||||
ant_div_control2 = HAL_BT_COEX_ANTDIV_CONTROL2_ENABLE;
|
||||
|
||||
/* Don't disable BT ant to allow BB to control SWCOM */
|
||||
ahp->ah_btCoexMode2 &= (~(AR_BT_DISABLE_BT_ANT));
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_MODE2, ahp->ah_btCoexMode2);
|
||||
|
||||
/* Program the correct SWCOM table */
|
||||
OS_REG_WRITE(ah, AR_PHY_SWITCH_COM,
|
||||
HAL_BT_COEX_ANT_DIV_SWITCH_COM);
|
||||
OS_REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0, 0, 0xf0000000);
|
||||
} else if (AH5212(ah)->ah_diversity == HAL_ANT_FIXED_B) {
|
||||
/* Disable antenna diversity. Use antenna B(LNA2) only. */
|
||||
ant_div_control1 = HAL_BT_COEX_ANTDIV_CONTROL1_FIXED_B;
|
||||
ant_div_control2 = HAL_BT_COEX_ANTDIV_CONTROL2_FIXED_B;
|
||||
|
||||
/* Disable BT ant to allow concurrent BT and WLAN receive */
|
||||
ahp->ah_btCoexMode2 |= AR_BT_DISABLE_BT_ANT;
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_MODE2, ahp->ah_btCoexMode2);
|
||||
|
||||
/* Program SWCOM talbe to make sure RF switch always parks at WLAN side */
|
||||
OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, HAL_BT_COEX_ANT_DIV_SWITCH_COM);
|
||||
OS_REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0, 0x60000000, 0xf0000000);
|
||||
} else {
|
||||
/* Disable antenna diversity. Use antenna A(LNA1) only */
|
||||
ant_div_control1 = HAL_BT_COEX_ANTDIV_CONTROL1_FIXED_A;
|
||||
ant_div_control2 = HAL_BT_COEX_ANTDIV_CONTROL2_FIXED_A;
|
||||
|
||||
/* Disable BT ant to allow concurrent BT and WLAN receive */
|
||||
ahp->ah_btCoexMode2 |= AR_BT_DISABLE_BT_ANT;
|
||||
OS_REG_WRITE(ah, AR_BT_COEX_MODE2, ahp->ah_btCoexMode2);
|
||||
|
||||
/* Program SWCOM talbe to make sure RF switch always parks at BT side */
|
||||
OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, 0);
|
||||
OS_REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0, 0, 0xf0000000);
|
||||
}
|
||||
|
||||
regVal = OS_REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL);
|
||||
regVal &= (~(AR_PHY_9285_ANT_DIV_CTL_ALL));
|
||||
/* Clear ant_fast_div_bias [14:9] since for Janus the main LNA is always LNA1. */
|
||||
regVal &= (~(AR_PHY_9285_FAST_DIV_BIAS));
|
||||
|
||||
regVal |= SM(ant_div_control1, AR_PHY_9285_ANT_DIV_CTL);
|
||||
regVal |= SM(ant_div_control2, AR_PHY_9285_ANT_DIV_ALT_LNACONF);
|
||||
regVal |= SM((ant_div_control2 >> 2), AR_PHY_9285_ANT_DIV_MAIN_LNACONF);
|
||||
regVal |= SM((ant_div_control1 >> 1), AR_PHY_9285_ANT_DIV_ALT_GAINTB);
|
||||
regVal |= SM((ant_div_control1 >> 2), AR_PHY_9285_ANT_DIV_MAIN_GAINTB);
|
||||
OS_REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regVal);
|
||||
|
||||
regVal = OS_REG_READ(ah, AR_PHY_CCK_DETECT);
|
||||
regVal &= (~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV);
|
||||
regVal |= SM((ant_div_control1 >> 3), AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV);
|
||||
OS_REG_WRITE(ah, AR_PHY_CCK_DETECT, regVal);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ar9285BTCoexSetParameter(struct ath_hal *ah, u_int32_t type, u_int32_t value)
|
||||
{
|
||||
struct ath_hal_5416 *ahp = AH5416(ah);
|
||||
|
||||
switch (type) {
|
||||
case HAL_BT_COEX_ANTENNA_DIVERSITY:
|
||||
if (AR_SREV_KITE(ah)) {
|
||||
ahp->ah_btCoexFlag |= HAL_BT_COEX_FLAG_ANT_DIV_ALLOW;
|
||||
if (value)
|
||||
ahp->ah_btCoexFlag |=
|
||||
HAL_BT_COEX_FLAG_ANT_DIV_ENABLE;
|
||||
else
|
||||
ahp->ah_btCoexFlag &=
|
||||
~HAL_BT_COEX_FLAG_ANT_DIV_ENABLE;
|
||||
ar9285BTCoexAntennaDiversity(ah);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ar5416BTCoexSetParameter(ah, type, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
59
sys/dev/ath/ath_hal/ar9003/ar9300_btcoex.h
Normal file
59
sys/dev/ath/ath_hal/ar9003/ar9300_btcoex.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2011 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __ATH_AR9300_BTCOEX_H__
|
||||
#define __ATH_AR9300_BTCOEX_H__
|
||||
/*
|
||||
* Weight table configurations.
|
||||
*/
|
||||
#define AR9300_BT_WGHT 0xcccc4444
|
||||
#define AR9300_STOMP_ALL_WLAN_WGHT0 0xfffffff0
|
||||
#define AR9300_STOMP_ALL_WLAN_WGHT1 0xfffffff0
|
||||
#define AR9300_STOMP_LOW_WLAN_WGHT0 0x88888880
|
||||
#define AR9300_STOMP_LOW_WLAN_WGHT1 0x88888880
|
||||
#define AR9300_STOMP_NONE_WLAN_WGHT0 0x00000000
|
||||
#define AR9300_STOMP_NONE_WLAN_WGHT1 0x00000000
|
||||
/* Stomp BT even when WLAN is idle */
|
||||
#define AR9300_STOMP_ALL_FORCE_WLAN_WGHT0 0xffffffff
|
||||
#define AR9300_STOMP_ALL_FORCE_WLAN_WGHT1 0xffffffff
|
||||
/* Stomp BT even when WLAN is idle */
|
||||
#define AR9300_STOMP_LOW_FORCE_WLAN_WGHT0 0x88888888
|
||||
#define AR9300_STOMP_LOW_FORCE_WLAN_WGHT1 0x88888888
|
||||
|
||||
#define JUPITER_STOMP_ALL_WLAN_WGHT0 0x00007d00
|
||||
#define JUPITER_STOMP_ALL_WLAN_WGHT1 0x7d7d7d00
|
||||
#define JUPITER_STOMP_ALL_WLAN_WGHT2 0x7d7d7d00
|
||||
#define JUPITER_STOMP_ALL_WLAN_WGHT3 0x7d7d7d7d
|
||||
#define JUPITER_STOMP_LOW_WLAN_WGHT0 0x00007d00
|
||||
#define JUPITER_STOMP_LOW_WLAN_WGHT1 0x7d3b3b00
|
||||
#define JUPITER_STOMP_LOW_WLAN_WGHT2 0x3b3b3b00
|
||||
#define JUPITER_STOMP_LOW_WLAN_WGHT3 0x3b3b3b3b
|
||||
#define JUPITER_STOMP_NONE_WLAN_WGHT0 0x00007d00
|
||||
#define JUPITER_STOMP_NONE_WLAN_WGHT1 0x7d000000
|
||||
#define JUPITER_STOMP_NONE_WLAN_WGHT2 0x00000000
|
||||
#define JUPITER_STOMP_NONE_WLAN_WGHT3 0x00000000
|
||||
#define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT0 0x00007d7d
|
||||
#define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT1 0x7d7d7d00
|
||||
#define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT2 0x7d7d7d7d
|
||||
#define JUPITER_STOMP_ALL_FORCE_WLAN_WGHT3 0x7d7d7d7d
|
||||
#define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT0 0x00003b3b
|
||||
#define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT1 0x3b3b3b00
|
||||
#define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT2 0x3b3b3b3b
|
||||
#define JUPITER_STOMP_LOW_FORCE_WLAN_WGHT3 0x3b3b3b3b
|
||||
|
||||
#endif /* __ATH_AR9300_BTCOEX_H__ */
|
@ -125,7 +125,7 @@ ath_led_config(struct ath_softc *sc)
|
||||
/* Software LED blinking - GPIO controlled LED */
|
||||
if (sc->sc_softled) {
|
||||
ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin,
|
||||
HAL_GPIO_MUX_OUTPUT);
|
||||
HAL_GPIO_OUTPUT_MUX_AS_OUTPUT);
|
||||
ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin, !sc->sc_ledon);
|
||||
}
|
||||
|
||||
@ -139,10 +139,10 @@ ath_led_config(struct ath_softc *sc)
|
||||
*/
|
||||
if (sc->sc_led_pwr_pin > 0)
|
||||
ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_led_pwr_pin,
|
||||
HAL_GPIO_MUX_MAC_POWER_LED);
|
||||
HAL_GPIO_OUTPUT_MUX_MAC_POWER_LED);
|
||||
if (sc->sc_led_net_pin > 0)
|
||||
ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_led_net_pin,
|
||||
HAL_GPIO_MUX_MAC_NETWORK_LED);
|
||||
HAL_GPIO_OUTPUT_MUX_MAC_NETWORK_LED);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user