Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sdmmc SDHCI byte swaps the BE response on the wire i...



details:   https://anonhg.NetBSD.org/src/rev/72f3f6013f8a
branches:  trunk
changeset: 780123:72f3f6013f8a
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Thu Jul 12 16:46:48 2012 +0000

description:
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:

 sys/dev/sdmmc/sdhc.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r 7b05ec125cc0 -r 72f3f6013f8a sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Thu Jul 12 16:34:30 2012 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Thu Jul 12 16:46:48 2012 +0000
@@ -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 @@
         */
        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);



Home | Main Index | Thread Index | Old Index