RE: [PATCH v4] mmc: core: allow detection of locked cards

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On 2024-07-10 15:26, Ulf Hansson wrote:
> > On Wed, 10 Jul 2024 at 07:21, Daniel Kucera <linux-mmc@xxxxxxxxx>
> > 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?
Looking in the spec, In SPI mode, the card moves to transfer state post ACMD41+CMD58.
On the other hand, it does support lock/unlock functionality - identical to SD mode,
And the R1_CARD_IS_LOCKED should be obtained from the results of CMD13 - 
Just like you proposed.

So, looks like your original proposal is more inclusive, but let me ask around and get back to you.

Thanks,
Avri
> 
>          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





[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux