From patchwork Mon Mar 5 14:36:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 10259149 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AF2C360365 for ; Mon, 5 Mar 2018 14:49:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FC5B28880 for ; Mon, 5 Mar 2018 14:49:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94A7D28A8F; Mon, 5 Mar 2018 14:49:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 263A028880 for ; Mon, 5 Mar 2018 14:49:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752300AbeCEOtU (ORCPT ); Mon, 5 Mar 2018 09:49:20 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:42892 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270AbeCEOtS (ORCPT ); Mon, 5 Mar 2018 09:49:18 -0500 Received: by mail-pf0-f196.google.com with SMTP id a16so7275003pfn.9 for ; Mon, 05 Mar 2018 06:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/ZLlUVQG1PIpS7m+Gx4UVhnnocwHY61e2FwAEeYOWTM=; b=cq0KifGeDVQQKTLwrA0CgoZilUpIfqkdLbcLhtpQ9oVN4Hne2R3Vmh6K5or3tAlEFD vAUy/38aTDqFT/yM9t4yon4OIf8KGmyHcZJplFCQbGO92W6jyiFyLre2MNwBnR1Ifu6P foUtscpG9nf//rGDNtjW5e37Y78zAi5eVtrNUPvob9E8zYwXnXCyNIpT0hiHQP02uKOQ +DMEOIDu1pm2pfK1QkuwXpa/IRg50QY6AZuz/o9TxnD98EuizaXZX7KX2IvmiR6ix5vo VH/emUPpPwZFa0iRMIqUDC5V22542mA0WkzrnpZ+2QnSlM8UxYebpyTd+8RMUZV1wZ0m eUhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/ZLlUVQG1PIpS7m+Gx4UVhnnocwHY61e2FwAEeYOWTM=; b=ty9Y/cra40xIyzLaolDg7PQpqmX1Ka2eZZEQTX8yVKZvibKpHc5MvHc9mqF6P4FtAn bxHoFZZKQCMTx/deNRs9sMPI4zuuizieK6vmSc0TEixUUg69RMTCJfXbz/2FRjHcaObl i9SEyZ0cdykQZBdzIiUp8I8Qvxxk6jb3yn67oOHCxxtjdNnibkLpDljmZJEBMiAVRZWr q5olyt0UbJPNJDr120KRKLRGm5B1NAjs51pR06HGbLZ4D7mMU10H4dVfe/5JotDqqcH/ VzjWBaT4zE7MAKzmXXIcSJ335AExggbFGBITOwIYMJIE0iC0ovD1AXQwB+Tu7t1g/jYx vr6A== X-Gm-Message-State: APf1xPC3XHLjajlnosKoSKIhgdblrM3KZWwreCPiv+RE7n9DvBX9o8y0 Bmg2HvtG/T9dJIwyu+/SbEs= X-Google-Smtp-Source: AG47ELsySpfHLwU+ZGiKfglDSZq7n5m2IX92hu3T1khcc+6v/3vIw4G74LfvTKepApU79RtlMFUb0g== X-Received: by 10.99.125.78 with SMTP id m14mr12451843pgn.391.1520261358190; Mon, 05 Mar 2018 06:49:18 -0800 (PST) Received: from cpu185.redpinesignals.com ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id i1sm29164845pfi.116.2018.03.05.06.49.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 06:49:17 -0800 (PST) From: Amitkumar Karwar To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Amitkumar Karwar , Siva Rebbagondla , Prameela Rani Garnepudi Subject: [PATCH 08/10] rsi: device disconnect changes Date: Mon, 5 Mar 2018 20:06:58 +0530 Message-Id: <1520260620-4694-9-git-send-email-amitkarwar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520260620-4694-1-git-send-email-amitkarwar@gmail.com> References: <1520260620-4694-1-git-send-email-amitkarwar@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Prameela Rani Garnepudi 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 --- 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(-) 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 {