Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc Add flags SDHC_FLAG_NO_AUTO_STOP and SDHC_FLAG...



details:   https://anonhg.NetBSD.org/src/rev/b6e57928b41a
branches:  trunk
changeset: 350189:b6e57928b41a
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Sat Jan 07 15:05:08 2017 +0000

description:
Add flags SDHC_FLAG_NO_AUTO_STOP and SDHC_FLAG_NO_BUSY_INTR.

diffstat:

 sys/dev/sdmmc/sdhc.c    |  18 +++++++++++++-----
 sys/dev/sdmmc/sdhcvar.h |   4 +++-
 2 files changed, 16 insertions(+), 6 deletions(-)

diffs (78 lines):

diff -r ff4e1d5ad18c -r b6e57928b41a sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Sat Jan 07 15:00:38 2017 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Sat Jan 07 15:05:08 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc.c,v 1.96 2017/01/07 15:00:38 kiyohara Exp $       */
+/*     $NetBSD: sdhc.c,v 1.97 2017/01/07 15:05:08 kiyohara 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.96 2017/01/07 15:00:38 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.97 2017/01/07 15:05:08 kiyohara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -595,7 +595,9 @@
                saa.saa_clkmin = hp->clkbase / 0x3ff;
        else
                saa.saa_clkmin = hp->clkbase / 256;
-       saa.saa_caps = SMC_CAPS_4BIT_MODE|SMC_CAPS_AUTO_STOP;
+       if (!ISSET(sc->sc_flags, SDHC_FLAG_NO_AUTO_STOP))
+               saa.saa_caps |= SMC_CAPS_AUTO_STOP;
+       saa.saa_caps |= SMC_CAPS_4BIT_MODE;
        if (ISSET(sc->sc_flags, SDHC_FLAG_8BIT_MODE))
                saa.saa_caps |= SMC_CAPS_8BIT_MODE;
        if (ISSET(caps, SDHC_HIGH_SPEED_SUPP))
@@ -1572,7 +1574,8 @@
        if (cmd->c_error == 0 && cmd->c_data != NULL)
                sdhc_transfer_data(hp, cmd);
        else if (ISSET(cmd->c_flags, SCF_RSP_BSY)) {
-               if (!sdhc_wait_intr(hp, SDHC_TRANSFER_COMPLETE, hz * 10, false)) {
+               if (!ISSET(hp->sc->sc_flags, SDHC_FLAG_NO_BUSY_INTR) &&
+                   !sdhc_wait_intr(hp, SDHC_TRANSFER_COMPLETE, hz * 10, false)) {
                        DPRINTF(1,("%s: sdhc_exec_command: RSP_BSY\n",
                            HDEVNAME(hp)));
                        cmd->c_error = ETIMEDOUT;
@@ -1588,6 +1591,10 @@
        }
        SET(cmd->c_flags, SCF_ITSDONE);
 
+       if (ISSET(hp->sc->sc_flags, SDHC_FLAG_NO_AUTO_STOP) &&
+           cmd->c_opcode == MMC_STOP_TRANSMISSION)
+               (void)sdhc_soft_reset(hp, SDHC_RESET_CMD|SDHC_RESET_DAT);
+
        mutex_exit(&hp->intr_lock);
 
        DPRINTF(1,("%s: cmd %d %s (flags=%08x error=%d)\n", HDEVNAME(hp),
@@ -1642,7 +1649,8 @@
        if (blkcount > 1) {
                mode |= SDHC_MULTI_BLOCK_MODE;
                /* XXX only for memory commands? */
-               mode |= SDHC_AUTO_CMD12_ENABLE;
+               if (!ISSET(sc->sc_flags, SDHC_FLAG_NO_AUTO_STOP))
+                       mode |= SDHC_AUTO_CMD12_ENABLE;
        }
        if (cmd->c_dmamap != NULL && cmd->c_datalen > 0 &&
            ISSET(hp->flags,  SHF_MODE_DMAEN)) {
diff -r ff4e1d5ad18c -r b6e57928b41a sys/dev/sdmmc/sdhcvar.h
--- a/sys/dev/sdmmc/sdhcvar.h   Sat Jan 07 15:00:38 2017 +0000
+++ b/sys/dev/sdmmc/sdhcvar.h   Sat Jan 07 15:05:08 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhcvar.h,v 1.26 2015/12/31 11:53:19 ryo Exp $ */
+/*     $NetBSD: sdhcvar.h,v 1.27 2017/01/07 15:05:08 kiyohara Exp $    */
 /*     $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
 
 /*
@@ -59,6 +59,8 @@
 #define        SDHC_FLAG_POLL_CARD_DET 0x00200000 /* polling card detect */
 #define        SDHC_FLAG_SLOW_SDR50    0x00400000 /* reduce SDR50 speed */
 #define        SDHC_FLAG_USDHC         0x00800000 /* Freescale uSDHC */
+#define        SDHC_FLAG_NO_AUTO_STOP  0x01000000 /* No auto CMD12 */
+#define        SDHC_FLAG_NO_BUSY_INTR  0x02000000 /* No intr when RESP_BUSY */
 
        uint32_t                sc_clkbase;
        int                     sc_clkmsk;      /* Mask for SDCLK */



Home | Main Index | Thread Index | Old Index