@@ -212,9 +212,9 @@ static int mmc_decode_scr(struct mmc_card *card)
/*
* Fetch and process SD Status register.
*/
-static int mmc_read_ssr(struct mmc_card *card)
+static int mmc_read_ssr(struct mmc_card *card, bool uhs_card)
{
- unsigned int au, es, et, eo;
+ unsigned int au, es, et, eo, au_min, au_max;
int err, i;
u32 *ssr;
@@ -243,8 +243,11 @@ static int mmc_read_ssr(struct mmc_card *card)
* UNSTUFF_BITS only works with four u32s so we have to offset the
* bitfield positions accordingly.
*/
- au = UNSTUFF_BITS(ssr, 428 - 384, 4);
- if (au > 0 && au <= 9) {
+ au_min = uhs_card ? 0x7 : 0x1;
+ au_max = card->scr.sda_spec3 ? 0xF : 0x9;
+ au = uhs_card ? UNSTUFF_BITS(ssr, 392 - 384, 4) :
+ UNSTUFF_BITS(ssr, 428 - 384, 4);
+ if (au >= au_min && au <= au_max) {
card->ssr.au = 1 << (au + 4);
es = UNSTUFF_BITS(ssr, 408 - 384, 16);
et = UNSTUFF_BITS(ssr, 402 - 384, 6);
@@ -793,7 +796,7 @@ int mmc_sd_get_csd(struct mmc_host *host, struct mmc_card *card)
}
int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
- bool reinit)
+ bool reinit, bool uhs_card)
{
int err;
@@ -812,7 +815,7 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
/*
* Fetch and process SD Status register.
*/
- err = mmc_read_ssr(card);
+ err = mmc_read_ssr(card, uhs_card);
if (err)
return err;
@@ -948,7 +951,8 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
return err;
}
- err = mmc_sd_setup_card(host, card, oldcard != NULL);
+ err = mmc_sd_setup_card(host, card, oldcard != NULL,
+ rocr & SD_ROCR_S18A);
if (err)
goto free_card;
@@ -9,7 +9,7 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr);
int mmc_sd_get_csd(struct mmc_host *host, struct mmc_card *card);
void mmc_decode_cid(struct mmc_card *card);
int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
- bool reinit);
+ bool reinit, bool uhs_card);
unsigned mmc_sd_get_max_clock(struct mmc_card *card);
int mmc_sd_switch_hs(struct mmc_card *card);
void mmc_sd_go_highspeed(struct mmc_card *card);
@@ -742,7 +742,8 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
mmc_fixup_device(card, NULL);
if (card->type == MMC_TYPE_SD_COMBO) {
- err = mmc_sd_setup_card(host, card, oldcard != NULL);
+ err = mmc_sd_setup_card(host, card, oldcard != NULL,
+ ocr & R4_18V_PRESENT);
/* handle as SDIO-only card if memory init failed */
if (err) {
mmc_go_idle(host);