# HG changeset patch # Parent 9acb94fa7860f39c457094a6e21589cce9971839 diff -r 9acb94fa7860 -r abf3cf6d05d6 sys/dev/mmc/mmc.c --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -1380,20 +1380,24 @@ mmc_discover_cards(struct mmc_softc *sc) } } - /* - * We reselect the card here. Some cards become - * unselected and timeout with the above two commands, - * although the state tables / diagrams in the standard - * suggest they go back to the transfer state. The only - * thing we use from the sd_status is the erase sector - * size, but it is still nice to get that right. It is - * normally harmless for cards not misbehaving. The - * Atmel bridge will complain about this command timing - * out. Others seem to handle it correctly, so it may - * be a combination of card and controller. - */ - mmc_select_card(sc, ivar->rca); - mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status); + err = mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status); + if (err != MMC_ERR_NONE) { + /* + * We reselect the card here. Some cards become + * unselected and timeout with the above two commands, + * although the state tables / diagrams in the standard + * suggest they go back to the transfer state. The only + * thing we use from the sd_status is the erase sector + * size, but it is still nice to get that right. It is + * normally harmless for cards not misbehaving. The + * Atmel bridge will complain about this command timing + * out. Others seem to handle it correctly, so it may + * be a combination of card and controller. + */ + mmc_select_card(sc, ivar->rca); + err = mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status); + /* XXX what to do in case the error persists? */ + } mmc_app_decode_sd_status(ivar->raw_sd_status, &ivar->sd_status); if (ivar->sd_status.au_size != 0) {