From: Daniel Kucera <linux-mmc@danman.eu>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Avri Altman <Avri.Altman@wdc.com>, linux-mmc@vger.kernel.org
Subject: Re: [PATCH v4] mmc: core: allow detection of locked cards
Date: Sat, 13 Jul 2024 22:50:09 +0200 [thread overview]
Message-ID: <43ef0045c1eb638b89160c7a7e9b617f@danman.eu> (raw)
In-Reply-To: <CAPDyKFrQc610OB+VaG=cKQys7+3pyB4m1DA4BZXeGT5WgRYQ=A@mail.gmail.com>
On 2024-07-10 15:26, Ulf Hansson wrote:
> On Wed, 10 Jul 2024 at 07:21, Daniel Kucera <linux-mmc@danman.eu>
> wrote:
>>
>> On 2024-07-09 22:06, Avri Altman wrote:
>> >> If I understand correctly, there is no point in sending the CMD13
>> >> above, unless
>> >> this is the first attempt to initialize the card.
>> >> Therefore, it's better to move the whole part above, inside the below
>> >> if-clause
>> >> too, otherwise we would end up sending a CMD13 in cases when it's not
>> >> needed.
>> > R1_CARD_IS_LOCKED is CMD13 response, but already in CMD7 response as
>> > well,
>> > So theoretically you want to skip mmc_sd_setup_card altogether.
>>
>> Do you mean to modify:
>> mmc_select_card(struct mmc_card *card)
>> to somehow return or save the R1 response to card struct?
>
> I quite like this, as it avoids us from sending an unnecessary command
> during initialization.
Okay, but what if the host is SPI?
if (!mmc_host_is_spi(host)) {
err = mmc_select_card(card);
if (err)
goto free_card;
}
err = mmc_sd_setup_card(host, card, oldcard != NULL);
>
> A suggestion is to let _mmc_select_card() take an additional
> out-parameter to provide the card's status. Then we can let
> mmc_select_card() parse the status - and if it finds that the card is
> locked, it can set a new state in card->state (similar to how we use
> MMC_STATE_BLOCKADDR, for example).
>
> In another future step, we may also want to keep track of whether a
> locked card becomes unlocked. Using the card->state should work fine
> for that too, I think.
>
> [...]
>
> Kind regards
> Uffe
next prev parent reply other threads:[~2024-07-13 20:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 13:12 [PATCH v4] mmc: core: allow detection of locked cards linux-mmc
2024-06-20 12:38 ` Ulf Hansson
2024-06-20 12:59 ` Daniel Kucera
2024-06-20 14:32 ` Ulf Hansson
2024-06-20 15:31 ` Christian Loehle
2024-06-20 18:15 ` Daniel Kucera
2024-06-21 7:16 ` Avri Altman
2024-07-01 8:33 ` Daniel Kucera
2024-07-08 13:32 ` Ulf Hansson
2024-07-08 13:43 ` Ulf Hansson
2024-07-09 20:06 ` Avri Altman
2024-07-10 5:21 ` Daniel Kucera
2024-07-10 5:49 ` Avri Altman
2024-07-10 13:26 ` Ulf Hansson
2024-07-13 20:50 ` Daniel Kucera [this message]
2024-07-14 6:49 ` Avri Altman
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=43ef0045c1eb638b89160c7a7e9b617f@danman.eu \
--to=linux-mmc@danman.eu \
--cc=Avri.Altman@wdc.com \
--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