Skip to content

Commit f0d8997

Browse files
andreiwcjb
authored andcommitted
mmc: core: Block CMD23 support for UHS104/SDXC cards.
SD cards operating at UHS104 or better support SET_BLOCK_COUNT. Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Reviewed-by: Arindam Nath <arindam.nath@amd.com> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent e89d456 commit f0d8997

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎drivers/mmc/card/block.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
10571057
blk_queue_logical_block_size(md->queue.queue, 512);
10581058
set_capacity(md->disk, size);
10591059

1060-
if (mmc_host_cmd23(card->host) &&
1061-
mmc_card_mmc(card))
1062-
md->flags |= MMC_BLK_CMD23;
1060+
if (mmc_host_cmd23(card->host)) {
1061+
if (mmc_card_mmc(card) ||
1062+
(mmc_card_sd(card) &&
1063+
card->scr.cmds & SD_SCR_CMD23_SUPPORT))
1064+
md->flags |= MMC_BLK_CMD23;
1065+
}
10631066

10641067
if (mmc_card_mmc(card) &&
10651068
md->flags & MMC_BLK_CMD23 &&

‎drivers/mmc/core/sd.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ static int mmc_decode_scr(struct mmc_card *card)
203203
else
204204
card->erased_byte = 0x0;
205205

206+
if (scr->sda_spec3)
207+
scr->cmds = UNSTUFF_BITS(resp, 32, 2);
206208
return 0;
207209
}
208210

‎include/linux/mmc/card.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ struct sd_scr {
7272
unsigned char bus_widths;
7373
#define SD_SCR_BUS_WIDTH_1 (1<<0)
7474
#define SD_SCR_BUS_WIDTH_4 (1<<2)
75+
unsigned char cmds;
76+
#define SD_SCR_CMD20_SUPPORT (1<<0)
77+
#define SD_SCR_CMD23_SUPPORT (1<<1)
7578
};
7679

7780
struct sd_ssr {

‎include/linux/mmc/sd.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
6868
#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
69-
#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
69+
#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00-3.0X */
7070

7171
/*
7272
* SD bus widths

0 commit comments

Comments
 (0)