From patchwork Mon Jun 17 17:56: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: 10999901 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 6F50B1398 for ; Mon, 17 Jun 2019 17:59:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 655D32898D for ; Mon, 17 Jun 2019 17:59:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 591AE289C5; Mon, 17 Jun 2019 17:59:11 +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 E93362898D for ; Mon, 17 Jun 2019 17:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728721AbfFQR7K (ORCPT ); Mon, 17 Jun 2019 13:59:10 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40540 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728711AbfFQR7J (ORCPT ); Mon, 17 Jun 2019 13:59:09 -0400 Received: by mail-pl1-f195.google.com with SMTP id a93so4398998pla.7 for ; Mon, 17 Jun 2019 10:59:09 -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=O3PB3xTklEmW3AoAowBmJggSurvgbCg3QOQ9X2qUJD4=; b=RboDbIDvgfV7dMa9VFb+74vgJFX6x47CzOGrFGwjfZWx5qTQzJLKX7DFLbYN926L3+ 5TghUkIKYttbsX6x/9xsWht/HRlB7c1tJJklBRT45jHnPf2Qw1JviIvXt2wDSNJQvJIa 9bxI4a9kWmsXHtMmE2XQ/j2f2fC8WP9mba6mw= 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=O3PB3xTklEmW3AoAowBmJggSurvgbCg3QOQ9X2qUJD4=; b=JxlCCOoh8O8VNGDevl+jITEPfyG1I+wIMPoTlzLo6KkOlbF+3wP5Vix0FsZUZhZ4O3 VVlXkkNgjhjkErQ9a3Hwu+9FRaGeiP+U++XNqKvkK2NS5sQ+/x0itgfugv+c1HbRlv1B aI2ZnZhGNP1rDf2Wl1+VzIFBYMIoAQHn7/3CMdgy8E63xlAhETBgdOFdrr0/uSokMGB8 z1z9HxH9hAKYimKTVnK9YDkfPx3UeDYQsIAZFSUuFI1G24tLvDZpMIfNOGukgu/1+15r hk1YhfejJSmChRUCwF1gMSoU/X9nD5sVrU4N8rF6FLLlFXCxgEMe6aLdayZAw1Nw/+nm ekJQ== X-Gm-Message-State: APjAAAV7fSJtWDlNy/Dhy8b2P6+UFTDYPqpStRJLgTTS9jJ+6ml5C/Gg lVZ0k/UqUNLoPo23P0rx8oQuuQ== X-Google-Smtp-Source: APXvYqwYSPmzyzQ5e2M8XtYApTa8vYDOCWFfkZGGCKzwG2cujAwMW6h8gJ+jE8rwNjGGmVTtaAqMcA== X-Received: by 2002:a17:902:24c:: with SMTP id 70mr108322563plc.2.1560794349089; Mon, 17 Jun 2019 10:59:09 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id q1sm15145809pfn.178.2019.06.17.10.59.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 10:59:06 -0700 (PDT) From: Douglas Anderson To: Ulf Hansson , Kalle Valo , Adrian Hunter , Arend van Spriel Cc: brcm80211-dev-list.pdl@broadcom.com, linux-rockchip@lists.infradead.org, Double Lo , briannorris@chromium.org, linux-wireless@vger.kernel.org, Naveen Gupta , Madhan Mohan R , mka@chromium.org, Wright Feng , Chi-Hsien Lin , netdev@vger.kernel.org, brcm80211-dev-list@cypress.com, Douglas Anderson , stable@vger.kernel.org, "David S. Miller" , Franky Lin , linux-kernel@vger.kernel.org, Hante Meuleman , YueHaibing , Michael Trimarchi Subject: [PATCH v5 3/5] brcmfmac: sdio: Disable auto-tuning around commands expected to fail Date: Mon, 17 Jun 2019 10:56:51 -0700 Message-Id: <20190617175653.21756-4-dianders@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617175653.21756-1-dianders@chromium.org> References: <20190617175653.21756-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. Commit notes: Patches #2 - #5 will go through Ulf's tree. This patch is still lacking Kalle Valo's Ack, which should probably be received before landing in Ulf's tree. END Fixes: bd11e8bd03ca ("mmc: core: Flag re-tuning is needed on CRC errors") Cc: stable@vger.kernel.org Signed-off-by: Douglas Anderson Acked-by: Adrian Hunter Reviewed-by: Arend van Spriel --- Changes in v5: None 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; }