Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/omap Initial kludgerific attempt at making sdhc...
details: https://anonhg.NetBSD.org/src/rev/c799cfa9bc9b
branches: trunk
changeset: 783223:c799cfa9bc9b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Dec 11 19:26:40 2012 +0000
description:
Initial kludgerific attempt at making sdhc work on the AM335x.
There's a timing issue somewhere in the whole sdmmc thing so that
this doesn't actually work without SDMMC_DEBUG or some specially
crafted debugging messages, and the SoC-specific code needs to be
separated out here another way, but it's a little progress.
diffstat:
sys/arch/arm/omap/omap3_sdhc.c | 50 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 2 deletions(-)
diffs (106 lines):
diff -r 1153492a49ba -r c799cfa9bc9b sys/arch/arm/omap/omap3_sdhc.c
--- a/sys/arch/arm/omap/omap3_sdhc.c Tue Dec 11 19:24:38 2012 +0000
+++ b/sys/arch/arm/omap/omap3_sdhc.c Tue Dec 11 19:26:40 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: omap3_sdhc.c,v 1.3 2012/12/11 01:54:42 khorben Exp $ */
+/* $NetBSD: omap3_sdhc.c,v 1.4 2012/12/11 19:26:40 riastradh Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.3 2012/12/11 01:54:42 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.4 2012/12/11 19:26:40 riastradh Exp $");
#include "opt_omap.h"
@@ -45,6 +45,11 @@
#include <arm/omap/omap2_obiovar.h>
#include <arm/omap/omap3_sdmmcreg.h>
+#ifdef TI_AM335X
+# include <arm/omap/am335x_prcm.h>
+# include <arm/omap/omap2_prcm.h>
+#endif
+
#include <dev/sdmmc/sdhcreg.h>
#include <dev/sdmmc/sdhcvar.h>
@@ -72,6 +77,22 @@
void *sc_ih; /* interrupt vectoring */
};
+#ifdef TI_AM335X
+struct am335x_sdhc {
+ const char *as_name;
+ bus_addr_t as_base_addr;
+ int as_intr;
+ struct omap_module as_module;
+};
+
+static const struct am335x_sdhc am335x_sdhc[] = {
+ /* XXX All offset by 0x100 because of the am335x's mmc registers. */
+ { "MMCHS0", 0x48060100, 64, { AM335X_PRCM_CM_PER, 0x3c } },
+ { "MMC1", 0x481d8100, 28, { AM335X_PRCM_CM_PER, 0xf4 } },
+ { "MMCHS2", 0x47810100, 29, { AM335X_PRCM_CM_WKUP, 0xf8 } },
+};
+#endif
+
CFATTACH_DECL_NEW(obiosdhc, sizeof(struct obiosdhc_softc),
obiosdhc_match, obiosdhc_attach, obiosdhc_detach, NULL);
@@ -81,6 +102,10 @@
#if defined(OMAP_3430) || defined(OMAP_3530)
struct obio_attach_args * const oa = aux;
#endif
+#ifdef TI_AM335X
+ struct obio_attach_args * const oa = aux;
+ size_t i;
+#endif
#if defined(OMAP_3430)
if (oa->obio_addr == SDMMC1_BASE_3430
@@ -94,6 +119,13 @@
return 1;
#endif
+#ifdef TI_AM335X
+ for (i = 0; i < __arraycount(am335x_sdhc); i++)
+ if ((oa->obio_addr == am335x_sdhc[i].as_base_addr) &&
+ (oa->obio_intr == am335x_sdhc[i].as_intr))
+ return 1;
+#endif
+
return 0;
}
@@ -104,6 +136,9 @@
struct obio_attach_args * const oa = aux;
uint32_t clkd, stat;
int error, timo, clksft, n;
+#ifdef TI_AM335X
+ size_t i;
+#endif
sc->sc.sc_dmat = oa->obio_dmat;
sc->sc.sc_dev = self;
@@ -136,6 +171,17 @@
aprint_naive(": SDHC controller\n");
aprint_normal(": SDHC controller\n");
+#ifdef TI_AM335X
+ /* XXX Not really AM335X-specific. */
+ for (i = 0; i < __arraycount(am335x_sdhc); i++)
+ if ((oa->obio_addr == am335x_sdhc[i].as_base_addr) &&
+ (oa->obio_intr == am335x_sdhc[i].as_intr)) {
+ prcm_module_enable(&am335x_sdhc[i].as_module);
+ break;
+ }
+ KASSERT(i < __arraycount(am335x_sdhc));
+#endif
+
/* XXXXXX: Turn-on regurator via I2C. */
/* XXXXXX: And enable ICLOCK/FCLOCK. */
Home |
Main Index |
Thread Index |
Old Index