Skip to contentSkip to conversation

ath9k patches

PATCH In review Sujith Manoharan 2 participants 11 messages Feb 16, 2015 – Mar 3, 2015 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath9k patches

From: Sujith Manoharan <[email protected]>

ath9k patches for -next.

Sujith Manoharan (9):
ath9k: Move MCI registers to reg_mci.h
ath9k: Remove useless check in MCI reset
ath9k: Add new MCI configuration parameters
ath9k: Handle 2-ANT AR9565 in MCI reset
ath9k: Fix MCI TX control
ath9k: Setup MCI statistics properly
ath9k: Prepare MCI interface correctly
ath9k: Fix GPM initialization
ath9k: Mute BT properly

 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 158 ++++++++++----
 drivers/net/wireless/ath/ath9k/ar9003_mci.h |  24 ++-
 drivers/net/wireless/ath/ath9k/hw.h         |   1 +
 drivers/net/wireless/ath/ath9k/mci.c        |   5 +-
 drivers/net/wireless/ath/ath9k/reg.h        | 275 ------------------------
 drivers/net/wireless/ath/ath9k/reg_mci.h    | 310 ++++++++++++++++++++++++++++
 6 files changed, 449 insertions(+), 324 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/reg_mci.h
Signature · 1 line
2.3.0
#1 lore raw

PATCH 1/9 ath9k: Move MCI registers to reg_mci.h

From: Sujith Manoharan <[email protected]>

---
 drivers/net/wireless/ath/ath9k/hw.h      |   1 +
 drivers/net/wireless/ath/ath9k/reg.h     | 275 ----------------------------
 drivers/net/wireless/ath/ath9k/reg_mci.h | 300 +++++++++++++++++++++++++++++++
 3 files changed, 301 insertions(+), 275 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/reg_mci.h
drivers/net/wireless/ath/ath9k/hw.h +1 -0
index e82e570..29a25d9 100644
@@ -27,6 +27,7 @@
 #include "eeprom.h"
 #include "calib.h"
 #include "reg.h"
+#include "reg_mci.h"
 #include "phy.h"
 #include "btcoex.h"
 #include "dynack.h"
drivers/net/wireless/ath/ath9k/reg.h +0 -275

279 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/reg_mci.h new file +300 -0

300 lines not on this page · raw message

Signature · 1 line
2.3.0
#2 lore raw

Re: [1/9] ath9k: Move MCI registers to reg_mci.h

Quoted 4 lines

From: Sujith Manoharan <[email protected]>

Thanks, 9 patches applied to wireless-drivers-next.git:

ae55099f5b6f ath9k: Move MCI registers to reg_mci.h 7d1805e194dc ath9k: Remove useless check in MCI reset d1d07813bb3e ath9k: Add new MCI configuration parameters e18e164e9af5 ath9k: Handle 2-ANT AR9565 in MCI reset d808ecd8743c ath9k: Fix MCI TX control 4d9f7c68b78d ath9k: Setup MCI statistics properly bc80d526d302 ath9k: Prepare MCI interface correctly ad1dc638725d ath9k: Fix GPM initialization 2f890caba6dd ath9k: Mute BT properly

Kalle Valo

#3 lore raw

PATCH 2/9 ath9k: Remove useless check in MCI reset

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

If we fail to allocate the sched/gpm buffers when initializing MCI, we bail out properly. Checking them in ar9003_mci_reset() is unnecessary, so remove it.

---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mci.c +0 -5
index 7b94a6c..4aed985 100644
@@ -831,11 +831,6 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
 	ath_dbg(common, MCI, "MCI Reset (full_sleep = %d, is_2g = %d)\n",
 		is_full_sleep, is_2g);
 
