diff mbox series

[<PATCH,v1>,6/9] mmc: sdhci-msm: Ignore data timeout error for R1B commands

Message ID 22061d3479b876e8590b966162d6385a47f851b1.1576540908.git.nguyenb@codeaurora.org
State New
Headers show
Series SD card bug fixes | expand

Commit Message

Bao D. Nguyen Dec. 17, 2019, 2:50 a.m. UTC
From: Sahitya Tummala <stummala@codeaurora.org>

Ignore data timeout error for R1B commands as there will be no
data associated and the busy timeout value for these commands
could be lager than the maximum timeout value that controller
can handle.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
---
 drivers/mmc/host/sdhci.c | 15 +++++++++------
 drivers/mmc/host/sdhci.h |  7 +++++++
 2 files changed, 16 insertions(+), 6 deletions(-)

Comments

Greg Kroah-Hartman Dec. 18, 2019, 8:34 a.m. UTC | #1
On Mon, Dec 16, 2019 at 06:50:39PM -0800, Bao D. Nguyen wrote:
> From: Sahitya Tummala <stummala@codeaurora.org>
> 
> Ignore data timeout error for R1B commands as there will be no
> data associated and the busy timeout value for these commands
> could be lager than the maximum timeout value that controller
> can handle.
> 
> Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
> Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
> ---
>  drivers/mmc/host/sdhci.c | 15 +++++++++------
>  drivers/mmc/host/sdhci.h |  7 +++++++
>  2 files changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index c04e1ac..0a05d74 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2925,12 +2925,6 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
>  		 * above in sdhci_cmd_irq().
>  		 */
>  		if (data_cmd && (data_cmd->flags & MMC_RSP_BUSY)) {
> -			if (intmask & SDHCI_INT_DATA_TIMEOUT) {
> -				host->data_cmd = NULL;
> -				data_cmd->error = -ETIMEDOUT;
> -				__sdhci_finish_mrq(host, data_cmd->mrq);
> -				return;
> -			}
>  			if (intmask & SDHCI_INT_DATA_END) {
>  				host->data_cmd = NULL;
>  				/*
> @@ -2944,6 +2938,15 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
>  				__sdhci_finish_mrq(host, data_cmd->mrq);
>  				return;
>  			}
> +			if (host->quirks2 &
> +				SDHCI_QUIRK2_IGNORE_DATATOUT_FOR_R1BCMD)
> +				return;
> +			if (intmask & SDHCI_INT_DATA_TIMEOUT) {
> +				host->data_cmd = NULL;
> +				data_cmd->error = -ETIMEDOUT;
> +				__sdhci_finish_mrq(host, data_cmd->mrq);
> +				return;
> +			}
>  		}
>  
>  		/*
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0ed3e0e..1a88f74 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -482,6 +482,13 @@ struct sdhci_host {
>   * block count.
>   */
>  #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT			(1<<18)
> +/*
> + * Ignore data timeout error for R1B commands as there will be no
> + * data associated and the busy timeout value for these commands
> + * could be lager than the maximum timeout value that controller
> + * can handle.
> + */
> +#define SDHCI_QUIRK2_IGNORE_DATATOUT_FOR_R1BCMD         (1<<19)

No tabs?

And what about using BIT(19) instead?

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c04e1ac..0a05d74 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2925,12 +2925,6 @@  static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 		 * above in sdhci_cmd_irq().
 		 */
 		if (data_cmd && (data_cmd->flags & MMC_RSP_BUSY)) {
-			if (intmask & SDHCI_INT_DATA_TIMEOUT) {
-				host->data_cmd = NULL;
-				data_cmd->error = -ETIMEDOUT;
-				__sdhci_finish_mrq(host, data_cmd->mrq);
-				return;
-			}
 			if (intmask & SDHCI_INT_DATA_END) {
 				host->data_cmd = NULL;
 				/*
@@ -2944,6 +2938,15 @@  static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 				__sdhci_finish_mrq(host, data_cmd->mrq);
 				return;
 			}
+			if (host->quirks2 &
+				SDHCI_QUIRK2_IGNORE_DATATOUT_FOR_R1BCMD)
+				return;
+			if (intmask & SDHCI_INT_DATA_TIMEOUT) {
+				host->data_cmd = NULL;
+				data_cmd->error = -ETIMEDOUT;
+				__sdhci_finish_mrq(host, data_cmd->mrq);
+				return;
+			}
 		}
 
 		/*
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 0ed3e0e..1a88f74 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -482,6 +482,13 @@  struct sdhci_host {
  * block count.
  */
 #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT			(1<<18)
+/*
+ * Ignore data timeout error for R1B commands as there will be no
+ * data associated and the busy timeout value for these commands
+ * could be lager than the maximum timeout value that controller
+ * can handle.
+ */
+#define SDHCI_QUIRK2_IGNORE_DATATOUT_FOR_R1BCMD         (1<<19)
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */