Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc Add a quirk for Ricoh 5U823 controller. Operat...



details:   https://anonhg.NetBSD.org/src/rev/c97311ae3a19
branches:  trunk
changeset: 809922:c97311ae3a19
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Aug 09 13:24:39 2015 +0000

description:
Add a quirk for Ricoh 5U823 controller. Operation with a 100MHz
bus clock for SDR50 seems to be unstable, reduce frequency one notch
(effectively down to 66MHz with divisor = 3).

diffstat:

 sys/dev/sdmmc/sdhc.c    |  13 +++++++++++--
 sys/dev/sdmmc/sdhcvar.h |   3 ++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diffs (51 lines):

diff -r 601e8cf5a59d -r c97311ae3a19 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Sun Aug 09 13:18:46 2015 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Sun Aug 09 13:24:39 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc.c,v 1.81 2015/08/06 09:30:55 jmcneill Exp $       */
+/*     $NetBSD: sdhc.c,v 1.82 2015/08/09 13:24:39 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.81 2015/08/06 09:30:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.82 2015/08/09 13:24:39 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -1072,6 +1072,15 @@
        }
 
        /*
+        * Slow down Ricoh 5U823 controller that isn't reliable
+        * at 100MHz bus clock.
+        */
+       if (ISSET(hp->sc->sc_flags, SDHC_FLAG_SLOW_SDR50)) {
+               if (freq == 100000)
+                       --freq;
+       }
+
+       /*
         * Set the minimum base clock frequency divisor.
         */
        if (!sdhc_clock_divisor(hp, freq, &div)) {
diff -r 601e8cf5a59d -r c97311ae3a19 sys/dev/sdmmc/sdhcvar.h
--- a/sys/dev/sdmmc/sdhcvar.h   Sun Aug 09 13:18:46 2015 +0000
+++ b/sys/dev/sdmmc/sdhcvar.h   Sun Aug 09 13:24:39 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhcvar.h,v 1.23 2015/08/03 12:11:36 jmcneill Exp $    */
+/*     $NetBSD: sdhcvar.h,v 1.24 2015/08/09 13:24:39 mlelstv Exp $     */
 /*     $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
 
 /*
@@ -57,6 +57,7 @@
 #define        SDHC_FLAG_NO_TIMEOUT    0x00080000 /* ignore timeout interrupts */
 #define        SDHC_FLAG_USE_ADMA2     0x00100000
 #define        SDHC_FLAG_POLL_CARD_DET 0x00200000 /* polling card detect */
+#define        SDHC_FLAG_SLOW_SDR50    0x00400000 /* reduce SDR50 speed */
 
        uint32_t                sc_clkbase;
        int                     sc_clkmsk;      /* Mask for SDCLK */



Home | Main Index | Thread Index | Old Index