svn commit: r275905 - head/sys/dev/mmc
Warner Losh
imp at FreeBSD.org
Thu Dec 18 16:57:23 UTC 2014
Author: imp
Date: Thu Dec 18 16:57:22 2014
New Revision: 275905
URL: https://svnweb.freebsd.org/changeset/base/275905
Log:
Don't deselect the card too soon. To set the block size or switch the
function parameters, the card has to be in transfer state. If it is in
the idle state, the commands are ignored. This caused us not to set
the proper parameters that we later assume to be present, leading to
downstream failures of the card / interface as our state machine
mismatches the card's.
Submitted by: Svatopluk Kraus <onwahe at gmail.com>, Michal Meloun
<meloun at miracle.cz>
Modified:
head/sys/dev/mmc/mmc.c
Modified: head/sys/dev/mmc/mmc.c
==============================================================================
--- head/sys/dev/mmc/mmc.c Thu Dec 18 16:57:19 2014 (r275904)
+++ head/sys/dev/mmc/mmc.c Thu Dec 18 16:57:22 2014 (r275905)
@@ -1357,7 +1357,6 @@ mmc_discover_cards(struct mmc_softc *sc)
ivar->erase_sector =
16 << ivar->sd_status.au_size;
}
- mmc_select_card(sc, 0);
/* Find max supported bus width. */
if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) &&
(ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4))
@@ -1385,6 +1384,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);
return;
}
mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid);
@@ -1443,7 +1443,6 @@ mmc_discover_cards(struct mmc_softc *sc)
ivar->hs_tran_speed = ivar->tran_speed;
/* Find max supported bus width. */
ivar->bus_width = mmc_test_bus_width(sc);
- mmc_select_card(sc, 0);
/* Handle HC erase sector size. */
if (ivar->raw_ext_csd[EXT_CSD_ERASE_GRP_SIZE] != 0) {
ivar->erase_sector = 1024 *
@@ -1451,6 +1450,7 @@ 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;
More information about the svn-src-all
mailing list