Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc Allow sdhc(4) to use a non-integrated DMA engine.



details:   https://anonhg.NetBSD.org/src/rev/8cc51d15d969
branches:  trunk
changeset: 332236:8cc51d15d969
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Sep 12 19:45:16 2014 +0000

description:
Allow sdhc(4) to use a non-integrated DMA engine.

diffstat:

 sys/dev/sdmmc/sdhc.c    |  12 ++++++++----
 sys/dev/sdmmc/sdhcvar.h |   5 ++++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diffs (73 lines):

diff -r d07cf881d499 -r 8cc51d15d969 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Fri Sep 12 19:33:45 2014 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Fri Sep 12 19:45:16 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc.c,v 1.44 2014/05/24 12:10:32 hkenken Exp $        */
+/*     $NetBSD: sdhc.c,v 1.45 2014/09/12 19:45:16 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.44 2014/05/24 12:10:32 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.45 2014/09/12 19:45:16 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -1196,7 +1196,8 @@
                /* XXX only for memory commands? */
                mode |= SDHC_AUTO_CMD12_ENABLE;
        }
-       if (cmd->c_dmamap != NULL && cmd->c_datalen > 0) {
+       if (cmd->c_dmamap != NULL && cmd->c_datalen > 0 &&
+           !ISSET(sc->sc_flags, SDHC_FLAG_EXTERNAL_DMA)) {
                mode |= SDHC_DMA_ENABLE;
        }
 
@@ -1284,7 +1285,10 @@
        }
 #endif
 
-       if (cmd->c_dmamap != NULL)
+       if (hp->sc->sc_vendor_transfer_data_dma != NULL &&
+           cmd->c_dmamap != NULL)
+               error = hp->sc->sc_vendor_transfer_data_dma(hp, cmd);
+       else if (cmd->c_dmamap != NULL)
                error = sdhc_transfer_data_dma(hp, cmd);
        else
                error = sdhc_transfer_data_pio(hp, cmd);
diff -r d07cf881d499 -r 8cc51d15d969 sys/dev/sdmmc/sdhcvar.h
--- a/sys/dev/sdmmc/sdhcvar.h   Fri Sep 12 19:33:45 2014 +0000
+++ b/sys/dev/sdmmc/sdhcvar.h   Fri Sep 12 19:45:16 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhcvar.h,v 1.13 2013/01/10 17:19:33 jmcneill Exp $    */
+/*     $NetBSD: sdhcvar.h,v 1.14 2014/09/12 19:45:16 jakllsch Exp $    */
 /*     $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
 
 /*
@@ -25,6 +25,7 @@
 #include <sys/pmf.h>
 
 struct sdhc_host;
+struct sdmmc_command;
 
 struct sdhc_softc {
        device_t                sc_dev;
@@ -49,6 +50,7 @@
 #define        SDHC_FLAG_SINGLE_ONLY   0x0800  /* Single transfer only */
 #define        SDHC_FLAG_WAIT_RESET    0x1000  /* Wait for soft resets to start */
 #define        SDHC_FLAG_NO_HS_BIT     0x2000  /* Don't set SDHC_HIGH_SPEED bit */
+#define        SDHC_FLAG_EXTERNAL_DMA  0x4000
 
        uint32_t                sc_clkbase;
        int                     sc_clkmsk;      /* Mask for SDCLK */
@@ -58,6 +60,7 @@
        int (*sc_vendor_write_protect)(struct sdhc_softc *);
        int (*sc_vendor_card_detect)(struct sdhc_softc *);
        int (*sc_vendor_bus_clock)(struct sdhc_softc *, int);
+       int (*sc_vendor_transfer_data_dma)(struct sdhc_host *, struct sdmmc_command *);
 };
 
 /* Host controller functions called by the attachment driver. */



Home | Main Index | Thread Index | Old Index