Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: "Christian Löhle" <CLoehle@hyperstone.com>
To: Avri Altman <Avri.Altman@wdc.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>
Subject: RE: [PATCH] mmc-utils: Add basic erase error check
Date: Tue, 13 Dec 2022 15:26:12 +0000	[thread overview]
Message-ID: <256e7a78852041ffbea965e3e3a71863@hyperstone.com> (raw)
In-Reply-To: <DM6PR04MB6575C12FBBD33AD36B8290D6FCE39@DM6PR04MB6575.namprd04.prod.outlook.com>

>> > For SD a CMD13 after CMD38 is required, too.
>> > I guess I can add that.
>> 
>> Just realized that sending CMD13 is not sufficient as the kernel will 
>> poll because of R1B and clear the error flag.
>> Anyway I have this kernel patch for a write flag bit that aggregates 
>> errors during polling until card is in TRAN again.
>> I will send it then, since I don't think there is a good way of 
>> solving this for SD in mmc-utils, please consider this patch on its own.
> Leaving SD aside for now - I Still wasn't able to get an expert opinion - holiday season etc. 
> While waiting however, looking in Table 70 - Device Status field/command - cross reference, I can see that :
> - ERASE_RESET - is not reported for any of cmd35, cmd36, and cmd38
> - ERASE_PARAM - is 'X' for cmd35 only
> - ERASE_SEQ_ ERROR - is 'R' for cmd35 and cmd36
>
> So potentially only ERASE_SEQ_ ERROR may reside in those commands responses.
> But mmc-utils uses multi-ioctl for that, so there couldn't be any mis-ordering?
> Which error bits you see in which command responses?
> 
> Thanks,
> Avri

Hey Avri,
Thanks for having a look at this.
Yeah I have indeed only seen ERASE_SEQ_ERROR, but added the rest because it doesn't hurt.
Why would you say ERASE_PARAM shouldn't be checked? Or are you arguing it should only be checked at CMD38 (i.e. the X of CMD35)?
(In which case I agree, just didn't want more than one error mask)
Seeing a ERASE_PARAM would definitely make the erase not happen (that's all mmc-utils should really care about).
ERASE_RESET may be removed for sure, could be checked when a SD ioctl erase fix like I described is in the kernel.
Then an ideal mmc-utils erase operation checks that no relevant R1 bits are set at CMD38 RSP and all CMD13 until card leaves PRG and stops signalling busy.


For an erase call like this:
mmc-utils erase legacy 0 0xFFFFFFFF /dev/mmcblk2

the MMC trace (according to spec and most cards I tried, this is one of them) looks like this:
Format: timestamp,type,CMDOPCODE,
for type 1 (CMD) and type 2 (Resp48) then the next field is arg/response in hex.
I guess rest is more or less self-explanatory / not relevant.

325533.758261654,1,13,00010000
325533.758282029,2,13,00000900, READY_FOR_DATA, TRANS_STATE
325534.549850485,1,08,00000000
325534.549874693,2,08,00000900, READY_FOR_DATA, TRANS_STATE
325534.550132818,4,08,0,512
325534.550132818,5,08,00000000000000000000000... REDACTED FOR SIZE
325534.550693693,1,35,00000000
325534.550710026,2,35,00000900, READY_FOR_DATA, TRANS_STATE
325534.550761651,1,36,ffffffff
325534.550774485,2,36,80000900, ADDRESS_OUT_OF_RANGE, READY_FOR_DATA, TRANS_STATE
325534.552136276,1,38,00000000
325534.552164568,2,38,10000900, ERASE_SEQ_ERROR, READY_FOR_DATA, TRANS_STATE
325534.552227568,1,13,00010000
325534.552241276,2,13,00000900, READY_FOR_DATA, TRANS_STATE

Hope that helps.

Regards,
Christian

Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782


  reply	other threads:[~2022-12-13 15:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12  9:21 [PATCH] mmc-utils: Add basic erase error check Christian Löhle
2022-12-12 13:44 ` Avri Altman
2022-12-12 14:00   ` Christian Löhle
2022-12-12 14:08     ` Christian Löhle
2022-12-13 14:00       ` Avri Altman
2022-12-13 15:26         ` Christian Löhle [this message]
2022-12-14  8:15           ` Avri Altman
2022-12-15 18:14             ` Christian Löhle
2022-12-16  6:11               ` Avri Altman
2023-01-02 12:01                 ` Avri Altman
  -- strict thread matches above, loose matches on Subject: below --
2023-01-16 10:49 Christian Löhle
2023-01-16 11:10 ` 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=256e7a78852041ffbea965e3e3a71863@hyperstone.com \
    --to=cloehle@hyperstone.com \
    --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