Module Name:    src
Committed By:   mlelstv
Date:           Sun Aug  9 13:24:39 UTC 2015

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

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/sdmmc/sdhc.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sdmmc/sdhcvar.h

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.81 src/sys/dev/sdmmc/sdhc.c:1.82
--- src/sys/dev/sdmmc/sdhc.c:1.81	Thu Aug  6 09:30:55 2015
+++ src/sys/dev/sdmmc/sdhc.c	Sun Aug  9 13:24:39 2015
@@ -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 @@ sdhc_bus_clock_ddr(sdmmc_chipset_handle_
 	}
 
 	/*
+	 * 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)) {

Index: src/sys/dev/sdmmc/sdhcvar.h
diff -u src/sys/dev/sdmmc/sdhcvar.h:1.23 src/sys/dev/sdmmc/sdhcvar.h:1.24
--- src/sys/dev/sdmmc/sdhcvar.h:1.23	Mon Aug  3 12:11:36 2015
+++ src/sys/dev/sdmmc/sdhcvar.h	Sun Aug  9 13:24:39 2015
@@ -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 @@ struct sdhc_softc {
 #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 */

Reply via email to