diff mbox

[08/10] rsi: device disconnect changes

Message ID 1520260620-4694-9-git-send-email-amitkarwar@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Amitkumar Karwar March 5, 2018, 2:36 p.m. UTC
From: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>

Below changes are done:
1. When HCI detach is called, making bt_adapter null and checking
for this variable where ever required.
2. In USB case, one extra register write is added to disable
firmware watchdog.
3. When interface down is called as part of disconnect, don't
send RX filter frame.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c |  8 ++++++--
 drivers/net/wireless/rsi/rsi_91x_main.c     |  2 ++
 drivers/net/wireless/rsi/rsi_91x_usb.c      | 10 ++++++++++
 drivers/net/wireless/rsi/rsi_hal.h          |  1 +
 drivers/net/wireless/rsi/rsi_main.h         |  1 +
 5 files changed, 20 insertions(+), 2 deletions(-)

Comments

Kalle Valo March 13, 2018, 3:27 p.m. UTC | #1
Amitkumar Karwar <amitkarwar@gmail.com> writes:

> From: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
>
> Below changes are done:
> 1. When HCI detach is called, making bt_adapter null and checking
> for this variable where ever required.
> 2. In USB case, one extra register write is added to disable
> firmware watchdog.
> 3. When interface down is called as part of disconnect, don't
> send RX filter frame.

Why? What does this patch fix? Please explain that (symptoms) in the
commit log.
Amitkumar Karwar March 15, 2018, 11:45 a.m. UTC | #2
On Tue, Mar 13, 2018 at 8:57 PM, Kalle Valo <kvalo@codeaurora.org> wrote:
> Amitkumar Karwar <amitkarwar@gmail.com> writes:
>
>> From: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
>>
>> Below changes are done:
>> 1. When HCI detach is called, making bt_adapter null and checking
>> for this variable where ever required.
>> 2. In USB case, one extra register write is added to disable
>> firmware watchdog.
>> 3. When interface down is called as part of disconnect, don't
>> send RX filter frame.
>
> Why? What does this patch fix? Please explain that (symptoms) in the
> commit log.

Kindly ignore this patch. I will include proper commit log which
explains the issue and resolution in updated version.

Regards,
Amitkumar
diff mbox

Patch

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index a7e1f7d..63d43fc 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -428,14 +428,18 @@  static void rsi_mac80211_stop(struct ieee80211_hw *hw)
 {
 	struct rsi_hw *adapter = hw->priv;
 	struct rsi_common *common = adapter->priv;
+	u16 rx_filter_word = 0xffff;
 
 	rsi_dbg(ERR_ZONE, "===> Interface DOWN <===\n");
 	mutex_lock(&common->mutex);
 	common->iface_down = true;
 	wiphy_rfkill_stop_polling(hw->wiphy);
 
-	/* Block all rx frames */
-	rsi_send_rx_filter_frame(common, 0xffff);
+	if (!common->disc_in_prog) {
+		/* Block all rx frames */
+		rx_filter_word |= ~DISALLOW_BEACONS;
+		rsi_send_rx_filter_frame(common, rx_filter_word);
+	}
 
 	mutex_unlock(&common->mutex);
 }
diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c
index 7790314..96b36aa 100644
--- a/drivers/net/wireless/rsi/rsi_91x_main.c
+++ b/drivers/net/wireless/rsi/rsi_91x_main.c
@@ -350,6 +350,8 @@  struct rsi_hw *rsi_91x_init(u16 oper_mode)
 	timer_setup(&common->roc_timer, rsi_roc_timeout, 0);
 	init_completion(&common->wlan_init_completion);
 	common->init_done = true;
+	common->disc_in_prog = false;
+	common->bt_adapter = NULL;
 	adapter->device_model = RSI_DEV_9113;
 	common->oper_mode = oper_mode;
 	adapter->reg_mode = rsi_reg;
diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
index be8236f..f92909c 100644
--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
+++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
@@ -676,11 +676,13 @@  static int usb_ulp_read_write(struct rsi_hw *adapter, u16 addr, u32 data,
 	return 0;
 }
 
+#define FW_WDT_DISABLE_REQ              0x69
 static int rsi_reset_card(struct rsi_hw *adapter)
 {
 	int ret;
 
 	rsi_dbg(INFO_ZONE, "Resetting Card...\n");
+
 	rsi_usb_master_reg_write(adapter, RSI_TA_HOLD_REG, 0xE, 4);
 
 	/* This msleep will ensure Thread-Arch processor to go to hold
@@ -688,6 +690,13 @@  static int rsi_reset_card(struct rsi_hw *adapter)
 	 */
 	msleep(100);
 
+	if (rsi_usb_master_reg_write(adapter, SWBL_REGOUT,
+				     FW_WDT_DISABLE_REQ,
+				     RSI_COMMON_REG_SIZE) < 0) {
+		rsi_dbg(ERR_ZONE, "%s: FW WDT Disable failed...\n", __func__);
+		goto fail;
+	}
+
 	ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_1,
 				 RSI_ULP_WRITE_2, 32);
 	if (ret < 0)
@@ -804,6 +813,7 @@  static void rsi_disconnect(struct usb_interface *pfunction)
 
 	if (!adapter)
 		return;
+	adapter->priv->disc_in_prog = true;
 
 	rsi_mac80211_detach(adapter);
 	rsi_reset_card(adapter);
diff --git a/drivers/net/wireless/rsi/rsi_hal.h b/drivers/net/wireless/rsi/rsi_hal.h
index d6c2baa..327638c 100644
--- a/drivers/net/wireless/rsi/rsi_hal.h
+++ b/drivers/net/wireless/rsi/rsi_hal.h
@@ -115,6 +115,7 @@ 
 #define FW_FLASH_OFFSET			0x820
 #define LMAC_VER_OFFSET			(FW_FLASH_OFFSET + 0x200)
 #define MAX_DWORD_ALIGN_BYTES		64
+#define RSI_COMMON_REG_SIZE		2
 
 struct bl_header {
 	__le32 flags;
diff --git a/drivers/net/wireless/rsi/rsi_main.h b/drivers/net/wireless/rsi/rsi_main.h
index 4521c43..9e09dd5 100644
--- a/drivers/net/wireless/rsi/rsi_main.h
+++ b/drivers/net/wireless/rsi/rsi_main.h
@@ -325,6 +325,7 @@  struct rsi_common {
 	bool bgscan_en;
 	bool cancel_hwscan;
 	bool eapol4_confirm;
+	bool disc_in_prog;
 };
 
 struct eepromrw_info {