stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philip Langdale <philipl@overt.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mmc: core: Fix init of SD cards reporting an invalid VDD range
Date: Tue, 27 Aug 2019 18:15:18 -0700	[thread overview]
Message-ID: <20190827181518.2e7aaa44@fido6> (raw)
In-Reply-To: <20190827081043.15443-1-ulf.hansson@linaro.org>

On Tue, 27 Aug 2019 10:10:43 +0200
Ulf Hansson <ulf.hansson@linaro.org> wrote:

> The OCR register defines the supported range of VDD voltages for SD
> cards. However, it has turned out that some SD cards reports an
> invalid voltage range, for example having bit7 set.
> 
> When a host supports MMC_CAP2_FULL_PWR_CYCLE and some of the voltages
> from the invalid VDD range, this triggers the core to run a power
> cycle of the card to try to initialize it at the lowest common
> supported voltage. Obviously this fails, since the card can't support
> it.
> 
> Let's fix this problem, by clearing invalid bits from the read OCR
> register for SD cards, before proceeding with the VDD voltage
> negotiation.
> 
> Cc: stable@vger.kernel.org
> Reported-by: Philip Langdale <philipl@overt.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  drivers/mmc/core/sd.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index d681e8aaca83..fe914ff5f5d6 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -1292,6 +1292,12 @@ int mmc_attach_sd(struct mmc_host *host)
>  			goto err;
>  	}
>  
> +	/*
> +	 * Some SD cards claims an out of spec VDD voltage range.
> Let's treat
> +	 * these bits as being in-valid and especially also bit7.
> +	 */
> +	ocr &= ~0x7FFF;
> +
>  	rocr = mmc_select_voltage(host, ocr);
>  
>  	/*

Looks right. Tried it out and worked as expected.

Reviewed-by: Philip Langdale <philipl@overt.org>

--phil

  reply	other threads:[~2019-08-28  1:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  8:10 [PATCH] mmc: core: Fix init of SD cards reporting an invalid VDD range Ulf Hansson
2019-08-28  1:15 ` Philip Langdale [this message]
2019-08-28 10:07   ` 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=20190827181518.2e7aaa44@fido6 \
    --to=philipl@overt.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).