From patchwork Thu Jun 13 23:41:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10993863 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 2CC441398 for ; Thu, 13 Jun 2019 23:42:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CD2526E55 for ; Thu, 13 Jun 2019 23:42:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10A6926E90; Thu, 13 Jun 2019 23:42:28 +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 ACF7F26E55 for ; Thu, 13 Jun 2019 23:42:27 +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=XPqPjhLTkiOmsPmoqF357FxR1XngNBbY8aY3grpHq/g=; b=DuAy6g2TeEjy02 2/l6vlu0KHzEuhAJpXCUW8YG+OQQ8rTuryBos8LQHnPFuskpZQsHhxjiZ1e/DBQlLCdpWYjjH1gOA RWAmFJQd+nIiu9oAQcJ2cynzG39jrOwmLQlZqCcxJB436dKVjQOCrzUVQyTKX14X3pTQsbWuXlgOl WK4OXm+43bfUhPreGyixJ4pDOsxZRPE1Iz0lDs1BfB0tGMqEI/JJGeYR858kxvDSvy0ztAGR/+CNs shArpengfDciXse3PcpkiTxibLE3mk32b8BEqP/+tWD3gn4st0boEd2FW8quEsosla9d5FwGozjBt oP5N6jnj7shYOAPfo45A==; 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 1hbZMH-0004kZ-L0; Thu, 13 Jun 2019 23:42:17 +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 1hbZMC-0004et-O7 for linux-rockchip@lists.infradead.org; Thu, 13 Jun 2019 23:42:14 +0000 Received: by mail-pl1-x643.google.com with SMTP id c14so192086plo.0 for ; Thu, 13 Jun 2019 16:42:12 -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=c7083/wRDhjfXKIPLOR/z/xGqx+N3NzGcEXMjAPkrtk=; b=iJ2vRTDhZeW4lVDaqVPjbVshWP4qjnkSnSGc+SrRGQ5aAPmwmUXkPpXZGJjODoGMiE z9Jm0f9FJ8ZQqbLU8oFkC1ru/LfZlKOFSblwIEKz0JHO/x4QY+girk7kLvPF2SnSW6iP u/ybRoaZsNnm7HpTBOdVgcftH21NcEWRLr7p8= 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=c7083/wRDhjfXKIPLOR/z/xGqx+N3NzGcEXMjAPkrtk=; b=r5YT7kfrYhvLOEiPS5XyQCe/zeiEMJBhKtUgjmgS9QFC0dwYIT0ayfD7hqLSmoPE5M jMYWiojTQUMx1/8uX46BfTmOshcFD3k1GeDvhEDfiC0S2dsMzLfWQ54Ey1JmMvc0Hum/ dNOBofR7U4ZOarg5rL71tLq08u/aNrUEn+n0iXUcNN+11cU465KKlrQRABRkhitVq6T9 XOCmUL5H6ADajrOMklK6w0Mhz5vXslxQGh/NpyMHRRqjfnz6bV3h57+hPG+6q5/NyEmu GivIpme78YbPmI1//YXgfgRrFWkNTM6eHvnoyIvwV/Ltz8Fv5RTeFbce/i8r7seWDFcU iOKQ== X-Gm-Message-State: APjAAAW3EbAa6Yh/+u0U+iiI1VsbIgcdGkikxaTOmen2ySypwB3wPDJ4 PqoMowQwuPF+aDcH/qzPENNgiQ== X-Google-Smtp-Source: APXvYqwoIyI7QZt4blA5Q5la53DjUJQtY42TC4Gcx1xTxy4vkRuynr/kzG9FYakwMCM6kZGmAeP4XA== X-Received: by 2002:a17:902:8d92:: with SMTP id v18mr67370527plo.211.1560469331903; Thu, 13 Jun 2019 16:42:11 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id p7sm781088pfp.131.2019.06.13.16.42.10 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 13 Jun 2019 16:42:11 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Subject: [PATCH v4 3/5] brcmfmac: sdio: Disable auto-tuning around commands expected to fail Date: Thu, 13 Jun 2019 16:41:51 -0700 Message-Id: <20190613234153.59309-4-dianders@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190613234153.59309-1-dianders@chromium.org> References: <20190613234153.59309-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190613_164212_804685_47FD3BC2 X-CRM114-Status: GOOD ( 10.03 ) 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: "David S. Miller" , Madhan Mohan R , brcm80211-dev-list.pdl@broadcom.com, YueHaibing , linux-kernel@vger.kernel.org, Hante Meuleman , Hans de Goede , 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 Acked-by: Adrian Hunter Reviewed-by: Arend van Spriel --- Changes in v4: - Adjust to API rename (Adrian, Ulf). 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 4a750838d8cd..ee76593259a7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -667,6 +667,8 @@ brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) brcmf_dbg(TRACE, "Enter: on=%d\n", on); + sdio_retune_crc_disable(bus->sdiodev->func1); + 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 +729,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); + sdio_retune_crc_enable(bus->sdiodev->func1); + return err; }