Sun Aug 27 16:05:26 2017 UTC ()
Add sun4i DMA and audio codec support.


(jmcneill)
diff -r1.19 -r1.20 src/sys/arch/arm/sunxi/files.sunxi
diff -r0 -r1.1 src/sys/arch/arm/sunxi/sun4i_a10_codec.c
diff -r0 -r1.1 src/sys/arch/arm/sunxi/sun4i_dma.c
diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_codec.c
diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_codec.h
diff -r1.24 -r1.25 src/sys/arch/evbarm/conf/SUNXI

cvs diff -r1.19 -r1.20 src/sys/arch/arm/sunxi/files.sunxi (expand / switch to unified diff)

--- src/sys/arch/arm/sunxi/files.sunxi 2017/08/27 02:19:46 1.19
+++ src/sys/arch/arm/sunxi/files.sunxi 2017/08/27 16:05:26 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: files.sunxi,v 1.19 2017/08/27 02:19:46 jmcneill Exp $ 1# $NetBSD: files.sunxi,v 1.20 2017/08/27 16:05:26 jmcneill Exp $
2# 2#
3# Configuration info for Allwinner sunxi family SoCs 3# Configuration info for Allwinner sunxi family SoCs
4# 4#
5# 5#
6 6
7include "arch/arm/pic/files.pic" 7include "arch/arm/pic/files.pic"
8include "arch/arm/cortex/files.cortex" 8include "arch/arm/cortex/files.cortex"
9 9
10file arch/arm/arm32/arm32_boot.c 10file arch/arm/arm32/arm32_boot.c
11file arch/arm/arm32/arm32_kvminit.c 11file arch/arm/arm32/arm32_kvminit.c
12file arch/arm/arm32/arm32_reboot.c 12file arch/arm/arm32/arm32_reboot.c
13file arch/arm/arm32/irq_dispatch.S 13file arch/arm/arm32/irq_dispatch.S
14file arch/arm/arm32/armv7_generic_space.c 14file arch/arm/arm32/armv7_generic_space.c
@@ -114,37 +114,43 @@ device sunxiemac: arp, ether, ifnet, mii @@ -114,37 +114,43 @@ device sunxiemac: arp, ether, ifnet, mii
114attach sunxiemac at fdt with sunxi_emac 114attach sunxiemac at fdt with sunxi_emac
115file arch/arm/sunxi/sunxi_emac.c sunxi_emac 115file arch/arm/sunxi/sunxi_emac.c sunxi_emac
116 116
117# Timer 117# Timer
118device sunxitimer 118device sunxitimer
119attach sunxitimer at fdt with sunxi_timer 119attach sunxitimer at fdt with sunxi_timer
120file arch/arm/sunxi/sunxi_timer.c sunxi_timer 120file arch/arm/sunxi/sunxi_timer.c sunxi_timer
121 121
122# Watchdog 122# Watchdog
123device sunxiwdt: sysmon_wdog 123device sunxiwdt: sysmon_wdog
124attach sunxiwdt at fdt with sunxi_wdt 124attach sunxiwdt at fdt with sunxi_wdt
125file arch/arm/sunxi/sunxi_wdt.c sunxi_wdt 125file arch/arm/sunxi/sunxi_wdt.c sunxi_wdt
126 126
127# DMA controller 127# DMA controller (sun4i)
 128device sun4idma
 129attach sun4idma at fdt with sun4i_dma
 130file arch/arm/sunxi/sun4i_dma.c sun4i_dma
 131
 132# DMA controller (sun6i)
128device sun6idma 133device sun6idma
129attach sun6idma at fdt with sun6i_dma 134attach sun6idma at fdt with sun6i_dma
130file arch/arm/sunxi/sun6i_dma.c sun6i_dma 135file arch/arm/sunxi/sun6i_dma.c sun6i_dma
131 136
132# Audio codec 137# Audio codec
133device sunxicodec: audiobus, auconv, mulaw, aurateconv 138device sunxicodec: audiobus, auconv, mulaw, aurateconv
134attach sunxicodec at fdt with sunxi_codec 139attach sunxicodec at fdt with sunxi_codec
135file arch/arm/sunxi/sunxi_codec.c sunxi_codec 140file arch/arm/sunxi/sunxi_codec.c sunxi_codec
 141file arch/arm/sunxi/sun4i_a10_codec.c sunxi_codec
136 142
137# Audio codec (analog part) 143# H3 Audio codec (analog part)
138device h3codec 144device h3codec
139attach h3codec at fdt with h3_codec 145attach h3codec at fdt with h3_codec
140file arch/arm/sunxi/sun8i_h3_codec.c h3_codec needs-flag 146file arch/arm/sunxi/sun8i_h3_codec.c h3_codec needs-flag
141 147
142# Display controller 148# Display controller
143attach genfb at fdt with sunxi_debe 149attach genfb at fdt with sunxi_debe
144file arch/arm/sunxi/sunxi_debe.c sunxi_debe 150file arch/arm/sunxi/sunxi_debe.c sunxi_debe
145 151
146# Touch Screen controller 152# Touch Screen controller
147device sunxits: wsmousedev, tpcalib 153device sunxits: wsmousedev, tpcalib
148attach sunxits at fdt with sunxi_ts 154attach sunxits at fdt with sunxi_ts
149file arch/arm/sunxi/sunxi_ts.c sunxi_ts 155file arch/arm/sunxi/sunxi_ts.c sunxi_ts
150 156

File Added: src/sys/arch/arm/sunxi/sun4i_a10_codec.c
/* $NetBSD: sun4i_a10_codec.c,v 1.1 2017/08/27 16:05:26 jmcneill Exp $ */

/*-
 * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
 * 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.
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sun4i_a10_codec.c,v 1.1 2017/08/27 16:05:26 jmcneill Exp $");

#include <sys/param.h>
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/device.h>
#include <sys/kmem.h>
#include <sys/bitops.h>

#include <sys/audioio.h>
#include <dev/audio_if.h>

#include <arm/sunxi/sunxi_codec.h>

#define	A10_DEFAULT_PAVOL	0x20

#define	A10_DAC_ACTRL		0x10
#define	 A10_DACAREN		__BIT(31)
#define	 A10_DACALEN		__BIT(30)
#define	 A10_MIXEN		__BIT(29)
#define	 A10_LNG		__BIT(26)
#define	 A10_FMG		__BITS(25,23)
#define	 A10_MICG		__BITS(22,20)
#define	 A10_LLNS		__BIT(19)
#define	 A10_RLNS		__BIT(18)
#define	 A10_LFMS		__BIT(17)
#define	 A10_RFMS		__BIT(16)
#define	 A10_LDACLMIXS		__BIT(15)
#define	 A10_RDACRMIXS		__BIT(14)
#define	 A10_LDACRMIXS		__BIT(13)
#define	 A10_MICLS		__BIT(12)
#define	 A10_MICRS		__BIT(11)
#define	 A10_DACPAS		__BIT(8)
#define	 A10_MIXPAS		__BIT(7)
#define	 A10_PAMUTE		__BIT(6)
#define	 A10_PAVOL		__BITS(5,0)

#define	A10_ADC_ACTRL		0x28
#define	 A10_ADCREN		__BIT(31)
#define	 A10_ADCLEN		__BIT(30)
#define	 A10_PREG1EN		__BIT(29)
#define	 A10_PREG2EN		__BIT(28)
#define	 A10_VMICEN		__BIT(27)
#define	 A10_PREG1		__BITS(26,25)
#define	 A10_PREG2		__BITS(24,23)
#define	 A10_ADCG		__BITS(22,20)
#define	 A10_ADCIS		__BITS(19,17)
#define	 A10_LNRDF		__BIT(16)
#define	 A10_LNPREG		__BITS(15,13)
#define	 A10_MIC1NEN		__BIT(12)
#define	 A10_DITHER		__BIT(8)
#define	 A10_PA_EN		__BIT(4)
#define	 A10_DDE		__BIT(3)
#define	 A10_COMPTEN		__BIT(2)
#define	 A10_PTDBS		__BITS(1,0)

enum a10_codec_mixer_ctrl {
	A10_CODEC_OUTPUT_CLASS,
	A10_CODEC_INPUT_CLASS,

	A10_CODEC_OUTPUT_MASTER_VOLUME,
	A10_CODEC_INPUT_DAC_VOLUME,

	A10_CODEC_MIXER_CTRL_LAST
};

static const struct a10_codec_mixer {
	const char *			name;
	enum a10_codec_mixer_ctrl	mixer_class;
	u_int				reg;
	u_int				mask;
} a10_codec_mixers[A10_CODEC_MIXER_CTRL_LAST] = {
	[A10_CODEC_OUTPUT_MASTER_VOLUME]	= { AudioNmaster,
	    A10_CODEC_OUTPUT_CLASS, A10_DAC_ACTRL, A10_PAVOL },
	[A10_CODEC_INPUT_DAC_VOLUME]		= { AudioNdac,
	    A10_CODEC_INPUT_CLASS, A10_DAC_ACTRL, A10_PAVOL },
};

#define	RD4(sc, reg)			\
	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
#define	WR4(sc, reg, val)		\
	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
#define	SET4(sc, reg, mask)		\
	WR4((sc), (reg), RD4((sc), (reg)) | (mask))
#define	CLR4(sc, reg, mask)		\
	WR4((sc), (reg), RD4((sc), (reg)) & ~(mask))

static int
a10_codec_init(struct sunxi_codec_softc *sc)
{

	/* Unmute PA */
	SET4(sc, A10_DAC_ACTRL, A10_PAMUTE);
	/* Set initial volume */
	CLR4(sc, A10_DAC_ACTRL, A10_PAVOL);
	SET4(sc, A10_DAC_ACTRL, __SHIFTIN(A10_DEFAULT_PAVOL, A10_PAVOL));
	/* Enable PA */
	SET4(sc, A10_ADC_ACTRL, A10_PA_EN);

	return 0;
}

static void
a10_codec_mute(struct sunxi_codec_softc *sc, int mute, u_int mode)
{
	if (mode == AUMODE_PLAY) {
		const uint32_t pmask = A10_DACAREN|A10_DACALEN|A10_DACPAS;
		if (mute) {
			/* Mute DAC l/r channels to output mixer */
			CLR4(sc, A10_DAC_ACTRL, pmask);
		} else {
			/* Enable DAC analog l/r channels and output mixer */
			SET4(sc, A10_DAC_ACTRL, pmask);
		}
	} else {
		const uint32_t rmask = A10_ADCREN|A10_ADCLEN;
		if (mute) {
			/* Disable ADC analog l/r channels */
			CLR4(sc, A10_ADC_ACTRL, rmask);
		} else {
			/* Enable ADC analog l/r channels */
			SET4(sc, A10_ADC_ACTRL, rmask);
		}
	}
}

