Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13464258ybl; Sun, 29 Dec 2019 12:29:54 -0800 (PST) X-Google-Smtp-Source: APXvYqxzASwKRTxVyuUuyd6WwvN1RXTt3NiDhykf9gdER9PCRwVqMV+I62aB26hO/5JErH8lPrHv X-Received: by 2002:a05:6830:4a4:: with SMTP id l4mr70991878otd.91.1577651394537; Sun, 29 Dec 2019 12:29:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577651394; cv=none; d=google.com; s=arc-20160816; b=vwqVqH7sIJNpsMVuy4Qph+9+saSuYVGOuWts9OSJ1pvYmhrRom+jOXD00Q5VMpfI4R veM5ECPphzZcXA/FrNZWSnkGGHubZEgoztQwz+FNoCvZGZC3F8NQftS5/5NRSpExwn1F tN8N8pxtZAiwT19Zm9vbOF6MI1jf4ESOQgmbe2YdENFZjCAsht4c7fr52wEE0EoVAlfR vEdjnE9KWltuoJ1B/aMzOzNyGTDCMhln6Nsd1FARYd1ZKVkp6XMW13DKsYkwJQBkZYT9 K+3hXOWu9kFmgKFqYPn4fYcTYgQcM49T3YEJEI+/H4pbcD9g5XmVoJ33HJdF7CogC+Fg m+Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nzYrK+uFHH0HjO8NjD3mXvKd/Qbi9/mkN0/oMyvEAIk=; b=XFJAWSRp/qKWGWnt2vtp88VkE0uVJmIji5Qn7MAlQV4i04OzIH4F0UGHqE7xfFrSkO rTL2mPUgINXFaF1XAv+5/zdZL22AVXhZLip9s3jeIXJoi6uSE/bspV2Sqwt8BElafyRC b5xIZ9zxcCJ1hvk9cIc+PpgQLkO/BaLuCFyJk1mgZ+AJ43u+B5AmoxJLpqhf0JwZ3vjP 0VwaJueR9+WnUnFImBEF8a8HpInzOwmqSVqHZDXA3n8SzYvkrTmsYxEP4ZqB2pdss//y eus2VeJPqpQ1Hjt0ZBqvsQ+jeg+5Kq5ZA9CHLInUP5KYOn1bq9rnQ8ZA1CK5Bs4N4V6m Fiew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zmBTh1dM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si20648921oia.264.2019.12.29.12.29.42; Sun, 29 Dec 2019 12:29:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zmBTh1dM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729226AbfL2Rbs (ORCPT + 99 others); Sun, 29 Dec 2019 12:31:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:59480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728949AbfL2Rbr (ORCPT ); Sun, 29 Dec 2019 12:31:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2007B20722; Sun, 29 Dec 2019 17:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640706; bh=W4hpWtdWAkWtDLqL7yCFe3I2YjLp5raAUKw1Kx9u9XI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zmBTh1dMOSAg5i0bFvnJOUhgeM+76+ObaKdpX8Lx6Qdr503strke4K09d4kUuF65j dI5rb7FyaRJ5+1Sjg26N7vSri+Cw2sqarYxSgFYCu4+7qMRZNwx8UyjNgveSUoTf4o UDwUa1ka+ZVVra7dfZFF7tA613KRyM06KSqVH6AU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Chiu , Jes Sorensen , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 088/219] rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot Date: Sun, 29 Dec 2019 18:18:10 +0100 Message-Id: <20191229162519.515718093@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Chiu [ Upstream commit 0eeb91ade90ce06d2fa1e2fcb55e3316b64c203c ] The RTL8723BU has problems connecting to AP after each warm reboot. Sometimes it returns no scan result, and in most cases, it fails the authentication for unknown reason. However, it works totally fine after cold reboot. Compare the value of register SYS_CR and SYS_CLK_MAC_CLK_ENABLE for cold reboot and warm reboot, the registers imply that the MAC is already powered and thus some procedures are skipped during driver initialization. Double checked the vendor driver, it reads the SYS_CR and SYS_CLK_MAC_CLK_ENABLE also but doesn't skip any during initialization based on them. This commit only tells the RTL8723BU to do full initialization without checking MAC status. Signed-off-by: Chris Chiu Signed-off-by: Jes Sorensen Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index 8828baf26e7b..47c2bfe06d03 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h @@ -1349,6 +1349,7 @@ struct rtl8xxxu_fileops { u8 has_s0s1:1; u8 has_tx_report:1; u8 gen2_thermal_meter:1; + u8 needs_full_init:1; u32 adda_1t_init; u32 adda_1t_path_on; u32 adda_2t_path_on_a; diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c index 26b674aca125..14e207f2466c 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c @@ -1673,6 +1673,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = { .has_s0s1 = 1, .has_tx_report = 1, .gen2_thermal_meter = 1, + .needs_full_init = 1, .adda_1t_init = 0x01c00014, .adda_1t_path_on = 0x01c00014, .adda_2t_path_on_a = 0x01c00014, diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 2b4fcdf4ec5b..66c6ee70f00a 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -3905,6 +3905,9 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) else macpower = true; + if (fops->needs_full_init) + macpower = false; + ret = fops->power_on(priv); if (ret < 0) { dev_warn(dev, "%s: Failed power on\n", __func__); -- 2.20.1