Skip to content

Commit dbea8ae

Browse files
author
Ulf Hansson
committed
mmc: core: Parse the SD SCR register for support of CMD48/49 and CMD58/59
In SD spec v4.x the support for CMD48/49 and CMD58/59 were introduced as optional features. To let the card announce whether it supports the commands, the SCR register has been extended with corresponding support bits. Let's parse and store this information for later use. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Acked-by: Avri Altman <avri.altman@wdc.com> Link: https://lore.kernel.org/r/20210504161222.101536-9-ulf.hansson@linaro.org
1 parent 41e84fe commit dbea8ae

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎drivers/mmc/core/sd.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ static int mmc_decode_scr(struct mmc_card *card)
222222
else
223223
card->erased_byte = 0x0;
224224

225-
if (scr->sda_spec3)
225+
if (scr->sda_spec4)
226+
scr->cmds = UNSTUFF_BITS(resp, 32, 4);
227+
else if (scr->sda_spec3)
226228
scr->cmds = UNSTUFF_BITS(resp, 32, 2);
227229

228230
/* SD Spec says: any SD Card shall set at least bits 0 and 2 */

‎include/linux/mmc/card.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ struct sd_scr {
139139
unsigned char cmds;
140140
#define SD_SCR_CMD20_SUPPORT (1<<0)
141141
#define SD_SCR_CMD23_SUPPORT (1<<1)
142+
#define SD_SCR_CMD48_SUPPORT (1<<2)
143+
#define SD_SCR_CMD58_SUPPORT (1<<3)
142144
};
143145

144146
struct sd_ssr {

0 commit comments

Comments
 (0)