diff options
| author | jakllsch <jakllsch@NetBSD.org> | 2012-07-12 16:46:48 +0000 |
|---|---|---|
| committer | jakllsch <jakllsch@NetBSD.org> | 2012-07-12 16:46:48 +0000 |
| commit | 4809e8b754eb859fb9fd25dfde0604bf52a4ec4c (patch) | |
| tree | a2f766e28266239ba7c2b79cca45faaea95a1dd1 /sys/dev | |
| parent | 7c366c1be3b1c146aecdeb854c5c6ad5ae2cffd2 (diff) | |
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.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/sdmmc/sdhc.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/sdmmc/sdhc.c b/sys/dev/sdmmc/sdhc.c index fcfcdf8c003..0c3ef5477a5 100644 --- a/sys/dev/sdmmc/sdhc.c +++ b/sys/dev/sdmmc/sdhc.c @@ -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 sch, struct sdmmc_command *cmd) */ 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); |
