Skip to contentSkip to conversation

mmc: block: apply NO_CMD32 quirk to an ATP card

PATCH Superseded Christoph Fritz 3 participants 13 messages Sep 9, 2017 – Dec 11, 2017 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: block: apply NO_CMD32 quirk to an ATP card

To get an ATP card work reliable on a high speed bus, CMD32 needs to be disabled.

Without this patch:

 $ dd if=/dev/urandom of=/mnt/test bs=1M count=10
    <mmc0: starting CMD23 arg 00000400 flags 00000015>
    mmc0: starting CMD25 arg 00a71f00 flags 000000b5
    mmc0:     blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0
    mmc0:     CMD12 arg 00000000 flags 0000049d
    sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
    mmc0: Timeout waiting for hardware interrupt.
---
 drivers/mmc/core/card.h   | 1 +
 drivers/mmc/core/quirks.h | 6 ++++++
 2 files changed, 7 insertions(+)
drivers/mmc/core/card.h +1 -0
index f06cd91..af9c48c 100644
@@ -75,6 +75,7 @@ struct mmc_fixup {
 #define EXT_CSD_REV_ANY (-1u)
 
 #define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_ATP          0x9
 #define CID_MANFID_TOSHIBA      0x11
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
drivers/mmc/core/quirks.h +6 -0
index fb72593..3205f0e 100644
@@ -52,6 +52,12 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
 		  MMC_QUIRK_BLK_NO_CMD23),
 
 	/*
+	 * Some SD cards lockup while using CMD23 multiblock transfers.
+	 */
+	MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+		  MMC_QUIRK_BLK_NO_CMD23),
+
+	/*
 	 * Some MMC cards need longer data read timeout than indicated in CSD.
 	 */
 	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/1 mmc: core: apply NO_CMD23 quirk to an ATP card

To get an ATP card work reliable on a high speed bus, CMD23 needs to be disabled.

Without this patch:

 $ dd if=/dev/urandom of=/mnt/test bs=1M count=10
    <mmc0: starting CMD23 arg 00000400 flags 00000015>
    mmc0: starting CMD25 arg 00a71f00 flags 000000b5
    mmc0:     blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0
    mmc0:     CMD12 arg 00000000 flags 0000049d
    sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
    mmc0: Timeout waiting for hardware interrupt.

---
Changes since v1:
- s/CMD32/CMD23

 drivers/mmc/core/card.h   | 1 +
 drivers/mmc/core/quirks.h | 6 ++++++
 2 files changed, 7 insertions(+)
drivers/mmc/core/card.h +1 -0
index f06cd91..af9c48c 100644
@@ -75,6 +75,7 @@ struct mmc_fixup {
 #define EXT_CSD_REV_ANY (-1u)
 
 #define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_ATP          0x9
 #define CID_MANFID_TOSHIBA      0x11
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
drivers/mmc/core/quirks.h +6 -0
index fb72593..3205f0e 100644
@@ -52,6 +52,12 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
 		  MMC_QUIRK_BLK_NO_CMD23),
 
 	/*
+	 * Some SD cards lockup while using CMD23 multiblock transfers.
+	 */
+	MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+		  MMC_QUIRK_BLK_NO_CMD23),
+
+	/*
 	 * Some MMC cards need longer data read timeout than indicated in CSD.
 	 */
 	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH v2] mmc: core: apply NO_CMD23 quirk to an ATP card

Quoted 5 lines · Christoph Fritz

To get an ATP card work reliable on a high speed bus, CMD23 needs to be disabled.

Without this patch:

Quoted 8 lines
 $ dd if=/dev/urandom of=/mnt/test bs=1M count=10
    <mmc0: starting CMD23 arg 00000400 flags 00000015>
    mmc0: starting CMD25 arg 00a71f00 flags 000000b5
    mmc0:     blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0
    mmc0:     CMD12 arg 00000000 flags 0000049d
    sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
    mmc0: Timeout waiting for hardware interrupt.

Seems like you are using some sdhci variant. Would it be possible for you to test this card on another platform? That to make sure it's not a driver thing.

Quoted 27 lines

---
Changes since v1:
- s/CMD32/CMD23

 drivers/mmc/core/card.h   | 1 +
 drivers/mmc/core/quirks.h | 6 ++++++
 2 files changed, 7 insertions(+)
