blob: f3acb8e34c6bef0b07e9dc65db0c8adc5a4502ef [file] [log] [blame]
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +09001/*
2 * arch/sh/include/asm/dma-sh.h
3 *
4 * Copyright (C) 2000 Takashi YOSHII
5 * Copyright (C) 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __DMA_SH_H
12#define __DMA_SH_H
13
Guennadi Liakhovetski8b1935e2010-02-11 16:50:14 +000014#include <asm/dma-register.h>
15#include <cpu/dma-register.h>
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090016#include <cpu/dma.h>
17
18/* DMAOR contorl: The DMAOR access size is different by CPU.*/
19#if defined(CONFIG_CPU_SUBTYPE_SH7723) || \
Kuninori Morimotoedc67b22009-08-03 04:52:24 +000020 defined(CONFIG_CPU_SUBTYPE_SH7724) || \
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090021 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
22 defined(CONFIG_CPU_SUBTYPE_SH7785)
23#define dmaor_read_reg(n) \
Paul Mundt9d56dd32010-01-26 12:58:40 +090024 (n ? __raw_readw(SH_DMAC_BASE1 + DMAOR) \
25 : __raw_readw(SH_DMAC_BASE0 + DMAOR))
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090026#define dmaor_write_reg(n, data) \
Paul Mundt9d56dd32010-01-26 12:58:40 +090027 (n ? __raw_writew(data, SH_DMAC_BASE1 + DMAOR) \
28 : __raw_writew(data, SH_DMAC_BASE0 + DMAOR))
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090029#else /* Other CPU */
Paul Mundt9d56dd32010-01-26 12:58:40 +090030#define dmaor_read_reg(n) __raw_readw(SH_DMAC_BASE0 + DMAOR)
31#define dmaor_write_reg(n, data) __raw_writew(data, SH_DMAC_BASE0 + DMAOR)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090032#endif
33
34static int dmte_irq_map[] __maybe_unused = {
Nobuhiro Iwamatsu039a7182009-03-12 06:34:39 +000035#if (MAX_DMA_CHANNELS >= 4)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090036 DMTE0_IRQ,
37 DMTE0_IRQ + 1,
38 DMTE0_IRQ + 2,
39 DMTE0_IRQ + 3,
40#endif
Nobuhiro Iwamatsu039a7182009-03-12 06:34:39 +000041#if (MAX_DMA_CHANNELS >= 6)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090042 DMTE4_IRQ,
43 DMTE4_IRQ + 1,
44#endif
Nobuhiro Iwamatsu039a7182009-03-12 06:34:39 +000045#if (MAX_DMA_CHANNELS >= 8)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090046 DMTE6_IRQ,
47 DMTE6_IRQ + 1,
48#endif
Nobuhiro Iwamatsu039a7182009-03-12 06:34:39 +000049#if (MAX_DMA_CHANNELS >= 12)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090050 DMTE8_IRQ,
51 DMTE9_IRQ,
52 DMTE10_IRQ,
53 DMTE11_IRQ,
54#endif
55};
56
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090057/*
58 * Define the default configuration for dual address memory-memory transfer.
59 * The 0x400 value represents auto-request, external->external.
60 */
Guennadi Liakhovetski623b4ac2010-02-03 14:44:12 +000061#define RS_DUAL (DM_INC | SM_INC | 0x400 | TS_INDEX2VAL(XMIT_SZ_32BIT))
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090062
63/* DMA base address */
64static u32 dma_base_addr[] __maybe_unused = {
Nobuhiro Iwamatsu039a7182009-03-12 06:34:39 +000065#if (MAX_DMA_CHANNELS >= 4)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090066 SH_DMAC_BASE0 + 0x00, /* channel 0 */
67 SH_DMAC_BASE0 + 0x10,
68 SH_DMAC_BASE0 + 0x20,
69 SH_DMAC_BASE0 + 0x30,
70#endif
Nobuhiro Iwamatsu039a7182009-03-12 06:34:39 +000071#if (MAX_DMA_CHANNELS >= 6)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090072 SH_DMAC_BASE0 + 0x50,
73 SH_DMAC_BASE0 + 0x60,
74#endif
Nobuhiro Iwamatsu039a7182009-03-12 06:34:39 +000075#if (MAX_DMA_CHANNELS >= 8)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090076 SH_DMAC_BASE1 + 0x00,
77 SH_DMAC_BASE1 + 0x10,
78#endif
Nobuhiro Iwamatsu039a7182009-03-12 06:34:39 +000079#if (MAX_DMA_CHANNELS >= 12)
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090080 SH_DMAC_BASE1 + 0x20,
81 SH_DMAC_BASE1 + 0x30,
82 SH_DMAC_BASE1 + 0x50,
83 SH_DMAC_BASE1 + 0x60, /* channel 11 */
84#endif
85};
86
Nobuhiro Iwamatsu71b973a2009-03-10 17:26:49 +090087#endif /* __DMA_SH_H */