Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6448936ybi; Wed, 5 Jun 2019 00:56:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxECI527OnEVAQNDByPzJGMc26/T5ZxEc0czMxKiOZ2pDeS9kaYiF+mwapI4UV9FH7hTwDM X-Received: by 2002:a17:90a:26cf:: with SMTP id m73mr42003524pje.90.1559721379751; Wed, 05 Jun 2019 00:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559721379; cv=none; d=google.com; s=arc-20160816; b=ujQ0JEhBKYqOz3jz/zKTgIYmj9XRgmPblTVXbQeTV/8nfoc493xrvAoK2FRtYByxae BJtz6xAS6D2/7JczL+BHYZdXnMVEv/iSV/K4SVB3w1uYTYt9gn5AaH/70psKpet/QSwv kI3qDlm2ByusuFtIwUv31xRbu4pcMaI/vaFxFSo/g0mpXCb4pDoZwZhqUw1VNWGJhJxP A1+3vVptPdJeqFSbnu6BKbeQO2WTRQQbPdMAqiGf6sPxY44tLHe7tSffm+GRfkbT4CYH rntpsyL5rDN9bsJ3J4yVC4tfnDvy/RYH+6TsCfir0tAmeoN0/fw5Vcx0dCDoSfXiEQZf X+7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=aiue8tHWiumr4g0nytcyTjYaJHwPhuqRgFXgCDSDwM0=; b=XLtyXHN/YYu3OX57IHNbIcB4Df+VbIvD/D/pC5nzJq8uOvOMjFBNz4dJ1NcZ60FV08 2zU96f7dPRmr4vP5nQnwabJkML2GayIFmunb9NCnQIGEuJe+fW0AfssdpeJsbbqeF8Qb MFcQCqMSzKZVS7BbdyJ07PLciSNfw5INYkYNDXwNoeNVX9QrP3P2KXM6rrZ0+9Y6BBWO X4NhTjN/QjDxnZ6fub8vt2MhhrhoaOnhI+UVlitczRgpw+LllbV82yEB3viS3RmpcIXX raYAjJ8h+RNloP7zaLHqJ+yamQ3st0Bq/4e/xVt0n3XUbK4qp/ktE78qDjV3y9WK/+1G 4Qig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=KGG4kw7m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18si25586759plq.297.2019.06.05.00.56.03; Wed, 05 Jun 2019 00:56:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=KGG4kw7m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726568AbfFEHy4 (ORCPT + 99 others); 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-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)