22 #include <linux/slab.h>
23 #include <linux/module.h>
25 #include <linux/device.h>
31 #include <mach/irqs.h>
33 #define OMAP1_DMA_BASE (0xfffed800)
34 #define OMAP1_LOGICAL_DMA_CH_COUNT 17
35 #define OMAP1_DMA_STRIDE 0x40
38 static u32 enable_1510_mode;
42 static u16 reg_map[] = {
182 static inline void dma_write(
u32 val,
int reg,
int lch)
187 stride = (reg >= dma_common_ch_start) ? dma_stride : 0;
188 offset = reg_map[
reg] + (stride * lch);
198 static inline u32 dma_read(
int reg,
int lch)
203 stride = (reg >= dma_common_ch_start) ? dma_stride : 0;
204 offset = reg_map[
reg] + (stride * lch);
212 val |= (upper << 16);
217 static void omap1_clear_lch_regs(
int lch)
219 int i = dma_common_ch_start;
221 for (; i <= dma_common_ch_end; i += 1)
222 dma_write(0, i, lch);
225 static void omap1_clear_dma(
int lch)
229 l = dma_read(
CCR, lch);
231 dma_write(l,
CCR, lch);
234 l = dma_read(
CSR, lch);
237 static void omap1_show_dma_caps(
void)
239 if (enable_1510_mode) {
251 w = dma_read(
GSCR, 0);
253 dma_write(w,
GSCR, 0);
258 static u32 configure_dma_errata(
void)
271 static int __init omap1_system_dma_init(
void)
280 pr_err(
"%s: Unable to device alloc for dma\n",
287 pr_err(
"%s: Unable to ioremap\n", __func__);
289 goto exit_device_put;
294 dev_err(&pdev->
dev,
"%s: Unable to add resources for %s%d\n",
295 __func__, pdev->
name, pdev->
id);
296 goto exit_device_put;
301 dev_err(&pdev->
dev,
"%s: Unable to allocate 'p' for %s\n",
302 __func__, pdev->
name);
304 goto exit_device_del;
309 dev_err(&pdev->
dev,
"%s: Unable to allocate 'd' for %s\n",
310 __func__, pdev->
name);
335 "%s: Memory allocation failed for d->chan!\n",
358 p->
errata = configure_dma_errata();
362 dev_err(&pdev->
dev,
"%s: Unable to add resources for %s%d\n",
363 __func__, pdev->
name, pdev->
id);
364 goto exit_release_chan;
369 dev_err(&pdev->
dev,
"%s: Unable to add resources for %s%d\n",
370 __func__, pdev->
name, pdev->
id);
371 goto exit_release_chan;
375 dma_common_ch_start =
CPC;
376 dma_common_ch_end =
COLOR;