static int
a10_codec_set_port(struct sunxi_codec_softc *sc, mixer_ctrl_t *mc)
{
	const struct a10_codec_mixer *mix;
	u_int val, shift;
	int nvol;

	switch (mc->dev) {
	case A10_CODEC_OUTPUT_MASTER_VOLUME:
	case A10_CODEC_INPUT_DAC_VOLUME:
		mix = &a10_codec_mixers[mc->dev];
		val = RD4(sc, mix->reg);
		shift = 8 - fls32(__SHIFTOUT_MASK(mix->mask));
		nvol = mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] >> shift;
		val &= ~mix->mask;
		val |= __SHIFTIN(nvol, mix->mask);
		WR4(sc, mix->reg, val);
		return 0;
	}

	return ENXIO;
}

static int
a10_codec_get_port(struct sunxi_codec_softc *sc, mixer_ctrl_t *mc)
{
	const struct a10_codec_mixer *mix;
	u_int val, shift;
	int nvol;

	switch (mc->dev) {
	case A10_CODEC_OUTPUT_MASTER_VOLUME:
	case A10_CODEC_INPUT_DAC_VOLUME:
		mix = &a10_codec_mixers[mc->dev];
		val = RD4(sc, mix->reg);
		shift = 8 - fls32(__SHIFTOUT_MASK(mix->mask));
		nvol = __SHIFTOUT(val, mix->mask) << shift;
		mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = nvol;
		mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = nvol;
		return 0;
	}

	return ENXIO;
}

static int
a10_codec_query_devinfo(struct sunxi_codec_softc *sc, mixer_devinfo_t *di)
{
	const struct a10_codec_mixer *mix;

	switch (di->index) {
	case A10_CODEC_OUTPUT_CLASS:
		di->mixer_class = di->index;
		strcpy(di->label.name, AudioCoutputs);
		di->type = AUDIO_MIXER_CLASS;
		di->next = di->prev = AUDIO_MIXER_LAST;
		return 0;

	case A10_CODEC_INPUT_CLASS:
		di->mixer_class = di->index;
		strcpy(di->label.name, AudioCinputs);
		di->type = AUDIO_MIXER_CLASS;
		di->next = di->prev = AUDIO_MIXER_LAST;
		return 0;

	case A10_CODEC_OUTPUT_MASTER_VOLUME:
	case A10_CODEC_INPUT_DAC_VOLUME:
		mix = &a10_codec_mixers[di->index];
		di->mixer_class = mix->mixer_class;
		strcpy(di->label.name, mix->name);
		di->un.v.delta =
		    256 / (__SHIFTOUT_MASK(mix->mask) + 1);
		di->type = AUDIO_MIXER_VALUE;
		di->next = di->prev = AUDIO_MIXER_LAST;
		di->un.v.num_channels = 2;
		strcpy(di->un.v.units.name, AudioNvolume);
		return 0;
	}

	return ENXIO;
}

const struct sunxi_codec_conf sun4i_a10_codecconf = {
	.name = "A10 Audio Codec",

	.init = a10_codec_init,
	.mute = a10_codec_mute,
	.set_port = a10_codec_set_port,
	.get_port = a10_codec_get_port,
	.query_devinfo = a10_codec_query_devinfo,

	.DPC		= 0x00,
	.DAC_FIFOC	= 0x04,
	.DAC_FIFOS	= 0x08,
	.DAC_TXDATA	= 0x0c,
	.ADC_FIFOC	= 0x1c,
	.ADC_FIFOS	= 0x20,
	.ADC_RXDATA	= 0x24,
	.DAC_CNT	= 0x30,
	.ADC_CNT	= 0x34,
};

File Added: src/sys/arch/arm/sunxi/sun4i_dma.c
/* $NetBSD: sun4i_dma.c,v 1.1 2017/08/27 16:05:26 jmcneill Exp $ */

/*-
 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
 * 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.
 */

#include "opt_ddb.h"

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sun4i_dma.c,v 1.1 2017/08/27 16:05:26 jmcneill Exp $");

#include <sys/param.h>
#include <sys/bus.h>
#include <sys/device.h>
#include <sys/intr.h>
#include <sys/systm.h>
#include <sys/mutex.h>
#include <sys/bitops.h>
#include <sys/kmem.h>

#include <dev/fdt/fdtvar.h>

#define	DMA_MAX_TYPES		2
#define	 DMA_TYPE_NORMAL	0
#define	 DMA_TYPE_DEDICATED	1
#define	DMA_MAX_CHANNELS	8
#define	DMA_MAX_DRQS		32

#define	DRQ_TYPE_SDRAM		0x16

