Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux...
[pandora-kernel.git] / arch / arm / mach-mxs / devices / platform-dma.c
1 /*
2  * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License version 2 as published by the
6  * Free Software Foundation.
7  */
8 #include <linux/compiler.h>
9 #include <linux/dma-mapping.h>
10 #include <linux/err.h>
11 #include <linux/init.h>
12
13 #include <mach/mx23.h>
14 #include <mach/mx28.h>
15 #include <mach/devices-common.h>
16
17 static struct platform_device *__init mxs_add_dma(const char *devid,
18                                                 resource_size_t base)
19 {
20         struct resource res[] = {
21                 {
22                         .start = base,
23                         .end = base + SZ_8K - 1,
24                         .flags = IORESOURCE_MEM,
25                 }
26         };
27
28         return mxs_add_platform_device_dmamask(devid, -1,
29                                 res, ARRAY_SIZE(res), NULL, 0,
30                                 DMA_BIT_MASK(32));
31 }
32
33 static int __init mxs_add_mxs_dma(void)
34 {
35         char *apbh = "mxs-dma-apbh";
36         char *apbx = "mxs-dma-apbx";
37
38         if (cpu_is_mx23()) {
39                 mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
40                 mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
41         }
42
43         if (cpu_is_mx28()) {
44                 mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
45                 mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
46         }
47
48         return 0;
49 }
50 arch_initcall(mxs_add_mxs_dma);