From patchwork Fri May 17 22:54:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10948785 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-2.web.codeaurora.org (Postfix) with ESMTP id E38B11398 for ; Fri, 17 May 2019 22:55:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0CC427F88 for ; Fri, 17 May 2019 22:55:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C33E828434; Fri, 17 May 2019 22:55:03 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 BDC6927F88 for ; Fri, 17 May 2019 22:55:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729588AbfEQWyq (ORCPT ); Fri, 17 May 2019 18:54:46 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40744 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729476AbfEQWyp (ORCPT ); Fri, 17 May 2019 18:54:45 -0400 Received: by mail-pg1-f195.google.com with SMTP id d30so3950258pgm.7 for ; Fri, 17 May 2019 15:54:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kE32OCklpIZXO7svMqG/W8w7+/cFFktuMCsLmJ9iAxQ=; b=j738cSt9G+eC+Ssi6Mhsw32N5TiBKHXPoJHB8D/AEDypV+5B0elAKCdF6PlzOM6OcS rbZQn5r0unqEm9W5BfrmtQTF+g0qfmROnRX2xCe1NjJ64kzHNg820UnDDryZLzrD8T2m etwXw4YU1QMMjXANx95rOa5DruCs5yslqOl6w= 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:mime-version:content-transfer-encoding; bh=kE32OCklpIZXO7svMqG/W8w7+/cFFktuMCsLmJ9iAxQ=; b=RF064xn+EaNlhF7bVt6ZXT3RL7CMobjBxx8yCAqz5MiVVbsysJh3WvHM8Wt6hQYU/2 Cm/uSmq8PZzNqOBjH97FRpMHR0QRJSyzDoc/Z1Wlyc5L6s+vC19EaCelP90Z5Su7K/7q X07CdmrTUbC3UfY5adKMJgh9txBPwSG6taZKAqmJbsOr5R3ouuU5ftR/CG+mGyrK0dk3 dRXeDpGrEd7siTY49mrlCKLrod/YoyQeVhOdjP6lZ2M4vP6I/F3KryAjx8nzBzAo6JsU dsBPXT1JMSCv181M5/UMdBYAm5YblZq+p0Rp32wQBVLkdyipDPKWYAoKC7B2oU2EDaop KO1A== X-Gm-Message-State: APjAAAVAzzdGtHDuJyz4xoRxV5B9SNtZ0bu7JpPbdNGQMQCpLi06mN6j jhTO2+q4zMlzepO30DbGaHi4UA== X-Google-Smtp-Source: APXvYqw3Pllw0o/YaHOCk+UhRzInd8A3zNoabhFlV045lJlGWBCfwcMIFoinD8muUSpjk/9MTo4nVw== X-Received: by 2002:a63:ee0b:: with SMTP id e11mr6703708pgi.453.1558133684631; Fri, 17 May 2019 15:54:44 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id u11sm11174450pfh.130.2019.05.17.15.54.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 15:54:44 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Cc: linux-rockchip@lists.infradead.org, Double Lo , briannorris@chromium.org, Madhan Mohan R , mka@chromium.org, Wright Feng , Chi-Hsien Lin , Douglas Anderson , brcm80211-dev-list.pdl@broadcom.com, Franky Lin , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Madhan Mohan R , Hante Meuleman , Naveen Gupta , brcm80211-dev-list@cypress.com, YueHaibing , "David S. Miller" Subject: [PATCH 1/3] brcmfmac: re-enable command decode in sdio_aos for BRCM 4354 Date: Fri, 17 May 2019 15:54:18 -0700 Message-Id: <20190517225420.176893-2-dianders@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190517225420.176893-1-dianders@chromium.org> References: <20190517225420.176893-1-dianders@chromium.org> MIME-Version: 1.0 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 In commit 29f6589140a1 ("brcmfmac: disable command decode in sdio_aos") we disabled something called "command decode in sdio_aos" for a whole bunch of Broadcom SDIO WiFi parts. After that patch landed I find that my kernel log on rk3288-veyron-minnie and rk3288-veyron-speedy is filled with: brcmfmac: brcmf_sdio_bus_sleep: error while changing bus sleep state -110 This seems to happen every time the Broadcom WiFi transitions out of sleep mode. Reverting the part of the commit that affects the WiFi on my boards fixes the problem for me, so that's what this patch does. Note that, in general, the justification in the original commit seemed a little weak. It looked like someone was testing on a SD card controller that would sometimes die if there were CRC errors on the bus. This used to happen back in early days of dw_mmc (the controller on my boards), but we fixed it. Disabling a feature on all boards just because one SD card controller is broken seems bad. ...so instead of just this patch possibly the right thing to do is to fully revert the original commit. Fixes: 29f6589140a1 ("brcmfmac: disable command decode in sdio_aos") Signed-off-by: Douglas Anderson --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 22b73da42822..3fd2d58a3c88 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -3378,8 +3378,7 @@ static bool brcmf_sdio_aos_no_decode(struct brcmf_sdio *bus) if (bus->ci->chip == CY_CC_43012_CHIP_ID || bus->ci->chip == CY_CC_4373_CHIP_ID || bus->ci->chip == BRCM_CC_4339_CHIP_ID || - bus->ci->chip == BRCM_CC_4345_CHIP_ID || - bus->ci->chip == BRCM_CC_4354_CHIP_ID) + bus->ci->chip == BRCM_CC_4345_CHIP_ID) return true; else return false; From patchwork Fri May 17 22:54:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10948777 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-2.web.codeaurora.org (Postfix) with ESMTP id 6A77D1398 for ; Fri, 17 May 2019 22:54:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58AA11FF7E for ; Fri, 17 May 2019 22:54:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C844284BF; Fri, 17 May 2019 22:54:54 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 E32DF1FF7E for ; Fri, 17 May 2019 22:54:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729685AbfEQWys (ORCPT ); Fri, 17 May 2019 18:54:48 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:39066 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729671AbfEQWyr (ORCPT ); Fri, 17 May 2019 18:54:47 -0400 Received: by mail-pg1-f196.google.com with SMTP id w22so3949463pgi.6 for ; Fri, 17 May 2019 15:54:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jmrinjUmvX+AQ+lipzMHtBZaQD2gwKEewfCw3RvxUZk=; b=YBy/i07qpQlrvxx+6Ohii/hGKkEYRmpgmxzUqTc6t6e7jWY6J0RFRRoni7Yc9uR55E dOjuS+sxiF3k24jBmU7V/xt3JzhbBVbS1Jb28lbbMPZ8uBUX67zRh9M3rxqKH17xRDfC 1JyFzVqKbemtnksZtgFzqdiY3uYO5HgqwLLb0= 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:mime-version:content-transfer-encoding; bh=jmrinjUmvX+AQ+lipzMHtBZaQD2gwKEewfCw3RvxUZk=; b=YUpnsAFHmN0p8wSyNxLf1RO3diWkkdmLnjrOw22BYrXeVfczRC/w2UYUgFtbDqp1rn b1us+fG3HIy4sYgYn8ct+IeVp5ShzGkJP9ujs6AKu1siHduqjQUXgZzqtKs/NmDK0tGA 8j1PoYyBAWIS0QfTOW8j15hqoDVV9xN2w0HeYvEE4DOJF8/fTfQQ89+EYTKnnQll4iJK 1eg3trjgd1GfN1J/FV+/ce7I1J+8OB/EBAP7kb4nUbqP9+JNtUXfz5FPX2U93SZWe3EF gEMp9gQyPlZ4JZLBLOv2SXV8DZDeTXlvhe7xvPiTLPLCyZxjh+gXcSeed5FzlXVwVUfE wZWg== X-Gm-Message-State: APjAAAW7Z8H39aZHpPGCWCLinioBjpYnTVmeA2Ne8oCyHYxRlOBOyugG 35/00dIuL9bnG0fuAN3m6HSTsQ== X-Google-Smtp-Source: APXvYqzxf9q2pzvCOer/zrm6/W4Z5BkzeAcb6pguC267JTog7JQqRYkt2ViDmHMU+7mEiD3cc9ESaA== X-Received: by 2002:a65:628b:: with SMTP id f11mr57246101pgv.95.1558133686865; Fri, 17 May 2019 15:54:46 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id u11sm11174450pfh.130.2019.05.17.15.54.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 15:54:46 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Cc: linux-rockchip@lists.infradead.org, Double Lo , briannorris@chromium.org, Madhan Mohan R , mka@chromium.org, Wright Feng , Chi-Hsien Lin , Douglas Anderson , brcm80211-dev-list.pdl@broadcom.com, "David S. Miller" , Franky Lin , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Hante Meuleman , Naveen Gupta , brcm80211-dev-list@cypress.com, YueHaibing , Michael Trimarchi Subject: [PATCH 3/3] brcmfmac: sdio: Disable auto-tuning around commands expected to fail Date: Fri, 17 May 2019 15:54:20 -0700 Message-Id: <20190517225420.176893-4-dianders@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190517225420.176893-1-dianders@chromium.org> References: <20190517225420.176893-1-dianders@chromium.org> MIME-Version: 1.0 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 There are certain cases, notably when transitioning between sleep and active state, when Broadcom SDIO WiFi cards will produce errors on the SDIO bus. This is evident from the source code where you can see that we try commands in a loop until we either get success or we've tried too many times. The comment in the code reinforces this by saying "just one write attempt may fail" Unfortunately these failures sometimes end up causing an "-EILSEQ" back to the core which triggers a retuning of the SDIO card and that blocks all traffic to the card until it's done. Let's disable retuning around the commands we expect might fail. Fixes: bd11e8bd03ca ("mmc: core: Flag re-tuning is needed on CRC errors") Signed-off-by: Douglas Anderson --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 3fd2d58a3c88..c09bb8965487 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -708,6 +709,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) bmask = SBSDIO_FUNC1_SLEEPCSR_KSO_MASK; } + mmc_expect_errors_begin(bus->sdiodev->func1->card->host); do { /* reliable KSO bit set/clr: * the sdiod sleep write access is synced to PMU 32khz clk @@ -730,6 +732,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) &err); } while (try_cnt++ < MAX_KSO_ATTEMPTS); + mmc_expect_errors_end(bus->sdiodev->func1->card->host); if (try_cnt > 2) brcmf_dbg(SDIO, "try_cnt=%d rd_val=0x%x err=%d\n", try_cnt,