Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/dwc2 Support external DMA mode and provide ...



details:   https://anonhg.NetBSD.org/src/rev/cea65b3edd54
branches:  trunk
changeset: 337850:cea65b3edd54
user:      hikaru <hikaru%NetBSD.org@localhost>
date:      Fri May 01 06:58:40 2015 +0000

description:
Support external DMA mode and provide an interface for DMA address configuration

diffstat:

 sys/external/bsd/dwc2/dist/dwc2_core.c |  29 +++++++++++++++++++++--------
 sys/external/bsd/dwc2/dwc2var.h        |   3 ++-
 2 files changed, 23 insertions(+), 9 deletions(-)

diffs (74 lines):

diff -r 15a9decee808 -r cea65b3edd54 sys/external/bsd/dwc2/dist/dwc2_core.c
--- a/sys/external/bsd/dwc2/dist/dwc2_core.c    Fri May 01 03:42:15 2015 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_core.c    Fri May 01 06:58:40 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2_core.c,v 1.6 2014/04/03 06:34:58 skrll Exp $      */
+/*     $NetBSD: dwc2_core.c,v 1.7 2015/05/01 06:58:40 hikaru Exp $     */
 
 /*
  * core.c - DesignWare HS OTG Controller common routines
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.6 2014/04/03 06:34:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.7 2015/05/01 06:58:40 hikaru Exp $");
 
 #include <sys/types.h>
 #include <sys/bus.h>
@@ -312,8 +312,13 @@
 
        switch (hsotg->hw_params.arch) {
        case GHWCFG2_EXT_DMA_ARCH:
-               dev_err(hsotg->dev, "External DMA Mode not supported\n");
-               return -EINVAL;
+               dev_dbg(hsotg->dev, "External DMA Mode\n");
+               if (hsotg->core_params->ahbcfg != -1) {
+                       ahbcfg &= GAHBCFG_CTRL_MASK;
+                       ahbcfg |= hsotg->core_params->ahbcfg &
+                                 ~GAHBCFG_CTRL_MASK;
+               }
+               break;
 
        case GHWCFG2_INT_DMA_ARCH:
                dev_dbg(hsotg->dev, "Internal DMA Mode\n");
@@ -1396,10 +1401,18 @@
                } else {
                        dma_addr = chan->xfer_dma;
                }
-               DWC2_WRITE_4(hsotg, HCDMA(chan->hc_num), (u32)dma_addr);
-               if (dbg_hc(chan))
-                       dev_vdbg(hsotg->dev, "Wrote %08lx to HCDMA(%d)\n",
-                                (unsigned long)dma_addr, chan->hc_num);
+               if (hsotg->hsotg_sc->sc_set_dma_addr == NULL) {
+                       DWC2_WRITE_4(hsotg, HCDMA(chan->hc_num),
+                           (u32)dma_addr);
+                       if (dbg_hc(chan))
+                               dev_vdbg(hsotg->dev,
+                                   "Wrote %08lx to HCDMA(%d)\n",
+                                    (unsigned long)dma_addr,
+                                   chan->hc_num);
+               } else {
+                       (void)(*hsotg->hsotg_sc->sc_set_dma_addr)(
+                           hsotg->dev, dma_addr, chan->hc_num);
+               }
        }
 
        /* Start the split */
diff -r 15a9decee808 -r cea65b3edd54 sys/external/bsd/dwc2/dwc2var.h
--- a/sys/external/bsd/dwc2/dwc2var.h   Fri May 01 03:42:15 2015 +0000
+++ b/sys/external/bsd/dwc2/dwc2var.h   Fri May 01 06:58:40 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2var.h,v 1.3 2013/10/22 12:57:40 skrll Exp $        */
+/*     $NetBSD: dwc2var.h,v 1.4 2015/05/01 06:58:40 hikaru Exp $       */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -77,6 +77,7 @@
        bus_space_handle_t      sc_ioh;
        bus_dma_tag_t           sc_dmat;
        struct dwc2_core_params *sc_params;
+       int                     (*sc_set_dma_addr)(device_t, bus_addr_t, int);
 
        /*
         * Private



Home | Main Index | Thread Index | Old Index