Module Name:    src
Committed By:   jmcneill
Date:           Wed Oct  1 20:59:37 UTC 2014

Modified Files:
        src/sys/dev/sdmmc: sdhc.c

Log Message:
correct clk div calculation for SD 3.0 controllers


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/sdmmc/sdhc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.48 src/sys/dev/sdmmc/sdhc.c:1.49
--- src/sys/dev/sdmmc/sdhc.c:1.48	Wed Oct  1 00:25:43 2014
+++ src/sys/dev/sdmmc/sdhc.c	Wed Oct  1 20:59:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.48 2014/10/01 00:25:43 jmcneill Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.49 2014/10/01 20:59:37 jmcneill Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.48 2014/10/01 00:25:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.49 2014/10/01 20:59:37 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -814,6 +814,8 @@ sdhc_clock_divisor(struct sdhc_host *hp,
 	}
 	if (hp->specver == SDHC_SPEC_VERS_300) {
 		div = howmany(hp->clkbase, freq);
+		if (div > 0)
+			--div;
 		if (div > 0x3ff)
 			return false;
 		*divp = (((div >> 8) & SDHC_SDCLK_XDIV_MASK)

Reply via email to