drivers/mmc/core/card.h +1 -0
index f06cd91..af9c48c 100644
@@ -75,6 +75,7 @@ struct mmc_fixup {
 #define EXT_CSD_REV_ANY (-1u)
 
 #define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_ATP          0x9
 #define CID_MANFID_TOSHIBA      0x11
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
drivers/mmc/core/quirks.h +0 -0
index fb72593..3205f0e 100644

drivers/mmc/core/quirks.h static const struct mmc_fixup mmc_blk_fixups[] = { · line 58

Quoted 7 lines
drivers/mmc/core/quirks.h +4 -0
@@ -52,6 +52,12 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
                  MMC_QUIRK_BLK_NO_CMD23),
 
        /*
+        * Some SD cards lockup while using CMD23 multiblock transfers.
+        */
+       MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+                 MMC_QUIRK_BLK_NO_CMD23),

Is really all ATP cards having this problem? Perhaps we should consider making this a bit more fine grained?

On the other hand, this may be the safest way to do it...

Quoted 8 lines
drivers/mmc/core/quirks.h +2 -1
+
+       /*
         * Some MMC cards need longer data read timeout than indicated in CSD.
         */
        MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
--

2.1.4

Kind regards
Uffe

#3 lore raw

Re: [PATCH v2] mmc: core: apply NO_CMD23 quirk to an ATP card

Hi

Quoted 15 lines · Ulf Hansson
Quoted 5 lines · Christoph Fritz

To get an ATP card work reliable on a high speed bus, CMD23 needs to be disabled.

Without this patch:

Quoted 8 lines
  $ dd if=/dev/urandom of=/mnt/test bs=1M count=10
     <mmc0: starting CMD23 arg 00000400 flags 00000015>
     mmc0: starting CMD25 arg 00a71f00 flags 000000b5
     mmc0:     blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0
     mmc0:     CMD12 arg 00000000 flags 0000049d
     sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
     mmc0: Timeout waiting for hardware interrupt.
Quoted 4 lines

Seems like you are using some sdhci variant. Would it be possible for you to test this card on another platform? That to make sure it's not a driver thing.

I'm just curious about if these ATP cards could work for ACMD23?

Could you kindly try this patch?

|https://patchwork.kernel.org/patch/9887651/

Quoted 58 lines
Quoted 27 lines

---
Changes since v1:
- s/CMD32/CMD23

  drivers/mmc/core/card.h   | 1 +
  drivers/mmc/core/quirks.h | 6 ++++++
  2 files changed, 7 insertions(+)
drivers/mmc/core/card.h +1 -0
index f06cd91..af9c48c 100644
@@ -75,6 +75,7 @@ struct mmc_fixup {
  #define EXT_CSD_REV_ANY (-1u)
 
  #define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_ATP          0x9
  #define CID_MANFID_TOSHIBA      0x11
  #define CID_MANFID_MICRON       0x13
  #define CID_MANFID_SAMSUNG      0x15
drivers/mmc/core/quirks.h +0 -0
index fb72593..3205f0e 100644

drivers/mmc/core/quirks.h static const struct mmc_fixup mmc_blk_fixups[] = { · line 58

Quoted 7 lines
drivers/mmc/core/quirks.h +4 -0
@@ -52,6 +52,12 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
                   MMC_QUIRK_BLK_NO_CMD23),
 
         /*
+        * Some SD cards lockup while using CMD23 multiblock transfers.
+        */
+       MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+                 MMC_QUIRK_BLK_NO_CMD23),

Is really all ATP cards having this problem? Perhaps we should consider making this a bit more fine grained?

On the other hand, this may be the safest way to do it...

Quoted 8 lines
drivers/mmc/core/quirks.h +2 -1
+
+       /*
          * Some MMC cards need longer data read timeout than indicated in CSD.
          */
         MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
--

2.1.4

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH v2] mmc: core: apply NO_CMD23 quirk to an ATP card

Hi Ulf and Shawn,

thanks for your input, I'm replying to both of you by this mail, please
see comments below.

Quoted 21 lines · Shawn Lin

Hi

Quoted 18 lines · Ulf Hansson
Quoted 5 lines · Christoph Fritz

To get an ATP card work reliable on a high speed bus, CMD23 needs to be disabled.

Without this patch:

Quoted 8 lines
  $ dd if=/dev/urandom of=/mnt/test bs=1M count=10
     <mmc0: starting CMD23 arg 00000400 flags 00000015>
     mmc0: starting CMD25 arg 00a71f00 flags 000000b5
     mmc0:     blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0
     mmc0:     CMD12 arg 00000000 flags 0000049d
     sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
     mmc0: Timeout waiting for hardware interrupt.

