diff options
author | Uwe Stuehler <uwe@cvs.openbsd.org> | 2007-03-18 22:07:17 +0000 |
---|---|---|
committer | Uwe Stuehler <uwe@cvs.openbsd.org> | 2007-03-18 22:07:17 +0000 |
commit | e268707a89acd6ed5d023571c38e975d443c15aa (patch) | |
tree | 40b9e7131e57d65c6dc955ab86c79195ee88e9cd | |
parent | e3d3b3ebff93641bc3eb25dccc541e9ee0f42e98 (diff) |
DHC automatically sends a CMD12 after multiple-block transfers, but other
controllers don't. Put in a temporary hack for pxammc on Zaurus.
-rw-r--r-- | sys/dev/sdmmc/sdmmc_mem.c | 27 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdmmcvar.h | 3 |
2 files changed, 28 insertions, 2 deletions
diff --git a/sys/dev/sdmmc/sdmmc_mem.c b/sys/dev/sdmmc/sdmmc_mem.c index 3ec17a1a5c3..a6354363de6 100644 --- a/sys/dev/sdmmc/sdmmc_mem.c +++ b/sys/dev/sdmmc/sdmmc_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_mem.c,v 1.6 2006/11/29 14:16:43 uwe Exp $ */ +/* $OpenBSD: sdmmc_mem.c,v 1.7 2007/03/18 22:07:16 uwe Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -410,6 +410,19 @@ sdmmc_mem_read_block(struct sdmmc_function *sf, int blkno, u_char *data, if (error != 0) goto err; + /* XXX sdhc(4) does not need this */ +#ifdef __zaurus__ + if (cmd.c_opcode == MMC_READ_BLOCK_MULTIPLE) { + bzero(&cmd, sizeof cmd); + cmd.c_opcode = MMC_STOP_TRANSMISSION; + cmd.c_arg = MMC_ARG_RCA(sf->rca); + cmd.c_flags = SCF_CMD_AC | SCF_RSP_R1B; + error = sdmmc_mmc_command(sc, &cmd); + if (error != 0) + goto err; + } +#endif + do { bzero(&cmd, sizeof cmd); cmd.c_opcode = MMC_SEND_STATUS; @@ -452,6 +465,18 @@ sdmmc_mem_write_block(struct sdmmc_function *sf, int blkno, u_char *data, if (error != 0) goto err; + /* XXX sdhc(4) does not need this */ +#ifdef __zaurus__ + if (cmd.c_opcode == MMC_WRITE_BLOCK_MULTIPLE) { + bzero(&cmd, sizeof cmd); + cmd.c_opcode = MMC_STOP_TRANSMISSION; + cmd.c_flags = SCF_CMD_AC | SCF_RSP_R1B; + error = sdmmc_mmc_command(sc, &cmd); + if (error != 0) + goto err; + } +#endif + do { bzero(&cmd, sizeof cmd); cmd.c_opcode = MMC_SEND_STATUS; diff --git a/sys/dev/sdmmc/sdmmcvar.h b/sys/dev/sdmmc/sdmmcvar.h index 13041d85368..2acf37c483d 100644 --- a/sys/dev/sdmmc/sdmmcvar.h +++ b/sys/dev/sdmmc/sdmmcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmcvar.h,v 1.6 2007/03/18 20:53:10 uwe Exp $ */ +/* $OpenBSD: sdmmcvar.h,v 1.7 2007/03/18 22:07:16 uwe Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -90,6 +90,7 @@ struct sdmmc_command { /* response types */ #define SCF_RSP_R0 0 /* none */ #define SCF_RSP_R1 (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_IDX) +#define SCF_RSP_R1B (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_IDX|SCF_RSP_BSY) #define SCF_RSP_R2 (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_136) #define SCF_RSP_R3 (SCF_RSP_PRESENT) #define SCF_RSP_R4 (SCF_RSP_PRESENT) |