Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc Send an explicit CMD12 (stop transmission) whe...
details: https://anonhg.NetBSD.org/src/rev/2b860344e680
branches: trunk
changeset: 339779:2b860344e680
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Aug 09 13:18:46 2015 +0000
description:
Send an explicit CMD12 (stop transmission) when there was an error
in multi-sector I/O.
The SDHC spec has a complex flowchart describing when an explicit
CMD12 is necessary, so we probably use it too often.
diffstat:
sys/dev/sdmmc/sdmmc.c | 29 +++++++++++++++++++++++++++--
sys/dev/sdmmc/sdmmcvar.h | 3 ++-
2 files changed, 29 insertions(+), 3 deletions(-)
diffs (71 lines):
diff -r 63bed603e857 -r 2b860344e680 sys/dev/sdmmc/sdmmc.c
--- a/sys/dev/sdmmc/sdmmc.c Sun Aug 09 13:14:11 2015 +0000
+++ b/sys/dev/sdmmc/sdmmc.c Sun Aug 09 13:18:46 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmc.c,v 1.30 2015/08/09 13:14:11 mlelstv Exp $ */
+/* $NetBSD: sdmmc.c,v 1.31 2015/08/09 13:18:46 mlelstv Exp $ */
/* $OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $ */
/*
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.30 2015/08/09 13:14:11 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.31 2015/08/09 13:18:46 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -817,10 +817,35 @@
DPRINTF(1,("sdmmc_mmc_command: error=%d\n", error));
+ if (error &&
+ (cmd->c_opcode == MMC_READ_BLOCK_MULTIPLE ||
+ cmd->c_opcode == MMC_WRITE_BLOCK_MULTIPLE)) {
+ sdmmc_stop_transmission(sc);
+ }
+
return error;
}
/*
+ * Send the "STOP TRANSMISSION" command
+ */
+void
+sdmmc_stop_transmission(struct sdmmc_softc *sc)
+{
+ struct sdmmc_command cmd;
+
+ DPRINTF(1,("sdmmc_stop_transmission\n"));
+
+ /* Don't lock */
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.c_opcode = MMC_STOP_TRANSMISSION;
+ cmd.c_flags = SCF_CMD_AC | SCF_RSP_R1B | SCF_RSP_SPI_R1B;
+
+ (void)sdmmc_mmc_command(sc, &cmd);
+}
+
+/*
* Send the "GO IDLE STATE" command.
*/
void
diff -r 63bed603e857 -r 2b860344e680 sys/dev/sdmmc/sdmmcvar.h
--- a/sys/dev/sdmmc/sdmmcvar.h Sun Aug 09 13:14:11 2015 +0000
+++ b/sys/dev/sdmmc/sdmmcvar.h Sun Aug 09 13:18:46 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmcvar.h,v 1.18 2015/08/03 10:08:51 jmcneill Exp $ */
+/* $NetBSD: sdmmcvar.h,v 1.19 2015/08/09 13:18:46 mlelstv Exp $ */
/* $OpenBSD: sdmmcvar.h,v 1.13 2009/01/09 10:55:22 jsg Exp $ */
/*
@@ -306,6 +306,7 @@
int sdmmc_mmc_command(struct sdmmc_softc *, struct sdmmc_command *);
int sdmmc_app_command(struct sdmmc_softc *, struct sdmmc_function *,
struct sdmmc_command *);
+void sdmmc_stop_transmission(struct sdmmc_softc *);
void sdmmc_go_idle_state(struct sdmmc_softc *);
int sdmmc_select_card(struct sdmmc_softc *, struct sdmmc_function *);
int sdmmc_set_relative_addr(struct sdmmc_softc *, struct sdmmc_function *);
Home |
Main Index |
Thread Index |
Old Index