Always select the card before we do the 4.x specific stuff and

deselect it after setting the block size. This is a similar bug that
was fixed elsewhere, but not here. This makes sure that we leave the
card deselected at the end of the loop, and we don't send any commands
to the card without it selected.

Reviewed by: ian@
This commit is contained in:
Warner Losh 2014-12-23 05:50:53 +00:00
parent df90fb1f9f
commit 3e834dd35d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276106

View File

@ -1446,10 +1446,10 @@ mmc_discover_cards(struct mmc_softc *sc)
break;
}
mmc_select_card(sc, ivar->rca);
/* Only MMC >= 4.x cards support EXT_CSD. */
if (ivar->csd.spec_vers >= 4) {
/* Card must be selected to fetch EXT_CSD. */
mmc_select_card(sc, ivar->rca);
mmc_send_ext_csd(sc, ivar->raw_ext_csd);
/* Handle extended capacity from EXT_CSD */
sec_count = ivar->raw_ext_csd[EXT_CSD_SEC_CNT] +
@ -1479,7 +1479,6 @@ mmc_discover_cards(struct mmc_softc *sc)
mmc_switch(sc, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_ERASE_GRP_DEF, 1);
}
mmc_select_card(sc, 0);
} else {
ivar->bus_width = bus_width_1;
ivar->timing = bus_timing_normal;
@ -1506,6 +1505,7 @@ mmc_discover_cards(struct mmc_softc *sc)
child = device_add_child(sc->dev, NULL, -1);
device_set_ivars(child, ivar);
}
mmc_select_card(sc, 0);
}
}