Deselect the sd card before re-selecting it when working around a problem

with some cards that causes them to become deselected after probing for
switch capabilities.  The old workaround fixes the behavior with some cards,
but causes problems with the cards the behave correctly and don't become
deselected.  Forcing a deselect then reselect appears to work correctly
with all cards in initial testing.
This commit is contained in:
Ian Lepore 2015-07-18 16:56:51 +00:00
parent a6e8e92404
commit e7b25f9168
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285678

View File

@ -1381,17 +1381,18 @@ mmc_discover_cards(struct mmc_softc *sc)
} }
/* /*
* We reselect the card here. Some cards become * We deselect then reselect the card here. Some cards
* unselected and timeout with the above two commands, * become unselected and timeout with the above two
* although the state tables / diagrams in the standard * commands, although the state tables / diagrams in the
* suggest they go back to the transfer state. The only * standard suggest they go back to the transfer state.
* thing we use from the sd_status is the erase sector * Other cards don't become deselected, and if we
* size, but it is still nice to get that right. It is * atttempt to blindly re-select them, we get timeout
* normally harmless for cards not misbehaving. The * errors from some controllers. So we deselect then
* Atmel bridge will complain about this command timing * reselect to handle all situations. The only thing we
* out. Others seem to handle it correctly, so it may * use from the sd_status is the erase sector size, but
* be a combination of card and controller. * it is still nice to get that right.
*/ */
mmc_select_card(sc, 0);
mmc_select_card(sc, ivar->rca); mmc_select_card(sc, ivar->rca);
mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status); mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status);
mmc_app_decode_sd_status(ivar->raw_sd_status, mmc_app_decode_sd_status(ivar->raw_sd_status,