Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc Add a SDHC_FLAG_NO_TIMEOUT quirk to handle spu...
details: https://anonhg.NetBSD.org/src/rev/75bfce44cb48
branches: trunk
changeset: 339466:75bfce44cb48
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Jul 23 23:52:54 2015 +0000
description:
Add a SDHC_FLAG_NO_TIMEOUT quirk to handle spurious timeouts on Tegra K1
during data transfers. While here, increase the soft timeout for DMA
transfers from 1s to 3s.
diffstat:
sys/dev/sdmmc/sdhc.c | 19 +++++++++++++++----
sys/dev/sdmmc/sdhcvar.h | 3 ++-
2 files changed, 17 insertions(+), 5 deletions(-)
diffs (71 lines):
diff -r 2ea4728a7131 -r 75bfce44cb48 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c Thu Jul 23 18:22:05 2015 +0000
+++ b/sys/dev/sdmmc/sdhc.c Thu Jul 23 23:52:54 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.60 2015/07/22 09:54:42 skrll Exp $ */
+/* $NetBSD: sdhc.c,v 1.61 2015/07/23 23:52:54 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.60 2015/07/22 09:54:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.61 2015/07/23 23:52:54 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -55,7 +55,7 @@
#define SDHC_COMMAND_TIMEOUT hz
#define SDHC_BUFFER_TIMEOUT hz
#define SDHC_TRANSFER_TIMEOUT hz
-#define SDHC_DMA_TIMEOUT hz
+#define SDHC_DMA_TIMEOUT (hz*3)
struct sdhc_host {
struct sdhc_softc *sc; /* host controller device */
@@ -1119,6 +1119,17 @@
mutex_exit(&hp->intr_mtx);
}
+ if (ISSET(hp->sc->sc_flags, SDHC_FLAG_NO_TIMEOUT)) {
+ const uint16_t eintr = SDHC_CMD_TIMEOUT_ERROR;
+ if (cmd->c_data != NULL) {
+ HCLR2(hp, SDHC_EINTR_SIGNAL_EN, eintr);
+ HCLR2(hp, SDHC_EINTR_STATUS_EN, eintr);
+ } else {
+ HSET2(hp, SDHC_EINTR_SIGNAL_EN, eintr);
+ HSET2(hp, SDHC_EINTR_STATUS_EN, eintr);
+ }
+ }
+
/*
* Start the MMC command, or mark `cmd' as failed and return.
*/
@@ -1332,7 +1343,7 @@
if (hp->sc->sc_vendor_transfer_data_dma != NULL) {
error = hp->sc->sc_vendor_transfer_data_dma(sc, cmd);
if (error == 0 && !sdhc_wait_intr(hp,
- SDHC_TRANSFER_COMPLETE, SDHC_TRANSFER_TIMEOUT)) {
+ SDHC_TRANSFER_COMPLETE, SDHC_DMA_TIMEOUT)) {
error = ETIMEDOUT;
}
} else {
diff -r 2ea4728a7131 -r 75bfce44cb48 sys/dev/sdmmc/sdhcvar.h
--- a/sys/dev/sdmmc/sdhcvar.h Thu Jul 23 18:22:05 2015 +0000
+++ b/sys/dev/sdmmc/sdhcvar.h Thu Jul 23 23:52:54 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhcvar.h,v 1.18 2015/05/03 11:46:25 jmcneill Exp $ */
+/* $NetBSD: sdhcvar.h,v 1.19 2015/07/23 23:52:54 jmcneill Exp $ */
/* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
/*
@@ -54,6 +54,7 @@
#define SDHC_FLAG_EXTDMA_DMAEN 0x00008000 /* ext. dma need SDHC_DMA_ENABLE */
#define SDHC_FLAG_NO_CLKBASE 0x00020000 /* ignore clkbase register */
#define SDHC_FLAG_SINGLE_POWER_WRITE 0x00040000
+#define SDHC_FLAG_NO_TIMEOUT 0x00080000 /* ignore timeout interrupts */
uint32_t sc_clkbase;
int sc_clkmsk; /* Mask for SDCLK */
Home |
Main Index |
Thread Index |
Old Index