Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Apr 2014 01:10:02 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264097 - head/sys/dev/sdhci
Message-ID:  <201404040110.s341A2i9094707@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Fri Apr  4 01:10:02 2014
New Revision: 264097
URL: http://svnweb.freebsd.org/changeset/base/264097

Log:
  When changing the sd bus clock divisor, clear just the bus clock enable bit
  before changing the divisor bits in the register.  We were writing a zero
  to the register, which clears the enable, but also cleared the divisor bits
  at the same time.  That's a violation of the sdhci spec, which says the
  divisor can only be changed when the clock is disabled.  This has worked
  okay on most hardware for years, but the TI OMAP controller would misbehave
  after changing the divisor improperly.
  
  Submitted by:	Svatopluk Kraus <onwahe@gmail.com>

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

Modified: head/sys/dev/sdhci/sdhci.c
==============================================================================
--- head/sys/dev/sdhci/sdhci.c	Fri Apr  4 00:59:40 2014	(r264096)
+++ head/sys/dev/sdhci/sdhci.c	Fri Apr  4 01:10:02 2014	(r264097)
@@ -235,7 +235,8 @@ sdhci_set_clock(struct sdhci_slot *slot,
 	slot->clock = clock;
 
 	/* Turn off the clock. */
-	WR2(slot, SDHCI_CLOCK_CONTROL, 0);
+	clk = RD2(slot, SDHCI_CLOCK_CONTROL);
+	WR2(slot, SDHCI_CLOCK_CONTROL, clk & ~SDHCI_CLOCK_CARD_EN);
 	/* If no clock requested - left it so. */
 	if (clock == 0)
 		return;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404040110.s341A2i9094707>