summaryrefslogtreecommitdiffstats
path: root/sys/dev/sdhci/sdhci.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2008-12-06 01:31:07 +0000
committermav <mav@FreeBSD.org>2008-12-06 01:31:07 +0000
commit0fa0ac8e2e1bf844cb674f3ca4fcb8e9498cca93 (patch)
tree21dedc58d7b898e47eb040a21edcaae6699c29a8 /sys/dev/sdhci/sdhci.c
parent67d3c5b7c356a4c6920f13003e3392f78e9171aa (diff)
downloadFreeBSD-src-0fa0ac8e2e1bf844cb674f3ca4fcb8e9498cca93.zip
FreeBSD-src-0fa0ac8e2e1bf844cb674f3ca4fcb8e9498cca93.tar.gz
Forget current bus power settings on full reset. Chip must be reconfigured.
Do not issue command if there is no card, clock or power. Controller will not detect command timeout without clock active.
Diffstat (limited to 'sys/dev/sdhci/sdhci.c')
-rw-r--r--sys/dev/sdhci/sdhci.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index 7157dac..5fe2e0f 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -301,8 +301,10 @@ sdhci_reset(struct sdhci_slot *slot, uint8_t mask)
WR1(slot, SDHCI_SOFTWARE_RESET, mask);
- if (mask & SDHCI_RESET_ALL)
+ if (mask & SDHCI_RESET_ALL) {
slot->clock = 0;
+ slot->power = 0;
+ }
/* Wait max 100 ms */
timeout = 100;
@@ -904,8 +906,11 @@ sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd)
/* Read controller present state. */
state = RD4(slot, SDHCI_PRESENT_STATE);
- /* Do not issue command if there is no card. */
- if ((state & SDHCI_CARD_PRESENT) == 0) {
+ /* Do not issue command if there is no card, clock or power.
+ * Controller will not detect timeout without clock active. */
+ if ((state & SDHCI_CARD_PRESENT) == 0 ||
+ slot->power == 0 ||
+ slot->clock == 0) {
cmd->error = MMC_ERR_FAILED;
slot->req = NULL;
slot->curcmd = NULL;
OpenPOWER on IntegriCloud