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