diff options
author | G, Manjunath Kondaiah <manjugk@ti.com> | 2010-12-20 21:27:19 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-12-20 21:38:30 -0500 |
commit | 6568f7c43a72f9631910e26092ef3ecf67cc99eb (patch) | |
tree | d3537667789f1285948d174336d6b9e9354a7a3a /arch/arm/mach-omap1 | |
parent | 531ce0d57caf7e49073608873de6976558fd7e4f (diff) |
OMAP1: DMA: Implement in platform device model
Implement OMAP1 DMA as platform device and add support for
registering through platform device layer using resource
structures.
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r-- | arch/arm/mach-omap1/dma.c | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c new file mode 100644 index 000000000000..120eff707ab2 --- /dev/null +++ b/arch/arm/mach-omap1/dma.c | |||
@@ -0,0 +1,179 @@ | |||
1 | /* | ||
2 | * OMAP1/OMAP7xx - specific DMA driver | ||
3 | * | ||
4 | * Copyright (C) 2003 - 2008 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> | ||
9 | * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc. | ||
10 | * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc. | ||
11 | * | ||
12 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | ||
13 | * Converted DMA library into platform driver | ||
14 | * - G, Manjunath Kondaiah <manjugk@ti.com> | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License version 2 as | ||
18 | * published by the Free Software Foundation. | ||
19 | */ | ||
20 | |||
21 | #include <linux/err.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/device.h> | ||
27 | |||
28 | #include <plat/dma.h> | ||
29 | #include <plat/tc.h> | ||
30 | #include <plat/irqs.h> | ||
31 | |||
32 | #define OMAP1_DMA_BASE (0xfffed800) | ||
33 | |||
34 | static struct resource res[] __initdata = { | ||
35 | [0] = { | ||
36 | .start = OMAP1_DMA_BASE, | ||
37 | .end = OMAP1_DMA_BASE + SZ_2K - 1, | ||
38 | .flags = IORESOURCE_MEM, | ||
39 | }, | ||
40 | [1] = { | ||
41 | .name = "0", | ||
42 | .start = INT_DMA_CH0_6, | ||
43 | .flags = IORESOURCE_IRQ, | ||
44 | }, | ||
45 | [2] = { | ||
46 | .name = "1", | ||
47 | .start = INT_DMA_CH1_7, | ||
48 | .flags = IORESOURCE_IRQ, | ||
49 | }, | ||
50 | [3] = { | ||
51 | .name = "2", | ||
52 | .start = INT_DMA_CH2_8, | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | }, | ||
55 | [4] = { | ||
56 | .name = "3", | ||
57 | .start = INT_DMA_CH3, | ||
58 | .flags = IORESOURCE_IRQ, | ||
59 | }, | ||
60 | [5] = { | ||
61 | .name = "4", | ||
62 | .start = INT_DMA_CH4, | ||
63 | .flags = IORESOURCE_IRQ, | ||
64 | }, | ||
65 | [6] = { | ||
66 | .name = "5", | ||
67 | .start = INT_DMA_CH5, | ||
68 | .flags = IORESOURCE_IRQ, | ||
69 | }, | ||
70 | [7] = { | ||
71 | .name = "6", | ||
72 | .start = INT_1610_DMA_CH6, | ||
73 | .flags = IORESOURCE_IRQ, | ||
74 | }, | ||
75 | /* irq's for omap16xx and omap7xx */ | ||
76 | [8] = { | ||
77 | .name = "7", | ||
78 | .start = INT_1610_DMA_CH7, | ||
79 | .flags = IORESOURCE_IRQ, | ||
80 | }, | ||
81 | [9] = { | ||
82 | .name = "8", | ||
83 | .start = INT_1610_DMA_CH8, | ||
84 | .flags = IORESOURCE_IRQ, | ||
85 | }, | ||
86 | [10] = { | ||
87 | .name = "9", | ||
88 | .start = INT_1610_DMA_CH9, | ||
89 | .flags = IORESOURCE_IRQ, | ||
90 | }, | ||
91 | [11] = { | ||
92 | .name = "10", | ||
93 | .start = INT_1610_DMA_CH10, | ||
94 | .flags = IORESOURCE_IRQ, | ||
95 | }, | ||
96 | [12] = { | ||
97 | .name = "11", | ||
98 | .start = INT_1610_DMA_CH11, | ||
99 | .flags = IORESOURCE_IRQ, | ||
100 | }, | ||
101 | [13] = { | ||
102 | .name = "12", | ||
103 | .start = INT_1610_DMA_CH12, | ||
104 | .flags = IORESOURCE_IRQ, | ||
105 | }, | ||
106 | [14] = { | ||
107 | .name = "13", | ||
108 | .start = INT_1610_DMA_CH13, | ||
109 | .flags = IORESOURCE_IRQ, | ||
110 | }, | ||
111 | [15] = { | ||
112 | .name = "14", | ||
113 | .start = INT_1610_DMA_CH14, | ||
114 | .flags = IORESOURCE_IRQ, | ||
115 | }, | ||
116 | [16] = { | ||
117 | .name = "15", | ||
118 | .start = INT_1610_DMA_CH15, | ||
119 | .flags = IORESOURCE_IRQ, | ||
120 | }, | ||
121 | [17] = { | ||
122 | .name = "16", | ||
123 | .start = INT_DMA_LCD, | ||
124 | .flags = IORESOURCE_IRQ, | ||
125 | }, | ||
126 | }; | ||
127 | |||
128 | static int __init omap1_system_dma_init(void) | ||
129 | { | ||
130 | struct omap_system_dma_plat_info *p; | ||
131 | struct platform_device *pdev; | ||
132 | int ret; | ||
133 | |||
134 | pdev = platform_device_alloc("omap_dma_system", 0); | ||
135 | if (!pdev) { | ||
136 | pr_err("%s: Unable to device alloc for dma\n", | ||
137 | __func__); | ||
138 | return -ENOMEM; | ||
139 | } | ||
140 | |||
141 | ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); | ||
142 | if (ret) { | ||
143 | dev_err(&pdev->dev, "%s: Unable to add resources for %s%d\n", | ||
144 | __func__, pdev->name, pdev->id); | ||
145 | goto exit_device_del; | ||
146 | } | ||
147 | |||
148 | p = kzalloc(sizeof(struct omap_system_dma_plat_info), GFP_KERNEL); | ||
149 | if (!p) { | ||
150 | dev_err(&pdev->dev, "%s: Unable to allocate 'p' for %s\n", | ||
151 | __func__, pdev->name); | ||
152 | ret = -ENOMEM; | ||
153 | goto exit_device_put; | ||
154 | } | ||
155 | |||
156 | ret = platform_device_add_data(pdev, p, sizeof(*p)); | ||
157 | if (ret) { | ||
158 | dev_err(&pdev->dev, "%s: Unable to add resources for %s%d\n", | ||
159 | __func__, pdev->name, pdev->id); | ||
160 | goto exit_device_put; | ||
161 | } | ||
162 | |||
163 | ret = platform_device_add(pdev); | ||
164 | if (ret) { | ||
165 | dev_err(&pdev->dev, "%s: Unable to add resources for %s%d\n", | ||
166 | __func__, pdev->name, pdev->id); | ||
167 | goto exit_device_put; | ||
168 | } | ||
169 | |||
170 | return ret; | ||
171 | |||
172 | exit_device_put: | ||
173 | platform_device_put(pdev); | ||
174 | exit_device_del: | ||
175 | platform_device_del(pdev); | ||
176 | |||
177 | return ret; | ||
178 | } | ||
179 | arch_initcall(omap1_system_dma_init); | ||