Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys Pull up following revision(s) (requested by jmcneill ...
details: https://anonhg.NetBSD.org/src/rev/92251d8aed69
branches: netbsd-7
changeset: 799684:92251d8aed69
user: riz <riz%NetBSD.org@localhost>
date: Sun Nov 08 01:22:54 2015 +0000
description:
Pull up following revision(s) (requested by jmcneill in ticket #1022):
sys/dev/sdmmc/sdhc.c: revision 1.89
sys/arch/arm/omap/omap3_sdhc.c: revision 1.19
sys/dev/sdmmc/sdhcvar.h: revision 1.25
sys/arch/evbarm/beagle/beagle_machdep.c: revision 1.62
allow vendor specific code to hook into bus width changes
Support 8-bit eMMC for TI AM335x. On my BeagleBone Black,
Before: 134217728 bytes transferred in 9.410 secs (14263307 bytes/sec)
After: 134217728 bytes transferred in 7.518 secs (17852850 bytes/sec)
enable 8-bit mode on AM335X SDMMC2
diffstat:
sys/arch/arm/omap/omap3_sdhc.c | 64 +++++++++++++++++++++++++++++++-
sys/arch/evbarm/beagle/beagle_machdep.c | 6 +-
sys/dev/sdmmc/sdhc.c | 10 ++++-
sys/dev/sdmmc/sdhcvar.h | 3 +-
4 files changed, 75 insertions(+), 8 deletions(-)
diffs (195 lines):
diff -r ec554a6eb528 -r 92251d8aed69 sys/arch/arm/omap/omap3_sdhc.c
--- a/sys/arch/arm/omap/omap3_sdhc.c Sun Nov 08 01:14:20 2015 +0000
+++ b/sys/arch/arm/omap/omap3_sdhc.c Sun Nov 08 01:22:54 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: omap3_sdhc.c,v 1.14.4.1 2015/04/19 04:37:17 msaitoh Exp $ */
+/* $NetBSD: omap3_sdhc.c,v 1.14.4.2 2015/11/08 01:22:54 riz 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.14.4.1 2015/04/19 04:37:17 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap3_sdhc.c,v 1.14.4.2 2015/11/08 01:22:54 riz Exp $");
#include "opt_omap.h"
#include "edma.h"
@@ -51,6 +51,8 @@
#ifdef TI_AM335X
# include <arm/omap/am335x_prcm.h>
# include <arm/omap/omap2_prcm.h>
+# include <arm/omap/sitara_cm.h>
+# include <arm/omap/sitara_cmreg.h>
#endif
#if NEDMA > 0
@@ -84,6 +86,7 @@
static void obiosdhc_attach(device_t, device_t, void *);
static int obiosdhc_detach(device_t, int);
+static int obiosdhc_bus_width(struct sdhc_softc *, int);
static int obiosdhc_bus_clock(struct sdhc_softc *, int);
static int obiosdhc_rod(struct sdhc_softc *, int);
static int obiosdhc_write_protect(struct sdhc_softc *);
@@ -129,6 +132,24 @@
{ "MMC1", SDMMC2_BASE_TIAM335X, 28, { AM335X_PRCM_CM_PER, 0xf4 } },
{ "MMCHS2", SDMMC3_BASE_TIAM335X, 29, { AM335X_PRCM_CM_WKUP, 0xf8 } },
};
+
+struct am335x_padconf {
+ const char *padname;
+ const char *padmode;
+};
+const struct am335x_padconf am335x_padconf_mmc1[] = {
+ { "GPMC_CSn1", "mmc1_clk" },
+ { "GPMC_CSn2", "mmc1_cmd" },
+ { "GPMC_AD0", "mmc1_dat0" },
+ { "GPMC_AD1", "mmc1_dat1" },
+ { "GPMC_AD2", "mmc1_dat2" },
+ { "GPMC_AD3", "mmc1_dat3" },
+ { "GPMC_AD4", "mmc1_dat4" },
+ { "GPMC_AD5", "mmc1_dat5" },
+ { "GPMC_AD6", "mmc1_dat6" },
+ { "GPMC_AD7", "mmc1_dat7" },
+ { NULL, NULL }
+};
#endif
CFATTACH_DECL_NEW(obiosdhc, sizeof(struct obiosdhc_softc),
@@ -213,6 +234,7 @@
sc->sc.sc_vendor_write_protect = obiosdhc_write_protect;
sc->sc.sc_vendor_card_detect = obiosdhc_card_detect;
sc->sc.sc_vendor_bus_clock = obiosdhc_bus_clock;
+ sc->sc.sc_vendor_bus_width = obiosdhc_bus_width;
sc->sc_bst = oa->obio_iot;
clksft = ffs(sc->sc.sc_clkmsk) - 1;
@@ -256,6 +278,27 @@
break;
}
KASSERT(i < __arraycount(am335x_sdhc));
+
+ if (oa->obio_addr == SDMMC2_BASE_TIAM335X) {
+ const char *mode;
+ u_int state;
+
+ const struct am335x_padconf *padconf = am335x_padconf_mmc1;
+ for (i = 0; padconf[i].padname; i++) {
+ const char *padname = padconf[i].padname;
+ const char *padmode = padconf[i].padmode;
+ if (sitara_cm_padconf_get(padname, &mode, &state) == 0) {
+ aprint_debug_dev(self, "%s mode %s state %d\n",
+ padname, mode, state);
+ }
+ if (sitara_cm_padconf_set(padname, padmode,
+ (1 << 4) | (1 << 5)) != 0) {
+ aprint_error_dev(self, "can't switch %s pad from %s to %s\n",
+ padname, mode, padmode);
+ return;
+ }
+ }
+ }
#endif
/* XXXXXX: Turn-on regurator via I2C. */
@@ -417,6 +460,23 @@
}
static int
+obiosdhc_bus_width(struct sdhc_softc *sc, int width)
+{
+ struct obiosdhc_softc *osc = (struct obiosdhc_softc *)sc;
+ uint32_t con;
+
+ con = bus_space_read_4(osc->sc_bst, osc->sc_bsh, MMCHS_CON);
+ if (width == 8) {
+ con |= CON_DW8;
+ } else {
+ con &= ~CON_DW8;
+ }
+ bus_space_write_4(osc->sc_bst, osc->sc_bsh, MMCHS_CON, con);
+
+ return 0;
+}
+
+static int
obiosdhc_bus_clock(struct sdhc_softc *sc, int clk)
{
struct obiosdhc_softc *osc = (struct obiosdhc_softc *)sc;
diff -r ec554a6eb528 -r 92251d8aed69 sys/arch/evbarm/beagle/beagle_machdep.c
--- a/sys/arch/evbarm/beagle/beagle_machdep.c Sun Nov 08 01:14:20 2015 +0000
+++ b/sys/arch/evbarm/beagle/beagle_machdep.c Sun Nov 08 01:22:54 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: beagle_machdep.c,v 1.60 2014/07/21 22:17:44 riz Exp $ */
+/* $NetBSD: beagle_machdep.c,v 1.60.2.1 2015/11/08 01:22:54 riz Exp $ */
/*
* Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.60 2014/07/21 22:17:44 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.60.2.1 2015/11/08 01:22:54 riz Exp $");
#include "opt_machdep.h"
#include "opt_ddb.h"
@@ -1084,7 +1084,7 @@
prop_dictionary_set_uint32(dict, "clkmask", 0);
prop_dictionary_set_bool(dict, "8bit", true);
#endif
-#if defined(TI_AM335X) && 0 // doesn't work
+#if defined(TI_AM335X)
struct obio_attach_args * const obio = aux;
if (obio->obio_addr == SDMMC2_BASE_TIAM335X)
prop_dictionary_set_bool(dict, "8bit", true);
diff -r ec554a6eb528 -r 92251d8aed69 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c Sun Nov 08 01:14:20 2015 +0000
+++ b/sys/dev/sdmmc/sdhc.c Sun Nov 08 01:22:54 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.44.2.8 2015/04/19 04:31:40 msaitoh Exp $ */
+/* $NetBSD: sdhc.c,v 1.44.2.9 2015/11/08 01:22:54 riz 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.44.2.8 2015/04/19 04:31:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.44.2.9 2015/11/08 01:22:54 riz Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -1000,6 +1000,12 @@
return 1;
}
+ if (hp->sc->sc_vendor_bus_width) {
+ const int error = hp->sc->sc_vendor_bus_width(hp->sc, width);
+ if (error != 0)
+ return error;
+ }
+
mutex_enter(&hp->host_mtx);
reg = HREAD1(hp, SDHC_HOST_CTL);
if (ISSET(hp->sc->sc_flags, SDHC_FLAG_ENHANCED)) {
diff -r ec554a6eb528 -r 92251d8aed69 sys/dev/sdmmc/sdhcvar.h
--- a/sys/dev/sdmmc/sdhcvar.h Sun Nov 08 01:14:20 2015 +0000
+++ b/sys/dev/sdmmc/sdhcvar.h Sun Nov 08 01:22:54 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhcvar.h,v 1.13.12.3 2015/04/19 04:31:40 msaitoh Exp $ */
+/* $NetBSD: sdhcvar.h,v 1.13.12.4 2015/11/08 01:22:54 riz Exp $ */
/* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
/*
@@ -60,6 +60,7 @@
int (*sc_vendor_rod)(struct sdhc_softc *, int);
int (*sc_vendor_write_protect)(struct sdhc_softc *);
int (*sc_vendor_card_detect)(struct sdhc_softc *);
+ int (*sc_vendor_bus_width)(struct sdhc_softc *, int);
int (*sc_vendor_bus_clock)(struct sdhc_softc *, int);
int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *);
};
Home |
Main Index |
Thread Index |
Old Index