#define	DMA_IRQ_EN_REG		0x00
#define	DMA_IRQ_PEND_STAS_REG	0x04
#define	 DMA_IRQ_PEND_STAS_END_MASK	0xaaaaaaaa
#define	NDMA_CTRL_REG(n)	(0x100 + (n) * 0x20)
#define	 NDMA_CTRL_LOAD			__BIT(31)
#define	 NDMA_CTRL_CONTI_EN		__BIT(30)
#define	 NDMA_CTRL_WAIT_STATE		__BITS(29,27)
#define	 NDMA_CTRL_DST_DATA_WIDTH	__BITS(26,25)
#define	 NDMA_CTRL_DST_BST_LEN		__BITS(24,23)
#define	 NDMA_CTRL_DST_ADDR_TYPE	__BIT(21)
#define	 NDMA_CTRL_DST_DRQ_TYPE		__BITS(20,16)
#define	 NDMA_CTRL_BC_MODE_SEL		__BIT(15)
#define	 NDMA_CTRL_SRC_DATA_WIDTH	__BITS(10,9)
#define	 NDMA_CTRL_SRC_BST_LEN		__BITS(8,7)
#define	 NDMA_CTRL_SRC_ADDR_TYPE	__BIT(5)
#define	 NDMA_CTRL_SRC_DRQ_TYPE		__BITS(4,0)
#define	NDMA_SRC_ADDR_REG(n)	(0x100 + (n) * 0x20 + 0x4)
#define	NDMA_DEST_ADDR_REG(n)	(0x100 + (n) * 0x20 + 0x8)
#define	NDMA_BC_REG(n)		(0x100 + (n) * 0x20 + 0xc)
#define	DDMA_CTRL_REG(n)	(0x300 + (n) * 0x20)
#define	 DDMA_CTRL_LOAD			__BIT(31)
#define	 DDMA_CTRL_BSY_STA		__BIT(30)
#define	 DDMA_CTRL_CONTI_EN		__BIT(29)
#define	 DDMA_CTRL_DST_DATA_WIDTH	__BITS(26,25)
#define	 DDMA_CTRL_DST_BST_LEN		__BITS(24,23)
#define	 DDMA_CTRL_DST_ADDR_MODE	__BITS(22,21)
#define	 DDMA_CTRL_DST_DRQ_TYPE		__BITS(20,16)
#define	 DDMA_CTRL_BC_MODE_SEL		__BIT(15)
#define	 DDMA_CTRL_SRC_DATA_WIDTH	__BITS(10,9)
#define	 DDMA_CTRL_SRC_BST_LEN		__BITS(8,7)
#define	 DDMA_CTRL_SRC_ADDR_MODE	__BITS(6,5)
#define	 DDMA_CTRL_SRC_DRQ_TYPE		__BITS(4,0)
#define	DDMA_SRC_ADDR_REG(n)	(0x300 + (n) * 0x20 + 0x4)
#define	DDMA_DEST_ADDR_REG(n)	(0x300 + (n) * 0x20 + 0x8)
#define	DDMA_BC_REG(n)		(0x300 + (n) * 0x20 + 0xc)
#define	DDMA_PARA_REG(n)	(0x300 + (n) * 0x20 + 0x18)
#define	 DDMA_PARA_DST_DATA_BLK_SIZE	__BITS(31,24)
#define	 DDMA_PARA_DST_WAIT_CLK_CYC	__BITS(23,16)
#define	 DDMA_PARA_SRC_DATA_BLK_SIZE	__BITS(15,8)
#define	 DDMA_PARA_SRC_WAIT_CLK_CYC	__BITS(7,0)

static const struct of_compat_data compat_data[] = {
	{ "allwinner,sun4i-a10-dma",		1 },
	{ NULL }
};

struct sun4idma_channel {
	uint8_t			ch_type;
	uint8_t			ch_index;
	uint32_t		ch_irqmask;
	void			(*ch_callback)(void *);
	void			*ch_callbackarg;
	u_int			ch_drq;
};

struct sun4idma_softc {
	device_t		sc_dev;
	bus_space_tag_t		sc_bst;
	bus_space_handle_t	sc_bsh;
	bus_dma_tag_t		sc_dmat;
	int			sc_phandle;
	void			*sc_ih;

	kmutex_t		sc_lock;

	struct sun4idma_channel	sc_chan[DMA_MAX_TYPES][DMA_MAX_CHANNELS];
};

#define DMA_READ(sc, reg)		\
	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
#define DMA_WRITE(sc, reg, val)		\
	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))

static void *
sun4idma_acquire(device_t dev, const void *data, size_t len,
    void (*cb)(void *), void *cbarg)
{
	struct sun4idma_softc *sc = device_private(dev);
	struct sun4idma_channel *ch = NULL;
	const uint32_t *specifier = data;
	uint32_t irqen;
	uint8_t index;

	if (len != 8)
		return NULL;

	const u_int type = be32toh(specifier[0]);
	const u_int drq = be32toh(specifier[1]);

	if (type >= DMA_MAX_TYPES || drq >= DMA_MAX_DRQS)
		return NULL;

	mutex_enter(&sc->sc_lock);

	for (index = 0; index < DMA_MAX_CHANNELS; index++) {
		if (sc->sc_chan[type][index].ch_callback == NULL) {
			ch = &sc->sc_chan[type][index];
			ch->ch_callback = cb;
			ch->ch_callbackarg = cbarg;
			ch->ch_drq = drq;

			irqen = DMA_READ(sc, DMA_IRQ_EN_REG);
			irqen |= ch->ch_irqmask;
			DMA_WRITE(sc, DMA_IRQ_EN_REG, irqen);

			break;
		}
	}

	mutex_exit(&sc->sc_lock);

	return ch;
}

static void
sun4idma_release(device_t dev, void *priv)
{
	struct sun4idma_softc *sc = device_private(dev);
	struct sun4idma_channel *ch = priv;
	uint32_t irqen;

	mutex_enter(&sc->sc_lock);

	irqen = DMA_READ(sc, DMA_IRQ_EN_REG);
	irqen &= ~ch->ch_irqmask;
	DMA_WRITE(sc, DMA_IRQ_EN_REG, irqen);

	ch->ch_callback = NULL;
	ch->ch_callbackarg = NULL;

	mutex_exit(&sc->sc_lock);
}

