Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/omap omapdma* -> omap3_sdma*
details: https://anonhg.NetBSD.org/src/rev/164ddeb66a87
branches: trunk
changeset: 783803:164ddeb66a87
user: macallan <macallan%NetBSD.org@localhost>
date: Wed Jan 09 03:35:11 2013 +0000
description:
omapdma* -> omap3_sdma*
diffstat:
sys/arch/arm/omap/files.omap2 | 6 +-
sys/arch/arm/omap/omap3_sdma.c | 157 +++++++++++++++++++++++++++++++++
sys/arch/arm/omap/omap3_sdmareg.h | 176 ++++++++++++++++++++++++++++++++++++++
sys/arch/arm/omap/omap3_sdmavar.h | 41 ++++++++
sys/arch/arm/omap/omapdma.c | 157 ---------------------------------
sys/arch/arm/omap/omapdmareg.h | 176 --------------------------------------
sys/arch/arm/omap/omapdmavar.h | 41 --------
7 files changed, 379 insertions(+), 375 deletions(-)
diffs (truncated from 794 to 300 lines):
diff -r 11963b0ddfc3 -r 164ddeb66a87 sys/arch/arm/omap/files.omap2
--- a/sys/arch/arm/omap/files.omap2 Wed Jan 09 02:05:12 2013 +0000
+++ b/sys/arch/arm/omap/files.omap2 Wed Jan 09 03:35:11 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.omap2,v 1.22 2013/01/03 21:13:26 jakllsch Exp $
+# $NetBSD: files.omap2,v 1.23 2013/01/09 03:35:11 macallan Exp $
#
# Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
# Based on xscale/files.pxa2x0
@@ -133,6 +133,10 @@
attach cpsw at obio
file arch/arm/omap/if_cpsw.c cpsw
+device omapdma
+attach omapdma at obio
+file arch/arm/omap/omap3_sdma.c omapdma
+
# these bus space methods are not bus-specific ...
#
file arch/arm/omap/omap_nobyteacc_space.c emifs | gpmc
diff -r 11963b0ddfc3 -r 164ddeb66a87 sys/arch/arm/omap/omap3_sdma.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/omap/omap3_sdma.c Wed Jan 09 03:35:11 2013 +0000
@@ -0,0 +1,157 @@
+/* $NetBSD: omap3_sdma.c,v 1.1 2013/01/09 03:35:11 macallan Exp $ */
+
+/*
+ * Copyright (c) 2012 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * OMAP 3530 DMA controller
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: omap3_sdma.c,v 1.1 2013/01/09 03:35:11 macallan Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/lwp.h>
+#include <sys/kauth.h>
+
+#include <sys/bus.h>
+#include <arm/omap/omap3_sdmareg.h>
+#include <arm/omap/omap3_sdmavar.h>
+#include <arm/omap/omap2_obiovar.h>
+#include <arm/omap/omap2_obioreg.h>
+#include <arm/omap/omap2_prcm.h>
+
+struct omapdma_softc {
+ device_t sc_dev;
+
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_regh;
+};
+
+static int omapdma_match(device_t, cfdata_t, void *);
+static void omapdma_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(omapdma, sizeof(struct omapdma_softc),
+ omapdma_match, omapdma_attach, NULL, NULL);
+
+struct omapdma_softc *omapdma_sc = NULL;
+
+static int
+omapdma_match(device_t parent, cfdata_t match, void *aux)
+{
+ struct obio_attach_args *obio = aux;
+
+ if ((obio->obio_addr == -1) || (obio->obio_size == 0))
+ return 0;
+ return 1;
+}
+
+static void
+omapdma_attach(device_t parent, device_t self, void *aux)
+{
+ struct omapdma_softc *sc = device_private(self);
+ struct obio_attach_args *obio = aux;
+ uint32_t reg;
+
+ sc->sc_iot = obio->obio_iot;
+ sc->sc_dev = self;
+
+ printf(": OMAP DMA controller rev ");
+ if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size, 0,
+ &sc->sc_regh)) {
+ aprint_error_dev(sc->sc_dev, ": couldn't map register space\n");
+ return;
+ }
+ reg = bus_space_read_4(sc->sc_iot, sc->sc_regh, OMAPDMA_REVISION);
+ printf("%d.%d\n", (reg >> 4) & 0xf, reg & 0xf);
+
+ /* disable & clear all interrupts etc. */
+ bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPDMA_IRQENABLE_L0, 0);
+ bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPDMA_IRQENABLE_L1, 0);
+ bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPDMA_IRQENABLE_L2, 0);
+ bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPDMA_IRQENABLE_L3, 0);
+ bus_space_write_4(sc->sc_iot, sc->sc_regh,
+ OMAPDMA_IRQSTATUS_L0, 0xffffffff);
+ bus_space_write_4(sc->sc_iot, sc->sc_regh,
+ OMAPDMA_IRQSTATUS_L1, 0xffffffff);
+ bus_space_write_4(sc->sc_iot, sc->sc_regh,
+ OMAPDMA_IRQSTATUS_L2, 0xffffffff);
+ bus_space_write_4(sc->sc_iot, sc->sc_regh,
+ OMAPDMA_IRQSTATUS_L3, 0xffffffff);
+
+ bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPDMA_SYSCONFIG,
+ OMAPDMA_IDLEMODE_SMART_STANDBY | OMAPDMA_SMART_IDLE |
+ OMAPDMA_AUTOIDLE);
+
+ omapdma_sc = sc;
+
+ /*
+ * TODO:
+ * - channel allocation
+ */
+}
+
+void
+omapdma_write_reg(int reg, uint32_t val)
+{
+ if (omapdma_sc != NULL) {
+ bus_space_write_4(omapdma_sc->sc_iot, omapdma_sc->sc_regh,
+ reg, val);
+ }
+}
+
+uint32_t
+omapdma_read_reg(int reg)
+{
+ if (omapdma_sc != NULL) {
+ return bus_space_read_4(omapdma_sc->sc_iot,
+ omapdma_sc->sc_regh, reg);
+ }
+ return 0;
+}
+
+void
+omapdma_write_ch_reg(int ch, int reg, uint32_t val)
+{
+ if (omapdma_sc != NULL) {
+ bus_space_write_4(omapdma_sc->sc_iot, omapdma_sc->sc_regh,
+ OMAPDMA_CHANNEL_BASE + 0x60 * ch + reg, val);
+ }
+}
+
+uint32_t
+omapdma_read_ch_reg(int ch, int reg)
+{
+ if (omapdma_sc != NULL) {
+ return bus_space_read_4(omapdma_sc->sc_iot,
+ omapdma_sc->sc_regh,
+ OMAPDMA_CHANNEL_BASE + 0x60 * ch + reg);
+ }
+ return 0;
+}
diff -r 11963b0ddfc3 -r 164ddeb66a87 sys/arch/arm/omap/omap3_sdmareg.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/omap/omap3_sdmareg.h Wed Jan 09 03:35:11 2013 +0000
@@ -0,0 +1,176 @@
+/* $NetBSD: omap3_sdmareg.h,v 1.1 2013/01/09 03:35:11 macallan Exp $ */
+
+/*
+ * Copyright (c) 2012 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: omap3_sdmareg.h,v 1.1 2013/01/09 03:35:11 macallan Exp $");
+
+#ifndef OMAPDMA_REG_H
+#define OMAPDMA_REG_H
+
+/*
+ * all register offsets are relative to OMAP3530_SDMA_BASE
+ */
+
+#define OMAPDMA_REVISION 0x00000000
+
+/* each bit corresponds to a DMA channel, write 1 to clear */
+#define OMAPDMA_IRQSTATUS_L0 0x00000008
+#define OMAPDMA_IRQSTATUS_L1 0x0000000c
+#define OMAPDMA_IRQSTATUS_L2 0x00000010
+#define OMAPDMA_IRQSTATUS_L3 0x00000014
+
+#define OMAPDMA_IRQENABLE_L0 0x00000018
+#define OMAPDMA_IRQENABLE_L1 0x0000001c
+#define OMAPDMA_IRQENABLE_L2 0x00000020
+#define OMAPDMA_IRQENABLE_L3 0x00000024
+
+#define OMAPDMA_SYSSTATUS 0x00000028
+ #define OMAPDMA_RESET_DONE 0x00000001
+
+#define OMAPDMA_SYSCONFIG 0x0000002c
+ #define OMAPDMA_IDLEMODE_MASK 0x00003000
+ #define OMAPDMA_IDLEMODE_FORCE_STANDBY 0x00000000
+ #define OMAPDMA_IDLEMODE_NO_STANDBY 0x00001000
+ #define OMAPDMA_IDLEMODE_SMART_STANDBY 0x00002000
+ #define OMAPDMA_CLKACT_MASK 0x00000300
+ #define OMAPDMA_EMUFREE 0x00000020
+ #define OMAPDMA_SIDLEMODE_MASK 0x00000018
+ #define OMAPDMA_FORCE_IDLE 0x00000000
+ #define OMAPDMA_NO_IDLE 0x00000008
+ #define OMAPDMA_SMART_IDLE 0x00000010
+ #define OMAPDMA_SOFTRESET 0x00000002
+ #define OMAPDMA_AUTOIDLE 0x00000001
+
+/* capability registers */
+#define OMAPDMA_CAPS_0 0x00000064
+ #define OMAPDMA_CAP_FILL 0x00080000 /* fill support */
+ #define OMAPDMA_CAP_TRANS_BLT 0x00040000 /* transparent blit */
+#define OMAPDMA_CAPS_2 0x0000006c
+#define OMAPDMA_CAPS_3 0x00000070
+#define OMAPDMA_CAPS_4 0x00000074
+#define OMAPDMA_GCR 0x00000078
+
+/*
+ * there are 32 channels, each occupies a 0x60 register space starting at
+ * 0x00000080 + 0x60 * c for c = 0 .. 31
+ */
+#define OMAPDMA_CHANNEL_BASE 0x00000080
+
+#define OMAPDMAC_CCR 0x00000000
+ #define CCR_WRITE_PRIORITY 0x04000000
+ #define CCR_BUFFERING_DISABLE 0x02000000
+ #define CCR_SEL_SRC_DST_SYNC 0x01000000
+ #define CCR_PREFETCH 0x00800000
+ #define CCR_SUPERVISOR 0x00400000
+ #define CCR_SUNC_CONTROL_UPPER_MASK 0x00180000
+ #define CCR_BLOCK_SYNC 0x00040000
+ #define CCR_TRANSPARENT_COPY_ENABLE 0x00020000
+ #define CCR_CONST_FILL_ENABLE 0x00010000
+ #define CCR_DST_AMODE_MASK 0x0000c000
+ #define CCR_DST_AMODE_CONST_ADDR 0x00000000
+ #define CCR_DST_AMODE_POST_INCR 0x00004000
+ #define CCR_DST_AMODE_SINGLE_INDEX 0x00008000
+ #define CCR_DST_AMODE_DOUBLE_INDEX 0x0000c000
+ #define CCR_SRC_AMODE_MASK 0x00003000
+ #define CCR_SRC_AMODE_CONST_ADDR 0x00000000
+ #define CCR_SRC_AMODE_POST_INCR 0x00001000
+ #define CCR_SRC_AMODE_SINGLE_INDEX 0x00002000
+ #define CCR_SRC_AMODE_DOUBLE_INDEX 0x00003000
+ #define CCR_WR_ACTIVE 0x00000400
+ #define CCR_RD_ACTIVE 0x00000200
+ #define CCR_SUSPEND_SENSITIVE 0x00000100
+ #define CCR_ENABLE 0x00000080
+ #define CCR_READ_PRIORITY 0x00000040
+ #define CCR_FRAME_SYNC 0x00000020
+ #define CCR_SYNCHRO_CONTROL_MASK 0x0000001f
+#define OMAPDMAC_CLNK_CTRL 0x00000004
+ #define CLNK_ENABLE_LNK 0x00008000
+ #define CLNK_NEXT_CHANNEL_MASK 0x0000001f
+#define OMAPDMAC_CICRI 0x00000008
+ #define CICRI_DRAIN_IE 0x00001000
Home |
Main Index |
Thread Index |
Old Index