Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/dev Allow dmac_alloc_channel() to specify DCR ...



details:   https://anonhg.NetBSD.org/src/rev/d11846ce872a
branches:  trunk
changeset: 826019:d11846ce872a
user:      isaki <isaki%NetBSD.org@localhost>
date:      Fri Aug 11 07:08:40 2017 +0000

description:
Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
>From Y.Suhagara and it was found by XM6i.

diffstat:

 sys/arch/x68k/dev/dmacvar.h    |  13 +++++++++----
 sys/arch/x68k/dev/fd.c         |   9 ++++++---
 sys/arch/x68k/dev/intio_dmac.c |  17 +++++++++--------
 sys/arch/x68k/dev/vs.c         |  14 +++++---------
 4 files changed, 29 insertions(+), 24 deletions(-)

diffs (158 lines):

diff -r 0a7d833029e9 -r d11846ce872a sys/arch/x68k/dev/dmacvar.h
--- a/sys/arch/x68k/dev/dmacvar.h       Fri Aug 11 06:47:35 2017 +0000
+++ b/sys/arch/x68k/dev/dmacvar.h       Fri Aug 11 07:08:40 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dmacvar.h,v 1.10 2008/06/25 13:30:24 isaki Exp $       */
+/*     $NetBSD: dmacvar.h,v 1.11 2017/08/11 07:08:40 isaki Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -99,9 +99,14 @@
 #define DMAC_MAXSEGSZ  0xff00
 #define DMAC_BOUNDARY  0
 
-struct dmac_channel_stat *dmac_alloc_channel(device_t, int, const char *,
-       int, dmac_intr_handler_t, void *, int, dmac_intr_handler_t, void *);
-               /* ch, name, normalv, normal, errorv, error */
+struct dmac_channel_stat *dmac_alloc_channel(device_t,
+       int,            /* ch */
+       const char *,   /* name */
+       int, dmac_intr_handler_t, void *,       /* normal handler */
+       int, dmac_intr_handler_t, void *,       /* error handler */
+       uint8_t,        /* dcr */
+       uint8_t         /* ocr */
+);
 int dmac_free_channel(device_t, int, void *);
                /* ch, channel */
 struct dmac_dma_xfer *dmac_alloc_xfer(struct dmac_channel_stat *,
diff -r 0a7d833029e9 -r d11846ce872a sys/arch/x68k/dev/fd.c
--- a/sys/arch/x68k/dev/fd.c    Fri Aug 11 06:47:35 2017 +0000
+++ b/sys/arch/x68k/dev/fd.c    Fri Aug 11 07:08:40 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.119 2017/01/12 14:24:53 isaki Exp $   */
+/*     $NetBSD: fd.c,v 1.120 2017/08/11 07:08:40 isaki Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.119 2017/01/12 14:24:53 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.120 2017/08/11 07:08:40 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m68k_arch.h"
@@ -487,7 +487,10 @@
        /* Initialize DMAC channel */
        fdc->sc_dmachan = dmac_alloc_channel(parent, ia->ia_dma, "fdc",
            ia->ia_dmaintr, fdcdmaintr, fdc,
-           ia->ia_dmaintr + 1, fdcdmaerrintr, fdc);
+           ia->ia_dmaintr + 1, fdcdmaerrintr, fdc,
+           (DMAC_DCR_XRM_CSWH | DMAC_DCR_OTYP_EASYNC | DMAC_DCR_OPS_8BIT),
+           (DMAC_OCR_SIZE_BYTE | DMAC_OCR_REQG_EXTERNAL));
+
        if (bus_dmamap_create(fdc->sc_dmat, FDC_MAXIOSIZE, 1, DMAC_MAXSEGSZ,
            0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &fdc->sc_dmamap)) {
                aprint_error_dev(self, "can't set up intio DMA map\n");
diff -r 0a7d833029e9 -r d11846ce872a sys/arch/x68k/dev/intio_dmac.c
--- a/sys/arch/x68k/dev/intio_dmac.c    Fri Aug 11 06:47:35 2017 +0000
+++ b/sys/arch/x68k/dev/intio_dmac.c    Fri Aug 11 07:08:40 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intio_dmac.c,v 1.35 2014/03/26 08:17:59 christos Exp $ */
+/*     $NetBSD: intio_dmac.c,v 1.36 2017/08/11 07:08:40 isaki Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_m68k_arch.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.35 2014/03/26 08:17:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio_dmac.c,v 1.36 2017/08/11 07:08:40 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -159,9 +159,10 @@
  * Channel initialization/deinitialization per user device.
  */
 struct dmac_channel_stat *
-dmac_alloc_channel(device_t self, int ch, const char *name, int normalv,
-    dmac_intr_handler_t normal, void *normalarg, int errorv,
-    dmac_intr_handler_t error, void *errorarg)
+dmac_alloc_channel(device_t self, int ch, const char *name,
+    int normalv, dmac_intr_handler_t normal, void *normalarg,
+    int errorv,  dmac_intr_handler_t error,  void *errorarg,
+    uint8_t dcr, uint8_t ocr)
 {
        struct intio_softc *intio = device_private(self);
        struct dmac_softc *dmac = device_private(intio->sc_dmac);
@@ -201,9 +202,8 @@
 
        /* fill the channel status structure by the default values. */
        strcpy(chan->ch_name, name);
-       chan->ch_dcr = (DMAC_DCR_XRM_CSWH | DMAC_DCR_OTYP_EASYNC |
-                       DMAC_DCR_OPS_8BIT);
-       chan->ch_ocr = (DMAC_OCR_SIZE_BYTE | DMAC_OCR_REQG_EXTERNAL);
+       chan->ch_dcr = dcr;
+       chan->ch_ocr = ocr;
        chan->ch_normalv = normalv;
        chan->ch_errorv = errorv;
        chan->ch_normal = normal;
@@ -217,6 +217,7 @@
        bus_space_write_1(dmac->sc_bst, chan->ch_bht,
                           DMAC_REG_DCR, chan->ch_dcr);
        bus_space_write_1(dmac->sc_bst, chan->ch_bht, DMAC_REG_CPR, 0);
+       /* OCR will be written at dmac_load_xfer() */
 
        /*
         * X68k physical user space is a subset of the kernel space;
diff -r 0a7d833029e9 -r d11846ce872a sys/arch/x68k/dev/vs.c
--- a/sys/arch/x68k/dev/vs.c    Fri Aug 11 06:47:35 2017 +0000
+++ b/sys/arch/x68k/dev/vs.c    Fri Aug 11 07:08:40 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vs.c,v 1.45 2017/08/11 06:47:35 isaki Exp $    */
+/*     $NetBSD: vs.c,v 1.46 2017/08/11 07:08:40 isaki Exp $    */
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.45 2017/08/11 06:47:35 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.46 2017/08/11 07:08:40 isaki Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -235,7 +235,9 @@
        sc->sc_dmat = ia->ia_dmat;
        sc->sc_dma_ch = dmac_alloc_channel(parent, ia->ia_dma, "vs",
                ia->ia_dmaintr,   vs_dmaintr, sc,
-               ia->ia_dmaintr+1, vs_dmaerrintr, sc);
+               ia->ia_dmaintr+1, vs_dmaerrintr, sc,
+               (DMAC_DCR_XRM_CSWOH | DMAC_DCR_OTYP_EASYNC | DMAC_DCR_OPS_8BIT),
+               (DMAC_OCR_SIZE_BYTE | DMAC_OCR_REQG_EXTERNAL));
 
        aprint_normal_dev(self, "MSM6258V ADPCM voice synthesizer\n");
 
@@ -517,9 +519,6 @@
        vd = sc->sc_dmas;
 
        chan = sc->sc_dma_ch;
-       chan->ch_dcr = (DMAC_DCR_XRM_CSWOH | DMAC_DCR_OTYP_EASYNC |
-                       DMAC_DCR_OPS_8BIT);
-       chan->ch_ocr = DMAC_OCR_REQG_EXTERNAL;
 
        sc->sc_current.xfer = dmac_prepare_xfer(chan, sc->sc_dmat, vd->vd_map,
            DMAC_OCR_DIR_MTD,
@@ -565,9 +564,6 @@
        vd = sc->sc_dmas;
 
        chan = sc->sc_dma_ch;
-       chan->ch_dcr = (DMAC_DCR_XRM_CSWOH | DMAC_DCR_OTYP_EASYNC |
-                       DMAC_DCR_OPS_8BIT);
-       chan->ch_ocr = DMAC_OCR_REQG_EXTERNAL;
 
        sc->sc_current.xfer = dmac_prepare_xfer(chan, sc->sc_dmat, vd->vd_map,
            DMAC_OCR_DIR_DTM,



Home | Main Index | Thread Index | Old Index