-	if (!mci->gpm_addr && !mci->sched_addr) {
-		ath_err(common, "MCI GPM and schedule buffers are not allocated\n");
-		return -ENOMEM;
-	}
-
 	if (REG_READ(ah, AR_BTCOEX_CTRL) == 0xdeadbeef) {
 		ath_err(common, "BTCOEX control register is dead\n");
 		return -EINVAL;
Signature · 1 line
2.3.0
#4 lore raw

PATCH 3/9 ath9k: Add new MCI configuration parameters

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

Several new MCI parameters need to be handled for
new chips, add them.

---
 drivers/net/wireless/ath/ath9k/ar9003_mci.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/ath9k/ar9003_mci.h +11 -0
index cef2010..e8b1914 100644
@@ -92,6 +92,17 @@ enum mci_gpm_coex_bt_update_flags_op {
 #define ATH_MCI_CONFIG_CLK_DIV              0x00003000
 #define ATH_MCI_CONFIG_CLK_DIV_S            12
 #define ATH_MCI_CONFIG_DISABLE_TUNING       0x00004000
+#define ATH_MCI_CONFIG_DISABLE_AIC          0x00008000
+#define ATH_MCI_CONFIG_AIC_CAL_NUM_CHAN     0x007f0000
+#define ATH_MCI_CONFIG_AIC_CAL_NUM_CHAN_S   16
+#define ATH_MCI_CONFIG_NO_QUIET_ACK         0x00800000
+#define ATH_MCI_CONFIG_NO_QUIET_ACK_S       23
+#define ATH_MCI_CONFIG_ANT_ARCH             0x07000000
+#define ATH_MCI_CONFIG_ANT_ARCH_S           24
+#define ATH_MCI_CONFIG_FORCE_QUIET_ACK      0x08000000
+#define ATH_MCI_CONFIG_FORCE_QUIET_ACK_S    27
+#define ATH_MCI_CONFIG_FORCE_2CHAIN_ACK     0x10000000
+#define ATH_MCI_CONFIG_MCI_STAT_DBG         0x20000000
 #define ATH_MCI_CONFIG_MCI_WEIGHT_DBG       0x40000000
 #define ATH_MCI_CONFIG_DISABLE_MCI          0x80000000
 
Signature · 1 line
2.3.0
#5 lore raw

PATCH 4/9 ath9k: Handle 2-ANT AR9565 in MCI reset

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

The value programmed in the BTCOEX control register is different for each chip. This patch adds support for 2-ANT, 1-ANT solutions based on AR9565.

---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 78 +++++++++++++++++++++++------
 drivers/net/wireless/ath/ath9k/ar9003_mci.h |  7 +++
 2 files changed, 69 insertions(+), 16 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mci.c +62 -16
index 4aed985..1a48528 100644
@@ -821,6 +821,61 @@ static void ar9003_mci_osla_setup(struct ath_hw *ah, bool enable)
 		      AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN, 1);
 }
 
