From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C77BC282DE for ; Wed, 5 Jun 2019 07:54:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 505D72083E for ; Wed, 5 Jun 2019 07:54:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="KGG4kw7m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726599AbfFEHy4 (ORCPT ); Wed, 5 Jun 2019 03:54:56 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35741 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbfFEHy4 (ORCPT ); Wed, 5 Jun 2019 03:54:56 -0400 Received: by mail-pl1-f194.google.com with SMTP id p1so9395562plo.2 for ; Wed, 05 Jun 2019 00:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aiue8tHWiumr4g0nytcyTjYaJHwPhuqRgFXgCDSDwM0=; b=KGG4kw7mp5EISlgpPMNpn5iOHG3+VLhZMDhZ+778rosnxJtQ2DdjdZ5tkcWiWRFGGX 13t7oW58cPGQVxfvPViY7GfglNUiaobpnuA5U9Lhk/zaJJvJa8iiwJxVGhf39no86EP+ tHTVDIzoVY5+6E11qiOyJvAD7RzmosldNH4nY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aiue8tHWiumr4g0nytcyTjYaJHwPhuqRgFXgCDSDwM0=; b=eDzgyR6xekyuf4AxZa/HE+0/FBynI6cRSkGmWA9djHMxr+x+1IPvrlmNpqYKybEsH8 rjYF9EiBOxCfLm7cdbKawmJWugbG6IF2FdV2l9tO6aJCXiHqSXkXKzEz593cm+Ywq1cD kT87IrMoeh5yjVfJPqv6+Xf2TTets16I9vXavNZ9rWFEAh5PB3LnrSxCIdP4vlhIStp4 3EWnxcaMhgBUz/7I24V1LMx9jXY3+wXLL3zX/amlMN05tNpvJ3PEovIJ3OTPOX0AUb0f yuLxB5Kwo6h7Khvp1cF0QYmnWKutqSNrXVo7s3c9nWbA2lB6JCxiELr/FNByc32ip6lj xvRg== X-Gm-Message-State: APjAAAWGYFczKiIAlf1aQrlKp9NCeoMm2LgBZG1fLpP1oWrrdXh2wkxP kxIWGQW8yjT5Wb5cJpOnK7JCLA== X-Google-Smtp-Source: APXvYqx1Gbz9qsU2PuuHu8YloVvKfIX0ptj4e8Hzpp+GXSquNY3RQsHEhI2ABswO9YBHJkaCFOSHnA== X-Received: by 2002:a17:902:8a87:: with SMTP id p7mr25322779plo.124.1559721294846; Wed, 05 Jun 2019 00:54:54 -0700 (PDT) Received: from [10.230.40.234] ([192.19.215.250]) by smtp.gmail.com with ESMTPSA id 11sm28366590pfu.155.2019.06.05.00.54.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 00:54:54 -0700 (PDT) Subject: Re: [PATCH v2 2/3] mmc: core: API for temporarily disabling auto-retuning due to errors To: Douglas Anderson , Ulf Hansson , Kalle Valo , Adrian Hunter 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, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Lin , Wolfram Sang , Avri Altman References: <20190603183740.239031-1-dianders@chromium.org> <20190603183740.239031-3-dianders@chromium.org> From: Arend Van Spriel Message-ID: <25fe1725-76fa-2739-1427-b0e8823ea4ae@broadcom.com> Date: Wed, 5 Jun 2019 09:54:48 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190603183740.239031-3-dianders@chromium.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/3/2019 8:37 PM, Douglas Anderson wrote: > 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. Hi Doug, Sorry for bringing this up, but there used to be an issue with retuning in general, ie. the device handled tuning command 19 only once after startup. I guess that is no longer an issue given your results. I guess the problem goes away when you disable device sleep functionality. No what you want in terms of power consumption, but would be good to know. You can disable it with below patch. Regards, Arend --- diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers index 15a40fd..18e90bd 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -307,7 +307,7 @@ struct rte_console { #define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change * when idle */ -#define BRCMF_IDLE_INTERVAL 1 +#define BRCMF_IDLE_INTERVAL 0 #define KSO_WAIT_US 50 #define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US)