Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc When doing vendor dma transfer wait for SDHC_T...
details: https://anonhg.NetBSD.org/src/rev/3ae61e5e6e5d
branches: trunk
changeset: 802433:3ae61e5e6e5d
user: skrll <skrll%NetBSD.org@localhost>
date: Sun Sep 14 08:47:08 2014 +0000
description:
When doing vendor dma transfer wait for SDHC_TRANSFER_COMPLETE.
>From jmcneill@ with some layout changes from me.
diffstat:
sys/dev/sdmmc/sdhc.c | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diffs (87 lines):
diff -r 253520e38bfe -r 3ae61e5e6e5d sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c Sun Sep 14 04:32:42 2014 +0000
+++ b/sys/dev/sdmmc/sdhc.c Sun Sep 14 08:47:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.46 2014/09/12 19:47:40 jakllsch Exp $ */
+/* $NetBSD: sdhc.c,v 1.47 2014/09/14 08:47:08 skrll 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.46 2014/09/12 19:47:40 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.47 2014/09/14 08:47:08 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -222,7 +222,7 @@
{
const struct sdmmcbus_attach_args * const saa = aux;
const struct sdhc_host * const hp = saa->saa_sch;
-
+
if (pnp) {
aprint_normal("sdmmc at %s", pnp);
}
@@ -1031,7 +1031,7 @@
}
}
-static void
+static void
sdhc_card_intr_ack(sdmmc_chipset_handle_t sch)
{
struct sdhc_host *hp = (struct sdhc_host *)sch;
@@ -1074,7 +1074,7 @@
} else {
HSET2(hp, SDHC_NINTR_SIGNAL_EN, ready);
HSET2(hp, SDHC_NINTR_STATUS_EN, ready);
- }
+ }
mutex_exit(&hp->intr_mtx);
}
@@ -1285,12 +1285,17 @@
}
#endif
- if (hp->sc->sc_vendor_transfer_data_dma != NULL &&
- cmd->c_dmamap != NULL)
- error = hp->sc->sc_vendor_transfer_data_dma(hp, cmd);
- else if (cmd->c_dmamap != NULL)
- error = sdhc_transfer_data_dma(hp, cmd);
- else
+ if (cmd->c_dmamap != NULL) {
+ if (hp->sc->sc_vendor_transfer_data_dma != NULL) {
+ error = hp->sc->sc_vendor_transfer_data_dma(hp, cmd);
+ if (error == 0 && !sdhc_wait_intr(hp,
+ SDHC_TRANSFER_COMPLETE, SDHC_TRANSFER_TIMEOUT)) {
+ error = ETIMEDOUT;
+ }
+ } else {
+ error = sdhc_transfer_data_dma(hp, cmd);
+ }
+ } else
error = sdhc_transfer_data_pio(hp, cmd);
if (error)
cmd->c_error = error;
@@ -1644,7 +1649,7 @@
DPRINTF(2,("%s: intr status %#x error %#x\n", HDEVNAME(hp), status,
hp->intr_error_status));
-
+
/* Command timeout has higher priority than command complete. */
if (ISSET(status, SDHC_ERROR_INTERRUPT) || hp->intr_error_status) {
hp->intr_error_status = 0;
@@ -1702,7 +1707,7 @@
HWRITE2(hp, SDHC_EINTR_STATUS, error);
}
}
-
+
DPRINTF(2,("%s: interrupt status=%x error=%x\n", HDEVNAME(hp),
status, error));
Home |
Main Index |
Thread Index |
Old Index