Re: [PATCH] mmc: enable UHS voltage switch for SDSC if supported
From: Ulf Hansson <hidden>
Date: 2021-05-06 13:55:31
Also in:
lkml
On Thu, 6 May 2021 at 10:34, Christian Löhle [off-list ref] wrote:
Well I am definitely for keeping this bug as a feature and utilizing UHS with this patch ;) I have tried all SDSC cards I could get my hands on and have not seen any 'accidentally' reporting UHS support.
That sounds promising.
I tested the patch with own custom cards. (Hyperstone, my employer, develops controllers for flash storage.)
I see, thanks for sharing!
There you would have to make the same choice, disabling UHS support reporting for all SDSC cards, but as some hosts accept UHS (including voltage switch) without checking CCS, this would throttle performance. (One such host is e.g. 8564:4000 Transcend Information, Inc. microSD/SD/CF UHS-II Card Reader) It would be nice to have this in linux-mmc as arguably the most important SD native host. I'm sure the other manufacturers either do not disable UHS support for SDSC cards, or have at least been playing with the idea.
Assuming I don't find any issues when I am testing some of my older SD cards, I am definitely open to change into what you propose in $subject patch. Although, I think it's important that we also state in the code with a comment somewhere - that we deliberately have decided to deviate from the SD spec for the reasons you have pointed out in our discussions. Can you perhaps prepare and post a new version and possibly also work a little bit on the commit message to make things a bit more clear? In the meantime, I will test some SD cards at my side... Kind regards Uffe
Regards, Christian From: Ulf Hansson <redacted> Sent: Wednesday, May 5, 2021 4:20 PM To: Christian Löhle <redacted> Cc: linux-kernel@vger.kernel.org <redacted>; linux-mmc@vger.kernel.org <redacted>; pali@kernel.org <pali@kernel.org>; huyue2@yulong.com <redacted>; tiantao6@hisilicon.com <tiantao6@hisilicon.com> Subject: Re: [PATCH] mmc: enable UHS voltage switch for SDSC if supported On Wed, 5 May 2021 at 14:13, Christian Löhle [off-list ref] wrote:quoted
So two cards that advertise UHS: https://www.euric.de/de/flash-speicher/sd-microsd/sd/ Model SDI790 and https://na.industrial.panasonic.com/products/storage-media/industrial-sd-cards/lineup/industrial-grade-2d-nand/series/71695Thanks for the links! Are these the ones that you have been using for testing?quoted
Hopefully that suffices as a couple, otherwise I would buy some that do not advertise it and actually check if they support it anyway. But 2GB SLC listings are kind of rare these days, so it's not as easy to find many that are still sold and available.Right. I have a whole bunch of old SD cards that I can test. I will let you know when I have got some time to test some of them. The main worry (but I may be wrong) I have with the patch is that it could cause problems for other older SDSC cards, which happens to incorrectly set the S18A bit. I mean, before UHS-I was introduced in the SD spec, this bit was just being reserved and potentially it could have *any* value by the card manufacturer. As I said, let me do some tests of my older SD cards.quoted
My point about deviating from the standard was that these cards are already initialized as UHS, they just don't do the voltage switch. So anything reserved for UHS-I (e.g. CMD23 )is already being done by the host with the current linux-mmc, so the standard deviation is already there. Just the voltage switch is missing.Ah, yes you are right! We call mmc_sd_init_uhs_card() no matter whether the CCS bit is set. Certainly this is a bug. Both the card and host aren't designed to work under these conditions/timings.quoted
Regards, ChristianKind regards Uffequoted
From: Ulf Hansson <redacted> Sent: Wednesday, May 5, 2021 12:09 PM To: Christian Löhle <redacted> Subject: Re: [PATCH] mmc: enable UHS voltage switch for SDSC if supported On Thu, 22 Apr 2021 at 15:18, Christian Löhle [off-list ref] wrote:quoted
Ignore the reported capacity if the card otherwise reports UHS support. Currently SDSC cards reporting UHS support except for the CCS do not run through the voltage switch. While strictly speaking a SDSC card cannot support UHS in compliance with the standard, there is no good reason to throttle them that way.Maybe not, but I think the code just tries to conform to the SD spec.quoted
Especially for pSLCs in practice such cards benefit greatly by this patch, as they can be new and UHS supporting, but must not lie about their CCS.Can you provide some concrete examples of SDSC cards that support UHS-I?quoted
The behaviour of linux-mmc for SDSC is deviating from the standard anyway in such a case, as the card is treated as UHS card not supporting the voltage switch in general. Such a card will come up as mmc0: new ultra high speed SDR25 SD card at address 0001. Thus the subsystem will support CMD23 and others to the card. But if we deviate from the standard anyway, then we might as well not throttle SDSC to 25MB/s.Not sure I understand this correctly? Can you elaborate a bit more, so I understand how we deviate from the SD spec here? As far as I understand the spec, SDSC cards shouldn't support UHS-I. If we decide to deviate from the spec to support this anyway, at least we need to know about a couple of cards that actually supports this. Kind regards Uffequoted
Signed-off-by: Christian Loehle <redacted> --- drivers/mmc/core/sd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 6fa51a6ed058..281ca2da8e0b 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c@@ -841,11 +841,10 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr) return err; /* - * In case CCS and S18A in the response is set, start Signal Voltage - * Switch procedure. SPI mode doesn't support CMD11. + * In case S18A in the response is set, start Signal Voltage Switch + * procedure. SPI mode doesn't support CMD11. */ - if (!mmc_host_is_spi(host) && rocr && - ((*rocr & 0x41000000) == 0x41000000)) { + if (!mmc_host_is_spi(host) && rocr && (*rocr & 0x01000000)) { err = mmc_set_uhs_voltage(host, pocr); if (err == -EAGAIN) { retries--; --2.31.1 Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz Managing Directors: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz Managing Directors: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz Managing Directors: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782