static int
sun4idma_transfer_ndma(struct sun4idma_softc *sc, struct sun4idma_channel *ch,
   struct fdtbus_dma_req *req)
{
	uint32_t cfg, mem_cfg, dev_cfg, src, dst;
	uint32_t mem_width, dev_width, mem_burst, dev_burst;

	mem_width = req->dreq_mem_opt.opt_bus_width >> 4;
	dev_width = req->dreq_dev_opt.opt_bus_width >> 4;
	mem_burst = req->dreq_mem_opt.opt_burst_len == 1 ? 0 :
		    (req->dreq_mem_opt.opt_burst_len >> 3) + 1;
	dev_burst = req->dreq_dev_opt.opt_burst_len == 1 ? 0 :
		    (req->dreq_dev_opt.opt_burst_len >> 3) + 1;

	mem_cfg = __SHIFTIN(mem_width, NDMA_CTRL_SRC_DATA_WIDTH) |
	    __SHIFTIN(mem_burst, NDMA_CTRL_SRC_BST_LEN) |
	    __SHIFTIN(DRQ_TYPE_SDRAM, NDMA_CTRL_SRC_DRQ_TYPE);
	dev_cfg = __SHIFTIN(dev_width, NDMA_CTRL_SRC_DATA_WIDTH) |
	    __SHIFTIN(dev_burst, NDMA_CTRL_SRC_BST_LEN) |
	    __SHIFTIN(ch->ch_drq, NDMA_CTRL_SRC_DRQ_TYPE) |
	    NDMA_CTRL_SRC_ADDR_TYPE;

	if (req->dreq_dir == FDT_DMA_READ) {
		src = req->dreq_dev_phys;
		dst = req->dreq_segs[0].ds_addr;
		cfg = mem_cfg << 16 | dev_cfg;
	} else {
		src = req->dreq_segs[0].ds_addr;
		dst = req->dreq_dev_phys;
		cfg = dev_cfg << 16 | mem_cfg;
	}

	DMA_WRITE(sc, NDMA_SRC_ADDR_REG(ch->ch_index), src);
	DMA_WRITE(sc, NDMA_DEST_ADDR_REG(ch->ch_index), dst);
	DMA_WRITE(sc, NDMA_BC_REG(ch->ch_index), req->dreq_segs[0].ds_len);
	DMA_WRITE(sc, NDMA_CTRL_REG(ch->ch_index), cfg | NDMA_CTRL_LOAD);

	return 0;
}

static int
sun4idma_transfer_ddma(struct sun4idma_softc *sc, struct sun4idma_channel *ch,
   struct fdtbus_dma_req *req)
{
	uint32_t cfg, mem_cfg, dev_cfg, src, dst;
	uint32_t mem_width, dev_width, mem_burst, dev_burst;

	mem_width = req->dreq_mem_opt.opt_bus_width >> 4;
	dev_width = req->dreq_dev_opt.opt_bus_width >> 4;
	mem_burst = req->dreq_mem_opt.opt_burst_len == 1 ? 0 :
		    (req->dreq_mem_opt.opt_burst_len >> 3) + 1;
	dev_burst = req->dreq_dev_opt.opt_burst_len == 1 ? 0 :
		    (req->dreq_dev_opt.opt_burst_len >> 3) + 1;

	mem_cfg = __SHIFTIN(mem_width, DDMA_CTRL_SRC_DATA_WIDTH) |
	    __SHIFTIN(mem_burst, DDMA_CTRL_SRC_BST_LEN) |
	    __SHIFTIN(DRQ_TYPE_SDRAM, DDMA_CTRL_SRC_DRQ_TYPE) |
	    __SHIFTIN(0, DDMA_CTRL_SRC_ADDR_MODE);
	dev_cfg = __SHIFTIN(dev_width, DDMA_CTRL_SRC_DATA_WIDTH) |
	    __SHIFTIN(dev_burst, DDMA_CTRL_SRC_BST_LEN) |
	    __SHIFTIN(ch->ch_drq, DDMA_CTRL_SRC_DRQ_TYPE) |
	    __SHIFTIN(1, DDMA_CTRL_SRC_ADDR_MODE);

	if (req->dreq_dir == FDT_DMA_READ) {
		src = req->dreq_dev_phys;
		dst = req->dreq_segs[0].ds_addr;
		cfg = mem_cfg << 16 | dev_cfg;
	} else {
		src = req->dreq_segs[0].ds_addr;
		dst = req->dreq_dev_phys;
		cfg = dev_cfg << 16 | mem_cfg;
	}

	DMA_WRITE(sc, DDMA_SRC_ADDR_REG(ch->ch_index), src);
	DMA_WRITE(sc, DDMA_DEST_ADDR_REG(ch->ch_index), dst);
	DMA_WRITE(sc, DDMA_BC_REG(ch->ch_index), req->dreq_segs[0].ds_len);
	DMA_WRITE(sc, DDMA_PARA_REG(ch->ch_index), 0);
	DMA_WRITE(sc, DDMA_CTRL_REG(ch->ch_index), cfg | DDMA_CTRL_LOAD);

	return 0;
}

