svn commit: r185661 - head/sys/dev/sdhci

Alexander Motin mav at FreeBSD.org
Fri Dec 5 17:31:08 PST 2008


Author: mav
Date: Sat Dec  6 01:31:07 2008
New Revision: 185661
URL: http://svn.freebsd.org/changeset/base/185661

Log:
  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.

Modified:
  head/sys/dev/sdhci/sdhci.c

Modified: head/sys/dev/sdhci/sdhci.c
==============================================================================
--- head/sys/dev/sdhci/sdhci.c	Sat Dec  6 01:11:45 2008	(r185660)
+++ head/sys/dev/sdhci/sdhci.c	Sat Dec  6 01:31:07 2008	(r185661)
@@ -301,8 +301,10 @@ sdhci_reset(struct sdhci_slot *slot, uin
 
 	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 *s
 
 	/* 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;


More information about the svn-src-all mailing list