Module Name: src
Committed By: mlelstv
Date: Thu Oct 2 18:14:38 UTC 2014
Modified Files:
src/sys/dev/sdmmc: sdhc.c
Log Message:
Fix divisor calculation for SDHC 3.0.
1/1 -> 0
1/2 -> 1
1/4 -> 2
...
1/2*N -> N
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 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.49 src/sys/dev/sdmmc/sdhc.c:1.50
--- src/sys/dev/sdmmc/sdhc.c:1.49 Wed Oct 1 20:59:37 2014
+++ src/sys/dev/sdmmc/sdhc.c Thu Oct 2 18:14:38 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.49 2014/10/01 20:59:37 jmcneill Exp $ */
+/* $NetBSD: sdhc.c,v 1.50 2014/10/02 18:14:38 mlelstv 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.49 2014/10/01 20:59:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.50 2014/10/02 18:14:38 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -814,8 +814,7 @@ sdhc_clock_divisor(struct sdhc_host *hp,
}
if (hp->specver == SDHC_SPEC_VERS_300) {
div = howmany(hp->clkbase, freq);
- if (div > 0)
- --div;
+ div = div > 1 ? howmany(div, 2) : 0;
if (div > 0x3ff)
return false;
*divp = (((div >> 8) & SDHC_SDCLK_XDIV_MASK)