static int
sun4idma_transfer(device_t dev, void *priv, struct fdtbus_dma_req *req)
{
	struct sun4idma_softc *sc = device_private(dev);
	struct sun4idma_channel *ch = priv;

	if (req->dreq_nsegs != 1)
		return EINVAL;

	if (ch->ch_type == DMA_TYPE_NORMAL)
		return sun4idma_transfer_ndma(sc, ch, req);
	else
		return sun4idma_transfer_ddma(sc, ch, req);
}

static void
sun4idma_halt(device_t dev, void *priv)
{
	struct sun4idma_softc *sc = device_private(dev);
	struct sun4idma_channel *ch = priv;

	if (ch->ch_type == DMA_TYPE_NORMAL)
		DMA_WRITE(sc, NDMA_CTRL_REG(ch->ch_index), 0);
	else
		DMA_WRITE(sc, DDMA_CTRL_REG(ch->ch_index), 0);
}

static const struct fdtbus_dma_controller_func sun4idma_funcs = {
	.acquire = sun4idma_acquire,
	.release = sun4idma_release,
	.transfer = sun4idma_transfer,
	.halt = sun4idma_halt
};

static int
sun4idma_intr(void *priv)
{
	struct sun4idma_softc *sc = priv;
	uint32_t pend, mask, bit;
	uint8_t type, index;

	pend = DMA_READ(sc, DMA_IRQ_PEND_STAS_REG);
	if (pend == 0)
		return 0;

	DMA_WRITE(sc, DMA_IRQ_PEND_STAS_REG, pend);

	pend &= DMA_IRQ_PEND_STAS_END_MASK;

	while ((bit = ffs32(pend)) != 0) {
		mask = __BIT(bit - 1);
		pend &= ~mask;
		type = ((bit - 1) / 2) / 8;
		index = ((bit - 1) / 2) % 8;

		if (sc->sc_chan[type][index].ch_callback == NULL)
			continue;
		sc->sc_chan[type][index].ch_callback(
		    sc->sc_chan[type][index].ch_callbackarg);
	}

	return 1;
}

static int
sun4idma_match(device_t parent, cfdata_t cf, void *aux)
{
	struct fdt_attach_args * const faa = aux;

	return of_match_compat_data(faa->faa_phandle, compat_data);
}

static void
sun4idma_attach(device_t parent, device_t self, void *aux)
{
	struct sun4idma_softc * const sc = device_private(self);
	struct fdt_attach_args * const faa = aux;
	const int phandle = faa->faa_phandle;
	struct clk *clk;
	char intrstr[128];
	bus_addr_t addr;
	bus_size_t size;
	u_int index, type;

	if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
		aprint_error(": couldn't get registers\n");
		return;
	}

	if ((clk = fdtbus_clock_get_index(phandle, 0)) == NULL ||
	    clk_enable(clk) != 0) {
		aprint_error(": couldn't enable clock\n");
		return;
	}

	sc->sc_dev = self;
	sc->sc_phandle = phandle;
	sc->sc_dmat = faa->faa_dmat;
	sc->sc_bst = faa->faa_bst;
	if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
		aprint_error(": couldn't map registers\n");
		return;
	}
	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SCHED);

	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
		aprint_error(": failed to decode interrupt\n");
		return;
	}

	aprint_naive("\n");
	aprint_normal(": DMA controller\n");

	DMA_WRITE(sc, DMA_IRQ_EN_REG, 0);
	DMA_WRITE(sc, DMA_IRQ_PEND_STAS_REG, ~0);

	for (type = 0; type < DMA_MAX_TYPES; type++) {
		for (index = 0; index < DMA_MAX_CHANNELS; index++) {
			struct sun4idma_channel *ch = &sc->sc_chan[type][index];
			ch->ch_type = type;
			ch->ch_index = index;
			ch->ch_irqmask = __BIT((type * 16) + (index * 2) + 1);
			ch->ch_callback = NULL;
			ch->ch_callbackarg = NULL;

			if (type == DMA_TYPE_NORMAL)
				DMA_WRITE(sc, NDMA_CTRL_REG(index), 0);
			else
				DMA_WRITE(sc, DDMA_CTRL_REG(index), 0);
		}
	}

	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_SCHED,
	    FDT_INTR_MPSAFE, sun4idma_intr, sc);
	if (sc->sc_ih == NULL) {
		aprint_error_dev(sc->sc_dev,
		    "couldn't establish interrupt on %s\n", intrstr);
		return;
	}
	aprint_normal_dev(sc->sc_dev, "interrupting on %s\n", intrstr);

	fdtbus_register_dma_controller(self, phandle, &sun4idma_funcs);
}

CFATTACH_DECL_NEW(sun4i_dma, sizeof(struct sun4idma_softc),
        sun4idma_match, sun4idma_attach, NULL, NULL);

cvs diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_codec.c (expand / switch to unified diff)

