linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-of-esdhc: re-implement erratum A-009204 workaround
@ 2019-12-19  3:23 Yangbo Lu
  2019-12-19  7:17 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Yangbo Lu @ 2019-12-19  3:23 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson, Adrian Hunter, Rasmus Villemoes, Yinbo Zhu
  Cc: Yangbo Lu

The erratum A-009204 workaround patch was reverted because of
incorrect implementation.

8b6dc6b mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add
        erratum A-009204 support"

This patch is to re-implement the workaround (add a 5 ms delay
before setting SYSCTL[RSTD] to make sure all the DMA transfers
are finished).

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/mmc/host/sdhci-of-esdhc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 4abb781..cd3b676 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -80,6 +80,7 @@ struct sdhci_esdhc {
 	bool quirk_tuning_erratum_type1;
 	bool quirk_tuning_erratum_type2;
 	bool quirk_ignore_data_inhibit;
+	bool quirk_delay_before_data_reset;
 	bool in_sw_tuning;
 	unsigned int peripheral_clock;
 	const struct esdhc_clk_fixup *clk_fixup;
@@ -759,6 +760,11 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask)
 	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	u32 val;
 
+	if (esdhc->quirk_delay_before_data_reset &&
+	    (mask & SDHCI_RESET_DATA) &&
+	    (host->flags & SDHCI_REQ_USE_DMA))
+		mdelay(5);
+
 	sdhci_reset(host, mask);
 
 	sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
@@ -1218,6 +1224,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 	if (match)
 		esdhc->clk_fixup = match->data;
 	np = pdev->dev.of_node;
+
+	if (of_device_is_compatible(np, "fsl,p2020-esdhc"))
+		esdhc->quirk_delay_before_data_reset = true;
+
 	clk = of_clk_get(np, 0);
 	if (!IS_ERR(clk)) {
 		/*
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc: sdhci-of-esdhc: re-implement erratum A-009204 workaround
  2019-12-19  3:23 [PATCH] mmc: sdhci-of-esdhc: re-implement erratum A-009204 workaround Yangbo Lu
@ 2019-12-19  7:17 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2019-12-19  7:17 UTC (permalink / raw)
  To: Yangbo Lu; +Cc: linux-mmc, Adrian Hunter, Rasmus Villemoes, Yinbo Zhu

On Thu, 19 Dec 2019 at 04:24, Yangbo Lu <yangbo.lu@nxp.com> wrote:
>
> The erratum A-009204 workaround patch was reverted because of
> incorrect implementation.
>
> 8b6dc6b mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add
>         erratum A-009204 support"
>
> This patch is to re-implement the workaround (add a 5 ms delay
> before setting SYSCTL[RSTD] to make sure all the DMA transfers
> are finished).
>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

That was quick! :-)

Applied for fixes and by adding a fixes/stable tag, thanks!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-of-esdhc.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 4abb781..cd3b676 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -80,6 +80,7 @@ struct sdhci_esdhc {
>         bool quirk_tuning_erratum_type1;
>         bool quirk_tuning_erratum_type2;
>         bool quirk_ignore_data_inhibit;
> +       bool quirk_delay_before_data_reset;
>         bool in_sw_tuning;
>         unsigned int peripheral_clock;
>         const struct esdhc_clk_fixup *clk_fixup;
> @@ -759,6 +760,11 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask)
>         struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
>         u32 val;
>
> +       if (esdhc->quirk_delay_before_data_reset &&
> +           (mask & SDHCI_RESET_DATA) &&
> +           (host->flags & SDHCI_REQ_USE_DMA))
> +               mdelay(5);
> +
>         sdhci_reset(host, mask);
>
>         sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
> @@ -1218,6 +1224,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
>         if (match)
>                 esdhc->clk_fixup = match->data;
>         np = pdev->dev.of_node;
> +
> +       if (of_device_is_compatible(np, "fsl,p2020-esdhc"))
> +               esdhc->quirk_delay_before_data_reset = true;
> +
>         clk = of_clk_get(np, 0);
>         if (!IS_ERR(clk)) {
>                 /*
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-19  7:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19  3:23 [PATCH] mmc: sdhci-of-esdhc: re-implement erratum A-009204 workaround Yangbo Lu
2019-12-19  7:17 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).