Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sdmmc Fix divisor calculation for SDHC 3.0.



details:   https://anonhg.NetBSD.org/src/rev/a7f520290849
branches:  trunk
changeset: 332662:a7f520290849
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Thu Oct 02 18:14:38 2014 +0000

description:
Fix divisor calculation for SDHC 3.0.
1/1   -> 0
1/2   -> 1
1/4   -> 2
...
1/2*N -> N

diffstat:

 sys/dev/sdmmc/sdhc.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r f449b0de973b -r a7f520290849 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Thu Oct 02 16:17:33 2014 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Thu Oct 02 18:14:38 2014 +0000
@@ -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 @@
        }
        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)



Home | Main Index | Thread Index | Old Index