--- src/sys/arch/arm/sunxi/sunxi_codec.c 2017/08/06 17:15:45 1.1
+++ src/sys/arch/arm/sunxi/sunxi_codec.c 2017/08/27 16:05:26 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunxi_codec.c,v 1.1 2017/08/06 17:15:45 jmcneill Exp $ */ 1/* $NetBSD: sunxi_codec.c,v 1.2 2017/08/27 16:05:26 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include "opt_ddb.h" 29#include "opt_ddb.h"
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: sunxi_codec.c,v 1.1 2017/08/06 17:15:45 jmcneill Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: sunxi_codec.c,v 1.2 2017/08/27 16:05:26 jmcneill Exp $");
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/bus.h> 35#include <sys/bus.h>
36#include <sys/cpu.h> 36#include <sys/cpu.h>
37#include <sys/device.h> 37#include <sys/device.h>
38#include <sys/kmem.h> 38#include <sys/kmem.h>
39#include <sys/gpio.h> 39#include <sys/gpio.h>
40 40
41#include <sys/audioio.h> 41#include <sys/audioio.h>
42#include <dev/audio_if.h> 42#include <dev/audio_if.h>
43#include <dev/auconv.h> 43#include <dev/auconv.h>
44 44
45#include <dev/fdt/fdtvar.h> 45#include <dev/fdt/fdtvar.h>
@@ -80,26 +80,27 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_codec. @@ -80,26 +80,27 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_codec.
80#define ADC_FIFOC_EN_AD __BIT(28) 80#define ADC_FIFOC_EN_AD __BIT(28)
81#define ADC_FIFOC_RX_FIFO_MODE __BIT(24) 81#define ADC_FIFOC_RX_FIFO_MODE __BIT(24)
82#define ADC_FIFOC_RX_TRIG_LEVEL __BITS(12,8) 82#define ADC_FIFOC_RX_TRIG_LEVEL __BITS(12,8)
83#define ADC_FIFOC_MONO_EN __BIT(7) 83#define ADC_FIFOC_MONO_EN __BIT(7)
84#define ADC_FIFOC_RX_BITS __BIT(6) 84#define ADC_FIFOC_RX_BITS __BIT(6)
85#define ADC_FIFOC_DRQ_EN __BIT(4) 85#define ADC_FIFOC_DRQ_EN __BIT(4)
86#define ADC_FIFOC_FIFO_FLUSH __BIT(0) 86#define ADC_FIFOC_FIFO_FLUSH __BIT(0)
87#define AC_ADC_FIFOS(_sc) ((_sc)->sc_cfg->ADC_FIFOS) 87#define AC_ADC_FIFOS(_sc) ((_sc)->sc_cfg->ADC_FIFOS)
88#define AC_ADC_RXDATA(_sc) ((_sc)->sc_cfg->ADC_RXDATA) 88#define AC_ADC_RXDATA(_sc) ((_sc)->sc_cfg->ADC_RXDATA)
89#define AC_DAC_CNT(_sc) ((_sc)->sc_cfg->DAC_CNT) 89#define AC_DAC_CNT(_sc) ((_sc)->sc_cfg->DAC_CNT)
90#define AC_ADC_CNT(_sc) ((_sc)->sc_cfg->ADC_CNT) 90#define AC_ADC_CNT(_sc) ((_sc)->sc_cfg->ADC_CNT)
91 91
92static const struct of_compat_data compat_data[] = { 92static const struct of_compat_data compat_data[] = {
 93 A10_CODEC_COMPATDATA,
93 H3_CODEC_COMPATDATA, 94 H3_CODEC_COMPATDATA,
94 { NULL } 95 { NULL }
95}; 96};
96 97
97#define CODEC_READ(sc, reg) \ 98#define CODEC_READ(sc, reg) \
98 bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) 99 bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
99#define CODEC_WRITE(sc, reg, val) \ 100#define CODEC_WRITE(sc, reg, val) \
100 bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) 101 bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
101 102
102static int 103static int
103sunxi_codec_allocdma(struct sunxi_codec_softc *sc, size_t size, 104sunxi_codec_allocdma(struct sunxi_codec_softc *sc, size_t size,
104 size_t align, struct sunxi_codec_dma *dma) 105 size_t align, struct sunxi_codec_dma *dma)
105{ 106{
@@ -616,34 +617,32 @@ sunxi_codec_clock_init(int phandle) @@ -616,34 +617,32 @@ sunxi_codec_clock_init(int phandle)
616 clk = fdtbus_clock_get(phandle, "apb"); 617 clk = fdtbus_clock_get(phandle, "apb");
617 if (clk == NULL) { 618 if (clk == NULL) {
618 aprint_error(": couldn't find apb clock\n"); 619 aprint_error(": couldn't find apb clock\n");
619 return ENXIO; 620 return ENXIO;
620 } 621 }
621 error = clk_enable(clk); 622 error = clk_enable(clk);
622 if (error != 0) { 623 if (error != 0) {
623 aprint_error(": couldn't enable apb clock: %d\n", error); 624 aprint_error(": couldn't enable apb clock: %d\n", error);
624 return error; 625 return error;
625 } 626 }
626 627
627 /* De-assert reset */ 628 /* De-assert reset */
628 rst = fdtbus_reset_get_index(phandle, 0); 629 rst = fdtbus_reset_get_index(phandle, 0);
629 if (rst == NULL) { 630 if (rst != NULL) {
630 aprint_error(": couldn't find reset\n"); 631 error = fdtbus_reset_deassert(rst);
631 return ENXIO; 632 if (error != 0) {
632 } 633 aprint_error(": couldn't de-assert reset: %d\n", error);
633 error = fdtbus_reset_deassert(rst); 634 return error;
634 if (error != 0) { 635 }
635 aprint_error(": couldn't de-assert reset: %d\n", error); 
636 return error; 
637 } 636 }
638 637
639 return 0; 638 return 0;
640} 639}
641 640
642static int 641static int
643sunxi_codec_match(device_t parent, cfdata_t cf, void *aux) 642sunxi_codec_match(device_t parent, cfdata_t cf, void *aux)
644{ 643{
645 struct fdt_attach_args * const faa = aux; 644 struct fdt_attach_args * const faa = aux;
646 645
647 return of_match_compat_data(faa->faa_phandle, compat_data); 646 return of_match_compat_data(faa->faa_phandle, compat_data);
648} 647}
649 648

