1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef __ASM_ARCH_DMA_H
14#define __ASM_ARCH_DMA_H __FILE__
15
16#include <plat/dma.h>
17#include <linux/sysdev.h>
18
19#define MAX_DMA_TRANSFER_SIZE 0x100000
20
21
22
23
24
25
26
27enum dma_ch {
28 DMACH_XD0,
29 DMACH_XD1,
30 DMACH_SDI,
31 DMACH_SPI0,
32 DMACH_SPI1,
33 DMACH_UART0,
34 DMACH_UART1,
35 DMACH_UART2,
36 DMACH_TIMER,
37 DMACH_I2S_IN,
38 DMACH_I2S_OUT,
39 DMACH_PCM_IN,
40 DMACH_PCM_OUT,
41 DMACH_MIC_IN,
42 DMACH_USB_EP1,
43 DMACH_USB_EP2,
44 DMACH_USB_EP3,
45 DMACH_USB_EP4,
46 DMACH_UART0_SRC2,
47 DMACH_UART1_SRC2,
48 DMACH_UART2_SRC2,
49 DMACH_UART3,
50 DMACH_UART3_SRC2,
51 DMACH_MAX,
52};
53
54#define DMACH_LOW_LEVEL (1<<28)
55
56
57#ifndef CONFIG_CPU_S3C2443
58#define S3C_DMA_CHANNELS (4)
59#else
60#define S3C_DMA_CHANNELS (6)
61#endif
62
63
64
65enum s3c2410_dma_state {
66 S3C2410_DMA_IDLE,
67 S3C2410_DMA_RUNNING,
68 S3C2410_DMA_PAUSED
69};
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99enum s3c2410_dma_loadst {
100 S3C2410_DMALOAD_NONE,
101 S3C2410_DMALOAD_1LOADED,
102 S3C2410_DMALOAD_1RUNNING,
103 S3C2410_DMALOAD_1LOADED_1RUNNING,
104};
105
106
107
108
109#define S3C2410_DMAF_SLOW (1<<0)
110
111#define S3C2410_DMAF_AUTOSTART (1<<1)
112
113#define S3C2410_DMAF_CIRCULAR (1 << 2)
114
115
116
117struct s3c2410_dma_buf;
118
119
120
121
122
123
124
125struct s3c2410_dma_buf {
126 struct s3c2410_dma_buf *next;
127 int magic;
128 int size;
129 dma_addr_t data;
130 dma_addr_t ptr;
131 void *id;
132};
133
134
135
136struct s3c2410_dma_stats {
137 unsigned long loads;
138 unsigned long timeout_longest;
139 unsigned long timeout_shortest;
140 unsigned long timeout_avg;
141 unsigned long timeout_failed;
142};
143
144struct s3c2410_dma_map;
145
146
147
148
149
150
151struct s3c2410_dma_chan {
152
153 unsigned char number;
154 unsigned char in_use;
155 unsigned char irq_claimed;
156 unsigned char irq_enabled;
157 unsigned char xfer_unit;
158
159
160
161 enum s3c2410_dma_state state;
162 enum s3c2410_dma_loadst load_state;
163 struct s3c2410_dma_client *client;
164
165
166 enum s3c2410_dmasrc source;
167 enum dma_ch req_ch;
168 unsigned long dev_addr;
169 unsigned long load_timeout;
170 unsigned int flags;
171
172 struct s3c24xx_dma_map *map;
173
174
175 void __iomem *regs;
176 void __iomem *addr_reg;
177 unsigned int irq;
178 unsigned long dcon;
179
180
181 s3c2410_dma_cbfn_t callback_fn;
182 s3c2410_dma_opfn_t op_fn;
183
184
185 struct s3c2410_dma_stats *stats;
186 struct s3c2410_dma_stats stats_store;
187
188
189 struct s3c2410_dma_buf *curr;
190 struct s3c2410_dma_buf *next;
191 struct s3c2410_dma_buf *end;
192
193
194 struct sys_device dev;
195};
196
197typedef unsigned long dma_device_t;
198
199static inline bool s3c_dma_has_circular(void)
200{
201 return false;
202}
203
204#endif
205