Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc Always enable and set block count register. W...



details:   https://anonhg.NetBSD.org/src/rev/619146553dc8
branches:  trunk
changeset: 780121:619146553dc8
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Thu Jul 12 16:32:34 2012 +0000

description:
Always enable and set block count register.  We never do infinite transfers.
The old way seemed to be causing issues on a R5C822, at least with DMA enabled.

diffstat:

 sys/dev/sdmmc/sdhc.c |  24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diffs (55 lines):

diff -r 4779cb33f4c4 -r 619146553dc8 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Thu Jul 12 16:15:40 2012 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Thu Jul 12 16:32:34 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc.c,v 1.14 2012/07/12 03:05:49 matt Exp $   */
+/*     $NetBSD: sdhc.c,v 1.15 2012/07/12 16:32:34 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.14 2012/07/12 03:05:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.15 2012/07/12 16:32:34 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -1083,16 +1083,13 @@
        }
 
        /* Prepare transfer mode register value. (2.2.5) */
-       mode = 0;
+       mode = SDHC_BLOCK_COUNT_ENABLE;
        if (ISSET(cmd->c_flags, SCF_CMD_READ))
                mode |= SDHC_READ_MODE;
-       if (blkcount > 0) {
-               mode |= SDHC_BLOCK_COUNT_ENABLE;
-               if (blkcount > 1) {
-                       mode |= SDHC_MULTI_BLOCK_MODE;
-                       /* XXX only for memory commands? */
-                       mode |= SDHC_AUTO_CMD12_ENABLE;
-               }
+       if (blkcount > 1) {
+               mode |= SDHC_MULTI_BLOCK_MODE;
+               /* XXX only for memory commands? */
+               mode |= SDHC_AUTO_CMD12_ENABLE;
        }
        if (cmd->c_dmamap != NULL && cmd->c_datalen > 0) {
                if (cmd->c_dmamap->dm_nsegs == 1) {
@@ -1151,11 +1148,10 @@
                HWRITE4(hp, SDHC_ARGUMENT, cmd->c_arg);
                HWRITE4(hp, SDHC_TRANSFER_MODE, mode | (command << 16));
        } else {
+               HWRITE2(hp, SDHC_BLOCK_SIZE, blksize);
+               HWRITE2(hp, SDHC_BLOCK_COUNT, blkcount);
+               HWRITE4(hp, SDHC_ARGUMENT, cmd->c_arg);
                HWRITE2(hp, SDHC_TRANSFER_MODE, mode);
-               HWRITE2(hp, SDHC_BLOCK_SIZE, blksize);
-               if (blkcount > 1)
-                       HWRITE2(hp, SDHC_BLOCK_COUNT, blkcount);
-               HWRITE4(hp, SDHC_ARGUMENT, cmd->c_arg);
                HWRITE2(hp, SDHC_COMMAND, command);
        }
 



Home | Main Index | Thread Index | Old Index