+static void ar9003_mci_set_btcoex_ctrl_9565_1ANT(struct ath_hw *ah)
+{
+	u32 regval;
+
+	regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) |
+		 SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) |
+		 SM(1, AR_BTCOEX_CTRL_PA_SHARED) |
+		 SM(1, AR_BTCOEX_CTRL_LNA_SHARED) |
+		 SM(1, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
+		 SM(1, AR_BTCOEX_CTRL_RX_CHAIN_MASK) |
+		 SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) |
+		 SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) |
+		 SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
+
+	REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2,
+		      AR_BTCOEX_CTRL2_TX_CHAIN_MASK, 0x1);
+	REG_WRITE(ah, AR_BTCOEX_CTRL, regval);
+}
+
+static void ar9003_mci_set_btcoex_ctrl_9565_2ANT(struct ath_hw *ah)
+{
+	u32 regval;
+
+	regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) |
+		 SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) |
+		 SM(0, AR_BTCOEX_CTRL_PA_SHARED) |
+		 SM(0, AR_BTCOEX_CTRL_LNA_SHARED) |
+		 SM(2, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
+		 SM(1, AR_BTCOEX_CTRL_RX_CHAIN_MASK) |
+		 SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) |
+		 SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) |
+		 SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
+
+	REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2,
+		      AR_BTCOEX_CTRL2_TX_CHAIN_MASK, 0x0);
+	REG_WRITE(ah, AR_BTCOEX_CTRL, regval);
+}
+
+static void ar9003_mci_set_btcoex_ctrl_9462(struct ath_hw *ah)
+{
+	u32 regval;
+
+        regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) |
+		 SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) |
+		 SM(1, AR_BTCOEX_CTRL_PA_SHARED) |
+		 SM(1, AR_BTCOEX_CTRL_LNA_SHARED) |
+		 SM(2, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
+		 SM(3, AR_BTCOEX_CTRL_RX_CHAIN_MASK) |
+		 SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) |
+		 SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) |
+		 SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
+
+	REG_WRITE(ah, AR_BTCOEX_CTRL, regval);
+}
+
 int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
 		     bool is_full_sleep)
 {
@@ -845,26 +900,17 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
 	* To avoid MCI state machine be affected by incoming remote MCI msgs,
 	* MCI mode will be enabled later, right before reset the MCI TX and RX.
 	*/
-
-	regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) |
-		 SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) |
-		 SM(1, AR_BTCOEX_CTRL_PA_SHARED) |
-		 SM(1, AR_BTCOEX_CTRL_LNA_SHARED) |
-		 SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) |
-		 SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) |
-		 SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
 	if (AR_SREV_9565(ah)) {
-		regval |= SM(1, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
-			  SM(1, AR_BTCOEX_CTRL_RX_CHAIN_MASK);
-		REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2,
-			      AR_BTCOEX_CTRL2_TX_CHAIN_MASK, 0x1);
+		u8 ant = MS(mci->config, ATH_MCI_CONFIG_ANT_ARCH);
+
+		if (ant == ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED)
+			ar9003_mci_set_btcoex_ctrl_9565_1ANT(ah);
+		else
+			ar9003_mci_set_btcoex_ctrl_9565_2ANT(ah);
 	} else {
-		regval |= SM(2, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
-			  SM(3, AR_BTCOEX_CTRL_RX_CHAIN_MASK);
+		ar9003_mci_set_btcoex_ctrl_9462(ah);
 	}
 
-	REG_WRITE(ah, AR_BTCOEX_CTRL, regval);
-
 	if (is_2g && !(mci->config & ATH_MCI_CONFIG_DISABLE_OSLA))
 		ar9003_mci_osla_setup(ah, true);
 	else
drivers/net/wireless/ath/ath9k/ar9003_mci.h +7 -0
index e8b1914..6f305ab 100644
@@ -109,8 +109,15 @@ enum mci_gpm_coex_bt_update_flags_op {
 #define ATH_MCI_CONFIG_MCI_OBS_MASK     (ATH_MCI_CONFIG_MCI_OBS_MCI  | \
 					 ATH_MCI_CONFIG_MCI_OBS_TXRX | \
 					 ATH_MCI_CONFIG_MCI_OBS_BT)
+
 #define ATH_MCI_CONFIG_MCI_OBS_GPIO     0x0000002F
 
+#define ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_NON_SHARED 0x00
+#define ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED     0x01
+#define ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_NON_SHARED 0x02
+#define ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_SHARED     0x03
+#define ATH_MCI_ANT_ARCH_3_ANT                   0x04
+
 enum mci_message_header {		/* length of payload */
 	MCI_LNA_CTRL     = 0x10,        /* len = 0 */
 	MCI_CONT_NACK    = 0x20,        /* len = 0 */
Signature · 1 line
2.3.0
#6 lore raw

PATCH 5/9 ath9k: Fix MCI TX control

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

This patch makes sure that the antenna configuration is used properly when setting AR_MCI_TX_CTRL.

---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 8 ++++++--
 drivers/net/wireless/ath/ath9k/ar9003_mci.h | 4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mci.c +6 -2
index 1a48528..aca9015 100644
@@ -973,8 +973,12 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
 		  (SM(0xe801, AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR) |
 		   SM(0x0000, AR_MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM)));
 
-	REG_CLR_BIT(ah, AR_MCI_TX_CTRL,
-		    AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE);
+	if (MCI_ANT_ARCH_PA_LNA_SHARED(mci))
+		REG_CLR_BIT(ah, AR_MCI_TX_CTRL,
+			    AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE);
+	else
+		REG_SET_BIT(ah, AR_MCI_TX_CTRL,
+			    AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE);
 
 	ar9003_mci_observation_set_up(ah);
 
drivers/net/wireless/ath/ath9k/ar9003_mci.h +4 -0
index 6f305ab..174ebea 100644
@@ -118,6 +118,10 @@ enum mci_gpm_coex_bt_update_flags_op {
 #define ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_SHARED     0x03
 #define ATH_MCI_ANT_ARCH_3_ANT                   0x04
 
+#define MCI_ANT_ARCH_PA_LNA_SHARED(mci)					\
+	((MS(mci->config, ATH_MCI_CONFIG_ANT_ARCH) == ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED) || \
+	 (MS(mci->config, ATH_MCI_CONFIG_ANT_ARCH) == ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_SHARED))
+
 enum mci_message_header {		/* length of payload */
 	MCI_LNA_CTRL     = 0x10,        /* len = 0 */
 	MCI_CONT_NACK    = 0x20,        /* len = 0 */
Signature · 1 line
2.3.0
#7 lore raw

PATCH 6/9 ath9k: Setup MCI statistics properly

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

Use a subroutine to enable MCI debug statistics
if it is present in the global configuration.

---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 23 ++++++++++++++++++++---
 drivers/net/wireless/ath/ath9k/reg_mci.h    |  5 +++++
 2 files changed, 25 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mci.c +20 -3
index aca9015..de65ce1 100644
@@ -821,6 +821,25 @@ static void ar9003_mci_osla_setup(struct ath_hw *ah, bool enable)
 		      AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN, 1);
 }
 
+static void ar9003_mci_stat_setup(struct ath_hw *ah)
+{
+	struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
+
+	if (!AR_SREV_9565(ah))
+		return;
+
+	if (mci->config & ATH_MCI_CONFIG_MCI_STAT_DBG) {
+		REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL,
+			      AR_MCI_DBG_CNT_CTRL_ENABLE, 1);
+		REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL,
+			      AR_MCI_DBG_CNT_CTRL_BT_LINKID,
+			      MCI_STAT_ALL_BT_LINKID);
+	} else {
+		REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL,
+			      AR_MCI_DBG_CNT_CTRL_ENABLE, 0);
+	}
+}
+
 static void ar9003_mci_set_btcoex_ctrl_9565_1ANT(struct ath_hw *ah)
 {
 	u32 regval;
@@ -984,10 +1003,8 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
 
 	mci->ready = true;
 	ar9003_mci_prep_interface(ah);
+	ar9003_mci_stat_setup(ah);
 
-	if (AR_SREV_9565(ah))
-		REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL,
-			      AR_MCI_DBG_CNT_CTRL_ENABLE, 0);
 	if (en_int)
 		ar9003_mci_enable_interrupt(ah);
 
