]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.8.5/mmc-block-don-t-use-cmd23-with-very-old-mmc-cards.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.5 / mmc-block-don-t-use-cmd23-with-very-old-mmc-cards.patch
1 From 0ed50abb2d8fc81570b53af25621dad560cd49b3 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= <dg@emlix.com>
3 Date: Tue, 30 Aug 2016 14:17:30 +0200
4 Subject: mmc: block: don't use CMD23 with very old MMC cards
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Daniel Glöckner <dg@emlix.com>
10
11 commit 0ed50abb2d8fc81570b53af25621dad560cd49b3 upstream.
12
13 CMD23 aka SET_BLOCK_COUNT was introduced with MMC v3.1.
14 Older versions of the specification allowed to terminate
15 multi-block transfers only with CMD12.
16
17 The patch fixes the following problem:
18
19 mmc0: new MMC card at address 0001
20 mmcblk0: mmc0:0001 SDMB-16 15.3 MiB
21 mmcblk0: timed out sending SET_BLOCK_COUNT command, card status 0x400900
22 ...
23 blk_update_request: I/O error, dev mmcblk0, sector 0
24 Buffer I/O error on dev mmcblk0, logical block 0, async page read
25 mmcblk0: unable to read partition table
26
27 Signed-off-by: Daniel Glöckner <dg@emlix.com>
28 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 drivers/mmc/card/block.c | 3 ++-
33 1 file changed, 2 insertions(+), 1 deletion(-)
34
35 --- a/drivers/mmc/card/block.c
36 +++ b/drivers/mmc/card/block.c
37 @@ -2303,7 +2303,8 @@ again:
38 set_capacity(md->disk, size);
39
40 if (mmc_host_cmd23(card->host)) {
41 - if (mmc_card_mmc(card) ||
42 + if ((mmc_card_mmc(card) &&
43 + card->csd.mmca_vsn >= CSD_SPEC_VER_3) ||
44 (mmc_card_sd(card) &&
45 card->scr.cmds & SD_SCR_CMD23_SUPPORT))
46 md->flags |= MMC_BLK_CMD23;