diff mbox series

[v2,4/6] mmc: sdhci-of-esdhc: add erratum eSDHC7 support

Message ID 20190228073618.16061-4-yinbo.zhu@nxp.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/6] mmc: sdhci-of-esdhc: add erratum eSDHC5 support | expand

Commit Message

Yinbo Zhu Feb. 28, 2019, 7:35 a.m. UTC
From: Yinbo Zhu <yinbo.zhu@nxp.com>

Invalid Transfer Complete (IRQSTAT[TC]) bit could be set during
multi-write operation even when the BLK_CNT in BLKATTR register
has not reached zero. Therefore, Transfer Complete might be
reported twice due to this erratum since a valid Transfer Complete
occurs when BLK_CNT reaches zero. This erratum is to fix this issue

Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
---
 drivers/mmc/host/sdhci.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

Comments

Adrian Hunter Feb. 28, 2019, 1:27 p.m. UTC | #1
On 28/02/19 9:35 AM, Yinbo Zhu wrote:
> From: Yinbo Zhu <yinbo.zhu@nxp.com>
> 
> Invalid Transfer Complete (IRQSTAT[TC]) bit could be set during
> multi-write operation even when the BLK_CNT in BLKATTR register
> has not reached zero. Therefore, Transfer Complete might be
> reported twice due to this erratum since a valid Transfer Complete
> occurs when BLK_CNT reaches zero. This erratum is to fix this issue
> 
> Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
> ---
>  drivers/mmc/host/sdhci.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 39bbbd7..2140762 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2985,6 +2985,15 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
>  		}
>  
>  		if (intmask & SDHCI_INT_DATA_END) {
> +			if (of_find_compatible_node(NULL, NULL,
> +							"fsl,p2020-esdhc")) {
> +				command = SDHCI_GET_CMD(sdhci_readw(host,
> +								SDHCI_COMMAND));
> +				if (command == MMC_WRITE_MULTIPLE_BLOCK &&
> +					sdhci_readw(host, SDHCI_BLOCK_COUNT)
> +					 != 0)
> +					return;
> +			}

Is it possible to do this with the host->ops->irq callback?  It should be
possible to clear the SDHCI_INT_DATA_END bit there although it will need to
be written back to SDHCI_INT_STATUS to clear that also.

>  			if (host->cmd == host->data_cmd) {
>  				/*
>  				 * Data managed to finish before the
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 39bbbd7..2140762 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2985,6 +2985,15 @@  static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 		}
 
 		if (intmask & SDHCI_INT_DATA_END) {
+			if (of_find_compatible_node(NULL, NULL,
+							"fsl,p2020-esdhc")) {
+				command = SDHCI_GET_CMD(sdhci_readw(host,
+								SDHCI_COMMAND));
+				if (command == MMC_WRITE_MULTIPLE_BLOCK &&
+					sdhci_readw(host, SDHCI_BLOCK_COUNT)
+					 != 0)
+					return;
+			}
 			if (host->cmd == host->data_cmd) {
 				/*
 				 * Data managed to finish before the