Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/sunxi Set "DMA MCLK interface circ...



details:   https://anonhg.NetBSD.org/src/rev/28f7c661e49d
branches:  trunk
changeset: 318927:28f7c661e49d
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed May 09 17:17:33 2018 +0000
description:
Set "DMA MCLK interface circuit auto gating bit" to 1 where required.

diffstat:

 sys/arch/arm/sunxi/sun6i_dma.c |  52 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 45 insertions(+), 7 deletions(-)

diffs (95 lines):

diff -r 09948a7b29b0 -r 28f7c661e49d sys/arch/arm/sunxi/sun6i_dma.c
--- a/sys/arch/arm/sunxi/sun6i_dma.c    Wed May 09 14:27:41 2018 +0000
+++ b/sys/arch/arm/sunxi/sun6i_dma.c    Wed May 09 17:17:33 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun6i_dma.c,v 1.3 2017/12/15 02:24:22 jmcneill Exp $ */
+/* $NetBSD: sun6i_dma.c,v 1.4 2018/05/09 17:17:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sun6i_dma.c,v 1.3 2017/12/15 02:24:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun6i_dma.c,v 1.4 2018/05/09 17:17:33 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -92,11 +92,43 @@
 #define DMA_NULL       0xfffff800
 };
 
+struct sun6idma_config {
+       u_int           num_channels;
+       bool            autogate;
+       bus_size_t      autogate_reg;
+       uint32_t        autogate_mask;
+};
+
+static const struct sun6idma_config sun6i_a31_dma_config = {
+       .num_channels = 16
+};
+
+static const struct sun6idma_config sun8i_a83t_dma_config = {
+       .num_channels = 8,
+       .autogate = true,
+       .autogate_reg = 0x20,
+       .autogate_mask = 0x4,
+};
+
+static const struct sun6idma_config sun8i_h3_dma_config = {
+       .num_channels = 12,
+       .autogate = true,
+       .autogate_reg = 0x28,
+       .autogate_mask = 0x4,
+};
+
+static const struct sun6idma_config sun50i_a64_dma_config = {
+       .num_channels = 8,
+       .autogate = true,
+       .autogate_reg = 0x28,
+       .autogate_mask = 0x4,
+};
+
 static const struct of_compat_data compat_data[] = {
-       { "allwinner,sun6i-a31-dma",            16 },
-       { "allwinner,sun8i-a83t-dma",           8 },
-       { "allwinner,sun8i-h3-dma",             12 },
-       { "allwinner,sun50i-a64-dma",           8 },
+       { "allwinner,sun6i-a31-dma",    (uintptr_t)&sun6i_a31_dma_config },
+       { "allwinner,sun8i-a83t-dma",   (uintptr_t)&sun8i_a83t_dma_config },
+       { "allwinner,sun8i-h3-dma",     (uintptr_t)&sun8i_h3_dma_config },
+       { "allwinner,sun50i-a64-dma",   (uintptr_t)&sun50i_a64_dma_config },
        { NULL }
 };
 
@@ -324,6 +356,7 @@
        struct fdt_attach_args * const faa = aux;
        const int phandle = faa->faa_phandle;
        const size_t desclen = sizeof(struct sun6idma_desc);
+       const struct sun6idma_config *conf;
        struct fdtbus_reset *rst;
        struct clk *clk;
        char intrstr[128];
@@ -363,7 +396,9 @@
                return;
        }
 
-       sc->sc_nchan = of_search_compatible(phandle, compat_data)->data;
+       conf = of_search_compatible(phandle, compat_data)->data;
+
+       sc->sc_nchan = conf->num_channels;
        sc->sc_chan = kmem_alloc(sizeof(*sc->sc_chan) * sc->sc_nchan, KM_SLEEP);
 
        aprint_naive("\n");
@@ -401,6 +436,9 @@
                DMA_WRITE(sc, DMA_EN_REG(index), 0);
        }
 
+       if (conf->autogate)
+               DMA_WRITE(sc, conf->autogate_reg, conf->autogate_mask);
+
        sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_SCHED, FDT_INTR_MPSAFE,
            sun6idma_intr, sc);
        if (sc->sc_ih == NULL) {



Home | Main Index | Thread Index | Old Index