cvs diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_codec.h (expand / switch to unified diff)

--- src/sys/arch/arm/sunxi/sunxi_codec.h 2017/08/06 17:15:45 1.1
+++ src/sys/arch/arm/sunxi/sunxi_codec.h 2017/08/27 16:05:26 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunxi_codec.h,v 1.1 2017/08/06 17:15:45 jmcneill Exp $ */ 1/* $NetBSD: sunxi_codec.h,v 1.2 2017/08/27 16:05:26 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -116,14 +116,18 @@ struct sunxi_codec_softc { @@ -116,14 +116,18 @@ struct sunxi_codec_softc {
116 116
117 struct sunxi_codec_chan sc_pchan; 117 struct sunxi_codec_chan sc_pchan;
118 struct sunxi_codec_chan sc_rchan; 118 struct sunxi_codec_chan sc_rchan;
119}; 119};
120 120
121#if NH3_CODEC > 0 121#if NH3_CODEC > 0
122extern const struct sunxi_codec_conf sun8i_h3_codecconf; 122extern const struct sunxi_codec_conf sun8i_h3_codecconf;
123#define H3_CODEC_COMPATDATA \ 123#define H3_CODEC_COMPATDATA \
124 { "allwinner,sun8i-h3-codec", (uintptr_t)&sun8i_h3_codecconf } 124 { "allwinner,sun8i-h3-codec", (uintptr_t)&sun8i_h3_codecconf }
125#else 125#else
126#define H3_CODEC_COMPATDATA 126#define H3_CODEC_COMPATDATA
127#endif 127#endif
128 128
 129extern const struct sunxi_codec_conf sun4i_a10_codecconf;
 130#define A10_CODEC_COMPATDATA \
 131 { "allwinner,sun4i-a10-codec", (uintptr_t)&sun4i_a10_codecconf }
 132
129#endif /* !_ARM_SUNXI_CODEC_H */ 133#endif /* !_ARM_SUNXI_CODEC_H */

cvs diff -r1.24 -r1.25 src/sys/arch/evbarm/conf/Attic/SUNXI (expand / switch to unified diff)

--- src/sys/arch/evbarm/conf/Attic/SUNXI 2017/08/27 02:22:17 1.24
+++ src/sys/arch/evbarm/conf/Attic/SUNXI 2017/08/27 16:05:26 1.25
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1# 1#
2# $NetBSD: SUNXI,v 1.24 2017/08/27 02:22:17 jmcneill Exp $ 2# $NetBSD: SUNXI,v 1.25 2017/08/27 16:05:26 jmcneill Exp $
3# 3#
4# Allwinner sunxi family 4# Allwinner sunxi family
5# 5#
6 6
7include "arch/evbarm/conf/std.sunxi" 7include "arch/evbarm/conf/std.sunxi"
8include "arch/evbarm/conf/GENERIC.common" 8include "arch/evbarm/conf/GENERIC.common"
9 9
10makeoptions DTS=" 10makeoptions DTS="
11 sun5i-a13-difrnce-dit4350.dts 11 sun5i-a13-difrnce-dit4350.dts
12 sun5i-a13-empire-electronix-d709.dts 12 sun5i-a13-empire-electronix-d709.dts
13 sun5i-a13-empire-electronix-m712.dts 13 sun5i-a13-empire-electronix-m712.dts
14 sun5i-a13-hsg-h702.dts 14 sun5i-a13-hsg-h702.dts
15 sun5i-a13-inet-98v-rev2.dts 15 sun5i-a13-inet-98v-rev2.dts
@@ -104,27 +104,28 @@ armgtmr0 at gtmr? @@ -104,27 +104,28 @@ armgtmr0 at gtmr?
104sunxitimer* at fdt? # Allwinner async timer 104sunxitimer* at fdt? # Allwinner async timer
105 105
106# Watchdog 106# Watchdog
107sunxiwdt* at fdt? # Allwinner watchdog 107sunxiwdt* at fdt? # Allwinner watchdog
108 108
109# Interrupt controller 109# Interrupt controller
110gic* at fdt? pass 1 # GIC 110gic* at fdt? pass 1 # GIC
111armgic0 at gic? 111armgic0 at gic?
112sunxiintc* at fdt? pass 1 # Allwinner INTC 112sunxiintc* at fdt? pass 1 # Allwinner INTC
113 113
114# Memory controller 114# Memory controller
115 115
116# DMA controller 116# DMA controller
117sun6idma* at fdt? # DMA controller 117sun4idma* at fdt? # DMA controller (sun4i)
 118sun6idma* at fdt? # DMA controller (sun6i)
118 119
119# Clock and Reset controller 120# Clock and Reset controller
120 121
121# GPIO controller 122# GPIO controller
122sunxigpio* at fdt? pass 2 # GPIO 123sunxigpio* at fdt? pass 2 # GPIO
123gpio* at gpiobus? 124gpio* at gpiobus?
124 125
125# Ethernet 126# Ethernet
126sunxiemac* at fdt? # Allwinner Gigabit Ethernet 127sunxiemac* at fdt? # Allwinner Gigabit Ethernet
127rgephy* at mii? phy ? 128rgephy* at mii? phy ?
128ukphy* at mii? phy ? 129ukphy* at mii? phy ?
129 130
130# UART 131# UART