Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic If the bus glue does not provide values for fifo ...
details: https://anonhg.NetBSD.org/src/rev/00e334bf52e2
branches: trunk
changeset: 319772:00e334bf52e2
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Jun 10 17:52:20 2018 +0000
description:
If the bus glue does not provide values for fifo reg offset and
fifo depth, try to auto detect based on the chip version and
value already programmed into FIFOTH.
diffstat:
sys/dev/ic/dwc_mmc.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r 065ae093695b -r 00e334bf52e2 sys/dev/ic/dwc_mmc.c
--- a/sys/dev/ic/dwc_mmc.c Sun Jun 10 17:17:46 2018 +0000
+++ b/sys/dev/ic/dwc_mmc.c Sun Jun 10 17:52:20 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.11 2017/06/19 22:03:02 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.12 2018/06/10 17:52:20 jmcneill Exp $ */
/*-
* Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.11 2017/06/19 22:03:02 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.12 2018/06/10 17:52:20 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -755,6 +755,23 @@
int
dwc_mmc_init(struct dwc_mmc_softc *sc)
{
+ uint32_t val;
+
+ if (sc->sc_fifo_reg == 0) {
+ val = MMC_READ(sc, DWC_MMC_VERID);
+ const u_int id = __SHIFTOUT(val, DWC_MMC_VERID_ID);
+
+ if (id < DWC_MMC_VERID_240A)
+ sc->sc_fifo_reg = 0x100;
+ else
+ sc->sc_fifo_reg = 0x200;
+ }
+
+ if (sc->sc_fifo_depth == 0) {
+ val = MMC_READ(sc, DWC_MMC_FIFOTH);
+ sc->sc_fifo_depth = __SHIFTOUT(val, DWC_MMC_FIFOTH_RX_WMARK) + 1;
+ }
+
mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_BIO);
cv_init(&sc->sc_intr_cv, "dwcmmcirq");
cv_init(&sc->sc_idst_cv, "dwcmmcdma");
Home |
Main Index |
Thread Index |
Old Index