diff mbox series

[RFT,3/3] mmc: sdhci-of-arasan: Fix Command Queuing enable handling

Message ID 20191230092343.30692-4-faiz_abbas@ti.com (mailing list archive)
State New, archived
Headers show
Series Fix issues with command queuing in arasan controllers | expand

Commit Message

Faiz Abbas Dec. 30, 2019, 9:23 a.m. UTC
There is a need to dump data from the buffer before enabling command
queuing because of leftover data from tuning. Reset the data lines to
fix this at the source.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

Comments

Shawn Lin Jan. 3, 2020, 12:36 a.m. UTC | #1
On 2019/12/30 17:23, Faiz Abbas wrote:
> There is a need to dump data from the buffer before enabling command
> queuing because of leftover data from tuning. Reset the data lines to
> fix this at the source.
> 

It seems to work for my platform by porting it to 4.19 LTS.

Tested-by: Shawn Lin <shawn.lin@rock-chips.com>

> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> ---
>   drivers/mmc/host/sdhci-of-arasan.c | 21 ++++-----------------
>   1 file changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index e49b44b4d82e..1495ae72b902 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -376,22 +376,8 @@ static void sdhci_arasan_dumpregs(struct mmc_host *mmc)
>   	sdhci_dumpregs(mmc_priv(mmc));
>   }
>   
> -static void sdhci_arasan_cqe_enable(struct mmc_host *mmc)
> -{
> -	struct sdhci_host *host = mmc_priv(mmc);
> -	u32 reg;
> -
> -	reg = sdhci_readl(host, SDHCI_PRESENT_STATE);
> -	while (reg & SDHCI_DATA_AVAILABLE) {
> -		sdhci_readl(host, SDHCI_BUFFER);
> -		reg = sdhci_readl(host, SDHCI_PRESENT_STATE);
> -	}
> -
> -	sdhci_cqe_enable(mmc);
> -}
> -
>   static const struct cqhci_host_ops sdhci_arasan_cqhci_ops = {
> -	.enable         = sdhci_arasan_cqe_enable,
> +	.enable         = sdhci_cqe_enable,
>   	.disable        = sdhci_cqe_disable,
>   	.dumpregs       = sdhci_arasan_dumpregs,
>   };
> @@ -410,8 +396,9 @@ static const struct sdhci_ops sdhci_arasan_cqe_ops = {
>   static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = {
>   	.ops = &sdhci_arasan_cqe_ops,
>   	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
> -	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
> -			SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
> +	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN	|
> +		   SDHCI_QUIRK2_RESET_DATA_POST_TUNING	|
> +		   SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
>   };
>   
>   static struct sdhci_arasan_of_data sdhci_arasan_rk3399_data = {
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index e49b44b4d82e..1495ae72b902 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -376,22 +376,8 @@  static void sdhci_arasan_dumpregs(struct mmc_host *mmc)
 	sdhci_dumpregs(mmc_priv(mmc));
 }
 
-static void sdhci_arasan_cqe_enable(struct mmc_host *mmc)
-{
-	struct sdhci_host *host = mmc_priv(mmc);
-	u32 reg;
-
-	reg = sdhci_readl(host, SDHCI_PRESENT_STATE);
-	while (reg & SDHCI_DATA_AVAILABLE) {
-		sdhci_readl(host, SDHCI_BUFFER);
-		reg = sdhci_readl(host, SDHCI_PRESENT_STATE);
-	}
-
-	sdhci_cqe_enable(mmc);
-}
-
 static const struct cqhci_host_ops sdhci_arasan_cqhci_ops = {
-	.enable         = sdhci_arasan_cqe_enable,
+	.enable         = sdhci_cqe_enable,
 	.disable        = sdhci_cqe_disable,
 	.dumpregs       = sdhci_arasan_dumpregs,
 };
@@ -410,8 +396,9 @@  static const struct sdhci_ops sdhci_arasan_cqe_ops = {
 static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = {
 	.ops = &sdhci_arasan_cqe_ops,
 	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
-	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
-			SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN	|
+		   SDHCI_QUIRK2_RESET_DATA_POST_TUNING	|
+		   SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
 };
 
 static struct sdhci_arasan_of_data sdhci_arasan_rk3399_data = {