drivers/net/wireless/ath/ath9k/reg_mci.h +5 -0
index 8d1572d..3bd7c21 100644
@@ -265,9 +265,14 @@
 #define AR_MCI_MISC                                     0x1a74
 #define AR_MCI_MISC_HW_FIX_EN                           0x00000001
 #define AR_MCI_MISC_HW_FIX_EN_S                         0
+
 #define AR_MCI_DBG_CNT_CTRL                             0x1a78
 #define AR_MCI_DBG_CNT_CTRL_ENABLE                      0x00000001
 #define AR_MCI_DBG_CNT_CTRL_ENABLE_S                    0
+#define AR_MCI_DBG_CNT_CTRL_BT_LINKID                   0x000007f8
+#define AR_MCI_DBG_CNT_CTRL_BT_LINKID_S                 3
+
+#define MCI_STAT_ALL_BT_LINKID                          0xffff
 
 #define AR_MCI_INTERRUPT_DEFAULT (AR_MCI_INTERRUPT_SW_MSG_DONE         | \
 				  AR_MCI_INTERRUPT_RX_INVALID_HDR      | \
Signature · 1 line
2.3.0
#8 lore raw

PATCH 7/9 ath9k: Prepare MCI interface correctly

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

The LNA_TRANS message needs to be sent only for
chips which have shared PA/LNA.

---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mci.c +2 -2
index de65ce1..505dfe3 100644
@@ -284,12 +284,12 @@ static void ar9003_mci_prep_interface(struct ath_hw *ah)
 		  AR_MCI_INTERRUPT_RX_MSG_CONT_RST);
 	REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, AR_MCI_INTERRUPT_BT_PRI);
 
