Skip to content

Commit

Permalink
mmc: core: Parse the SD SCR register for support of CMD48/49 and CMD5…
Browse files Browse the repository at this point in the history
…8/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
  • Loading branch information
Ulf Hansson committed Jun 14, 2021
1 parent 41e84fe commit dbea8ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mmc/core/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ static int mmc_decode_scr(struct mmc_card *card)
else
card->erased_byte = 0x0;

if (scr->sda_spec3)
if (scr->sda_spec4)
scr->cmds = UNSTUFF_BITS(resp, 32, 4);
else if (scr->sda_spec3)
scr->cmds = UNSTUFF_BITS(resp, 32, 2);

/* SD Spec says: any SD Card shall set at least bits 0 and 2 */
Expand Down
2 changes: 2 additions & 0 deletions include/linux/mmc/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ struct sd_scr {
unsigned char cmds;
#define SD_SCR_CMD20_SUPPORT (1<<0)
#define SD_SCR_CMD23_SUPPORT (1<<1)
#define SD_SCR_CMD48_SUPPORT (1<<2)
#define SD_SCR_CMD58_SUPPORT (1<<3)
};

struct sd_ssr {
Expand Down

0 comments on commit dbea8ae

Please sign in to comment.