Module Name: src
Committed By: martin
Date: Sat Mar 21 20:24:36 UTC 2020
Modified Files:
src/sys/dev/ic [netbsd-9]: dwc_mmc.c dwc_mmc_reg.h dwc_mmc_var.h
Log Message:
Pull up following revision(s) (requested by skrll in ticket #800):
sys/dev/ic/dwc_mmc_var.h: revision 1.14
sys/dev/ic/dwc_mmc_reg.h: revision 1.10
sys/dev/ic/dwc_mmc.c: revision 1.23
sys/dev/ic/dwc_mmc.c: revision 1.24
sys/dev/ic/dwc_mmc.c: revision 1.25
sys/dev/ic/dwc_mmc.c: revision 1.26
Release the sc_intr_lock on error
Trailing whitespace
Add DWC_MMC_VERID_280A
Remember / use sc_verid
Disable thrctrl or now and note why
To generate a diff of this commit:
cvs rdiff -u -r1.17.2.2 -r1.17.2.3 src/sys/dev/ic/dwc_mmc.c
cvs rdiff -u -r1.7.8.1 -r1.7.8.2 src/sys/dev/ic/dwc_mmc_reg.h
cvs rdiff -u -r1.8.2.2 -r1.8.2.3 src/sys/dev/ic/dwc_mmc_var.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/ic/dwc_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.17.2.2 src/sys/dev/ic/dwc_mmc.c:1.17.2.3
--- src/sys/dev/ic/dwc_mmc.c:1.17.2.2 Tue Feb 25 18:40:43 2020
+++ src/sys/dev/ic/dwc_mmc.c Sat Mar 21 20:24:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.17.2.2 2020/02/25 18:40:43 martin Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.17.2.3 2020/03/21 20:24:36 martin Exp $ */
/*-
* Copyright (c) 2014-2017 Jared McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.17.2.2 2020/02/25 18:40:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.17.2.3 2020/03/21 20:24:36 martin Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -439,7 +439,7 @@ dwc_mmc_bus_width(sdmmc_chipset_handle_t
}
sc->sc_mmc_width = width;
-
+
return 0;
}
@@ -662,11 +662,21 @@ dwc_mmc_exec_command(sdmmc_chipset_handl
MMC_WRITE(sc, DWC_MMC_BLKSZ, cmd->c_blklen);
MMC_WRITE(sc, DWC_MMC_BYTECNT,
nblks > 1 ? nblks * cmd->c_blklen : cmd->c_datalen);
+
+#if 0
+ /*
+ * The following doesn't work on the 250a verid IP in Odroid-XU4.
+ *
+ * thrctl should only be used for UHS/HS200 and faster timings on
+ * >=240a
+ */
+
if (ISSET(cmd->c_flags, SCF_CMD_READ)) {
MMC_WRITE(sc, DWC_MMC_CARDTHRCTL,
__SHIFTIN(cmd->c_blklen, DWC_MMC_CARDTHRCTL_RDTHR) |
DWC_MMC_CARDTHRCTL_RDTHREN);
}
+#endif
}
MMC_WRITE(sc, DWC_MMC_IMASK, imask | sc->sc_intr_card);
@@ -717,6 +727,7 @@ dwc_mmc_exec_command(sdmmc_chipset_handl
if (error != 0) {
cmd->c_error = error;
SET(cmd->c_flags, SCF_ITSDONE);
+ mutex_exit(&sc->sc_intr_lock);
goto done;
}
}
@@ -806,11 +817,11 @@ 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);
+ val = MMC_READ(sc, DWC_MMC_VERID);
+ sc->sc_verid = __SHIFTOUT(val, DWC_MMC_VERID_ID);
- if (id < DWC_MMC_VERID_240A)
+ if (sc->sc_fifo_reg == 0) {
+ if (sc->sc_verid < DWC_MMC_VERID_240A)
sc->sc_fifo_reg = 0x100;
else
sc->sc_fifo_reg = 0x200;
Index: src/sys/dev/ic/dwc_mmc_reg.h
diff -u src/sys/dev/ic/dwc_mmc_reg.h:1.7.8.1 src/sys/dev/ic/dwc_mmc_reg.h:1.7.8.2
--- src/sys/dev/ic/dwc_mmc_reg.h:1.7.8.1 Tue Feb 25 18:40:43 2020
+++ src/sys/dev/ic/dwc_mmc_reg.h Sat Mar 21 20:24:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_reg.h,v 1.7.8.1 2020/02/25 18:40:43 martin Exp $ */
+/* $NetBSD: dwc_mmc_reg.h,v 1.7.8.2 2020/03/21 20:24:36 martin Exp $ */
/*-
* Copyright (c) 2014-2017 Jared McNeill <[email protected]>
@@ -153,6 +153,7 @@
#define DWC_MMC_VERID_ID __BITS(15,0)
#define DWC_MMC_VERID_240A 0x240a
+#define DWC_MMC_VERID_280A 0x280a
#define DWC_MMC_IDST_HOST_ABT __BIT(10)
#define DWC_MMC_IDST_ABNORMAL_INT_SUM __BIT(9)
Index: src/sys/dev/ic/dwc_mmc_var.h
diff -u src/sys/dev/ic/dwc_mmc_var.h:1.8.2.2 src/sys/dev/ic/dwc_mmc_var.h:1.8.2.3
--- src/sys/dev/ic/dwc_mmc_var.h:1.8.2.2 Tue Feb 25 18:40:43 2020
+++ src/sys/dev/ic/dwc_mmc_var.h Sat Mar 21 20:24:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_var.h,v 1.8.2.2 2020/02/25 18:40:43 martin Exp $ */
+/* $NetBSD: dwc_mmc_var.h,v 1.8.2.3 2020/03/21 20:24:36 martin Exp $ */
/*-
* Copyright (c) 2014-2017 Jared McNeill <[email protected]>
@@ -45,6 +45,7 @@ struct dwc_mmc_softc {
u_int sc_clock_freq;
u_int sc_bus_width;
bool sc_card_inited;
+ u_int sc_verid;
void *sc_ih;
kmutex_t sc_lock;