-	if (mci->is_2g) {
+	if (mci->is_2g && MCI_ANT_ARCH_PA_LNA_SHARED(mci)) {
 		ar9003_mci_send_lna_transfer(ah, true);
 		udelay(5);
 	}
 
-	if ((mci->is_2g && !mci->update_2g5g)) {
+	if (mci->is_2g && !mci->update_2g5g && MCI_ANT_ARCH_PA_LNA_SHARED(mci)) {
 		if (ar9003_mci_wait_for_interrupt(ah,
 					AR_MCI_INTERRUPT_RX_MSG_RAW,
 					AR_MCI_INTERRUPT_RX_MSG_LNA_INFO,
Signature · 1 line
2.3.0
#9 lore raw

PATCH 8/9 ath9k: Fix GPM initialization

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

Handle MCI_STATE_INIT_GPM_OFFSET separately and do not overload ar9003_mci_get_next_gpm_offset() with a special case.

---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 27 +++++++++++++--------------
 drivers/net/wireless/ath/ath9k/ar9003_mci.h |  2 +-
 drivers/net/wireless/ath/ath9k/mci.c        |  5 ++---
 3 files changed, 16 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mci.c +13 -14
index 505dfe3..133b867 100644
@@ -593,7 +593,7 @@ static u32 ar9003_mci_wait_for_gpm(struct ath_hw *ah, u8 gpm_type,
 		if (!time_out)
 			break;
 
-		offset = ar9003_mci_get_next_gpm_offset(ah, false, &more_data);
+		offset = ar9003_mci_get_next_gpm_offset(ah, &more_data);
 
 		if (offset == MCI_GPM_INVALID)
 			continue;
@@ -657,7 +657,7 @@ static u32 ar9003_mci_wait_for_gpm(struct ath_hw *ah, u8 gpm_type,
 		time_out = 0;
 
 	while (more_data == MCI_GPM_MORE) {
-		offset = ar9003_mci_get_next_gpm_offset(ah, false, &more_data);
+		offset = ar9003_mci_get_next_gpm_offset(ah, &more_data);
 		if (offset == MCI_GPM_INVALID)
 			break;
 
@@ -986,7 +986,8 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
 	regval &= ~SM(1, AR_MCI_COMMAND2_RESET_RX);
 	REG_WRITE(ah, AR_MCI_COMMAND2, regval);
 
-	ar9003_mci_get_next_gpm_offset(ah, true, NULL);
+	/* Init GPM offset after MCI Reset Rx */
+	ar9003_mci_state(ah, MCI_STATE_INIT_GPM_OFFSET);
 
 	REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE,
 		  (SM(0xe801, AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR) |
@@ -1280,6 +1281,14 @@ u32 ar9003_mci_state(struct ath_hw *ah, u32 state_type)
 		}
 		value &= AR_BTCOEX_CTRL_MCI_MODE_EN;
 		break;
+	case MCI_STATE_INIT_GPM_OFFSET:
+		value = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR);
+
+		if (value < mci->gpm_len)
+			mci->gpm_idx = value;
+		else
+			mci->gpm_idx = 0;
+		break;
 	case MCI_STATE_LAST_SCHD_MSG_OFFSET:
 		value = MS(REG_READ(ah, AR_MCI_RX_STATUS),
 				    AR_MCI_RX_LAST_SCHD_MSG_INDEX);
@@ -1426,21 +1435,11 @@ void ar9003_mci_check_gpm_offset(struct ath_hw *ah)
 	mci->gpm_idx = 0;
 }
 
-u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, bool first, u32 *more)
+u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, u32 *more)
 {
 	struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
 	u32 offset, more_gpm = 0, gpm_ptr;
 
-	if (first) {
-		gpm_ptr = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR);
-
-		if (gpm_ptr >= mci->gpm_len)
-			gpm_ptr = 0;
-
-		mci->gpm_idx = gpm_ptr;
-		return gpm_ptr;
-	}
-
 	/*
 	 * This could be useful to avoid new GPM message interrupt which
 	 * may lead to spurious interrupt after power sleep, or multiple
drivers/net/wireless/ath/ath9k/ar9003_mci.h +1 -1
index 174ebea..e288611 100644
@@ -312,7 +312,7 @@ int ar9003_mci_setup(struct ath_hw *ah, u32 gpm_addr, void *gpm_buf,
 void ar9003_mci_cleanup(struct ath_hw *ah);
 void ar9003_mci_get_interrupt(struct ath_hw *ah, u32 *raw_intr,
 			      u32 *rx_msg_intr);
-u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, bool first, u32 *more);
+u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, u32 *more);
 void ar9003_mci_set_bt_version(struct ath_hw *ah, u8 major, u8 minor);
 void ar9003_mci_send_wlan_channels(struct ath_hw *ah);
 /*
drivers/net/wireless/ath/ath9k/mci.c +2 -3
index 3f7a11e..66596b9 100644
@@ -495,7 +495,7 @@ void ath_mci_intr(struct ath_softc *sc)
 	ar9003_mci_get_interrupt(sc->sc_ah, &mci_int, &mci_int_rxmsg);
 
 	if (ar9003_mci_state(ah, MCI_STATE_ENABLE) == 0) {
-		ar9003_mci_get_next_gpm_offset(ah, true, NULL);
+		ar9003_mci_state(ah, MCI_STATE_INIT_GPM_OFFSET);
 		return;
 	}
 
@@ -559,8 +559,7 @@ void ath_mci_intr(struct ath_softc *sc)
 				return;
 
 			pgpm = mci->gpm_buf.bf_addr;
-			offset = ar9003_mci_get_next_gpm_offset(ah, false,
-								&more_data);
+			offset = ar9003_mci_get_next_gpm_offset(ah, &more_data);
 
 			if (offset == MCI_GPM_INVALID)
 				break;
Signature · 1 line
2.3.0
#10 lore raw

PATCH 9/9 ath9k: Mute BT properly

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

Set The BT/WLAN priority weights correctly and make sure that MCI_LNA_TAKE is sent only for cards that share PA/LNA.

---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 13 ++++++++++---
 drivers/net/wireless/ath/ath9k/reg_mci.h    |  5 +++++
 2 files changed, 15 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mci.c +10 -3
index 133b867..bd169fa 100644
@@ -771,8 +771,14 @@ exit:
 
 static void ar9003_mci_mute_bt(struct ath_hw *ah)
 {
+	struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
+
 	/* disable all MCI messages */
 	REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, 0xffff0000);
+	REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS0, 0xffffffff);
+	REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS1, 0xffffffff);
+	REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS2, 0xffffffff);
+	REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS3, 0xffffffff);
 	REG_SET_BIT(ah, AR_MCI_TX_CTRL, AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE);
 
 	/* wait pending HW messages to flush out */
