Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jan 2016 19:36:49 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294679 - stable/10/sys/arm/freescale/imx
Message-ID:  <201601241936.u0OJan11081792@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sun Jan 24 19:36:49 2016
New Revision: 294679
URL: https://svnweb.freebsd.org/changeset/base/294679

Log:
  MFC r292419, r294237:
  
    Fix the clock divisor calc for imx6 sdcard bus speed.
  
    Quick exit after setting the clock control register.

Modified:
  stable/10/sys/arm/freescale/imx/imx_sdhci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/freescale/imx/imx_sdhci.c
==============================================================================
--- stable/10/sys/arm/freescale/imx/imx_sdhci.c	Sun Jan 24 19:34:05 2016	(r294678)
+++ stable/10/sys/arm/freescale/imx/imx_sdhci.c	Sun Jan 24 19:36:49 2016	(r294679)
@@ -429,6 +429,7 @@ imx_sdhci_write_2(device_t dev, struct s
 		} else {
 			imx_sdhc_set_clock(sc, false);
 		}
+		return;
 	}
 
 	/*
@@ -522,12 +523,19 @@ imx_sdhc_set_clock(struct imx_sdhci_soft
 	else
 		freq = sc->baseclk_hz / (2 * divisor);
 
-	for (prescale = 2; prescale < freq / prescale / 16;)
+	for (prescale = 2; freq < sc->baseclk_hz / (prescale * 16);)
 		prescale <<= 1;
 
-	for (divisor = 1; freq < freq / prescale / divisor;)
+	for (divisor = 1; freq < sc->baseclk_hz / (prescale * divisor);)
 		++divisor;
 
+#ifdef DEBUG	
+	device_printf(sc->dev,
+	    "desired SD freq: %d, actual: %d; base %d prescale %d divisor %d\n",
+	    freq, sc->baseclk_hz / (prescale * divisor), sc->baseclk_hz, 
+	    prescale, divisor);
+#endif	
+
 	prescale >>= 1;
 	divisor -= 1;
 



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