svn commit: r283128 - head/sys/dev/mmc
Warner Losh
imp at FreeBSD.org
Tue May 19 21:16:54 UTC 2015
Author: imp
Date: Tue May 19 21:16:53 2015
New Revision: 283128
URL: https://svnweb.freebsd.org/changeset/base/283128
Log:
Re-select the SD card before getting the SD status. On a couple Atmel
boards, this prevents some error messages during enumeration and also
gives us the correct erase block size. They appear to be harmless
elsewhere.
# Note: we treat too many commands as 'can't fail' if they don't work
# after a couple of retries. We need to fix that, but not today...
Modified:
head/sys/dev/mmc/mmc.c
Modified: head/sys/dev/mmc/mmc.c
==============================================================================
--- head/sys/dev/mmc/mmc.c Tue May 19 21:16:51 2015 (r283127)
+++ head/sys/dev/mmc/mmc.c Tue May 19 21:16:53 2015 (r283128)
@@ -1379,6 +1379,20 @@ mmc_discover_cards(struct mmc_softc *sc)
ivar->hs_tran_speed = SD_MAX_HS;
}
}
+
+ /*
+ * 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);
mmc_app_decode_sd_status(ivar->raw_sd_status,
&ivar->sd_status);
More information about the svn-src-all
mailing list