Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch A80 DMA controller support
details: https://anonhg.NetBSD.org/src/rev/b5378e5e18f9
branches: trunk
changeset: 334763:b5378e5e18f9
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Dec 05 18:54:35 2014 +0000
description:
A80 DMA controller support
diffstat:
sys/arch/arm/allwinner/awin_dma.c | 20 ++++++++++----------
sys/arch/arm/allwinner/awin_dma.h | 6 +++---
sys/arch/arm/allwinner/awin_dma_a31.c | 20 ++++++++++++++++----
sys/arch/arm/allwinner/awin_io.c | 3 ++-
sys/arch/arm/allwinner/awin_reg.h | 3 +++
sys/arch/arm/allwinner/files.awin | 4 ++--
sys/arch/evbarm/conf/ALLWINNER_A80 | 4 ++--
7 files changed, 38 insertions(+), 22 deletions(-)
diffs (223 lines):
diff -r 3446e98f0905 -r b5378e5e18f9 sys/arch/arm/allwinner/awin_dma.c
--- a/sys/arch/arm/allwinner/awin_dma.c Fri Dec 05 18:45:37 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_dma.c Fri Dec 05 18:54:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_dma.c,v 1.5 2014/10/13 12:34:00 jmcneill Exp $ */
+/* $NetBSD: awin_dma.c,v 1.6 2014/12/05 18:54:35 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
#include "opt_allwinner.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_dma.c,v 1.5 2014/10/13 12:34:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_dma.c,v 1.6 2014/12/05 18:54:35 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -58,11 +58,7 @@
static int
awin_dma_match(device_t parent, cfdata_t cf, void *aux)
{
-#if defined(ALLWINNER_A10) || defined(ALLWINNER_A20) || defined(ALLWINNER_A31)
return awin_dma_sc == NULL;
-#else
- return 0;
-#endif
}
static void
@@ -71,6 +67,8 @@
struct awin_dma_softc *sc = device_private(self);
struct awinio_attach_args * const aio = aux;
const struct awin_locators * const loc = &aio->aio_loc;
+ bus_space_handle_t bsh = awin_chip_id() == AWIN_CHIP_ID_A80 ?
+ aio->aio_a80_core2_bsh : aio->aio_core_bsh;
KASSERT(awin_dma_sc == NULL);
awin_dma_sc = sc;
@@ -78,8 +76,8 @@
sc->sc_dev = self;
sc->sc_bst = aio->aio_core_bst;
sc->sc_dmat = aio->aio_dmat;
- bus_space_subregion(sc->sc_bst, aio->aio_core_bsh,
- loc->loc_offset, loc->loc_size, &sc->sc_bsh);
+ bus_space_subregion(sc->sc_bst, bsh, loc->loc_offset,
+ loc->loc_size, &sc->sc_bsh);
aprint_naive("\n");
aprint_normal(": DMA\n");
@@ -91,8 +89,9 @@
awin_dma_a10_attach(sc, aio, loc);
break;
#endif
-#if defined(ALLWINNER_A31)
+#if defined(ALLWINNER_A31) || defined(ALLWINNER_A80)
case AWIN_CHIP_ID_A31:
+ case AWIN_CHIP_ID_A80:
awin_dma_a31_attach(sc, aio, loc);
break;
#endif
@@ -166,8 +165,9 @@
awin_dma_a10_dump_regs(sc);
break;
#endif
-#if defined(ALLWINNER_A31)
+#if defined(ALLWINNER_A31) || defined(ALLWINNER_A80)
case AWIN_CHIP_ID_A31:
+ case AWIN_CHIP_ID_A80:
awin_dma_a31_dump_regs(sc);
break;
#endif
diff -r 3446e98f0905 -r b5378e5e18f9 sys/arch/arm/allwinner/awin_dma.h
--- a/sys/arch/arm/allwinner/awin_dma.h Fri Dec 05 18:45:37 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_dma.h Fri Dec 05 18:54:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_dma.h,v 1.1 2014/10/13 12:34:00 jmcneill Exp $ */
+/* $NetBSD: awin_dma.h,v 1.2 2014/12/05 18:54:35 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
#include "opt_allwinner.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_dma.h,v 1.1 2014/10/13 12:34:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_dma.h,v 1.2 2014/12/05 18:54:35 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -74,7 +74,7 @@
#endif
#endif
-#if defined(ALLWINNER_A31)
+#if defined(ALLWINNER_A31) || defined(ALLWINNER_A80)
void awin_dma_a31_attach(struct awin_dma_softc *, struct awinio_attach_args *,
const struct awin_locators * const);
#if defined(DDB)
diff -r 3446e98f0905 -r b5378e5e18f9 sys/arch/arm/allwinner/awin_dma_a31.c
--- a/sys/arch/arm/allwinner/awin_dma_a31.c Fri Dec 05 18:45:37 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_dma_a31.c Fri Dec 05 18:54:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_dma_a31.c,v 1.2 2014/10/13 13:34:54 jmcneill Exp $ */
+/* $NetBSD: awin_dma_a31.c,v 1.3 2014/12/05 18:54:35 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
#include "opt_ddb.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_dma_a31.c,v 1.2 2014/10/13 13:34:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_dma_a31.c,v 1.3 2014/12/05 18:54:35 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -96,8 +96,20 @@
mutex_init(&awin_dma_a31_lock, MUTEX_DEFAULT, IPL_SCHED);
- awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh,
- AWIN_AHB_GATING0_REG, AWIN_AHB_GATING0_DMA, 0);
+ switch (awin_chip_id()) {
+ case AWIN_CHIP_ID_A31:
+ awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh,
+ AWIN_AHB_GATING0_REG, AWIN_AHB_GATING0_DMA, 0);
+ break;
+ case AWIN_CHIP_ID_A80:
+ awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh,
+ AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_REG,
+ AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_DMA, 0);
+ awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh,
+ AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_REG,
+ AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_DMA, 0);
+ break;
+ }
DMA_WRITE(sc, AWIN_A31_DMA_IRQ_EN_REG0_REG, 0);
DMA_WRITE(sc, AWIN_A31_DMA_IRQ_EN_REG1_REG, 0);
diff -r 3446e98f0905 -r b5378e5e18f9 sys/arch/arm/allwinner/awin_io.c
--- a/sys/arch/arm/allwinner/awin_io.c Fri Dec 05 18:45:37 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_io.c Fri Dec 05 18:54:35 2014 +0000
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: awin_io.c,v 1.35 2014/12/05 18:41:41 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_io.c,v 1.36 2014/12/05 18:54:35 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -100,6 +100,7 @@
{ "awingpio", OFFANDSIZE(A80_PIO), NOPORT, NOINTR, A80|REQ },
{ "awindma", OFFANDSIZE(DMA), NOPORT, AWIN_IRQ_DMA, A10|A20 },
{ "awindma", OFFANDSIZE(DMA), NOPORT, AWIN_A31_IRQ_DMA, A31 },
+ { "awindma", OFFANDSIZE(A80_DMA), NOPORT, AWIN_A80_IRQ_DMA, A80 },
{ "awintmr", OFFANDSIZE(TMR), NOPORT, AWIN_IRQ_TMR0, A10 },
{ "awincnt", OFFANDSIZE(CPUCFG), NOPORT, NOINTR, A20 },
{ "awincnt", OFFANDSIZE(A31_CPUCFG), NOPORT, NOINTR, A31 },
diff -r 3446e98f0905 -r b5378e5e18f9 sys/arch/arm/allwinner/awin_reg.h
--- a/sys/arch/arm/allwinner/awin_reg.h Fri Dec 05 18:45:37 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_reg.h Fri Dec 05 18:54:35 2014 +0000
@@ -2699,6 +2699,7 @@
* These offsets are relative to AWIN_A80_CORE2_PBASE
*/
#define AWIN_A80_SYS_CTRL_OFFSET 0x00000000
+#define AWIN_A80_DMA_OFFSET 0x00002000
#define AWIN_A80_GMAC_OFFSET 0x00030000
#define AWIN_A80_SDMMC_COMM_SDC_RESET_SW __BIT(18)
@@ -2748,6 +2749,7 @@
#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING0_SD __BIT(8)
+#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_DMA __BIT(24)
#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_GMAC __BIT(17)
#define AWIN_A80_CCU_SCLK_BUS_CLK_GATING1_USB_HOST __BIT(1)
@@ -2759,6 +2761,7 @@
#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST0_SD __BIT(8)
+#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_DMA __BIT(24)
#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_GMAC __BIT(17)
#define AWIN_A80_CCU_SCLK_BUS_SOFT_RST1_USB_HOST __BIT(1)
diff -r 3446e98f0905 -r b5378e5e18f9 sys/arch/arm/allwinner/files.awin
--- a/sys/arch/arm/allwinner/files.awin Fri Dec 05 18:45:37 2014 +0000
+++ b/sys/arch/arm/allwinner/files.awin Fri Dec 05 18:54:35 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.awin,v 1.27 2014/12/04 11:16:38 jmcneill Exp $
+# $NetBSD: files.awin,v 1.28 2014/12/05 18:54:35 jmcneill Exp $
#
# Configuration info for Allwinner ARM Peripherals
#
@@ -78,7 +78,7 @@
attach awindma at awinio with awin_dma
file arch/arm/allwinner/awin_dma.c awin_dma
file arch/arm/allwinner/awin_dma_a10.c awin_dma & (allwinner_a10 | allwinner_a20)
-file arch/arm/allwinner/awin_dma_a31.c awin_dma & allwinner_a31
+file arch/arm/allwinner/awin_dma_a31.c awin_dma & (allwinner_a31 | allwinner_a80)
# A10/A20 TWI (IIC)
device awiniic : i2cbus, i2cexec, mvi2c
diff -r 3446e98f0905 -r b5378e5e18f9 sys/arch/evbarm/conf/ALLWINNER_A80
--- a/sys/arch/evbarm/conf/ALLWINNER_A80 Fri Dec 05 18:45:37 2014 +0000
+++ b/sys/arch/evbarm/conf/ALLWINNER_A80 Fri Dec 05 18:54:35 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ALLWINNER_A80,v 1.5 2014/12/05 18:42:02 jmcneill Exp $
+# $NetBSD: ALLWINNER_A80,v 1.6 2014/12/05 18:54:35 jmcneill Exp $
#
# ALLWINNER_A80 - Allwinner A80 boards (Cubieboard4, OptimusBoard, etc)
#
@@ -207,7 +207,7 @@
awinicu0 at awinio0
# DMA Controller
-#awindma0 at awinio0
+awindma0 at awinio0
# 64-bit counter
#awincnt0 at awinio0
Home |
Main Index |
Thread Index |
Old Index