Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc Enable block count only for count > 0.



details:   https://anonhg.NetBSD.org/src/rev/82246424f969
branches:  trunk
changeset: 953590:82246424f969
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Mar 13 23:26:47 2021 +0000

description:
Enable block count only for count > 0.
Don't enable autostop when command sets new flag SCF_NO_STOP.

diffstat:

 sys/dev/sdmmc/sdhc.c |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r 68231b4c9b89 -r 82246424f969 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Sat Mar 13 23:22:44 2021 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Sat Mar 13 23:26:47 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc.c,v 1.107 2020/07/15 15:57:52 msaitoh Exp $       */
+/*     $NetBSD: sdhc.c,v 1.108 2021/03/13 23:26:47 mlelstv 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.107 2020/07/15 15:57:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.108 2021/03/13 23:26:47 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -389,6 +389,8 @@
                }
        }
 
+       aprint_verbose(", caps <%08x/%08x>", caps, caps2);
+
        const u_int retuning_mode = (caps2 >> SDHC_RETUNING_MODES_SHIFT) &
            SDHC_RETUNING_MODES_MASK;
        if (retuning_mode == SDHC_RETUNING_MODE_1) {
@@ -1724,14 +1726,17 @@
        }
 
        /* Prepare transfer mode register value. (2.2.5) */
-       mode = SDHC_BLOCK_COUNT_ENABLE;
+       mode = 0;
        if (ISSET(cmd->c_flags, SCF_CMD_READ))
                mode |= SDHC_READ_MODE;
-       if (blkcount > 1) {
-               mode |= SDHC_MULTI_BLOCK_MODE;
-               /* XXX only for memory commands? */
-               if (!ISSET(sc->sc_flags, SDHC_FLAG_NO_AUTO_STOP))
-                       mode |= SDHC_AUTO_CMD12_ENABLE;
+       if (blkcount > 0) {
+               mode |= SDHC_BLOCK_COUNT_ENABLE;
+               if (blkcount > 1) {
+                       mode |= SDHC_MULTI_BLOCK_MODE;
+                       if (!ISSET(sc->sc_flags, SDHC_FLAG_NO_AUTO_STOP)
+                           && !ISSET(cmd->c_flags, SCF_NO_STOP))
+                               mode |= SDHC_AUTO_CMD12_ENABLE;
+               }
        }
        if (cmd->c_dmamap != NULL && cmd->c_datalen > 0 &&
            ISSET(hp->flags,  SHF_MODE_DMAEN)) {



Home | Main Index | Thread Index | Old Index