@@ -783,9 +789,10 @@ static void ar9003_mci_mute_bt(struct ath_hw *ah)
 	 * 1. reset not after resuming from full sleep
 	 * 2. before reset MCI RX, to quiet BT and avoid MCI RX misalignment
 	 */
-	ar9003_mci_send_lna_take(ah, true);
-
-	udelay(5);
+	if (MCI_ANT_ARCH_PA_LNA_SHARED(mci)) {
+		ar9003_mci_send_lna_take(ah, true);
+		udelay(5);
+	}
 
 	ar9003_mci_send_sys_sleeping(ah, true);
 }
drivers/net/wireless/ath/ath9k/reg_mci.h +5 -0
index 3bd7c21..6251310 100644
@@ -212,6 +212,11 @@
 #define AR_BTCOEX_CTRL_SPDT_POLARITY                    0x80000000
 #define AR_BTCOEX_CTRL_SPDT_POLARITY_S                  31
 
+#define AR_BTCOEX_WL_WEIGHTS0                           0x18b0
+#define AR_BTCOEX_WL_WEIGHTS1                           0x18b4
+#define AR_BTCOEX_WL_WEIGHTS2                           0x18b8
+#define AR_BTCOEX_WL_WEIGHTS3                           0x18bc
+
 #define AR_BTCOEX_MAX_TXPWR(_x)                         (0x18c0 + ((_x) << 2))
 #define AR_BTCOEX_WL_LNA                                0x1940
 #define AR_BTCOEX_RFGAIN_CTRL                           0x1944
Signature · 1 line
2.3.0