From: Christian Loehle <christian.loehle@arm.com>
To: linux-mmc@danman.eu, linux-mmc@vger.kernel.org, ulf.hansson@linaro.org
Subject: Re: [PATCH] mmc: core: allow detection of locked cards
Date: Thu, 23 May 2024 09:29:54 +0100 [thread overview]
Message-ID: <bf9b0807-85fa-42bd-9dec-e59a6166197b@arm.com> (raw)
In-Reply-To: <20240521210455.543587-1-linux-mmc@danman.eu>
On 5/21/24 22:04, linux-mmc@danman.eu wrote:
> From: Daniel Kucera <linux-mmc@danman.eu>
>
> Signed-off-by: Daniel Kucera <linux-mmc@danman.eu>
> ---
> drivers/mmc/core/sd.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 1c8148cdd..b22c30348 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -1475,9 +1475,22 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
> goto free_card;
> }
>
> - err = mmc_sd_setup_card(host, card, oldcard != NULL);
> - if (err)
> - goto free_card;
> + u32 card_status;
> +
> + err = mmc_send_status(card, &card_status);
> + if (err){
> + pr_err("%s: unable to get card status\n",
> + mmc_hostname(host));
> + goto free_card;
> + }
> +
> + if (card_status & R1_CARD_IS_LOCKED){
> + pr_warn("%s: card is locked\n", mmc_hostname(host));
> + } else {
> + err = mmc_sd_setup_card(host, card, oldcard != NULL);
> + if (err)
> + goto free_card;
> + }
>
> /*
> * If the card has not been power cycled, it may still be using 1.8V
Does that work for you?
I vaguely remember adding some checks before the block device setup and some
recovery as well since the partition scan (will fail) already triggered resets.
next prev parent reply other threads:[~2024-05-23 8:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 21:04 [PATCH] mmc: core: allow detection of locked cards linux-mmc
2024-05-23 3:41 ` Avri Altman
2024-05-23 8:29 ` Christian Loehle [this message]
2024-05-23 13:17 ` Daniel Kucera
2024-05-23 8:30 ` Christian Loehle
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=bf9b0807-85fa-42bd-9dec-e59a6166197b@arm.com \
--to=christian.loehle@arm.com \
--cc=linux-mmc@danman.eu \
--cc=linux-mmc@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