public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Prathamesh Shete <pshete@nvidia.com>,
	ulf.hansson@linaro.org, thierry.reding@gmail.com,
	jonathanh@nvidia.com, p.zabel@pengutronix.de,
	linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: anrao@nvidia.com, smangipudi@nvidia.com, kyarlagadda@nvidia.com
Subject: Re: [PATCH v4 3/4] mmc: sdhci-tegra: Issue CMD and DAT resets together
Date: Tue, 27 Sep 2022 13:23:41 +0300	[thread overview]
Message-ID: <df68846a-2a09-ef98-6823-d536d99ccb61@intel.com> (raw)
In-Reply-To: <20220927100946.19482-3-pshete@nvidia.com>

On 27/09/22 13:09, Prathamesh Shete wrote:
> In case of error condition to avoid system crash
> Tegra SDMMC controller requires CMD and DAT resets
> issued together. SDHCI controller FSM goes into
> bad state due to rapid SD card hot-plug event.
> Issuing reset on the CMD FSM before DATA FSM results
> in kernel panic, hence add support to issue CMD and
> DAT resets together.
> This is applicable to Tegra186 and later chips.
> 
> Signed-off-by: Aniruddha TVS Rao <anrao@nvidia.com>
> Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
> ---
>  drivers/mmc/host/sdhci-tegra.c | 3 ++-
>  drivers/mmc/host/sdhci.c       | 8 +++++++-
>  drivers/mmc/host/sdhci.h       | 2 ++
>  3 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
> index 46f37cc26dbb..61dc5ee0726d 100644
> --- a/drivers/mmc/host/sdhci-tegra.c
> +++ b/drivers/mmc/host/sdhci-tegra.c
> @@ -1536,7 +1536,8 @@ static const struct sdhci_pltfm_data sdhci_tegra186_pdata = {
>  		  SDHCI_QUIRK_NO_HISPD_BIT |
>  		  SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
>  		  SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
> -	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> +	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
> +		   SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER,
>  	.ops  = &tegra186_sdhci_ops,
>  };
>  
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 2b5dda521b0e..5123ec3fc74a 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -266,12 +266,14 @@ enum sdhci_reset_reason {
>  	SDHCI_RESET_FOR_TUNING_ABORT,
>  	SDHCI_RESET_FOR_CARD_REMOVED,
>  	SDHCI_RESET_FOR_CQE_RECOVERY,
> +	SDHCI_RESET_FOR_CMD_DAT_TOGETHER,
>  };
>  
>  static void sdhci_reset_for_reason(struct sdhci_host *host, enum sdhci_reset_reason reason)
>  {
>  	switch (reason) {
>  	case SDHCI_RESET_FOR_INIT:
> +	case SDHCI_RESET_FOR_CMD_DAT_TOGETHER:
>  		sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
>  		break;
>  	case SDHCI_RESET_FOR_REQUEST_ERROR:
> @@ -3084,7 +3086,11 @@ static bool sdhci_request_done(struct sdhci_host *host)
>  			/* This is to force an update */
>  			host->ops->set_clock(host, host->clock);
>  
> -		sdhci_reset_for(host, REQUEST_ERROR);
> +		if (host->quirks2 &
> +			SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER)
> +			sdhci_reset_for(host, CMD_DAT_TOGETHER);
> +		else
> +			sdhci_reset_for(host, REQUEST_ERROR);

This is what I am trying to avoid because it is inconsistent.
Consider:
 - why is the quirk needed for some REQUEST_ERRORs but not others?
 - or why is the quirk not needed for all CMD / DAT resets?

So, I was expecting the quirk to be applied in sdhci_reset_for_reason()
not here.

>  
>  		host->pending_reset = false;
>  	}
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index d750c464bd1e..6a5766774b05 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -478,6 +478,8 @@ struct sdhci_host {
>   * block count.
>   */
>  #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT			(1<<18)
> +/* Issue CMD and DATA reset together */
> +#define SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER	(1<<19)
>  
>  	int irq;		/* Device IRQ */
>  	void __iomem *ioaddr;	/* Mapped address */


  reply	other threads:[~2022-09-27 10:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26  9:49 [PATCH v3 1/4] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Prathamesh Shete
2022-09-26  9:49 ` [PATCH v3 2/4] mmc: sdhci-tegra: Add support to program MC stream ID Prathamesh Shete
2022-09-26  9:49 ` [PATCH v3 3/4] mmc: sdhci-tegra: Issue CMD and DAT resets together Prathamesh Shete
2022-09-26 19:26   ` Adrian Hunter
2022-09-27 10:09     ` [PATCH v4 1/4] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Prathamesh Shete
2022-09-27 10:09       ` [PATCH v4 2/4] mmc: sdhci-tegra: Add support to program MC stream ID Prathamesh Shete
2022-09-27 10:09       ` [PATCH v4 3/4] mmc: sdhci-tegra: Issue CMD and DAT resets together Prathamesh Shete
2022-09-27 10:23         ` Adrian Hunter [this message]
2022-09-27 11:13           ` [PATCH v5 1/3] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Prathamesh Shete
2022-09-27 11:13             ` [PATCH v5 2/3] mmc: sdhci-tegra: Add support to program MC stream ID Prathamesh Shete
2022-09-27 12:45               ` Adrian Hunter
2022-09-28 12:56                 ` [PATCH v6 1/4] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Prathamesh Shete
2022-09-28 12:56                   ` [PATCH v6 2/4] mmc: sdhci-tegra: Add support to program MC stream ID Prathamesh Shete
2022-09-28 14:18                     ` Adrian Hunter
2022-10-06 10:52                       ` Thierry Reding
2022-10-06 13:06                         ` [PATCH v7 1/4] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Prathamesh Shete
2022-10-06 13:06                           ` [PATCH v7 2/4] mmc: sdhci-tegra: Add support to program MC stream ID Prathamesh Shete
2022-10-11  9:58                             ` Ulf Hansson
2022-10-11 11:44                               ` Prathamesh Shete
2022-10-11 12:33                                 ` Ulf Hansson
2022-10-13  6:33                                   ` Prathamesh Shete
2022-10-13 13:43                                     ` Ulf Hansson
2022-10-14  7:24                                       ` [PATCH v8 1/3] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Prathamesh Shete
2022-10-14  7:24                                         ` [PATCH v8 2/3] mmc: sdhci-tegra: Add support to program MC stream ID Prathamesh Shete
2022-10-14 13:38                                           ` Ulf Hansson
2022-10-14  7:24                                         ` [PATCH v8 3/3] mmc: sdhci-tegra: Issue CMD and DAT resets together Prathamesh Shete
2022-10-14  7:28                                           ` Prathamesh Shete
2022-10-17 14:11                                       ` [PATCH v7 2/4] mmc: sdhci-tegra: Add support to program MC stream ID Thierry Reding
2022-10-18 10:10                                         ` Ulf Hansson
2022-10-06 13:06                           ` [PATCH v7 3/4] mmc: sdhci-tegra: Issue CMD and DAT resets together Prathamesh Shete
2022-10-06 13:06                           ` [PATCH v7 4/4] mmc: sdhci-tegra: Use actual clock rate for SW tuning correction Prathamesh Shete
2022-10-07  9:04                             ` Ulf Hansson
2022-09-28 12:56                   ` [PATCH v6 3/4] mmc: sdhci-tegra: Issue CMD and DAT resets together Prathamesh Shete
2022-09-28 12:56                   ` [PATCH v6 4/4] mmc: sdhci-tegra: Use actual clock rate for SW tuning correction Prathamesh Shete
2022-09-27 11:13             ` [PATCH v5 3/3] mmc: sdhci-tegra: Issue CMD and DAT resets together Prathamesh Shete
2022-09-27 12:49               ` Adrian Hunter
2022-09-27 11:13             ` [PATCH v5 4/4] mmc: sdhci-tegra: Use actual clock rate for SW tuning correction Prathamesh Shete
2022-09-27 10:09       ` [PATCH v4 " Prathamesh Shete
2022-09-26  9:49 ` [PATCH v3 " Prathamesh Shete

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df68846a-2a09-ef98-6823-d536d99ccb61@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=anrao@nvidia.com \
    --cc=jonathanh@nvidia.com \
    --cc=kyarlagadda@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pshete@nvidia.com \
    --cc=smangipudi@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox