Module Name: src
Committed By: jakllsch
Date: Thu Jul 12 16:46:48 UTC 2012
Modified Files:
src/sys/dev/sdmmc: sdhc.c
Log Message:
SDHCI byte swaps the BE response on the wire into LE registers.
As we always want response data in LE, use bus_space_read_stream.
Additonally, read response data in 1 or 4 4-byte chunks, instead of
one 4-byte chunk or 15 1-byte chunks.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/sdmmc/sdhc.c
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/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.15 src/sys/dev/sdmmc/sdhc.c:1.16
--- src/sys/dev/sdmmc/sdhc.c:1.15 Thu Jul 12 16:32:34 2012
+++ src/sys/dev/sdmmc/sdhc.c Thu Jul 12 16:46:48 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.15 2012/07/12 16:32:34 jakllsch Exp $ */
+/* $NetBSD: sdhc.c,v 1.16 2012/07/12 16:46:48 jakllsch 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.15 2012/07/12 16:32:34 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.16 2012/07/12 16:46:48 jakllsch Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -997,14 +997,14 @@ sdhc_exec_command(sdmmc_chipset_handle_t
*/
mutex_enter(&hp->host_mtx);
if (cmd->c_error == 0 && ISSET(cmd->c_flags, SCF_RSP_PRESENT)) {
- if (ISSET(cmd->c_flags, SCF_RSP_136)) {
- uint8_t *p = (uint8_t *)cmd->c_resp;
- int i;
+ uint32_t *p = cmd->c_resp;
+ int i;
- for (i = 0; i < 15; i++)
- *p++ = HREAD1(hp, SDHC_RESPONSE + i);
- } else {
- cmd->c_resp[0] = HREAD4(hp, SDHC_RESPONSE);
+ for (i = 0; i < 4; i++) {
+ *p++ = bus_space_read_stream_4(hp->iot, hp->ioh,
+ SDHC_RESPONSE + i * 4);
+ if (!ISSET(cmd->c_flags, SCF_RSP_136))
+ break;
}
}
mutex_exit(&hp->host_mtx);