diff options
author | John Crispin <blogic@openwrt.org> | 2011-05-05 18:10:00 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-05-19 04:55:43 -0400 |
commit | dfec1a827d2bdc35d0990afd100f79a685ec0985 (patch) | |
tree | 72d87305a10e126a9cb1f7243d8a37947bc5a4b3 /arch/mips/include/asm/mach-lantiq/xway | |
parent | 2f0fc4159a6abc20b13569522c545150b99485cf (diff) |
MIPS: Lantiq: Add DMA support
This patch adds support for the DMA engine found inside the XWAY family of
SoCs. The engine has 5 ports and 20 channels.
Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Ralph Hempel <ralph.hempel@lantiq.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2355/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/mach-lantiq/xway')
-rw-r--r-- | arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 3 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-lantiq/xway/xway_dma.h | 60 |
2 files changed, 62 insertions, 1 deletions
diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h index 343e82cbf601..4827afbe3739 100644 --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h | |||
@@ -86,7 +86,8 @@ | |||
86 | #define LTQ_PPE32_SIZE 0x40000 | 86 | #define LTQ_PPE32_SIZE 0x40000 |
87 | 87 | ||
88 | /* DMA */ | 88 | /* DMA */ |
89 | #define LTQ_DMA_BASE_ADDR 0xBE104100 | 89 | #define LTQ_DMA_BASE_ADDR 0x1E104100 |
90 | #define LTQ_DMA_SIZE 0x800 | ||
90 | 91 | ||
91 | /* PCI */ | 92 | /* PCI */ |
92 | #define PCI_CR_BASE_ADDR 0x1E105400 | 93 | #define PCI_CR_BASE_ADDR 0x1E105400 |
diff --git a/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h new file mode 100644 index 000000000000..872943a4b90e --- /dev/null +++ b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify it | ||
3 | * under the terms of the GNU General Public License version 2 as published | ||
4 | * by the Free Software Foundation. | ||
5 | * | ||
6 | * This program is distributed in the hope that it will be useful, | ||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
9 | * GNU General Public License for more details. | ||
10 | * | ||
11 | * You should have received a copy of the GNU General Public License | ||
12 | * along with this program; if not, write to the Free Software | ||
13 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
14 | * | ||
15 | * Copyright (C) 2011 John Crispin <blogic@openwrt.org> | ||
16 | */ | ||
17 | |||
18 | #ifndef LTQ_DMA_H__ | ||
19 | #define LTQ_DMA_H__ | ||
20 | |||
21 | #define LTQ_DESC_SIZE 0x08 /* each descriptor is 64bit */ | ||
22 | #define LTQ_DESC_NUM 0x40 /* 64 descriptors / channel */ | ||
23 | |||
24 | #define LTQ_DMA_OWN BIT(31) /* owner bit */ | ||
25 | #define LTQ_DMA_C BIT(30) /* complete bit */ | ||
26 | #define LTQ_DMA_SOP BIT(29) /* start of packet */ | ||
27 | #define LTQ_DMA_EOP BIT(28) /* end of packet */ | ||
28 | #define LTQ_DMA_TX_OFFSET(x) ((x & 0x1f) << 23) /* data bytes offset */ | ||
29 | #define LTQ_DMA_RX_OFFSET(x) ((x & 0x7) << 23) /* data bytes offset */ | ||
30 | #define LTQ_DMA_SIZE_MASK (0xffff) /* the size field is 16 bit */ | ||
31 | |||
32 | struct ltq_dma_desc { | ||
33 | u32 ctl; | ||
34 | u32 addr; | ||
35 | }; | ||
36 | |||
37 | struct ltq_dma_channel { | ||
38 | int nr; /* the channel number */ | ||
39 | int irq; /* the mapped irq */ | ||
40 | int desc; /* the current descriptor */ | ||
41 | struct ltq_dma_desc *desc_base; /* the descriptor base */ | ||
42 | int phys; /* physical addr */ | ||
43 | }; | ||
44 | |||
45 | enum { | ||
46 | DMA_PORT_ETOP = 0, | ||
47 | DMA_PORT_DEU, | ||
48 | }; | ||
49 | |||
50 | extern void ltq_dma_enable_irq(struct ltq_dma_channel *ch); | ||
51 | extern void ltq_dma_disable_irq(struct ltq_dma_channel *ch); | ||
52 | extern void ltq_dma_ack_irq(struct ltq_dma_channel *ch); | ||
53 | extern void ltq_dma_open(struct ltq_dma_channel *ch); | ||
54 | extern void ltq_dma_close(struct ltq_dma_channel *ch); | ||
55 | extern void ltq_dma_alloc_tx(struct ltq_dma_channel *ch); | ||
56 | extern void ltq_dma_alloc_rx(struct ltq_dma_channel *ch); | ||
57 | extern void ltq_dma_free(struct ltq_dma_channel *ch); | ||
58 | extern void ltq_dma_init_port(int p); | ||
59 | |||
60 | #endif | ||