Seems like you are using some sdhci variant. Would it be possible for you to test this card on another platform? That to make sure it's not a driver thing.

SoC am335x (omap_hsmmc) works fine because it lacks CMD23 host support. My RK3288 board supports only micro-SD cards. If you want me to, I could get an adapter (micro-SD -> SD) but the shipping takes ~40 days.

Quoted 7 lines
Quoted 1 line

I'm just curious about if these ATP cards could work for ACMD23?

Could you kindly try this patch?

|https://patchwork.kernel.org/patch/9887651/

By looking at your patch I can see that bool variable 'need_acmd23' is only set when card does not support CMD23. But here this card (falsely) claims to support CMD23, which is the whole point of the NO_CMD23 quirk.

So testing your patch would not make any difference, because its functionality would be disabled, or do I miss something?

Quoted 40 lines
Quoted 40 lines
Quoted 29 lines

---
Changes since v1:
- s/CMD32/CMD23

  drivers/mmc/core/card.h   | 1 +
  drivers/mmc/core/quirks.h | 6 ++++++
  2 files changed, 7 insertions(+)
drivers/mmc/core/card.h +1 -0
index f06cd91..af9c48c 100644
@@ -75,6 +75,7 @@ struct mmc_fixup {
  #define EXT_CSD_REV_ANY (-1u)
 
  #define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_ATP          0x9
  #define CID_MANFID_TOSHIBA      0x11
  #define CID_MANFID_MICRON       0x13
  #define CID_MANFID_SAMSUNG      0x15
drivers/mmc/core/quirks.h +0 -0
index fb72593..3205f0e 100644

drivers/mmc/core/quirks.h static const struct mmc_fixup mmc_blk_fixups[] = { · line 58

Quoted 7 lines
drivers/mmc/core/quirks.h +4 -0
@@ -52,6 +52,12 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
                   MMC_QUIRK_BLK_NO_CMD23),
 
         /*
+        * Some SD cards lockup while using CMD23 multiblock transfers.
+        */
+       MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+                 MMC_QUIRK_BLK_NO_CMD23),

Is really all ATP cards having this problem? Perhaps we should consider making this a bit more fine grained?

Quoted 1 line
Quoted 1 line

On the other hand, this may be the safest way to do it...

I also thought about this and set CID_OEMID_ANY because I wanted to be on the safe side. Maybe ATP can comment on this (in CC)?

Thanks
-- Christoph

#5 lore raw

Re: [PATCH v2] mmc: core: apply NO_CMD23 quirk to an ATP card

Hi,

Quoted 38 lines · Christoph Fritz

Hi Ulf and Shawn,

thanks for your input, I'm replying to both of you by this mail, please
see comments below.

Quoted 21 lines · Shawn Lin

Hi

Quoted 18 lines · Ulf Hansson
Quoted 5 lines · Christoph Fritz

To get an ATP card work reliable on a high speed bus, CMD23 needs to be disabled.

Without this patch:

Quoted 8 lines
   $ dd if=/dev/urandom of=/mnt/test bs=1M count=10
      <mmc0: starting CMD23 arg 00000400 flags 00000015>
      mmc0: starting CMD25 arg 00a71f00 flags 000000b5
      mmc0:     blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0
      mmc0:     CMD12 arg 00000000 flags 0000049d
      sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
      mmc0: Timeout waiting for hardware interrupt.

Seems like you are using some sdhci variant. Would it be possible for you to test this card on another platform? That to make sure it's not a driver thing.

SoC am335x (omap_hsmmc) works fine because it lacks CMD23 host support. My RK3288 board supports only micro-SD cards. If you want me to, I could get an adapter (micro-SD -> SD) but the shipping takes ~40 days.

Quoted 6 lines
Quoted 1 line

I'm just curious about if these ATP cards could work for ACMD23?

Could you kindly try this patch?

Quoted 7 lines
Quoted 1 line

|https://patchwork.kernel.org/patch/9887651/

By looking at your patch I can see that bool variable 'need_acmd23' is only set when card does not support CMD23. But here this card (falsely) claims to support CMD23, which is the whole point of the NO_CMD23 quirk.

So testing your patch would not make any difference, because its

yup, sorry fot that. I mean you could hack it a little to mask CMD23 support and let ACMD23 take effect, and see how it would go?

Quoted 53 lines

functionality would be disabled, or do I miss something?

Quoted 40 lines
Quoted 40 lines
Quoted 29 lines

---
Changes since v1:
- s/CMD32/CMD23

   drivers/mmc/core/card.h   | 1 +
   drivers/mmc/core/quirks.h | 6 ++++++
   2 files changed, 7 insertions(+)
drivers/mmc/core/card.h +1 -0
index f06cd91..af9c48c 100644
@@ -75,6 +75,7 @@ struct mmc_fixup {
   #define EXT_CSD_REV_ANY (-1u)
 
   #define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_ATP          0x9
   #define CID_MANFID_TOSHIBA      0x11
   #define CID_MANFID_MICRON       0x13
   #define CID_MANFID_SAMSUNG      0x15
drivers/mmc/core/quirks.h +0 -0
index fb72593..3205f0e 100644

drivers/mmc/core/quirks.h static const struct mmc_fixup mmc_blk_fixups[] = { · line 58

Quoted 7 lines
drivers/mmc/core/quirks.h +4 -0
@@ -52,6 +52,12 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
                    MMC_QUIRK_BLK_NO_CMD23),
 
          /*
+        * Some SD cards lockup while using CMD23 multiblock transfers.
+        */
+       MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+                 MMC_QUIRK_BLK_NO_CMD23),

Is really all ATP cards having this problem? Perhaps we should consider making this a bit more fine grained?

Quoted 1 line
Quoted 1 line

On the other hand, this may be the safest way to do it...

I also thought about this and set CID_OEMID_ANY because I wanted to be on the safe side. Maybe ATP can comment on this (in CC)?

Thanks
-- Christoph

#6 lore raw

Re: [PATCH v2] mmc: core: apply NO_CMD23 quirk to an ATP card

Quoted 10 lines · Shawn Lin
Quoted 10 lines
Quoted 5 lines

I'm just curious about if these ATP cards could work for ACMD23?

Could you kindly try this patch?

|https://patchwork.kernel.org/patch/9887651/

By looking at your patch I can see that bool variable 'need_acmd23' is only set when card does not support CMD23. But here this card (falsely) claims to support CMD23, which is the whole point of the NO_CMD23 quirk.

Quoted 5 lines
Quoted 1 line

So testing your patch would not make any difference, because its

yup, sorry fot that. I mean you could hack it a little to mask CMD23 support and let ACMD23 take effect, and see how it would go?

forcing ACMD23 instead of CMD23 works fine:

dd if=/dev/urandom of=/mnt/test bs=1M count=100 conv=fsync 100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 9.9496 s, 10.5 MB/s

It's as fast as using my NO_CMD23 quirk.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
          /*
drivers/mmc/core/quirks.h +4 -0
+        * Some SD cards lockup while using CMD23 multiblock transfers.
+        */
+       MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+                 MMC_QUIRK_BLK_NO_CMD23),
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Is really all ATP cards having this problem? Perhaps we should consider making this a bit more fine grained?

On the other hand, this may be the safest way to do it...

I also thought about this and set CID_OEMID_ANY because I wanted to be on the safe side. Maybe ATP can comment on this (in CC)?

Thanks
-- Christoph

#7 lore raw

Re: [PATCH v2] mmc: core: apply NO_CMD23 quirk to an ATP card

Quoted 17 lines · Christoph Fritz
Quoted 10 lines · Shawn Lin
Quoted 10 lines
Quoted 5 lines

I'm just curious about if these ATP cards could work for ACMD23?

Could you kindly try this patch?

|https://patchwork.kernel.org/patch/9887651/

By looking at your patch I can see that bool variable 'need_acmd23' is only set when card does not support CMD23. But here this card (falsely) claims to support CMD23, which is the whole point of the NO_CMD23 quirk.

Quoted 5 lines
Quoted 1 line

So testing your patch would not make any difference, because its

yup, sorry fot that. I mean you could hack it a little to mask CMD23 support and let ACMD23 take effect, and see how it would go?

Quoted 8 lines

forcing ACMD23 instead of CMD23 works fine:

dd if=/dev/urandom of=/mnt/test bs=1M count=100 conv=fsync 100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 9.9496 s, 10.5 MB/s

It's as fast as using my NO_CMD23 quirk.

Thanks for the test. Given that ACMD23 is mandatory but very few sd cards claim to support CMD23, maybe force ACMD23 support is better than current CMD23/open-ending combo.

Back to $subject patch, It still need to verify this conclusion on other platforms or get acknowledgement from the vendor.

Quoted 21 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
           /*
drivers/mmc/core/quirks.h +4 -0
+        * Some SD cards lockup while using CMD23 multiblock transfers.
+        */
+       MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+                 MMC_QUIRK_BLK_NO_CMD23),
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Is really all ATP cards having this problem? Perhaps we should consider making this a bit more fine grained?

On the other hand, this may be the safest way to do it...

I also thought about this and set CID_OEMID_ANY because I wanted to be on the safe side. Maybe ATP can comment on this (in CC)?

Thanks
-- Christoph

#8 lore raw

Re: [PATCH v2] mmc: core: apply NO_CMD23 quirk to an ATP card

Hi Shawn and Ulf

Quoted 2 lines · Shawn Lin

Back to $subject patch, It still need to verify this conclusion on other platforms or get acknowledgement from the vendor.

to quote myself:

Quoted 3 lines · Christoph Fritz
Quoted 3 lines

SoC am335x (omap_hsmmc) works fine because it lacks CMD23 host support. My RK3288 board supports only micro-SD cards. If you want me to, I could get an adapter (micro-SD -> SD) but the shipping takes ~40 days.

Finally I got this microSD to SD adapter to test the ATP card on RK3288 platform too. As expected, card fails without the patch:

 $ dd if=/dev/urandom of=./test bs=1M count=10

does freeze system without any response

So I can verify failing CMD23 behaviour on imx6 and rk3288 running kernel 4.14. Applying the patch does fix the issue on both platforms.

Could you queue up this patch now?

Thanks
-- Christoph

#9 lore raw

Re: [PATCH v2] mmc: core: apply NO_CMD23 quirk to an ATP card

Quoted 11 lines · Christoph Fritz

Finally I got this microSD to SD adapter to test the ATP card on RK3288 platform too. As expected, card fails without the patch:

 $ dd if=/dev/urandom of=./test bs=1M count=10

does freeze system without any response

So I can verify failing CMD23 behaviour on imx6 and rk3288 running kernel 4.14. Applying the patch does fix the issue on both platforms.

Could you queue up this patch now?

*ping*

Meanwhile I found another card which fails CMD23 by testing it on rk3288 and i.MX6.

I'll send a patch for both cards as v3 of this Patch.

best regards
-- Christoph

#10 lore raw

PATCH v3 1/1 mmc: core: apply NO_CMD23 quirk to some specific cards

To get an usdhc Apacer and some ATP SD cards work reliable, CMD23 needs to be disabled. This has been tested on i.MX6 (sdhci-esdhc) and rk3288 (dw_mmc-rockchip).

Without this patch on i.MX6 (sdhci-esdhc):

 $ dd if=/dev/urandom of=/mnt/test bs=1M count=10 conv=fsync
    | <mmc0: starting CMD23 arg 00000400 flags 00000015>
    | mmc0: starting CMD25 arg 00a71f00 flags 000000b5
    | mmc0:     blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0
    | mmc0:     CMD12 arg 00000000 flags 0000049d
    | sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
    | mmc0: Timeout waiting for hardware interrupt.

Without this patch on rk3288 (dw_mmc-rockchip):

    | mmc1: Card stuck in programming state! mmcblk1 card_busy_detect
    | dwmmc_rockchip ff0c0000.dwmmc: Busy; trying anyway
    | mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz,
    | actual 400000HZ div = 0)
    | mmc1: card never left busy state
    | mmc1: tried to reset card, got error -110
    | blk_update_request: I/O error, dev mmcblk1, sector 139778
    | Buffer I/O error on dev mmcblk1p1, logical block 131586, lost async
    | page write

---
Changes since v1:
- s/CMD32/CMD23
Changes since v2:
- add an Apacer card
- adapt comment

 drivers/mmc/core/card.h   | 2 ++
 drivers/mmc/core/quirks.h | 8 ++++++++
 2 files changed, 10 insertions(+)
drivers/mmc/core/card.h +2 -0
index f06cd91..79a5b98 100644
@@ -75,9 +75,11 @@ struct mmc_fixup {
 #define EXT_CSD_REV_ANY (-1u)
 
 #define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_ATP          0x9
 #define CID_MANFID_TOSHIBA      0x11
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
+#define CID_MANFID_APACER       0x27
 #define CID_MANFID_KINGSTON     0x70
 #define CID_MANFID_HYNIX	0x90
 
drivers/mmc/core/quirks.h +8 -0
index 9107f0b..d4ff9d8 100644
@@ -53,6 +53,14 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
 		  MMC_QUIRK_BLK_NO_CMD23),
 
 	/*
+	 * Some SD cards lockup while using CMD23 multiblock transfers.
+	 */
+	MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+		  MMC_QUIRK_BLK_NO_CMD23),
+	MMC_FIXUP("APUSD", CID_MANFID_APACER, 0x5048, add_quirk_sd,
+		  MMC_QUIRK_BLK_NO_CMD23),
+
+	/*
 	 * Some MMC cards need longer data read timeout than indicated in CSD.
 	 */
 	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
Signature · 1 line
2.1.4
Applied
#11 lore raw

Re: [PATCH v3] mmc: core: apply NO_CMD23 quirk to some specific cards

Quoted 27 lines · Christoph Fritz

To get an usdhc Apacer and some ATP SD cards work reliable, CMD23 needs to be disabled. This has been tested on i.MX6 (sdhci-esdhc) and rk3288 (dw_mmc-rockchip).

Without this patch on i.MX6 (sdhci-esdhc):

 $ dd if=/dev/urandom of=/mnt/test bs=1M count=10 conv=fsync
    | <mmc0: starting CMD23 arg 00000400 flags 00000015>
    | mmc0: starting CMD25 arg 00a71f00 flags 000000b5
    | mmc0:     blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0
    | mmc0:     CMD12 arg 00000000 flags 0000049d
    | sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001
    | mmc0: Timeout waiting for hardware interrupt.

Without this patch on rk3288 (dw_mmc-rockchip):

    | mmc1: Card stuck in programming state! mmcblk1 card_busy_detect
    | dwmmc_rockchip ff0c0000.dwmmc: Busy; trying anyway
    | mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz,
    | actual 400000HZ div = 0)
    | mmc1: card never left busy state
    | mmc1: tried to reset card, got error -110
    | blk_update_request: I/O error, dev mmcblk1, sector 139778
    | Buffer I/O error on dev mmcblk1p1, logical block 131586, lost async
    | page write
Quoted 1 line

Thanks, applied for fixes and added a stable tag (4.14+, since the patch didn't apply to earlier versions).

If/when Shawn find some time to re-spin his series, adding support for ACMD23 [1], we may be able to revert this change. Let's see.

However, using the quirks as a fix for stable is certainly a good approach.

Kind regards
Uffe

Quoted 49 lines

---
Changes since v1:
- s/CMD32/CMD23
Changes since v2:
- add an Apacer card
- adapt comment

 drivers/mmc/core/card.h   | 2 ++
 drivers/mmc/core/quirks.h | 8 ++++++++
 2 files changed, 10 insertions(+)
drivers/mmc/core/card.h +2 -0
index f06cd91..79a5b98 100644
@@ -75,9 +75,11 @@ struct mmc_fixup {
 #define EXT_CSD_REV_ANY (-1u)
 
 #define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_ATP          0x9
 #define CID_MANFID_TOSHIBA      0x11
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
+#define CID_MANFID_APACER       0x27
 #define CID_MANFID_KINGSTON     0x70
 #define CID_MANFID_HYNIX       0x90
 
drivers/mmc/core/quirks.h +8 -1
index 9107f0b..d4ff9d8 100644
@@ -53,6 +53,14 @@ static const struct mmc_fixup mmc_blk_fixups[] = {
                  MMC_QUIRK_BLK_NO_CMD23),
 
        /*
+        * Some SD cards lockup while using CMD23 multiblock transfers.
+        */
+       MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
+                 MMC_QUIRK_BLK_NO_CMD23),
+       MMC_FIXUP("APUSD", CID_MANFID_APACER, 0x5048, add_quirk_sd,
+                 MMC_QUIRK_BLK_NO_CMD23),
+
+       /*
         * Some MMC cards need longer data read timeout than indicated in CSD.
         */
        MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
--

2.1.4

#12 lore raw

Re: [PATCH v3] mmc: core: apply NO_CMD23 quirk to some specific cards

Quoted 2 lines · Ulf Hansson

If/when Shawn find some time to re-spin his series, adding support for ACMD23 [1], we may be able to revert this change. Let's see.

If you or Shawn want me to test then again, please give me a head up.

Quoted 1 line

However, using the quirks as a fix for stable is certainly a good approach.

Thanks
-- Christoph