blob: 1bbb431843ce056ced668044bd5d71a43036a14e [file] [log] [blame]
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001/*
2 * linux/arch/arm/plat-omap/dma.c
3 *
4 * Copyright (C) 2003 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
7 * Graphics DMA and LCD DMA graphics tranformations
8 * by Imre Deak <imre.deak@nokia.com>
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00009 * OMAP2 support Copyright (C) 2004-2005 Texas Instruments, Inc.
10 * Merged to support both OMAP1 and OMAP2 by Tony Lindgren <tony@atomide.com>
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010011 * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
12 *
13 * Support functions for the OMAP internal DMA channels.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 *
19 */
20
21#include <linux/module.h>
22#include <linux/init.h>
23#include <linux/sched.h>
24#include <linux/spinlock.h>
25#include <linux/errno.h>
26#include <linux/interrupt.h>
Thomas Gleixner418ca1f02006-07-01 22:32:41 +010027#include <linux/irq.h>
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010028
29#include <asm/system.h>
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010030#include <asm/hardware.h>
31#include <asm/dma.h>
32#include <asm/io.h>
33
34#include <asm/arch/tc.h>
35
Tony Lindgren1a8bfa12005-11-10 14:26:50 +000036#define DEBUG_PRINTS
37#undef DEBUG_PRINTS
38#ifdef DEBUG_PRINTS
39#define debug_printk(x) printk x
40#else
41#define debug_printk(x)
42#endif
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010043
Tony Lindgren1a8bfa12005-11-10 14:26:50 +000044#define OMAP_DMA_ACTIVE 0x01
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010045#define OMAP_DMA_CCR_EN (1 << 7)
Tony Lindgren7ff879d2006-06-26 16:16:15 -070046#define OMAP2_DMA_CSR_CLEAR_MASK 0xffe
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010047
48#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec)
49
50static int enable_1510_mode = 0;
51
52struct omap_dma_lch {
53 int next_lch;
54 int dev_id;
55 u16 saved_csr;
56 u16 enabled_irqs;
57 const char *dev_name;
58 void (* callback)(int lch, u16 ch_status, void *data);
59 void *data;
60 long flags;
61};
62
63static int dma_chan_count;
64
65static spinlock_t dma_chan_lock;
66static struct omap_dma_lch dma_chan[OMAP_LOGICAL_DMA_CH_COUNT];
67
Jesper Juhl3c6bee12006-01-09 20:54:01 -080068static const u8 omap1_dma_irq[OMAP_LOGICAL_DMA_CH_COUNT] = {
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010069 INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3,
70 INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7,
71 INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10,
72 INT_1610_DMA_CH11, INT_1610_DMA_CH12, INT_1610_DMA_CH13,
73 INT_1610_DMA_CH14, INT_1610_DMA_CH15, INT_DMA_LCD
74};
75
Tony Lindgren1a8bfa12005-11-10 14:26:50 +000076#define REVISIT_24XX() printk(KERN_ERR "FIXME: no %s on 24xx\n", \
77 __FUNCTION__);
78
79#ifdef CONFIG_ARCH_OMAP15XX
80/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */
81int omap_dma_in_1510_mode(void)
82{
83 return enable_1510_mode;
84}
85#else
86#define omap_dma_in_1510_mode() 0
87#endif
88
89#ifdef CONFIG_ARCH_OMAP1
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +010090static inline int get_gdma_dev(int req)
91{
92 u32 reg = OMAP_FUNC_MUX_ARM_BASE + ((req - 1) / 5) * 4;
93 int shift = ((req - 1) % 5) * 6;
94
95 return ((omap_readl(reg) >> shift) & 0x3f) + 1;
96}
97
98static inline void set_gdma_dev(int req, int dev)
99{
100 u32 reg = OMAP_FUNC_MUX_ARM_BASE + ((req - 1) / 5) * 4;
101 int shift = ((req - 1) % 5) * 6;
102 u32 l;
103
104 l = omap_readl(reg);
105 l &= ~(0x3f << shift);
106 l |= (dev - 1) << shift;
107 omap_writel(l, reg);
108}
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000109#else
110#define set_gdma_dev(req, dev) do {} while (0)
111#endif
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100112
113static void clear_lch_regs(int lch)
114{
115 int i;
116 u32 lch_base = OMAP_DMA_BASE + lch * 0x40;
117
118 for (i = 0; i < 0x2c; i += 2)
119 omap_writew(0, lch_base + i);
120}
121
Tony Lindgren709eb3e52006-09-25 12:45:45 +0300122void omap_set_dma_priority(int lch, int dst_port, int priority)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100123{
124 unsigned long reg;
125 u32 l;
126
Tony Lindgren709eb3e52006-09-25 12:45:45 +0300127 if (cpu_class_is_omap1()) {
128 switch (dst_port) {
129 case OMAP_DMA_PORT_OCP_T1: /* FFFECC00 */
130 reg = OMAP_TC_OCPT1_PRIOR;
131 break;
132 case OMAP_DMA_PORT_OCP_T2: /* FFFECCD0 */
133 reg = OMAP_TC_OCPT2_PRIOR;
134 break;
135 case OMAP_DMA_PORT_EMIFF: /* FFFECC08 */
136 reg = OMAP_TC_EMIFF_PRIOR;
137 break;
138 case OMAP_DMA_PORT_EMIFS: /* FFFECC04 */
139 reg = OMAP_TC_EMIFS_PRIOR;
140 break;
141 default:
142 BUG();
143 return;
144 }
145 l = omap_readl(reg);
146 l &= ~(0xf << 8);
147 l |= (priority & 0xf) << 8;
148 omap_writel(l, reg);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100149 }
Tony Lindgren709eb3e52006-09-25 12:45:45 +0300150
151 if (cpu_is_omap24xx()) {
152 if (priority)
153 OMAP_DMA_CCR_REG(lch) |= (1 << 6);
154 else
155 OMAP_DMA_CCR_REG(lch) &= ~(1 << 6);
156 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100157}
158
159void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000160 int frame_count, int sync_mode,
161 int dma_trigger, int src_or_dst_synch)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100162{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000163 OMAP_DMA_CSDP_REG(lch) &= ~0x03;
164 OMAP_DMA_CSDP_REG(lch) |= data_type;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100165
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000166 if (cpu_class_is_omap1()) {
167 OMAP_DMA_CCR_REG(lch) &= ~(1 << 5);
168 if (sync_mode == OMAP_DMA_SYNC_FRAME)
169 OMAP_DMA_CCR_REG(lch) |= 1 << 5;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100170
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000171 OMAP1_DMA_CCR2_REG(lch) &= ~(1 << 2);
172 if (sync_mode == OMAP_DMA_SYNC_BLOCK)
173 OMAP1_DMA_CCR2_REG(lch) |= 1 << 2;
174 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100175
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000176 if (cpu_is_omap24xx() && dma_trigger) {
177 u32 val = OMAP_DMA_CCR_REG(lch);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100178
Peter Ujfalusieca9e562006-06-26 16:16:06 -0700179 val &= ~(3 << 19);
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000180 if (dma_trigger > 63)
181 val |= 1 << 20;
182 if (dma_trigger > 31)
183 val |= 1 << 19;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100184
Peter Ujfalusieca9e562006-06-26 16:16:06 -0700185 val &= ~(0x1f);
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000186 val |= (dma_trigger & 0x1f);
187
188 if (sync_mode & OMAP_DMA_SYNC_FRAME)
189 val |= 1 << 5;
Peter Ujfalusieca9e562006-06-26 16:16:06 -0700190 else
191 val &= ~(1 << 5);
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000192
193 if (sync_mode & OMAP_DMA_SYNC_BLOCK)
194 val |= 1 << 18;
Peter Ujfalusieca9e562006-06-26 16:16:06 -0700195 else
196 val &= ~(1 << 18);
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000197
198 if (src_or_dst_synch)
199 val |= 1 << 24; /* source synch */
200 else
201 val &= ~(1 << 24); /* dest synch */
202
203 OMAP_DMA_CCR_REG(lch) = val;
204 }
205
206 OMAP_DMA_CEN_REG(lch) = elem_count;
207 OMAP_DMA_CFN_REG(lch) = frame_count;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100208}
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000209
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100210void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode, u32 color)
211{
212 u16 w;
213
214 BUG_ON(omap_dma_in_1510_mode());
215
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000216 if (cpu_is_omap24xx()) {
217 REVISIT_24XX();
218 return;
219 }
220
221 w = OMAP1_DMA_CCR2_REG(lch) & ~0x03;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100222 switch (mode) {
223 case OMAP_DMA_CONSTANT_FILL:
224 w |= 0x01;
225 break;
226 case OMAP_DMA_TRANSPARENT_COPY:
227 w |= 0x02;
228 break;
229 case OMAP_DMA_COLOR_DIS:
230 break;
231 default:
232 BUG();
233 }
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000234 OMAP1_DMA_CCR2_REG(lch) = w;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100235
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000236 w = OMAP1_DMA_LCH_CTRL_REG(lch) & ~0x0f;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100237 /* Default is channel type 2D */
238 if (mode) {
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000239 OMAP1_DMA_COLOR_L_REG(lch) = (u16)color;
240 OMAP1_DMA_COLOR_U_REG(lch) = (u16)(color >> 16);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100241 w |= 1; /* Channel type G */
242 }
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000243 OMAP1_DMA_LCH_CTRL_REG(lch) = w;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100244}
245
Tony Lindgren709eb3e52006-09-25 12:45:45 +0300246void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode)
247{
248 if (cpu_is_omap24xx()) {
249 OMAP_DMA_CSDP_REG(lch) &= ~(0x3 << 16);
250 OMAP_DMA_CSDP_REG(lch) |= (mode << 16);
251 }
252}
253
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000254/* Note that src_port is only for omap1 */
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100255void omap_set_dma_src_params(int lch, int src_port, int src_amode,
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000256 unsigned long src_start,
257 int src_ei, int src_fi)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100258{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000259 if (cpu_class_is_omap1()) {
260 OMAP_DMA_CSDP_REG(lch) &= ~(0x1f << 2);
261 OMAP_DMA_CSDP_REG(lch) |= src_port << 2;
262 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100263
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000264 OMAP_DMA_CCR_REG(lch) &= ~(0x03 << 12);
265 OMAP_DMA_CCR_REG(lch) |= src_amode << 12;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100266
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000267 if (cpu_class_is_omap1()) {
268 OMAP1_DMA_CSSA_U_REG(lch) = src_start >> 16;
269 OMAP1_DMA_CSSA_L_REG(lch) = src_start;
270 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100271
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000272 if (cpu_is_omap24xx())
273 OMAP2_DMA_CSSA_REG(lch) = src_start;
274
275 OMAP_DMA_CSEI_REG(lch) = src_ei;
276 OMAP_DMA_CSFI_REG(lch) = src_fi;
277}
278
279void omap_set_dma_params(int lch, struct omap_dma_channel_params * params)
280{
281 omap_set_dma_transfer_params(lch, params->data_type,
282 params->elem_count, params->frame_count,
283 params->sync_mode, params->trigger,
284 params->src_or_dst_synch);
285 omap_set_dma_src_params(lch, params->src_port,
286 params->src_amode, params->src_start,
287 params->src_ei, params->src_fi);
288
289 omap_set_dma_dest_params(lch, params->dst_port,
290 params->dst_amode, params->dst_start,
291 params->dst_ei, params->dst_fi);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100292}
293
294void omap_set_dma_src_index(int lch, int eidx, int fidx)
295{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000296 if (cpu_is_omap24xx()) {
297 REVISIT_24XX();
298 return;
299 }
300 OMAP_DMA_CSEI_REG(lch) = eidx;
301 OMAP_DMA_CSFI_REG(lch) = fidx;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100302}
303
304void omap_set_dma_src_data_pack(int lch, int enable)
305{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000306 OMAP_DMA_CSDP_REG(lch) &= ~(1 << 6);
307 if (enable)
308 OMAP_DMA_CSDP_REG(lch) |= (1 << 6);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100309}
310
311void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
312{
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700313 unsigned int burst = 0;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000314 OMAP_DMA_CSDP_REG(lch) &= ~(0x03 << 7);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100315
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100316 switch (burst_mode) {
317 case OMAP_DMA_DATA_BURST_DIS:
318 break;
319 case OMAP_DMA_DATA_BURST_4:
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700320 if (cpu_is_omap24xx())
321 burst = 0x1;
322 else
323 burst = 0x2;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100324 break;
325 case OMAP_DMA_DATA_BURST_8:
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700326 if (cpu_is_omap24xx()) {
327 burst = 0x2;
328 break;
329 }
330 /* not supported by current hardware on OMAP1
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100331 * w |= (0x03 << 7);
332 * fall through
333 */
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700334 case OMAP_DMA_DATA_BURST_16:
335 if (cpu_is_omap24xx()) {
336 burst = 0x3;
337 break;
338 }
339 /* OMAP1 don't support burst 16
340 * fall through
341 */
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100342 default:
343 BUG();
344 }
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700345 OMAP_DMA_CSDP_REG(lch) |= (burst << 7);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100346}
347
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000348/* Note that dest_port is only for OMAP1 */
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100349void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000350 unsigned long dest_start,
351 int dst_ei, int dst_fi)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100352{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000353 if (cpu_class_is_omap1()) {
354 OMAP_DMA_CSDP_REG(lch) &= ~(0x1f << 9);
355 OMAP_DMA_CSDP_REG(lch) |= dest_port << 9;
356 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100357
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000358 OMAP_DMA_CCR_REG(lch) &= ~(0x03 << 14);
359 OMAP_DMA_CCR_REG(lch) |= dest_amode << 14;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100360
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000361 if (cpu_class_is_omap1()) {
362 OMAP1_DMA_CDSA_U_REG(lch) = dest_start >> 16;
363 OMAP1_DMA_CDSA_L_REG(lch) = dest_start;
364 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100365
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000366 if (cpu_is_omap24xx())
367 OMAP2_DMA_CDSA_REG(lch) = dest_start;
368
369 OMAP_DMA_CDEI_REG(lch) = dst_ei;
370 OMAP_DMA_CDFI_REG(lch) = dst_fi;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100371}
372
373void omap_set_dma_dest_index(int lch, int eidx, int fidx)
374{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000375 if (cpu_is_omap24xx()) {
376 REVISIT_24XX();
377 return;
378 }
379 OMAP_DMA_CDEI_REG(lch) = eidx;
380 OMAP_DMA_CDFI_REG(lch) = fidx;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100381}
382
383void omap_set_dma_dest_data_pack(int lch, int enable)
384{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000385 OMAP_DMA_CSDP_REG(lch) &= ~(1 << 13);
386 if (enable)
387 OMAP_DMA_CSDP_REG(lch) |= 1 << 13;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100388}
389
390void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
391{
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700392 unsigned int burst = 0;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000393 OMAP_DMA_CSDP_REG(lch) &= ~(0x03 << 14);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100394
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100395 switch (burst_mode) {
396 case OMAP_DMA_DATA_BURST_DIS:
397 break;
398 case OMAP_DMA_DATA_BURST_4:
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700399 if (cpu_is_omap24xx())
400 burst = 0x1;
401 else
402 burst = 0x2;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100403 break;
404 case OMAP_DMA_DATA_BURST_8:
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700405 if (cpu_is_omap24xx())
406 burst = 0x2;
407 else
408 burst = 0x3;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100409 break;
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700410 case OMAP_DMA_DATA_BURST_16:
411 if (cpu_is_omap24xx()) {
412 burst = 0x3;
413 break;
414 }
415 /* OMAP1 don't support burst 16
416 * fall through
417 */
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100418 default:
419 printk(KERN_ERR "Invalid DMA burst mode\n");
420 BUG();
421 return;
422 }
Kyungmin Park6dc3c8f2006-06-26 16:16:14 -0700423 OMAP_DMA_CSDP_REG(lch) |= (burst << 14);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100424}
425
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000426static inline void omap_enable_channel_irq(int lch)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100427{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000428 u32 status;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100429
Tony Lindgren7ff879d2006-06-26 16:16:15 -0700430 /* Clear CSR */
431 if (cpu_class_is_omap1())
432 status = OMAP_DMA_CSR_REG(lch);
433 else if (cpu_is_omap24xx())
434 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000435
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100436 /* Enable some nice interrupts. */
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000437 OMAP_DMA_CICR_REG(lch) = dma_chan[lch].enabled_irqs;
438
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100439 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
440}
441
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000442static void omap_disable_channel_irq(int lch)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100443{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000444 if (cpu_is_omap24xx())
445 OMAP_DMA_CICR_REG(lch) = 0;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100446}
447
448void omap_enable_dma_irq(int lch, u16 bits)
449{
450 dma_chan[lch].enabled_irqs |= bits;
451}
452
453void omap_disable_dma_irq(int lch, u16 bits)
454{
455 dma_chan[lch].enabled_irqs &= ~bits;
456}
457
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000458static inline void enable_lnk(int lch)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100459{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000460 if (cpu_class_is_omap1())
461 OMAP_DMA_CLNK_CTRL_REG(lch) &= ~(1 << 14);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100462
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000463 /* Set the ENABLE_LNK bits */
464 if (dma_chan[lch].next_lch != -1)
465 OMAP_DMA_CLNK_CTRL_REG(lch) =
466 dma_chan[lch].next_lch | (1 << 15);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100467}
468
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000469static inline void disable_lnk(int lch)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100470{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000471 /* Disable interrupts */
472 if (cpu_class_is_omap1()) {
473 OMAP_DMA_CICR_REG(lch) = 0;
474 /* Set the STOP_LNK bit */
475 OMAP_DMA_CLNK_CTRL_REG(lch) |= 1 << 14;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100476 }
477
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000478 if (cpu_is_omap24xx()) {
479 omap_disable_channel_irq(lch);
480 /* Clear the ENABLE_LNK bit */
481 OMAP_DMA_CLNK_CTRL_REG(lch) &= ~(1 << 15);
482 }
483
484 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
485}
486
487static inline void omap2_enable_irq_lch(int lch)
488{
489 u32 val;
490
491 if (!cpu_is_omap24xx())
492 return;
493
494 val = omap_readl(OMAP_DMA4_IRQENABLE_L0);
495 val |= 1 << lch;
496 omap_writel(val, OMAP_DMA4_IRQENABLE_L0);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100497}
498
499int omap_request_dma(int dev_id, const char *dev_name,
500 void (* callback)(int lch, u16 ch_status, void *data),
501 void *data, int *dma_ch_out)
502{
503 int ch, free_ch = -1;
504 unsigned long flags;
505 struct omap_dma_lch *chan;
506
507 spin_lock_irqsave(&dma_chan_lock, flags);
508 for (ch = 0; ch < dma_chan_count; ch++) {
509 if (free_ch == -1 && dma_chan[ch].dev_id == -1) {
510 free_ch = ch;
511 if (dev_id == 0)
512 break;
513 }
514 }
515 if (free_ch == -1) {
516 spin_unlock_irqrestore(&dma_chan_lock, flags);
517 return -EBUSY;
518 }
519 chan = dma_chan + free_ch;
520 chan->dev_id = dev_id;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000521
522 if (cpu_class_is_omap1())
523 clear_lch_regs(free_ch);
524
525 if (cpu_is_omap24xx())
526 omap_clear_dma(free_ch);
527
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100528 spin_unlock_irqrestore(&dma_chan_lock, flags);
529
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100530 chan->dev_name = dev_name;
531 chan->callback = callback;
532 chan->data = data;
Tony Lindgren7ff879d2006-06-26 16:16:15 -0700533 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000534
Tony Lindgren7ff879d2006-06-26 16:16:15 -0700535 if (cpu_class_is_omap1())
536 chan->enabled_irqs |= OMAP1_DMA_TOUT_IRQ;
537 else if (cpu_is_omap24xx())
538 chan->enabled_irqs |= OMAP2_DMA_MISALIGNED_ERR_IRQ |
539 OMAP2_DMA_TRANS_ERR_IRQ;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100540
541 if (cpu_is_omap16xx()) {
542 /* If the sync device is set, configure it dynamically. */
543 if (dev_id != 0) {
544 set_gdma_dev(free_ch + 1, dev_id);
545 dev_id = free_ch + 1;
546 }
547 /* Disable the 1510 compatibility mode and set the sync device
548 * id. */
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000549 OMAP_DMA_CCR_REG(free_ch) = dev_id | (1 << 10);
550 } else if (cpu_is_omap730() || cpu_is_omap15xx()) {
551 OMAP_DMA_CCR_REG(free_ch) = dev_id;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100552 }
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000553
554 if (cpu_is_omap24xx()) {
555 omap2_enable_irq_lch(free_ch);
556
557 omap_enable_channel_irq(free_ch);
558 /* Clear the CSR register and IRQ status register */
Tony Lindgren7ff879d2006-06-26 16:16:15 -0700559 OMAP_DMA_CSR_REG(free_ch) = OMAP2_DMA_CSR_CLEAR_MASK;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000560 omap_writel(~0x0, OMAP_DMA4_IRQSTATUS_L0);
561 }
562
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100563 *dma_ch_out = free_ch;
564
565 return 0;
566}
567
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000568void omap_free_dma(int lch)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100569{
570 unsigned long flags;
571
572 spin_lock_irqsave(&dma_chan_lock, flags);
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000573 if (dma_chan[lch].dev_id == -1) {
574 printk("omap_dma: trying to free nonallocated DMA channel %d\n",
575 lch);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100576 spin_unlock_irqrestore(&dma_chan_lock, flags);
577 return;
578 }
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000579 dma_chan[lch].dev_id = -1;
580 dma_chan[lch].next_lch = -1;
581 dma_chan[lch].callback = NULL;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100582 spin_unlock_irqrestore(&dma_chan_lock, flags);
583
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000584 if (cpu_class_is_omap1()) {
585 /* Disable all DMA interrupts for the channel. */
586 OMAP_DMA_CICR_REG(lch) = 0;
587 /* Make sure the DMA transfer is stopped. */
588 OMAP_DMA_CCR_REG(lch) = 0;
589 }
590
591 if (cpu_is_omap24xx()) {
592 u32 val;
593 /* Disable interrupts */
594 val = omap_readl(OMAP_DMA4_IRQENABLE_L0);
595 val &= ~(1 << lch);
596 omap_writel(val, OMAP_DMA4_IRQENABLE_L0);
597
598 /* Clear the CSR register and IRQ status register */
Tony Lindgren7ff879d2006-06-26 16:16:15 -0700599 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000600
601 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0);
602 val |= 1 << lch;
603 omap_writel(val, OMAP_DMA4_IRQSTATUS_L0);
604
605 /* Disable all DMA interrupts for the channel. */
606 OMAP_DMA_CICR_REG(lch) = 0;
607
608 /* Make sure the DMA transfer is stopped. */
609 OMAP_DMA_CCR_REG(lch) = 0;
610 omap_clear_dma(lch);
611 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100612}
613
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000614/*
615 * Clears any DMA state so the DMA engine is ready to restart with new buffers
616 * through omap_start_dma(). Any buffers in flight are discarded.
617 */
618void omap_clear_dma(int lch)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100619{
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000620 unsigned long flags;
621
622 local_irq_save(flags);
623
624 if (cpu_class_is_omap1()) {
625 int status;
626 OMAP_DMA_CCR_REG(lch) &= ~OMAP_DMA_CCR_EN;
627
628 /* Clear pending interrupts */
629 status = OMAP_DMA_CSR_REG(lch);
630 }
631
632 if (cpu_is_omap24xx()) {
633 int i;
634 u32 lch_base = OMAP24XX_DMA_BASE + lch * 0x60 + 0x80;
635 for (i = 0; i < 0x44; i += 4)
636 omap_writel(0, lch_base + i);
637 }
638
639 local_irq_restore(flags);
640}
641
642void omap_start_dma(int lch)
643{
644 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
645 int next_lch, cur_lch;
646 char dma_chan_link_map[OMAP_LOGICAL_DMA_CH_COUNT];
647
648 dma_chan_link_map[lch] = 1;
649 /* Set the link register of the first channel */
650 enable_lnk(lch);
651
652 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map));
653 cur_lch = dma_chan[lch].next_lch;
654 do {
655 next_lch = dma_chan[cur_lch].next_lch;
656
657 /* The loop case: we've been here already */
658 if (dma_chan_link_map[cur_lch])
659 break;
660 /* Mark the current channel */
661 dma_chan_link_map[cur_lch] = 1;
662
663 enable_lnk(cur_lch);
664 omap_enable_channel_irq(cur_lch);
665
666 cur_lch = next_lch;
667 } while (next_lch != -1);
668 } else if (cpu_is_omap24xx()) {
669 /* Errata: Need to write lch even if not using chaining */
670 OMAP_DMA_CLNK_CTRL_REG(lch) = lch;
671 }
672
673 omap_enable_channel_irq(lch);
674
675 /* Errata: On ES2.0 BUFFERING disable must be set.
676 * This will always fail on ES1.0 */
677 if (cpu_is_omap24xx()) {
678 OMAP_DMA_CCR_REG(lch) |= OMAP_DMA_CCR_EN;
679 }
680
681 OMAP_DMA_CCR_REG(lch) |= OMAP_DMA_CCR_EN;
682
683 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
684}
685
686void omap_stop_dma(int lch)
687{
688 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
689 int next_lch, cur_lch = lch;
690 char dma_chan_link_map[OMAP_LOGICAL_DMA_CH_COUNT];
691
692 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map));
693 do {
694 /* The loop case: we've been here already */
695 if (dma_chan_link_map[cur_lch])
696 break;
697 /* Mark the current channel */
698 dma_chan_link_map[cur_lch] = 1;
699
700 disable_lnk(cur_lch);
701
702 next_lch = dma_chan[cur_lch].next_lch;
703 cur_lch = next_lch;
704 } while (next_lch != -1);
705
706 return;
707 }
708
709 /* Disable all interrupts on the channel */
710 if (cpu_class_is_omap1())
711 OMAP_DMA_CICR_REG(lch) = 0;
712
713 OMAP_DMA_CCR_REG(lch) &= ~OMAP_DMA_CCR_EN;
714 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
715}
716
717/*
Tony Lindgren709eb3e52006-09-25 12:45:45 +0300718 * Allows changing the DMA callback function or data. This may be needed if
719 * the driver shares a single DMA channel for multiple dma triggers.
720 */
721int omap_set_dma_callback(int lch,
722 void (* callback)(int lch, u16 ch_status, void *data),
723 void *data)
724{
725 unsigned long flags;
726
727 if (lch < 0)
728 return -ENODEV;
729
730 spin_lock_irqsave(&dma_chan_lock, flags);
731 if (dma_chan[lch].dev_id == -1) {
732 printk(KERN_ERR "DMA callback for not set for free channel\n");
733 spin_unlock_irqrestore(&dma_chan_lock, flags);
734 return -EINVAL;
735 }
736 dma_chan[lch].callback = callback;
737 dma_chan[lch].data = data;
738 spin_unlock_irqrestore(&dma_chan_lock, flags);
739
740 return 0;
741}
742
743/*
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000744 * Returns current physical source address for the given DMA channel.
745 * If the channel is running the caller must disable interrupts prior calling
746 * this function and process the returned value before re-enabling interrupt to
747 * prevent races with the interrupt handler. Note that in continuous mode there
748 * is a chance for CSSA_L register overflow inbetween the two reads resulting
749 * in incorrect return value.
750 */
751dma_addr_t omap_get_dma_src_pos(int lch)
752{
753 dma_addr_t offset;
754
755 if (cpu_class_is_omap1())
756 offset = (dma_addr_t) (OMAP1_DMA_CSSA_L_REG(lch) |
757 (OMAP1_DMA_CSSA_U_REG(lch) << 16));
758
759 if (cpu_is_omap24xx())
760 offset = OMAP_DMA_CSAC_REG(lch);
761
762 return offset;
763}
764
765/*
766 * Returns current physical destination address for the given DMA channel.
767 * If the channel is running the caller must disable interrupts prior calling
768 * this function and process the returned value before re-enabling interrupt to
769 * prevent races with the interrupt handler. Note that in continuous mode there
770 * is a chance for CDSA_L register overflow inbetween the two reads resulting
771 * in incorrect return value.
772 */
773dma_addr_t omap_get_dma_dst_pos(int lch)
774{
775 dma_addr_t offset;
776
777 if (cpu_class_is_omap1())
778 offset = (dma_addr_t) (OMAP1_DMA_CDSA_L_REG(lch) |
779 (OMAP1_DMA_CDSA_U_REG(lch) << 16));
780
781 if (cpu_is_omap24xx())
782 offset = OMAP2_DMA_CDSA_REG(lch);
783
784 return offset;
785}
786
787/*
788 * Returns current source transfer counting for the given DMA channel.
789 * Can be used to monitor the progress of a transfer inside a block.
790 * It must be called with disabled interrupts.
791 */
792int omap_get_dma_src_addr_counter(int lch)
793{
794 return (dma_addr_t) OMAP_DMA_CSAC_REG(lch);
795}
796
797int omap_dma_running(void)
798{
799 int lch;
800
801 /* Check if LCD DMA is running */
802 if (cpu_is_omap16xx())
803 if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
804 return 1;
805
806 for (lch = 0; lch < dma_chan_count; lch++)
807 if (OMAP_DMA_CCR_REG(lch) & OMAP_DMA_CCR_EN)
808 return 1;
809
810 return 0;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100811}
812
813/*
814 * lch_queue DMA will start right after lch_head one is finished.
815 * For this DMA link to start, you still need to start (see omap_start_dma)
816 * the first one. That will fire up the entire queue.
817 */
818void omap_dma_link_lch (int lch_head, int lch_queue)
819{
820 if (omap_dma_in_1510_mode()) {
821 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
822 BUG();
823 return;
824 }
825
826 if ((dma_chan[lch_head].dev_id == -1) ||
827 (dma_chan[lch_queue].dev_id == -1)) {
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000828 printk(KERN_ERR "omap_dma: trying to link "
829 "non requested channels\n");
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100830 dump_stack();
831 }
832
833 dma_chan[lch_head].next_lch = lch_queue;
834}
835
836/*
837 * Once the DMA queue is stopped, we can destroy it.
838 */
839void omap_dma_unlink_lch (int lch_head, int lch_queue)
840{
841 if (omap_dma_in_1510_mode()) {
842 printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
843 BUG();
844 return;
845 }
846
847 if (dma_chan[lch_head].next_lch != lch_queue ||
848 dma_chan[lch_head].next_lch == -1) {
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000849 printk(KERN_ERR "omap_dma: trying to unlink "
850 "non linked channels\n");
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100851 dump_stack();
852 }
853
854
855 if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) ||
856 (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) {
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000857 printk(KERN_ERR "omap_dma: You need to stop the DMA channels "
858 "before unlinking\n");
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100859 dump_stack();
860 }
861
862 dma_chan[lch_head].next_lch = -1;
863}
864
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000865/*----------------------------------------------------------------------------*/
866
867#ifdef CONFIG_ARCH_OMAP1
868
869static int omap1_dma_handle_ch(int ch)
870{
871 u16 csr;
872
873 if (enable_1510_mode && ch >= 6) {
874 csr = dma_chan[ch].saved_csr;
875 dma_chan[ch].saved_csr = 0;
876 } else
877 csr = OMAP_DMA_CSR_REG(ch);
878 if (enable_1510_mode && ch <= 2 && (csr >> 7) != 0) {
879 dma_chan[ch + 6].saved_csr = csr >> 7;
880 csr &= 0x7f;
881 }
882 if ((csr & 0x3f) == 0)
883 return 0;
884 if (unlikely(dma_chan[ch].dev_id == -1)) {
885 printk(KERN_WARNING "Spurious interrupt from DMA channel "
886 "%d (CSR %04x)\n", ch, csr);
887 return 0;
888 }
Tony Lindgren7ff879d2006-06-26 16:16:15 -0700889 if (unlikely(csr & OMAP1_DMA_TOUT_IRQ))
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000890 printk(KERN_WARNING "DMA timeout with device %d\n",
891 dma_chan[ch].dev_id);
892 if (unlikely(csr & OMAP_DMA_DROP_IRQ))
893 printk(KERN_WARNING "DMA synchronization event drop occurred "
894 "with device %d\n", dma_chan[ch].dev_id);
895 if (likely(csr & OMAP_DMA_BLOCK_IRQ))
896 dma_chan[ch].flags &= ~OMAP_DMA_ACTIVE;
897 if (likely(dma_chan[ch].callback != NULL))
898 dma_chan[ch].callback(ch, csr, dma_chan[ch].data);
899 return 1;
900}
901
902static irqreturn_t omap1_dma_irq_handler(int irq, void *dev_id,
903 struct pt_regs *regs)
904{
905 int ch = ((int) dev_id) - 1;
906 int handled = 0;
907
908 for (;;) {
909 int handled_now = 0;
910
911 handled_now += omap1_dma_handle_ch(ch);
912 if (enable_1510_mode && dma_chan[ch + 6].saved_csr)
913 handled_now += omap1_dma_handle_ch(ch + 6);
914 if (!handled_now)
915 break;
916 handled += handled_now;
917 }
918
919 return handled ? IRQ_HANDLED : IRQ_NONE;
920}
921
922#else
923#define omap1_dma_irq_handler NULL
924#endif
925
926#ifdef CONFIG_ARCH_OMAP2
927
928static int omap2_dma_handle_ch(int ch)
929{
930 u32 status = OMAP_DMA_CSR_REG(ch);
931 u32 val;
932
933 if (!status)
934 return 0;
935 if (unlikely(dma_chan[ch].dev_id == -1))
936 return 0;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000937 if (unlikely(status & OMAP_DMA_DROP_IRQ))
938 printk(KERN_INFO
939 "DMA synchronization event drop occurred with device "
940 "%d\n", dma_chan[ch].dev_id);
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000941 if (unlikely(status & OMAP2_DMA_TRANS_ERR_IRQ))
942 printk(KERN_INFO "DMA transaction error with device %d\n",
943 dma_chan[ch].dev_id);
Tony Lindgren7ff879d2006-06-26 16:16:15 -0700944 if (unlikely(status & OMAP2_DMA_SECURE_ERR_IRQ))
945 printk(KERN_INFO "DMA secure error with device %d\n",
946 dma_chan[ch].dev_id);
947 if (unlikely(status & OMAP2_DMA_MISALIGNED_ERR_IRQ))
948 printk(KERN_INFO "DMA misaligned error with device %d\n",
949 dma_chan[ch].dev_id);
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000950
Tony Lindgren7ff879d2006-06-26 16:16:15 -0700951 OMAP_DMA_CSR_REG(ch) = OMAP2_DMA_CSR_CLEAR_MASK;
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000952
953 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0);
954 /* ch in this function is from 0-31 while in register it is 1-32 */
955 val = 1 << (ch);
956 omap_writel(val, OMAP_DMA4_IRQSTATUS_L0);
957
958 if (likely(dma_chan[ch].callback != NULL))
959 dma_chan[ch].callback(ch, status, dma_chan[ch].data);
960
961 return 0;
962}
963
964/* STATUS register count is from 1-32 while our is 0-31 */
965static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id,
966 struct pt_regs *regs)
967{
968 u32 val;
969 int i;
970
971 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0);
972
973 for (i = 1; i <= OMAP_LOGICAL_DMA_CH_COUNT; i++) {
974 int active = val & (1 << (i - 1));
975 if (active)
976 omap2_dma_handle_ch(i - 1);
977 }
978
979 return IRQ_HANDLED;
980}
981
982static struct irqaction omap24xx_dma_irq = {
983 .name = "DMA",
984 .handler = omap2_dma_irq_handler,
Thomas Gleixner52e405e2006-07-03 02:20:05 +0200985 .flags = IRQF_DISABLED
Tony Lindgren1a8bfa12005-11-10 14:26:50 +0000986};
987
988#else
989static struct irqaction omap24xx_dma_irq;
990#endif
991
992/*----------------------------------------------------------------------------*/
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +0100993
994static struct lcd_dma_info {
995 spinlock_t lock;
996 int reserved;
997 void (* callback)(u16 status, void *data);
998 void *cb_data;
999
1000 int active;
1001 unsigned long addr, size;
1002 int rotate, data_type, xres, yres;
1003 int vxres;
1004 int mirror;
1005 int xscale, yscale;
1006 int ext_ctrl;
1007 int src_port;
1008 int single_transfer;
1009} lcd_dma;
1010
1011void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
1012 int data_type)
1013{
1014 lcd_dma.addr = addr;
1015 lcd_dma.data_type = data_type;
1016 lcd_dma.xres = fb_xres;
1017 lcd_dma.yres = fb_yres;
1018}
1019
1020void omap_set_lcd_dma_src_port(int port)
1021{
1022 lcd_dma.src_port = port;
1023}
1024
1025void omap_set_lcd_dma_ext_controller(int external)
1026{
1027 lcd_dma.ext_ctrl = external;
1028}
1029
1030void omap_set_lcd_dma_single_transfer(int single)
1031{
1032 lcd_dma.single_transfer = single;
1033}
1034
1035
1036void omap_set_lcd_dma_b1_rotation(int rotate)
1037{
1038 if (omap_dma_in_1510_mode()) {
1039 printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n");
1040 BUG();
1041 return;
1042 }
1043 lcd_dma.rotate = rotate;
1044}
1045
1046void omap_set_lcd_dma_b1_mirror(int mirror)
1047{
1048 if (omap_dma_in_1510_mode()) {
1049 printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n");
1050 BUG();
1051 }
1052 lcd_dma.mirror = mirror;
1053}
1054
1055void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
1056{
1057 if (omap_dma_in_1510_mode()) {
1058 printk(KERN_ERR "DMA virtual resulotion is not supported "
1059 "in 1510 mode\n");
1060 BUG();
1061 }
1062 lcd_dma.vxres = vxres;
1063}
1064
1065void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
1066{
1067 if (omap_dma_in_1510_mode()) {
1068 printk(KERN_ERR "DMA scale is not supported in 1510 mode\n");
1069 BUG();
1070 }
1071 lcd_dma.xscale = xscale;
1072 lcd_dma.yscale = yscale;
1073}
1074
1075static void set_b1_regs(void)
1076{
1077 unsigned long top, bottom;
1078 int es;
1079 u16 w;
1080 unsigned long en, fn;
1081 long ei, fi;
1082 unsigned long vxres;
1083 unsigned int xscale, yscale;
1084
1085 switch (lcd_dma.data_type) {
1086 case OMAP_DMA_DATA_TYPE_S8:
1087 es = 1;
1088 break;
1089 case OMAP_DMA_DATA_TYPE_S16:
1090 es = 2;
1091 break;
1092 case OMAP_DMA_DATA_TYPE_S32:
1093 es = 4;
1094 break;
1095 default:
1096 BUG();
1097 return;
1098 }
1099
1100 vxres = lcd_dma.vxres ? lcd_dma.vxres : lcd_dma.xres;
1101 xscale = lcd_dma.xscale ? lcd_dma.xscale : 1;
1102 yscale = lcd_dma.yscale ? lcd_dma.yscale : 1;
1103 BUG_ON(vxres < lcd_dma.xres);
1104#define PIXADDR(x,y) (lcd_dma.addr + ((y) * vxres * yscale + (x) * xscale) * es)
1105#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1)
1106 switch (lcd_dma.rotate) {
1107 case 0:
1108 if (!lcd_dma.mirror) {
1109 top = PIXADDR(0, 0);
1110 bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
1111 /* 1510 DMA requires the bottom address to be 2 more
1112 * than the actual last memory access location. */
1113 if (omap_dma_in_1510_mode() &&
1114 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32)
1115 bottom += 2;
1116 ei = PIXSTEP(0, 0, 1, 0);
1117 fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1);
1118 } else {
1119 top = PIXADDR(lcd_dma.xres - 1, 0);
1120 bottom = PIXADDR(0, lcd_dma.yres - 1);
1121 ei = PIXSTEP(1, 0, 0, 0);
1122 fi = PIXSTEP(0, 0, lcd_dma.xres - 1, 1);
1123 }
1124 en = lcd_dma.xres;
1125 fn = lcd_dma.yres;
1126 break;
1127 case 90:
1128 if (!lcd_dma.mirror) {
1129 top = PIXADDR(0, lcd_dma.yres - 1);
1130 bottom = PIXADDR(lcd_dma.xres - 1, 0);
1131 ei = PIXSTEP(0, 1, 0, 0);
1132 fi = PIXSTEP(0, 0, 1, lcd_dma.yres - 1);
1133 } else {
1134 top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
1135 bottom = PIXADDR(0, 0);
1136 ei = PIXSTEP(0, 1, 0, 0);
1137 fi = PIXSTEP(1, 0, 0, lcd_dma.yres - 1);
1138 }
1139 en = lcd_dma.yres;
1140 fn = lcd_dma.xres;
1141 break;
1142 case 180:
1143 if (!lcd_dma.mirror) {
1144 top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
1145 bottom = PIXADDR(0, 0);
1146 ei = PIXSTEP(1, 0, 0, 0);
1147 fi = PIXSTEP(0, 1, lcd_dma.xres - 1, 0);
1148 } else {
1149 top = PIXADDR(0, lcd_dma.yres - 1);
1150 bottom = PIXADDR(lcd_dma.xres - 1, 0);
1151 ei = PIXSTEP(0, 0, 1, 0);
1152 fi = PIXSTEP(lcd_dma.xres - 1, 1, 0, 0);
1153 }
1154 en = lcd_dma.xres;
1155 fn = lcd_dma.yres;
1156 break;
1157 case 270:
1158 if (!lcd_dma.mirror) {
1159 top = PIXADDR(lcd_dma.xres - 1, 0);
1160 bottom = PIXADDR(0, lcd_dma.yres - 1);
1161 ei = PIXSTEP(0, 0, 0, 1);
1162 fi = PIXSTEP(1, lcd_dma.yres - 1, 0, 0);
1163 } else {
1164 top = PIXADDR(0, 0);
1165 bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
1166 ei = PIXSTEP(0, 0, 0, 1);
1167 fi = PIXSTEP(0, lcd_dma.yres - 1, 1, 0);
1168 }
1169 en = lcd_dma.yres;
1170 fn = lcd_dma.xres;
1171 break;
1172 default:
1173 BUG();
1174 return; /* Supress warning about uninitialized vars */
1175 }
1176
1177 if (omap_dma_in_1510_mode()) {
1178 omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U);
1179 omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L);
1180 omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U);
1181 omap_writew(bottom, OMAP1510_DMA_LCD_BOT_F1_L);
1182
1183 return;
1184 }
1185
1186 /* 1610 regs */
1187 omap_writew(top >> 16, OMAP1610_DMA_LCD_TOP_B1_U);
1188 omap_writew(top, OMAP1610_DMA_LCD_TOP_B1_L);
1189 omap_writew(bottom >> 16, OMAP1610_DMA_LCD_BOT_B1_U);
1190 omap_writew(bottom, OMAP1610_DMA_LCD_BOT_B1_L);
1191
1192 omap_writew(en, OMAP1610_DMA_LCD_SRC_EN_B1);
1193 omap_writew(fn, OMAP1610_DMA_LCD_SRC_FN_B1);
1194
1195 w = omap_readw(OMAP1610_DMA_LCD_CSDP);
1196 w &= ~0x03;
1197 w |= lcd_dma.data_type;
1198 omap_writew(w, OMAP1610_DMA_LCD_CSDP);
1199
1200 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
1201 /* Always set the source port as SDRAM for now*/
1202 w &= ~(0x03 << 6);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001203 if (lcd_dma.callback != NULL)
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001204 w |= 1 << 1; /* Block interrupt enable */
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001205 else
1206 w &= ~(1 << 1);
1207 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
1208
1209 if (!(lcd_dma.rotate || lcd_dma.mirror ||
1210 lcd_dma.vxres || lcd_dma.xscale || lcd_dma.yscale))
1211 return;
1212
1213 w = omap_readw(OMAP1610_DMA_LCD_CCR);
1214 /* Set the double-indexed addressing mode */
1215 w |= (0x03 << 12);
1216 omap_writew(w, OMAP1610_DMA_LCD_CCR);
1217
1218 omap_writew(ei, OMAP1610_DMA_LCD_SRC_EI_B1);
1219 omap_writew(fi >> 16, OMAP1610_DMA_LCD_SRC_FI_B1_U);
1220 omap_writew(fi, OMAP1610_DMA_LCD_SRC_FI_B1_L);
1221}
1222
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001223static irqreturn_t lcd_dma_irq_handler(int irq, void *dev_id,
1224 struct pt_regs *regs)
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001225{
1226 u16 w;
1227
1228 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
1229 if (unlikely(!(w & (1 << 3)))) {
1230 printk(KERN_WARNING "Spurious LCD DMA IRQ\n");
1231 return IRQ_NONE;
1232 }
1233 /* Ack the IRQ */
1234 w |= (1 << 3);
1235 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
1236 lcd_dma.active = 0;
1237 if (lcd_dma.callback != NULL)
1238 lcd_dma.callback(w, lcd_dma.cb_data);
1239
1240 return IRQ_HANDLED;
1241}
1242
1243int omap_request_lcd_dma(void (* callback)(u16 status, void *data),
1244 void *data)
1245{
1246 spin_lock_irq(&lcd_dma.lock);
1247 if (lcd_dma.reserved) {
1248 spin_unlock_irq(&lcd_dma.lock);
1249 printk(KERN_ERR "LCD DMA channel already reserved\n");
1250 BUG();
1251 return -EBUSY;
1252 }
1253 lcd_dma.reserved = 1;
1254 spin_unlock_irq(&lcd_dma.lock);
1255 lcd_dma.callback = callback;
1256 lcd_dma.cb_data = data;
1257 lcd_dma.active = 0;
1258 lcd_dma.single_transfer = 0;
1259 lcd_dma.rotate = 0;
1260 lcd_dma.vxres = 0;
1261 lcd_dma.mirror = 0;
1262 lcd_dma.xscale = 0;
1263 lcd_dma.yscale = 0;
1264 lcd_dma.ext_ctrl = 0;
1265 lcd_dma.src_port = 0;
1266
1267 return 0;
1268}
1269
1270void omap_free_lcd_dma(void)
1271{
1272 spin_lock(&lcd_dma.lock);
1273 if (!lcd_dma.reserved) {
1274 spin_unlock(&lcd_dma.lock);
1275 printk(KERN_ERR "LCD DMA is not reserved\n");
1276 BUG();
1277 return;
1278 }
1279 if (!enable_1510_mode)
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001280 omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1,
1281 OMAP1610_DMA_LCD_CCR);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001282 lcd_dma.reserved = 0;
1283 spin_unlock(&lcd_dma.lock);
1284}
1285
1286void omap_enable_lcd_dma(void)
1287{
1288 u16 w;
1289
1290 /* Set the Enable bit only if an external controller is
1291 * connected. Otherwise the OMAP internal controller will
1292 * start the transfer when it gets enabled.
1293 */
1294 if (enable_1510_mode || !lcd_dma.ext_ctrl)
1295 return;
Tony Lindgrenbb13b5f2005-07-10 19:58:18 +01001296
1297 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
1298 w |= 1 << 8;
1299 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
1300
Tony Lindgren92105bb2005-09-07 17:20:26 +01001301 lcd_dma.active = 1;
1302
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001303 w = omap_readw(OMAP1610_DMA_LCD_CCR);
1304 w |= 1 << 7;
1305 omap_writew(w, OMAP1610_DMA_LCD_CCR);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001306}
1307
1308void omap_setup_lcd_dma(void)
1309{
1310 BUG_ON(lcd_dma.active);
1311 if (!enable_1510_mode) {
1312 /* Set some reasonable defaults */
1313 omap_writew(0x5440, OMAP1610_DMA_LCD_CCR);
1314 omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP);
1315 omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL);
1316 }
1317 set_b1_regs();
1318 if (!enable_1510_mode) {
1319 u16 w;
1320
1321 w = omap_readw(OMAP1610_DMA_LCD_CCR);
1322 /* If DMA was already active set the end_prog bit to have
1323 * the programmed register set loaded into the active
1324 * register set.
1325 */
1326 w |= 1 << 11; /* End_prog */
1327 if (!lcd_dma.single_transfer)
1328 w |= (3 << 8); /* Auto_init, repeat */
1329 omap_writew(w, OMAP1610_DMA_LCD_CCR);
1330 }
1331}
1332
1333void omap_stop_lcd_dma(void)
1334{
Tony Lindgrenbb13b5f2005-07-10 19:58:18 +01001335 u16 w;
1336
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001337 lcd_dma.active = 0;
Tony Lindgrenbb13b5f2005-07-10 19:58:18 +01001338 if (enable_1510_mode || !lcd_dma.ext_ctrl)
1339 return;
1340
1341 w = omap_readw(OMAP1610_DMA_LCD_CCR);
1342 w &= ~(1 << 7);
1343 omap_writew(w, OMAP1610_DMA_LCD_CCR);
1344
1345 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
1346 w &= ~(1 << 8);
1347 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001348}
1349
Tony Lindgren0dc5e772006-04-02 17:46:26 +01001350int omap_lcd_dma_ext_running(void)
1351{
1352 return lcd_dma.ext_ctrl && lcd_dma.active;
1353}
1354
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001355/*----------------------------------------------------------------------------*/
Tony Lindgrenbb13b5f2005-07-10 19:58:18 +01001356
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001357static int __init omap_init_dma(void)
1358{
1359 int ch, r;
1360
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001361 if (cpu_is_omap15xx()) {
1362 printk(KERN_INFO "DMA support for OMAP15xx initialized\n");
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001363 dma_chan_count = 9;
1364 enable_1510_mode = 1;
1365 } else if (cpu_is_omap16xx() || cpu_is_omap730()) {
1366 printk(KERN_INFO "OMAP DMA hardware version %d\n",
1367 omap_readw(OMAP_DMA_HW_ID));
1368 printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n",
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001369 (omap_readw(OMAP_DMA_CAPS_0_U) << 16) |
1370 omap_readw(OMAP_DMA_CAPS_0_L),
1371 (omap_readw(OMAP_DMA_CAPS_1_U) << 16) |
1372 omap_readw(OMAP_DMA_CAPS_1_L),
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001373 omap_readw(OMAP_DMA_CAPS_2), omap_readw(OMAP_DMA_CAPS_3),
1374 omap_readw(OMAP_DMA_CAPS_4));
1375 if (!enable_1510_mode) {
1376 u16 w;
1377
1378 /* Disable OMAP 3.0/3.1 compatibility mode. */
1379 w = omap_readw(OMAP_DMA_GSCR);
1380 w |= 1 << 3;
1381 omap_writew(w, OMAP_DMA_GSCR);
1382 dma_chan_count = 16;
1383 } else
1384 dma_chan_count = 9;
Imre Deakb5beef52006-09-25 12:41:28 +03001385 if (cpu_is_omap16xx()) {
1386 u16 w;
1387
1388 /* this would prevent OMAP sleep */
1389 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
1390 w &= ~(1 << 8);
1391 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
1392 }
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001393 } else if (cpu_is_omap24xx()) {
1394 u8 revision = omap_readb(OMAP_DMA4_REVISION);
1395 printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n",
1396 revision >> 4, revision & 0xf);
1397 dma_chan_count = OMAP_LOGICAL_DMA_CH_COUNT;
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001398 } else {
1399 dma_chan_count = 0;
1400 return 0;
1401 }
1402
1403 memset(&lcd_dma, 0, sizeof(lcd_dma));
1404 spin_lock_init(&lcd_dma.lock);
1405 spin_lock_init(&dma_chan_lock);
1406 memset(&dma_chan, 0, sizeof(dma_chan));
1407
1408 for (ch = 0; ch < dma_chan_count; ch++) {
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001409 omap_clear_dma(ch);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001410 dma_chan[ch].dev_id = -1;
1411 dma_chan[ch].next_lch = -1;
1412
1413 if (ch >= 6 && enable_1510_mode)
1414 continue;
1415
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001416 if (cpu_class_is_omap1()) {
1417 /* request_irq() doesn't like dev_id (ie. ch) being
1418 * zero, so we have to kludge around this. */
1419 r = request_irq(omap1_dma_irq[ch],
1420 omap1_dma_irq_handler, 0, "DMA",
1421 (void *) (ch + 1));
1422 if (r != 0) {
1423 int i;
1424
1425 printk(KERN_ERR "unable to request IRQ %d "
1426 "for DMA (error %d)\n",
1427 omap1_dma_irq[ch], r);
1428 for (i = 0; i < ch; i++)
1429 free_irq(omap1_dma_irq[i],
1430 (void *) (i + 1));
1431 return r;
1432 }
1433 }
1434 }
1435
1436 if (cpu_is_omap24xx())
1437 setup_irq(INT_24XX_SDMA_IRQ0, &omap24xx_dma_irq);
1438
1439 /* FIXME: Update LCD DMA to work on 24xx */
1440 if (cpu_class_is_omap1()) {
1441 r = request_irq(INT_DMA_LCD, lcd_dma_irq_handler, 0,
1442 "LCD DMA", NULL);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001443 if (r != 0) {
1444 int i;
1445
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001446 printk(KERN_ERR "unable to request IRQ for LCD DMA "
1447 "(error %d)\n", r);
1448 for (i = 0; i < dma_chan_count; i++)
1449 free_irq(omap1_dma_irq[i], (void *) (i + 1));
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001450 return r;
1451 }
1452 }
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001453
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001454 return 0;
1455}
1456
1457arch_initcall(omap_init_dma);
1458
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001459EXPORT_SYMBOL(omap_get_dma_src_pos);
1460EXPORT_SYMBOL(omap_get_dma_dst_pos);
Tony Lindgren92105bb2005-09-07 17:20:26 +01001461EXPORT_SYMBOL(omap_get_dma_src_addr_counter);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001462EXPORT_SYMBOL(omap_clear_dma);
1463EXPORT_SYMBOL(omap_set_dma_priority);
1464EXPORT_SYMBOL(omap_request_dma);
1465EXPORT_SYMBOL(omap_free_dma);
1466EXPORT_SYMBOL(omap_start_dma);
1467EXPORT_SYMBOL(omap_stop_dma);
Tony Lindgren123e9a52006-09-25 12:41:34 +03001468EXPORT_SYMBOL(omap_set_dma_callback);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001469EXPORT_SYMBOL(omap_enable_dma_irq);
1470EXPORT_SYMBOL(omap_disable_dma_irq);
1471
1472EXPORT_SYMBOL(omap_set_dma_transfer_params);
1473EXPORT_SYMBOL(omap_set_dma_color_mode);
Tony Lindgren123e9a52006-09-25 12:41:34 +03001474EXPORT_SYMBOL(omap_set_dma_write_mode);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001475
1476EXPORT_SYMBOL(omap_set_dma_src_params);
1477EXPORT_SYMBOL(omap_set_dma_src_index);
1478EXPORT_SYMBOL(omap_set_dma_src_data_pack);
1479EXPORT_SYMBOL(omap_set_dma_src_burst_mode);
1480
1481EXPORT_SYMBOL(omap_set_dma_dest_params);
1482EXPORT_SYMBOL(omap_set_dma_dest_index);
1483EXPORT_SYMBOL(omap_set_dma_dest_data_pack);
1484EXPORT_SYMBOL(omap_set_dma_dest_burst_mode);
1485
Tony Lindgren1a8bfa12005-11-10 14:26:50 +00001486EXPORT_SYMBOL(omap_set_dma_params);
1487
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001488EXPORT_SYMBOL(omap_dma_link_lch);
1489EXPORT_SYMBOL(omap_dma_unlink_lch);
1490
1491EXPORT_SYMBOL(omap_request_lcd_dma);
1492EXPORT_SYMBOL(omap_free_lcd_dma);
1493EXPORT_SYMBOL(omap_enable_lcd_dma);
1494EXPORT_SYMBOL(omap_setup_lcd_dma);
1495EXPORT_SYMBOL(omap_stop_lcd_dma);
Tony Lindgren0dc5e772006-04-02 17:46:26 +01001496EXPORT_SYMBOL(omap_lcd_dma_ext_running);
Tony Lindgren5e1c5ff2005-07-10 19:58:15 +01001497EXPORT_SYMBOL(omap_set_lcd_dma_b1);
1498EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
1499EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
1500EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
1501EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
1502EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
1503EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
1504