Skip to content

Commit ec1ef20

Browse files
committed
mmc: sd: add fall-back extension register parsing attempt
Several types of cards have a common bug where the vendor did not populate the General Information block, but extension registers are present at assumed function offsets, and the features are correctly implemented. Probe the offsets to see if valid data is returned. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
1 parent 89050b1 commit ec1ef20

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

  • drivers/mmc/core

drivers/mmc/core/sd.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,26 @@ static int mmc_sd_read_ext_regs(struct mmc_card *card)
12181218
goto out;
12191219
}
12201220

1221+
/* Some cards have zeroes in GEN_INFO but correctly implement EXT_PERF and EXT_PWR */
1222+
if (!memcmp(card->ext_reg_buf, gen_info_buf, 512)) {
1223+
pr_info("%s: using fall-back extension register parsing\n",
1224+
mmc_hostname(card->host));
1225+
/* PWR typically hard-coded at FNO=1 */
1226+
err = sd_parse_ext_reg_power(card, 1, 0, 0);
1227+
if (err) {
1228+
pr_err("%s: error %d parsing SD Power extension\n",
1229+
mmc_hostname(card->host), err);
1230+
goto out;
1231+
}
1232+
/* PERF typically hard-coded at FNO=2 */
1233+
err = sd_parse_ext_reg_perf(card, 2, 0, 0);
1234+
if (err) {
1235+
pr_err("%s: error %d parsing SD Performance extension\n",
1236+
mmc_hostname(card->host), err);
1237+
}
1238+
goto out;
1239+
}
1240+
12211241
/* General info structure revision. */
12221242
memcpy(&rev, &gen_info_buf[0], 2);
12231243

0 commit comments

Comments
 (0)