public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: James Hogan <james.hogan@imgtec.com>,
	Seungwon Jeon <tgih.jun@samsung.com>
Cc: stable@vger.kernel.org, Chris Ball <chris@printf.net>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: dw_mmc: avoid write to CDTHRCTL on older versions
Date: Tue, 18 Nov 2014 09:45:53 +0900	[thread overview]
Message-ID: <546A96C1.5060208@samsung.com> (raw)
In-Reply-To: <1416246545-14118-1-git-send-email-james.hogan@imgtec.com>

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;
> 

  reply	other threads:[~2014-11-18  0:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-11-19 10:53 ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546A96C1.5060208@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=chris@printf.net \
    --cc=james.hogan@imgtec.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tgih.jun@samsung.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox