]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mmc: block: don't use CMD23 with very old MMC cards
authorDaniel Glöckner <dg@emlix.com>
Tue, 30 Aug 2016 12:17:30 +0000 (14:17 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 26 Sep 2016 19:31:17 +0000 (21:31 +0200)
CMD23 aka SET_BLOCK_COUNT was introduced with MMC v3.1.
Older versions of the specification allowed to terminate
multi-block transfers only with CMD12.

The patch fixes the following problem:

  mmc0: new MMC card at address 0001
  mmcblk0: mmc0:0001 SDMB-16 15.3 MiB
  mmcblk0: timed out sending SET_BLOCK_COUNT command, card status 0x400900
  ...
  blk_update_request: I/O error, dev mmcblk0, sector 0
  Buffer I/O error on dev mmcblk0, logical block 0, async page read
   mmcblk0: unable to read partition table

Signed-off-by: Daniel Glöckner <dg@emlix.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/card/block.c

index 74c7625ee0dbc3a9b8a98eebf0eef4c607b4add4..03670aa5ac8e5025b107a87e82cacccc97fded32 100644 (file)
@@ -2303,7 +2303,8 @@ again:
        set_capacity(md->disk, size);
 
        if (mmc_host_cmd23(card->host)) {
-               if (mmc_card_mmc(card) ||
+               if ((mmc_card_mmc(card) &&
+                    card->csd.mmca_vsn >= CSD_SPEC_VER_3) ||
                    (mmc_card_sd(card) &&
                     card->scr.cmds & SD_SCR_CMD23_SUPPORT))
                        md->flags |= MMC_BLK_CMD23;