From patchwork Fri Jun 7 22:37:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10982869 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 7182114C0 for ; Fri, 7 Jun 2019 22:37:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FE7228BB8 for ; Fri, 7 Jun 2019 22:37:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5301628BE3; Fri, 7 Jun 2019 22:37:50 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB1F728BB8 for ; Fri, 7 Jun 2019 22:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vj2BpNSxjcdGmmUEJklYpHj7qM5PSFHOWh/WMMPqhDs=; b=DglWWoy1k/xt7j ujkM6J3h7QWf5qSv7uWSoU+Kkv7s5Pa18KDi09E0PtajJipypRohHq3x3DCgU77jesohni8HLXOMI TVCOvv1WwxM8RmaVnP0I6MWbqNf/BDVdPDpMflqJFNCddPEmbu4jhLqlne/VLnLYODU6dlNvvAi5h RBpqBNXWvm14nfhlBJ9E812o382LNW03eqM+xjIrU8KSI74ONknRWW7R6Ye+sOIBCnEhlMT2jArea PouyKkk8KW5wI2VMZ3TmewidrsQfeydrRcGj9oW3/imS2SQwkVG8w0uwMPLQi2RQVSvw/8Vg57M4y 9ano4fegk2acMQDLDVZw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUX-0004qn-4C; Fri, 07 Jun 2019 22:37:45 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUU-0004pP-5J for linux-rockchip@lists.infradead.org; Fri, 07 Jun 2019 22:37:43 +0000 Received: by mail-pl1-x641.google.com with SMTP id a93so1340155pla.7 for ; Fri, 07 Jun 2019 15:37:42 -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=npqZn7jrWknLiP6RpPMO0pPj6O8NQ9dRH7/VI2Vhthk=; b=hdMt7Tp8R3E0DReUmZ60ezy4X6bTQmVNpN9Xob9TjfIVuVL+nrVX7wdG3Y2lEjkEoe w7yjBbWqqH3/q7tBbdW4khMsRF5Fm+s4GofU3zrlvE3jW8r+me40NCIVGSVFt5KL9VVA g2YydiHRvFDQXquQIEaNZ1shPB2elvhqoQdmI= 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=npqZn7jrWknLiP6RpPMO0pPj6O8NQ9dRH7/VI2Vhthk=; b=oHnS+pjZgYpA1WA1pxO9puqb9F1v1jv3rSX2iR90/wv3CzYtsEMKppBDUQhe2FuzOO S81VHjTYQiwtwSbFUpsm5+emdLvPzfgye3JDqLDPPWoGbmvgchdvDK16+GprtVQS4tcu tij+WhGKxFkBkinZMbc2I2Yq4CpmA54YmLJ66FkFUOPO5Fa5FrmUK9Q45n1uihv8owQA BcxHDmT4HaCtHaQ0YK6xroV45UbY3M1fMisMuLVclNMBkoHF6IrQDzNzQ5U9rzZ2gPkx 7SgBRrCTzaQw6rjmUx05Js1HLtwqhBBTyTagmVkqhETt7/Va7a7YiJcZLMCk9Q7z6nq8 /aeQ== X-Gm-Message-State: APjAAAVb1DLWUzihWv5cON+M7WKmHlcIJJyFumsY6FpiDKMuy9UZ+/Yk O4TIRR4/wWeM2bM1jogvC571e1xwvTg= X-Google-Smtp-Source: APXvYqxe0jRoHVjH0j4kVqEfBP2PUF3gAe9VxHlJqI7LH0UKRSF8v7zzb19mCum1XWxKY7vDj7csbg== X-Received: by 2002:a17:902:522:: with SMTP id 31mr55340726plf.296.1559947061581; Fri, 07 Jun 2019 15:37:41 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id j23sm4185193pgb.63.2019.06.07.15.37.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 15:37:41 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Subject: [PATCH v3 1/5] Revert "brcmfmac: disable command decode in sdio_aos" Date: Fri, 7 Jun 2019 15:37:12 -0700 Message-Id: <20190607223716.119277-2-dianders@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190607223716.119277-1-dianders@chromium.org> References: <20190607223716.119277-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190607_153742_229024_D7E4A82C X-CRM114-Status: GOOD ( 13.55 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Madhan Mohan R , brcm80211-dev-list.pdl@broadcom.com, YueHaibing , linux-kernel@vger.kernel.org, Hante Meuleman , "David S. Miller" , netdev@vger.kernel.org, Chi-Hsien Lin , briannorris@chromium.org, linux-wireless@vger.kernel.org, Double Lo , Douglas Anderson , linux-rockchip@lists.infradead.org, mka@chromium.org, Wright Feng , =?utf-8?b?UmFmYcWC?= =?utf-8?b?IE1pxYJlY2tp?= , Michael Trimarchi , brcm80211-dev-list@cypress.com, Naveen Gupta , Franky Lin Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 29f6589140a10ece8c1d73f58043ea5b3473ab3e. 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 commit 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. Fixes: 29f6589140a1 ("brcmfmac: disable command decode in sdio_aos") Cc: Wright Feng Cc: Double Lo Cc: Madhan Mohan R Cc: Chi-Hsien Lin Signed-off-by: Douglas Anderson --- As far as I know this patch can land anytime. Changes in v3: None Changes in v2: - A full revert, not just a partial one (Arend). ...with explicit Cc. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 4e15ea57d4f5..4a750838d8cd 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -3364,11 +3364,7 @@ static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus, 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) + if (bus->ci->chip == CY_CC_43012_CHIP_ID) return true; else return false; From patchwork Fri Jun 7 22:37:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10982871 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 0F8A93A3F for ; Fri, 7 Jun 2019 22:37:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F15EB288B9 for ; Fri, 7 Jun 2019 22:37:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E490F28BE0; Fri, 7 Jun 2019 22:37:50 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C9968288B9 for ; Fri, 7 Jun 2019 22:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KWiaebgyjPiACz3rQfuaERh90KA1z5s++daMUCjjtcE=; b=YpjQLlSAq+kSJP U/xDEvKboXWNmGfJUPXVrKc/5A81IScqcb5ku3ANuY880BXbTmAez1Ss7CUCkNCMKFxH9MEIiqHjf ZiQFD++NTn/8ghvIxOEYSmWNqlULfCO/8ffcoqC+MIKnJ+kzz78TGea/i5ofdufs3YCYqpa7MJ/is kbk5DGunq6/ahET1ld+/dvMoTY/d4sIXf8YkMohlHQvIUuqs3ZuxEVnfV0CA2cbmlmn29aziQt9GV 11fhyO3yzKqPCZOtbsNCXd4vlvBWgJ6HVuo9aE8M4jympmvpC3uS0b/uuPkXLF+9a8DgNllwijRHE IjlfjlwK6k5Hf4wNWnMw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUY-0004si-M2; Fri, 07 Jun 2019 22:37:46 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUV-0004pr-Q0 for linux-rockchip@lists.infradead.org; Fri, 07 Jun 2019 22:37:45 +0000 Received: by mail-pl1-x643.google.com with SMTP id s24so1335980plr.8 for ; Fri, 07 Jun 2019 15:37:43 -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=U1Ebpn5sqJxVeDjM8NV6sp+M7Ulx/T6T1ihRForNiZk=; b=Fi4fr1iKul90yPOJYhRoZAs0JfmWDCdK83HoFAtKwI0sa5Hmq71Np5w+DUGRnvlKSA b2NFI2LFjgVQ90kWVGfFESnSRwT8+RuSbO0c7JI9vT7zJDfnv5W98nxlOQtdT3otquGX P6fGnDg2wLxeP+LllQUHw0fUUVAlmkG5hWQSI= 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=U1Ebpn5sqJxVeDjM8NV6sp+M7Ulx/T6T1ihRForNiZk=; b=juxWumW4bW3t7WbmjeRiaRmd9sLkNXxnLYVysKtNfEqei0iVl2EXvrpH3jJdUM/lLf vk3D0eU0+H/hFwdiNF1TetRMbmj96b42C1v7W3820StukEbCg6mhEok31DwVN/75gav3 zCbiGnBLh6S37/QORiIBRgr/gLTBAujU4a6eu2tS8j+WigXw1XdHjZdNd94hB4xkepkM JvZYm8X60DNCLccEf5SHSF6gistBFMwl00UEX+k564XFo/Up7mKMxGQzYh5cmvtyVl6U 3BWgcx1UcPerDJuovS98W/8fbuMiwgixTsiMNP65qP+2gBBfw5ylR7txLDMCs1aeg++C ByJg== X-Gm-Message-State: APjAAAVEBFHzBrvuaBfCvijp1I1pyib8BmrGROUBCLHYUZXcDWanUETg 8Iw4DF9ZjBQSMmCyXHtoaNHevA== X-Google-Smtp-Source: APXvYqx6fo8W+foYQLpakl+ecnh//DcmwJfox7qyAVeK0zqYD9gJhLmGN07/cvV+AvtMzg3L3jRNdA== X-Received: by 2002:a17:902:42e2:: with SMTP id h89mr58422930pld.332.1559947062929; Fri, 07 Jun 2019 15:37:42 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id j23sm4185193pgb.63.2019.06.07.15.37.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 15:37:42 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Subject: [PATCH v3 2/5] mmc: core: API for temporarily disabling auto-retuning due to errors Date: Fri, 7 Jun 2019 15:37:13 -0700 Message-Id: <20190607223716.119277-3-dianders@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190607223716.119277-1-dianders@chromium.org> References: <20190607223716.119277-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190607_153743_844733_96198F85 X-CRM114-Status: GOOD ( 21.79 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Madhan Mohan R , brcm80211-dev-list.pdl@broadcom.com, linux-kernel@vger.kernel.org, Wolfram Sang , netdev@vger.kernel.org, Chi-Hsien Lin , briannorris@chromium.org, linux-wireless@vger.kernel.org, Double Lo , Douglas Anderson , linux-rockchip@lists.infradead.org, Avri Altman , mka@chromium.org, Ritesh Harjani , Wright Feng , Jiong Wu , linux-mmc@vger.kernel.org, Shawn Lin , brcm80211-dev-list@cypress.com, Naveen Gupta Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Normally when the MMC core sees an "-EILSEQ" error returned by a host controller then it will trigger a retuning of the card. This is generally a good idea. However, if a command is expected to sometimes cause transfer errors then these transfer errors shouldn't cause a re-tuning. This re-tuning will be a needless waste of time. One example case where a transfer is expected to cause errors is when transitioning between idle (sometimes referred to as "sleep" in Broadcom code) and active state on certain Broadcom WiFi cards. Specifically if the card was already transitioning between states when the command was sent it could cause an error on the SDIO bus. Let's add an API that the SDIO card drivers can call that will temporarily disable the auto-tuning functionality. Then we can add a call to this in the Broadcom WiFi driver and any other driver that might have similar needs. NOTE: this makes the assumption that the card is already tuned well enough that it's OK to disable the auto-retuning during one of these error-prone situations. Presumably the driver code performing the error-prone transfer knows how to recover / retry from errors. ...and after we can get back to a state where transfers are no longer error-prone then we can enable the auto-retuning again. If we truly find ourselves in a case where the card needs to be retuned sometimes to handle one of these error-prone transfers then we can always try a few transfers first without auto-retuning and then re-try with auto-retuning if the first few fail. Without this change on rk3288-veyron-minnie I periodically see this in the logs of a machine just sitting there idle: dwmmc_rockchip ff0d0000.dwmmc: Successfully tuned phase to XYZ Fixes: bd11e8bd03ca ("mmc: core: Flag re-tuning is needed on CRC errors") Signed-off-by: Douglas Anderson --- Note that are are a whole boatload of different ways that we could provide an API for the Broadcom WiFi SDIO driver. This patch illustrates one way but if maintainers feel strongly that this is too ugly and have a better idea then I can give it a shot too. From a purist point of view I kinda felt that the "expect errors" really belonged as part of the mmc_request structure, but getting it into there meant changing a whole pile of core SD/MMC APIs. Simply adding it to the host seemed to match the current style better and was a less intrusive change. Changes in v3: - Took out the spinlock since I believe this is all in one context. Changes in v2: - Updated commit message to clarify based on discussion of v1. drivers/mmc/core/core.c | 19 +++++++++++++++++-- include/linux/mmc/core.h | 2 ++ include/linux/mmc/host.h | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 6db36dc870b5..bc109ec49406 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -144,8 +144,9 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) int err = cmd->error; /* Flag re-tuning needed on CRC errors */ - if ((cmd->opcode != MMC_SEND_TUNING_BLOCK && - cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200) && + if (cmd->opcode != MMC_SEND_TUNING_BLOCK && + cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200 && + !host->expect_errors && (err == -EILSEQ || (mrq->sbc && mrq->sbc->error == -EILSEQ) || (mrq->data && mrq->data->error == -EILSEQ) || (mrq->stop && mrq->stop->error == -EILSEQ))) @@ -2163,6 +2164,20 @@ int mmc_sw_reset(struct mmc_host *host) } EXPORT_SYMBOL(mmc_sw_reset); +void mmc_expect_errors_begin(struct mmc_host *host) +{ + WARN_ON(host->expect_errors); + host->expect_errors = true; +} +EXPORT_SYMBOL_GPL(mmc_expect_errors_begin); + +void mmc_expect_errors_end(struct mmc_host *host) +{ + WARN_ON(!host->expect_errors); + host->expect_errors = false; +} +EXPORT_SYMBOL_GPL(mmc_expect_errors_end); + static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq) { host->f_init = freq; diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 134a6483347a..02a13abf0cda 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -178,6 +178,8 @@ int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int mmc_hw_reset(struct mmc_host *host); int mmc_sw_reset(struct mmc_host *host); +void mmc_expect_errors_begin(struct mmc_host *host); +void mmc_expect_errors_end(struct mmc_host *host); void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card); #endif /* LINUX_MMC_CORE_H */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 43d0f0c496f6..8d553fb8c834 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -398,6 +398,7 @@ struct mmc_host { unsigned int retune_now:1; /* do re-tuning at next req */ unsigned int retune_paused:1; /* re-tuning is temporarily disabled */ unsigned int use_blk_mq:1; /* use blk-mq */ + unsigned int expect_errors:1; /* don't trigger retune upon errors */ int rescan_disable; /* disable card detection */ int rescan_entered; /* used with nonremovable devices */ From patchwork Fri Jun 7 22:37:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10982875 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 921FE14C0 for ; Fri, 7 Jun 2019 22:37:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82647288B9 for ; Fri, 7 Jun 2019 22:37:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75AFE28BDA; Fri, 7 Jun 2019 22:37:52 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A6A7288B9 for ; Fri, 7 Jun 2019 22:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u7Rn8Cp3E9wEQscPrbX7+SE4+DylKvm8tZfWJFskU/w=; b=eDoxLwz2unuw1c Biw03BVDmLgE0lOzv8OnxQDTAw57PbHbZPyn1URJLPqyxC3E0b1uXwx1mdoAov0V3HAJfXYf87q2w Bm2KQPyD2t0WPOYeoqBzursaKQ+JbeXZaXkopMM1usqKH/iX7a3v0bjWVXx8XDAr1zKkLAwR2rsD7 LxWeS14aR52dYjs2nC5A+FeO7hROm4gW48U1vTe6ZZ4yicq0BMw+ALPqBx2H7uWsxrITt4r9282/5 ZH5KDSHkjHUnGmkzg0gB4kxZbP/WOz4RQytATiCubJvw5jrPcj5LhpA/0JPa93zq64irUoDuVaWXG N3S9xkdxdWqAM2KeN4VQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUa-0004vF-Pc; Fri, 07 Jun 2019 22:37:48 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUW-0004qZ-LD for linux-rockchip@lists.infradead.org; Fri, 07 Jun 2019 22:37:45 +0000 Received: by mail-pl1-x643.google.com with SMTP id e5so1326784pls.13 for ; Fri, 07 Jun 2019 15:37: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=Z/Emr8zkD81f/RoFF2bpt9vXXmYuPgcPH/tJJB2TNkM=; b=oQQs34ffYiXMPOR36xOya64Dt1KgLnf9z1SV0HDmj0CMof30gz507FOLOXiwLZF9vI 1D4A3r35LVnz+omcfO1khnEJ5B5cf2uWoH3JxkZrIVrFp+vmy6UzYUj2ueHLGx4vpf7/ 59wQukIGshja6mS/TY/bI/w1srMb5f0chSNZ8= 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=Z/Emr8zkD81f/RoFF2bpt9vXXmYuPgcPH/tJJB2TNkM=; b=a2x7r5XRynkqz/erijCCz6FeGeFlxbHryRet87y5/dmAcBeUjh6bhtGjznFY4+h3Bs 8NLnUAkeDaEfRXllbIR9KelwWefK6E2a3Osu54rAnh0YY2lnOnguB+EgNzZA5ezek190 NGu65Fd8tQGFQ27rxo1Igy2UKBCW3L5gs0TSD/ZaGlF4sCZC2dpLpXpcMNqPauP7VYng FTDoCvSRF6+2qFFmTAzTw4s9WYP0JHaan6yq9pmMPYBIJvFsGiXVO4cOGza15cECrJhK WDM6gTgRc5kdHYyMRM47iUNmRg4V+UkIIkTeB7Wvvn8voD3SovXB4dM78nQQ3yaGfcFI XxcA== X-Gm-Message-State: APjAAAWB6mWjX5cNCPtoeNqZ7bs+4Jmn50oMcxIat3AFm1vgP8I7D/ur txTBjs2t0uoJbGlVSej2orBikA== X-Google-Smtp-Source: APXvYqyNw/yZY/ZbD9VOj7XTh2VyqbwOrp6QXWwuAPrgMHCzudlnfDTuWjve7w8tswOe88lOZPL0rQ== X-Received: by 2002:a17:902:290b:: with SMTP id g11mr57474438plb.26.1559947064218; Fri, 07 Jun 2019 15:37: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 j23sm4185193pgb.63.2019.06.07.15.37.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 15:37:43 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Subject: [PATCH v3 3/5] brcmfmac: sdio: Disable auto-tuning around commands expected to fail Date: Fri, 7 Jun 2019 15:37:14 -0700 Message-Id: <20190607223716.119277-4-dianders@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190607223716.119277-1-dianders@chromium.org> References: <20190607223716.119277-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190607_153744_690814_89945D6D X-CRM114-Status: GOOD ( 11.55 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Madhan Mohan R , brcm80211-dev-list.pdl@broadcom.com, YueHaibing , linux-kernel@vger.kernel.org, Hante Meuleman , "David S. Miller" , netdev@vger.kernel.org, Chi-Hsien Lin , briannorris@chromium.org, linux-wireless@vger.kernel.org, Double Lo , Douglas Anderson , linux-rockchip@lists.infradead.org, mka@chromium.org, Wright Feng , brcm80211-dev-list@cypress.com, Naveen Gupta , Franky Lin Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.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 --- Changes in v3: - Expect errors for all of brcmf_sdio_kso_control() (Adrian). Changes in v2: None drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 4a750838d8cd..4040aae1f9ed 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -667,6 +668,8 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) brcmf_dbg(TRACE, "Enter: on=%d\n", on); + mmc_expect_errors_begin(bus->sdiodev->func1->card->host); + wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); /* 1st KSO write goes to AOS wake up core if device is asleep */ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err); @@ -727,6 +730,8 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) if (try_cnt > MAX_KSO_ATTEMPTS) brcmf_err("max tries: rd_val=0x%x err=%d\n", rd_val, err); + mmc_expect_errors_end(bus->sdiodev->func1->card->host); + return err; } From patchwork Fri Jun 7 22:37:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10982877 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 03A8915E6 for ; Fri, 7 Jun 2019 22:37:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7790288B9 for ; Fri, 7 Jun 2019 22:37:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA98328BDA; Fri, 7 Jun 2019 22:37:55 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B5AA288B9 for ; Fri, 7 Jun 2019 22:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zg9THcfcGaN3jruG5eWB7rMqAVGqH5/WbQMBxwhQcsM=; b=iOIF1Z/3wo5hmq +i2Bldb8pxbiOyeBTFZAi9SDUzJTTIlUkYgjdVpJLMHuvXL0Hy3LEeSdohC6Cp5lHopfslEVSZPjI rAYeRR2GwtdeONkSQCR7veIxSEavhFNVsLbbgiYEAkMIbBXHMwB8hVqhcie0vIXIc/Mh0/YtqnY6D wLz3/POSe3TQyJs9oxJh4XMArUfLOCN07BOE9AmMt4vi02SXCoIAUgXst4b/RK5yx7GMl+zGZwcTy IlAZOkzeOPNRmMXd0F9uPTb0ukmqTrk2tY1ochUXH1+kSYvQpvMek6nqUvGpCeoYrakkztnNG0uMn y9iY07N2E1wvwbaioOsg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUe-0004zM-KX; Fri, 07 Jun 2019 22:37:52 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUX-0004rV-S9 for linux-rockchip@lists.infradead.org; Fri, 07 Jun 2019 22:37:47 +0000 Received: by mail-pl1-x641.google.com with SMTP id c5so1331529pll.11 for ; Fri, 07 Jun 2019 15:37:45 -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=8sTKn+NeNGftSNd5KJGe8Yb4ykjEmhycPSYA44kfjJY=; b=Ucg5J6CS84kZYZtbBhATrQIknzmFCKsyZ7LYk+YHEeYL4wOxQCtCRSkS3wIsUeuHkJ /LQxRvlY2IWw8HHiKuSX9ALH8ZzfyZEB4BNOJKcdMs2xn7gjThq+DFjBPyJ8y52VaHrx 2MH6k6VP9dROiEtG//1pGg4RL1jTW6bsCQPgg= 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=8sTKn+NeNGftSNd5KJGe8Yb4ykjEmhycPSYA44kfjJY=; b=KJabHM5GiMZYy1bENXUtfdmFz27Edkqp8aV6k9uMCILRWw9yu4mtjGdX6WKLRIhmBs QZNMGklzt51kNGSrOzyjtsq8UfeMAnsv6i20HfspXFNfOP3e7CFpGnIlXwk7JzxOmka6 fWAwOlY3jmy+4UzIgWy4xJAe8ikbQ6bc2P8lmHu21bnUIw8udmZ2G34O6OSR505vH4EQ QvYay+Li+Mf6ABNxzdJmJjBjAY7cvzCKH0w/mQCLd8JhV/2MfcX04Fvdr8ZYZumqcO6v 3IHrgC6O5H/WjBNfXfiXkbNxZ8IMlQLi8smbAHwljT8JOa4B3seFEKDvzYFvWSmFFdCf 4Uwg== X-Gm-Message-State: APjAAAXkF/FiZLsYkgpupa6B6nio9bty35+GLdSNNl2eLt62qHiofz5M 7VJanV7i+YEFMm4ngGSqm90Gcw== X-Google-Smtp-Source: APXvYqw1I/ZttnUQ8QkMd/Js4RpLH7dJjGMdXXIuPwxR4ePJkKWsj+UjjyQqqvZzmUs8Y7lbo3jcBw== X-Received: by 2002:a17:902:d88e:: with SMTP id b14mr7328462plz.153.1559947065437; Fri, 07 Jun 2019 15:37:45 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id j23sm4185193pgb.63.2019.06.07.15.37.44 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 15:37:44 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Subject: [PATCH v3 4/5] mmc: core: Export mmc_retune_hold_now() mmc_retune_release() Date: Fri, 7 Jun 2019 15:37:15 -0700 Message-Id: <20190607223716.119277-5-dianders@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190607223716.119277-1-dianders@chromium.org> References: <20190607223716.119277-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190607_153745_952791_B22B416A X-CRM114-Status: GOOD ( 10.67 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Madhan Mohan R , brcm80211-dev-list.pdl@broadcom.com, linux-kernel@vger.kernel.org, Pavel Machek , Linus Walleij , Martin Blumenstingl , netdev@vger.kernel.org, Chi-Hsien Lin , briannorris@chromium.org, linux-wireless@vger.kernel.org, Double Lo , Douglas Anderson , Mathieu Malaterre , linux-rockchip@lists.infradead.org, Tony Lindgren , mka@chromium.org, Wright Feng , Pan Bian , linux-mmc@vger.kernel.org, brcm80211-dev-list@cypress.com, Naveen Gupta Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We want SDIO drivers to be able to temporarily stop retuning when the driver knows that the SDIO card is not in a state where retuning will work (maybe because the card is asleep). We'll move the relevant functions to a place where drivers can call them. NOTE: We'll leave the calls with a mmc_ prefix following the lead of the API call mmc_hw_reset(), which is also expected to be called directly by SDIO cards. Signed-off-by: Douglas Anderson --- Changes in v3: - ("mmc: core: Export mmc_retune_hold_now() mmc_retune_release()") new for v3. Changes in v2: None drivers/mmc/core/host.c | 7 +++++++ drivers/mmc/core/host.h | 7 ------- include/linux/mmc/core.h | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 6a51f7a06ce7..361f4d151d20 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -111,6 +111,13 @@ void mmc_retune_hold(struct mmc_host *host) host->hold_retune += 1; } +void mmc_retune_hold_now(struct mmc_host *host) +{ + host->retune_now = 0; + host->hold_retune += 1; +} +EXPORT_SYMBOL(mmc_retune_hold_now); + void mmc_retune_release(struct mmc_host *host) { if (host->hold_retune) diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h index 4805438c02ff..3212afc6c9fe 100644 --- a/drivers/mmc/core/host.h +++ b/drivers/mmc/core/host.h @@ -19,17 +19,10 @@ void mmc_unregister_host_class(void); void mmc_retune_enable(struct mmc_host *host); void mmc_retune_disable(struct mmc_host *host); void mmc_retune_hold(struct mmc_host *host); -void mmc_retune_release(struct mmc_host *host); int mmc_retune(struct mmc_host *host); void mmc_retune_pause(struct mmc_host *host); void mmc_retune_unpause(struct mmc_host *host); -static inline void mmc_retune_hold_now(struct mmc_host *host) -{ - host->retune_now = 0; - host->hold_retune += 1; -} - static inline void mmc_retune_recheck(struct mmc_host *host) { if (host->hold_retune <= 1) diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 02a13abf0cda..53085245383c 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -181,5 +181,7 @@ int mmc_sw_reset(struct mmc_host *host); void mmc_expect_errors_begin(struct mmc_host *host); void mmc_expect_errors_end(struct mmc_host *host); void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card); +void mmc_retune_release(struct mmc_host *host); +void mmc_retune_hold_now(struct mmc_host *host); #endif /* LINUX_MMC_CORE_H */ From patchwork Fri Jun 7 22:37:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10982879 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 0FC2515E6 for ; Fri, 7 Jun 2019 22:37:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3E88288B9 for ; Fri, 7 Jun 2019 22:37:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E78A028BE0; Fri, 7 Jun 2019 22:37:57 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DC670288B9 for ; Fri, 7 Jun 2019 22:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/CmFE6e5cEG+RzA+fblAMD0JYE5xpl20naFWaC/WF+A=; b=BLmibyGS56hEvy vIPfLXZYtu5ngAbYELjYy2OwddaxeSGxSw7MZS66F94SSR8A8zXS7+BDNi6G8I/Ek2lrq8yYpsyDa kRYEK2EOhb4HmUJkxWtIKGLuEn0tYf1YkH508TEU1tvxTsYIy6WPEcsqbHfwRIhPx2sj5Snli20UR eZKoM7viHhsTu/tHx+zw/QcQqmPX1L10hYDNyAUTBHTJ+YXBGtH5MBabsOgnTt36sGNY7Lz0l4deJ DyX5uzN29pc2X6rZKnsJgpwN2NLQbvmurPdKNEBpseLvypV5Q3bxjxtX4YgkN+pxBTUqSFr/Z9Xuf FMHwZXxdQ2vDftOxj8lQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUg-00051O-B2; Fri, 07 Jun 2019 22:37:54 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hZNUZ-0004tH-6a for linux-rockchip@lists.infradead.org; Fri, 07 Jun 2019 22:37:48 +0000 Received: by mail-pg1-x543.google.com with SMTP id f25so1857705pgv.10 for ; Fri, 07 Jun 2019 15:37: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=z4uQcLhxDEep9Dd0+N4T4ar1lYZLNVNOCQMZpRaAcgQ=; b=Wu5ODvnEgN+Dz3rZXFZGppPRarqh2wkcmSq/jdU0lxIYcSNaG6l9SM/cQ7rqNOQ+cx zxBOamHsP0cMwIo+6syFyWFHtQZ64LbEArNImhJSma0pDWnZQVdsP77XNYh/mmK0Dm2q qWYduKxF+F5spTIpgm3Rypp+nRk8xG2J2D5aM= 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=z4uQcLhxDEep9Dd0+N4T4ar1lYZLNVNOCQMZpRaAcgQ=; b=PulFyIhUeVTTRMVTNmiS5t+XE68ADqHOs3Gja3qgVsx9MQw0n/Nw0m7fuZFgMilBNz iKzLMgm0sa6xaCQ0dFoAxpWEunDb5GpVOBGKTpLdagZ5xN+SkP6p7HmKqRY6VonQFT6S /+jvzbh5pJi/8ByKsJEWiN9rohcOOg/mw2FYzZ88smZjNiqaWFsRbdbYe1+MKnvlx90l aKtAK6Fc0y40JeMc7Cb0IkoNfWK/2wHlMSc2dV25oh7zgG4tjV1e1tJqZsDBWtPjDK/r Iv6APb1L+yqhIXP1uE+z6S5OdX8BFMHRamX8lZYtlmvcvd4P+CMY1xqe/S4FqAlo/uzB xqkQ== X-Gm-Message-State: APjAAAVR/QZ0ZDpK63/TXVvCmwYgyi8xh1j3fXuFGKO+jCShriPEVKhC 3eztevm+3TvVZc5jZ3ZyoqKoMP5Vf9s= X-Google-Smtp-Source: APXvYqxs31BYhnz3CuDYoW0F6K1ef/NQQc4dhUPxacP60w15cFP3tld8eeafi1pEevxCtCS+7gK93A== X-Received: by 2002:a17:90a:9504:: with SMTP id t4mr8420374pjo.100.1559947066689; Fri, 07 Jun 2019 15:37: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 j23sm4185193pgb.63.2019.06.07.15.37.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 15:37:46 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Subject: [PATCH v3 5/5] brcmfmac: sdio: Don't tune while the card is off Date: Fri, 7 Jun 2019 15:37:16 -0700 Message-Id: <20190607223716.119277-6-dianders@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190607223716.119277-1-dianders@chromium.org> References: <20190607223716.119277-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190607_153747_282473_044674A0 X-CRM114-Status: GOOD ( 13.98 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , Madhan Mohan R , brcm80211-dev-list.pdl@broadcom.com, YueHaibing , linux-kernel@vger.kernel.org, Hante Meuleman , "David S. Miller" , netdev@vger.kernel.org, Chi-Hsien Lin , briannorris@chromium.org, linux-wireless@vger.kernel.org, Double Lo , Douglas Anderson , linux-rockchip@lists.infradead.org, mka@chromium.org, Wright Feng , brcm80211-dev-list@cypress.com, Naveen Gupta , Franky Lin Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When Broadcom SDIO cards are idled they go to sleep and a whole separate subsystem takes over their SDIO communication. This is the Always-On-Subsystem (AOS) and it can't handle tuning requests. Specifically, as tested on rk3288-veyron-minnie (which reports having BCM4354/1 in dmesg), if I force a retune in brcmf_sdio_kso_control() when "on = 1" (aka we're transition from sleep to wake) by whacking: bus->sdiodev->func1->card->host->need_retune = 1 ...then I can often see tuning fail. In this case dw_mmc reports "All phases bad!"). Note that I don't get 100% failure, presumably because sometimes the card itself has already transitioned away from the AOS itself by the time we try to wake it up. If I force retuning when "on = 0" (AKA force retuning right before sending the command to go to sleep) then retuning is always OK. NOTE: we need _both_ this patch and the patch to avoid triggering tuning due to CRC errors in the sleep/wake transition, AKA ("brcmfmac: sdio: Disable auto-tuning around commands expected to fail"). Though both patches handle issues with Broadcom's AOS, the problems are distinct: 1. We want to defer (but not ignore) asynchronous (like timer-requested) tuning requests till the card is awake. However, we want to ignore CRC errors during the transition, we don't want to queue deferred tuning request. 2. You could imagine that the AOS could implement retuning but we could still get errors while transitioning in and out of the AOS. Similarly you could imagine a seamless transition into and out of the AOS (with no CRC errors) even if the AOS couldn't handle tuning. ALSO NOTE: presumably there is never a desperate need to retune in order to wake up the card, since doing so is impossible. Luckily the only way the card can get into sleep state is if we had a good enough tuning to send it a sleep command, so presumably that "good enough" tuning is enough to wake us up, at least with a few retries. Signed-off-by: Douglas Anderson --- Changes in v3: - ("brcmfmac: sdio: Don't tune while the card is off") new for v3. Changes in v2: None drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 4040aae1f9ed..98ffb4e90e15 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -670,6 +670,10 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) mmc_expect_errors_begin(bus->sdiodev->func1->card->host); + /* Cannot re-tune if device is asleep; defer till we're awake */ + if (on) + mmc_retune_hold_now(bus->sdiodev->func1->card->host); + wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); /* 1st KSO write goes to AOS wake up core if device is asleep */ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err); @@ -730,6 +734,9 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) if (try_cnt > MAX_KSO_ATTEMPTS) brcmf_err("max tries: rd_val=0x%x err=%d\n", rd_val, err); + if (on) + mmc_retune_release(bus->sdiodev->func1->card->host); + mmc_expect_errors_end(bus->sdiodev->func1->card->host); return err;