From patchwork Sun Nov 13 11:17:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Day X-Patchwork-Id: 9424771 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 6290C6047D for ; Sun, 13 Nov 2016 11:39:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E7C828B1D for ; Sun, 13 Nov 2016 11:39:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FD7228B23; Sun, 13 Nov 2016 11:39:04 +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 E6F2E28B1D for ; Sun, 13 Nov 2016 11:39:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933926AbcKMLjC (ORCPT ); Sun, 13 Nov 2016 06:39:02 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34283 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933275AbcKMLi7 (ORCPT ); Sun, 13 Nov 2016 06:38:59 -0500 Received: by mail-pf0-f194.google.com with SMTP id y68so4640820pfb.1 for ; Sun, 13 Nov 2016 03:38:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=7w7ybMvJ0u2Jvuia9msqyctVK7AhVJ/ootBkPcw9TWw=; b=Pb9BT3vyqwIjEuS3skbIkPbcxyP8b79e5Wn2xMl5uheVJEGEJzulyHr10m6pj5hukU WLqCiy3+nRZxVWtgul1EsFkVr+juP9hWB6HVPHfUMRlki4M9EAvEJOPU1KXSKoRASYAA fmspcNQ5QvKlxvOE8U1pbUJuWemROsktTrkn2gfjiqOkHP0EbdcIgA+ag7SVnSES63so guTfUxw/OHyjVrF1f4FSABAXXbvwGXNS0NPsgqJLDh7UwvLRVhubQjvyVk0cLcyxfDJM UAHUutoWldMtA055QpgiZjCFa7QEMmzzF4X1u9uxGi6EzJ8nqZjdiSqgAN5jdRDX9fd5 CPhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=7w7ybMvJ0u2Jvuia9msqyctVK7AhVJ/ootBkPcw9TWw=; b=Rc2ja2ux3xZgRxW1eeZdWbgI3SwAahy+ayC0IJoiTNN3SF1sfq7aBCY5hQEXdp1EGQ iFTWNubd76dH+xlRs6d4lBL6niIP9083Vdi1cx7d1cFqQQZgr/1M/5mXfktKegzM+WVI LItNiOisQHVK4FHWCStcm/bJgUmBJrQGfnjhgryMNHGo3uu3ghRu4OO7Ucy/dPKdyySm xT5v6q3xc3km6uSUIEc3rm0CnLobmpQI5azLk+h3B9uKxElPMn/4mR/9PokuVVw0sF7I 3i36JU3R23vuJQy0ev192TasCn0BliuHE3iELAyTtzt1g/dgd/c8yXjE8XD5NwGj9E7x 9TuA== X-Gm-Message-State: ABUngveBrFEQ+VmlbHOGAm7usFR49TkfjpqnVJh6p9vcHNvMrTrlAyHkW6kPkKtYEMDQvw== X-Received: by 10.99.123.87 with SMTP id k23mr60689070pgn.101.1479036021059; Sun, 13 Nov 2016 03:20:21 -0800 (PST) Received: from box64.home.org (182-239-181-56.ip.adam.com.au. [182.239.181.56]) by smtp.gmail.com with ESMTPSA id t20sm27653429pfk.48.2016.11.13.03.20.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Nov 2016 03:20:20 -0800 (PST) Date: Sun, 13 Nov 2016 21:17:09 +1000 From: Barry Day To: Jes Sorensen Cc: Kalle Valo , linux-wireless@vger.kernel.org Subject: [PATCH] rtl8xxxu: Fix failure to reconnect to AP Message-ID: <20161113111705.GA2393@box64.home.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.1 (2016-04-27) 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 The rtl8192e and rtl8723 fail to reconnect to an AP after being disconnected. Ths patch fixes that without affecting the rtl8192cu. I don't have a rtl8723 to test but it has been tested on a rtl8192eu. After going through the orginal realtek code for the rtl8723, I am confident the patch is applicable to both. Signed-off-by: Barry Day --- rtl8xxxu_core.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rtl8xxxu_core.c b/rtl8xxxu_core.c index 04141e5..6ac10d2 100644 --- a/rtl8xxxu_core.c +++ b/rtl8xxxu_core.c @@ -4372,17 +4372,25 @@ void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv, void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, u8 macid, bool connect) { + u8 val8; struct h2c_cmd h2c; memset(&h2c, 0, sizeof(struct h2c_cmd)); h2c.media_status_rpt.cmd = H2C_8723B_MEDIA_STATUS_RPT; - if (connect) + if (connect) { h2c.media_status_rpt.parm |= BIT(0); - else - h2c.media_status_rpt.parm &= ~BIT(0); + rtl8xxxu_gen2_h2c_cmd(priv, &h2c, + sizeof(h2c.media_status_rpt)); + } else { + val8 = rtl8xxxu_read8(priv, REG_BEACON_CTRL); + val8 &= ~BEACON_FUNCTION_ENABLE; + + rtl8xxxu_write8(priv, REG_BEACON_CTRL, val8); + rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x00); + rtl8xxxu_write8(priv, REG_DUAL_TSF_RST, (BIT(0) | BIT(1))); + } - rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.media_status_rpt)); } void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv) @@ -4515,6 +4523,8 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, sgi = 1; rcu_read_unlock(); + rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0xffff); + priv->fops->update_rate_mask(priv, ramask, sgi); rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff);