* [PATCH] mmc: dw_mmc: avoid write to CDTHRCTL on older versions
@ 2014-11-17 17:49 James Hogan
2014-11-18 0:45 ` Jaehoon Chung
2014-11-19 10:53 ` Ulf Hansson
0 siblings, 2 replies; 3+ messages in thread
From: James Hogan @ 2014-11-17 17:49 UTC (permalink / raw)
To: Jaehoon Chung, Seungwon Jeon
Cc: James Hogan, stable, Chris Ball, Ulf Hansson, linux-mmc
Commit f1d2736c8156 (mmc: dw_mmc: control card read threshold) added
dw_mci_ctrl_rd_thld() with an unconditional write to the CDTHRCTL
register at offset 0x100. However before version 240a, the FIFO region
started at 0x100, so the write messes with the FIFO and completely
breaks the driver.
If the version id < 240A, return early from dw_mci_ctl_rd_thld() so as
not to hit this problem.
Fixes: f1d2736c8156 (mmc: dw_mmc: control card read threshold)
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: <stable@vger.kernel.org> # v3.13+
Cc: Seungwon Jeon <tgih.jun@samsung.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Chris Ball <chris@printf.net>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org
---
Note I've completely guessed at 240A being the point where that register
was introduced since the FIFO region moved then.
---
drivers/mmc/host/dw_mmc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 69f0cc68d5b2..f7c95abc8c11 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -626,6 +626,13 @@ static void dw_mci_ctrl_rd_thld(struct dw_mci *host, struct mmc_data *data)
WARN_ON(!(data->flags & MMC_DATA_READ));
+ /*
+ * CDTHRCTL doesn't exist prior to 240A (in fact that register offset is
+ * in the FIFO region, so we really shouldn't access it).
+ */
+ if (host->verid < DW_MMC_240A)
+ return;
+
if (host->timing != MMC_TIMING_MMC_HS200 &&
host->timing != MMC_TIMING_UHS_SDR104)
goto disable;
--
2.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: dw_mmc: avoid write to CDTHRCTL on older versions
2014-11-17 17:49 [PATCH] mmc: dw_mmc: avoid write to CDTHRCTL on older versions James Hogan
@ 2014-11-18 0:45 ` Jaehoon Chung
2014-11-19 10:53 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2014-11-18 0:45 UTC (permalink / raw)
To: James Hogan, Seungwon Jeon; +Cc: stable, Chris Ball, Ulf Hansson, linux-mmc
Hi, James.
Thanks for pointing out.
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Best Regards,
Jaehoon Chung
On 11/18/2014 02:49 AM, James Hogan wrote:
> Commit f1d2736c8156 (mmc: dw_mmc: control card read threshold) added
> dw_mci_ctrl_rd_thld() with an unconditional write to the CDTHRCTL
> register at offset 0x100. However before version 240a, the FIFO region
> started at 0x100, so the write messes with the FIFO and completely
> breaks the driver.
>
> If the version id < 240A, return early from dw_mci_ctl_rd_thld() so as
> not to hit this problem.
>
> Fixes: f1d2736c8156 (mmc: dw_mmc: control card read threshold)
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: <stable@vger.kernel.org> # v3.13+
> Cc: Seungwon Jeon <tgih.jun@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Chris Ball <chris@printf.net>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mmc@vger.kernel.org
> ---
> Note I've completely guessed at 240A being the point where that register
> was introduced since the FIFO region moved then.
> ---
> drivers/mmc/host/dw_mmc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 69f0cc68d5b2..f7c95abc8c11 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -626,6 +626,13 @@ static void dw_mci_ctrl_rd_thld(struct dw_mci *host, struct mmc_data *data)
>
> WARN_ON(!(data->flags & MMC_DATA_READ));
>
> + /*
> + * CDTHRCTL doesn't exist prior to 240A (in fact that register offset is
> + * in the FIFO region, so we really shouldn't access it).
> + */
> + if (host->verid < DW_MMC_240A)
> + return;
> +
> if (host->timing != MMC_TIMING_MMC_HS200 &&
> host->timing != MMC_TIMING_UHS_SDR104)
> goto disable;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: dw_mmc: avoid write to CDTHRCTL on older versions
2014-11-17 17:49 [PATCH] mmc: dw_mmc: avoid write to CDTHRCTL on older versions James Hogan
2014-11-18 0:45 ` Jaehoon Chung
@ 2014-11-19 10:53 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2014-11-19 10:53 UTC (permalink / raw)
To: James Hogan; +Cc: Jaehoon Chung, Seungwon Jeon, stable, Chris Ball, linux-mmc
On 17 November 2014 18:49, James Hogan <james.hogan@imgtec.com> wrote:
> Commit f1d2736c8156 (mmc: dw_mmc: control card read threshold) added
> dw_mci_ctrl_rd_thld() with an unconditional write to the CDTHRCTL
> register at offset 0x100. However before version 240a, the FIFO region
> started at 0x100, so the write messes with the FIFO and completely
> breaks the driver.
>
> If the version id < 240A, return early from dw_mci_ctl_rd_thld() so as
> not to hit this problem.
>
> Fixes: f1d2736c8156 (mmc: dw_mmc: control card read threshold)
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: <stable@vger.kernel.org> # v3.13+
> Cc: Seungwon Jeon <tgih.jun@samsung.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Chris Ball <chris@printf.net>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mmc@vger.kernel.org
Thanks! Applied for next and removing some of the Cc:s above,
Kind regards
Uffe
> ---
> Note I've completely guessed at 240A being the point where that register
> was introduced since the FIFO region moved then.
> ---
> drivers/mmc/host/dw_mmc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 69f0cc68d5b2..f7c95abc8c11 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -626,6 +626,13 @@ static void dw_mci_ctrl_rd_thld(struct dw_mci *host, struct mmc_data *data)
>
> WARN_ON(!(data->flags & MMC_DATA_READ));
>
> + /*
> + * CDTHRCTL doesn't exist prior to 240A (in fact that register offset is
> + * in the FIFO region, so we really shouldn't access it).
> + */
> + if (host->verid < DW_MMC_240A)
> + return;
> +
> if (host->timing != MMC_TIMING_MMC_HS200 &&
> host->timing != MMC_TIMING_UHS_SDR104)
> goto disable;
> --
> 2.0.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-19 10:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17 17:49 [PATCH] mmc: dw_mmc: avoid write to CDTHRCTL on older versions James Hogan
2014-11-18 0:45 ` Jaehoon Chung
2014-11-19 10:53 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox