Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc support SDHC 4.0, allow for overriding clk bas...
details: https://anonhg.NetBSD.org/src/rev/8d22377887ee
branches: trunk
changeset: 337873:8d22377887ee
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat May 02 12:10:24 2015 +0000
description:
support SDHC 4.0, allow for overriding clk base frequency
diffstat:
sys/dev/sdmmc/sdhc.c | 17 +++++++++++------
sys/dev/sdmmc/sdhcreg.h | 3 ++-
sys/dev/sdmmc/sdhcvar.h | 3 ++-
3 files changed, 15 insertions(+), 8 deletions(-)
diffs (97 lines):
diff -r 53915e744602 -r 8d22377887ee sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c Sat May 02 12:09:34 2015 +0000
+++ b/sys/dev/sdmmc/sdhc.c Sat May 02 12:10:24 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.55 2015/04/14 18:34:29 bouyer Exp $ */
+/* $NetBSD: sdhc.c,v 1.56 2015/05/02 12:10:24 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.55 2015/04/14 18:34:29 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.56 2015/05/02 12:10:24 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -289,6 +289,10 @@
aprint_normal("3.0");
break;
+ case SDHC_SPEC_VERS_400:
+ aprint_normal("4.0");
+ break;
+
default:
aprint_normal("unknown version(0x%x)",
SDHC_SPEC_VERSION(sdhcver));
@@ -329,12 +333,13 @@
/*
* Determine the base clock frequency. (2.2.24)
*/
- if (hp->specver == SDHC_SPEC_VERS_300) {
+ if (hp->specver >= SDHC_SPEC_VERS_300) {
hp->clkbase = SDHC_BASE_V3_FREQ_KHZ(caps);
} else {
hp->clkbase = SDHC_BASE_FREQ_KHZ(caps);
}
- if (hp->clkbase == 0) {
+ if (hp->clkbase == 0 ||
+ ISSET(sc->sc_flags, SDHC_FLAG_NO_CLKBASE)) {
if (sc->sc_clkbase == 0) {
/* The attachment driver must tell us. */
aprint_error_dev(sc->sc_dev,
@@ -424,7 +429,7 @@
else if (hp->sc->sc_clkmsk != 0)
saa.saa_clkmin = hp->clkbase / (hp->sc->sc_clkmsk >>
(ffs(hp->sc->sc_clkmsk) - 1));
- else if (hp->specver == SDHC_SPEC_VERS_300)
+ else if (hp->specver >= SDHC_SPEC_VERS_300)
saa.saa_clkmin = hp->clkbase / 0x3ff;
else
saa.saa_clkmin = hp->clkbase / 256;
@@ -827,7 +832,7 @@
//freq = hp->clkbase / div;
return true;
}
- if (hp->specver == SDHC_SPEC_VERS_300) {
+ if (hp->specver >= SDHC_SPEC_VERS_300) {
div = howmany(hp->clkbase, freq);
div = div > 1 ? howmany(div, 2) : 0;
if (div > 0x3ff)
diff -r 53915e744602 -r 8d22377887ee sys/dev/sdmmc/sdhcreg.h
--- a/sys/dev/sdmmc/sdhcreg.h Sat May 02 12:09:34 2015 +0000
+++ b/sys/dev/sdmmc/sdhcreg.h Sat May 02 12:10:24 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhcreg.h,v 1.12 2015/01/26 04:56:56 nonaka Exp $ */
+/* $NetBSD: sdhcreg.h,v 1.13 2015/05/02 12:10:24 jmcneill Exp $ */
/* $OpenBSD: sdhcreg.h,v 1.4 2006/07/30 17:20:40 fgsch Exp $ */
/*
@@ -183,6 +183,7 @@
#define SDHC_SPEC_VERS_100 0x00
#define SDHC_SPEC_VERS_200 0x01
#define SDHC_SPEC_VERS_300 0x02
+#define SDHC_SPEC_VERS_400 0x03
/* SDHC_CAPABILITIES decoding */
#define SDHC_BASE_V3_FREQ_KHZ(cap) \
diff -r 53915e744602 -r 8d22377887ee sys/dev/sdmmc/sdhcvar.h
--- a/sys/dev/sdmmc/sdhcvar.h Sat May 02 12:09:34 2015 +0000
+++ b/sys/dev/sdmmc/sdhcvar.h Sat May 02 12:10:24 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhcvar.h,v 1.16 2015/04/14 18:34:29 bouyer Exp $ */
+/* $NetBSD: sdhcvar.h,v 1.17 2015/05/02 12:10:24 jmcneill Exp $ */
/* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
/*
@@ -52,6 +52,7 @@
#define SDHC_FLAG_NO_HS_BIT 0x00002000 /* Don't set SDHC_HIGH_SPEED bit */
#define SDHC_FLAG_EXTERNAL_DMA 0x00004000
#define SDHC_FLAG_EXTDMA_DMAEN 0x00008000 /* ext. dma need SDHC_DMA_ENABLE */
+#define SDHC_FLAG_NO_CLKBASE 0x00020000 /* ignore clkbase register */
uint32_t sc_clkbase;
int sc_clkmsk; /* Mask for SDCLK */
Home |
Main Index |
Thread Index |
Old Index