blob: 96ee5642d049447c2259cacf844b0ae58b7f7293 [file] [log] [blame]
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -07001/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070011 */
12
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/bootmem.h>
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080016#include <mach/irqs.h>
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070017#include <mach/iommu.h>
Joel King41d594e2011-10-14 13:18:20 -070018#include <mach/socinfo.h>
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070019
20static struct resource msm_iommu_jpegd_resources[] = {
21 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080022 .start = 0x07300000,
23 .end = 0x07300000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070024 .name = "physbase",
25 .flags = IORESOURCE_MEM,
26 },
27 {
28 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070029 .start = 98,
30 .end = 98,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070031 .flags = IORESOURCE_IRQ,
32 },
33 {
34 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070035 .start = 97,
36 .end = 97,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070037 .flags = IORESOURCE_IRQ,
38 },
39};
40
41static struct resource msm_iommu_vpe_resources[] = {
42 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080043 .start = 0x07400000,
44 .end = 0x07400000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070045 .name = "physbase",
46 .flags = IORESOURCE_MEM,
47 },
48 {
49 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070050 .start = 84,
51 .end = 84,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070052 .flags = IORESOURCE_IRQ,
53 },
54 {
55 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070056 .start = 83,
57 .end = 83,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070058 .flags = IORESOURCE_IRQ,
59 },
60};
61
62static struct resource msm_iommu_mdp0_resources[] = {
63 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080064 .start = 0x07500000,
65 .end = 0x07500000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070066 .name = "physbase",
67 .flags = IORESOURCE_MEM,
68 },
69 {
70 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070071 .start = 96,
72 .end = 96,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070073 .flags = IORESOURCE_IRQ,
74 },
75 {
76 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070077 .start = 95,
78 .end = 95,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070079 .flags = IORESOURCE_IRQ,
80 },
81};
82
83static struct resource msm_iommu_mdp1_resources[] = {
84 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080085 .start = 0x07600000,
86 .end = 0x07600000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070087 .name = "physbase",
88 .flags = IORESOURCE_MEM,
89 },
90 {
91 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070092 .start = 94,
93 .end = 94,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070094 .flags = IORESOURCE_IRQ,
95 },
96 {
97 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070098 .start = 93,
99 .end = 93,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700100 .flags = IORESOURCE_IRQ,
101 },
102};
103
104static struct resource msm_iommu_rot_resources[] = {
105 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800106 .start = 0x07700000,
107 .end = 0x07700000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700108 .name = "physbase",
109 .flags = IORESOURCE_MEM,
110 },
111 {
112 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700113 .start = 92,
114 .end = 92,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700115 .flags = IORESOURCE_IRQ,
116 },
117 {
118 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700119 .start = 91,
120 .end = 91,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700121 .flags = IORESOURCE_IRQ,
122 },
123};
124
125static struct resource msm_iommu_ijpeg_resources[] = {
126 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800127 .start = 0x07800000,
128 .end = 0x07800000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700129 .name = "physbase",
130 .flags = IORESOURCE_MEM,
131 },
132 {
133 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700134 .start = 100,
135 .end = 100,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700136 .flags = IORESOURCE_IRQ,
137 },
138 {
139 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700140 .start = 99,
141 .end = 99,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700142 .flags = IORESOURCE_IRQ,
143 },
144};
145
146static struct resource msm_iommu_vfe_resources[] = {
147 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800148 .start = 0x07900000,
149 .end = 0x07900000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700150 .name = "physbase",
151 .flags = IORESOURCE_MEM,
152 },
153 {
154 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700155 .start = 86,
156 .end = 86,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700157 .flags = IORESOURCE_IRQ,
158 },
159 {
160 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700161 .start = 85,
162 .end = 85,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700163 .flags = IORESOURCE_IRQ,
164 },
165};
166
167static struct resource msm_iommu_vcodec_a_resources[] = {
168 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800169 .start = 0x07A00000,
170 .end = 0x07A00000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700171 .name = "physbase",
172 .flags = IORESOURCE_MEM,
173 },
174 {
175 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700176 .start = 90,
177 .end = 90,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700178 .flags = IORESOURCE_IRQ,
179 },
180 {
181 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700182 .start = 89,
183 .end = 89,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700184 .flags = IORESOURCE_IRQ,
185 },
186};
187
188static struct resource msm_iommu_vcodec_b_resources[] = {
189 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800190 .start = 0x07B00000,
191 .end = 0x07B00000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700192 .name = "physbase",
193 .flags = IORESOURCE_MEM,
194 },
195 {
196 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700197 .start = 88,
198 .end = 88,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700199 .flags = IORESOURCE_IRQ,
200 },
201 {
202 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700203 .start = 87,
204 .end = 87,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700205 .flags = IORESOURCE_IRQ,
206 },
207};
208
209static struct resource msm_iommu_gfx3d_resources[] = {
210 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800211 .start = 0x07C00000,
212 .end = 0x07C00000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700213 .name = "physbase",
214 .flags = IORESOURCE_MEM,
215 },
216 {
217 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700218 .start = 102,
219 .end = 102,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700220 .flags = IORESOURCE_IRQ,
221 },
222 {
223 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700224 .start = 101,
225 .end = 101,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700226 .flags = IORESOURCE_IRQ,
227 },
228};
229
Joel King41d594e2011-10-14 13:18:20 -0700230static struct resource msm_iommu_gfx3d1_resources[] = {
231 {
232 .start = 0x07D00000,
233 .end = 0x07D00000 + SZ_1M - 1,
234 .name = "physbase",
235 .flags = IORESOURCE_MEM,
236 },
237 {
238 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700239 .start = 243,
240 .end = 243,
Joel King41d594e2011-10-14 13:18:20 -0700241 .flags = IORESOURCE_IRQ,
242 },
243 {
244 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700245 .start = 242,
246 .end = 242,
Joel King41d594e2011-10-14 13:18:20 -0700247 .flags = IORESOURCE_IRQ,
248 },
249};
250
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700251static struct resource msm_iommu_gfx2d0_resources[] = {
252 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800253 .start = 0x07D00000,
254 .end = 0x07D00000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700255 .name = "physbase",
256 .flags = IORESOURCE_MEM,
257 },
258 {
259 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700260 .start = 104,
261 .end = 104,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700262 .flags = IORESOURCE_IRQ,
263 },
264 {
265 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700266 .start = 103,
267 .end = 103,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700268 .flags = IORESOURCE_IRQ,
269 },
270};
271
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800272static struct resource msm_iommu_gfx2d1_resources[] = {
273 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800274 .start = 0x07E00000,
275 .end = 0x07E00000 + SZ_1M - 1,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800276 .name = "physbase",
277 .flags = IORESOURCE_MEM,
278 },
279 {
280 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700281 .start = 243,
282 .end = 243,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800283 .flags = IORESOURCE_IRQ,
284 },
285 {
286 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700287 .start = 242,
288 .end = 242,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800289 .flags = IORESOURCE_IRQ,
290 },
291};
292
Joel King41d594e2011-10-14 13:18:20 -0700293static struct resource msm_iommu_vcap_resources[] = {
294 {
295 .start = 0x07200000,
296 .end = 0x07200000 + SZ_1M - 1,
297 .name = "physbase",
298 .flags = IORESOURCE_MEM,
299 },
300 {
301 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700302 .start = 269,
303 .end = 269,
Joel King41d594e2011-10-14 13:18:20 -0700304 .flags = IORESOURCE_IRQ,
305 },
306 {
307 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700308 .start = 268,
309 .end = 268,
Joel King41d594e2011-10-14 13:18:20 -0700310 .flags = IORESOURCE_IRQ,
311 },
312};
313
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700314static struct platform_device msm_root_iommu_dev = {
315 .name = "msm_iommu",
316 .id = -1,
317};
318
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800319static struct msm_iommu_dev jpegd_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700320 .name = "jpegd",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800321 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700322};
323
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800324static struct msm_iommu_dev vpe_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800325 .name = "vpe",
326 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700327};
328
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800329static struct msm_iommu_dev mdp0_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800330 .name = "mdp0",
331 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700332};
333
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800334static struct msm_iommu_dev mdp1_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800335 .name = "mdp1",
336 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700337};
338
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800339static struct msm_iommu_dev rot_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800340 .name = "rot",
341 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700342};
343
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800344static struct msm_iommu_dev ijpeg_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800345 .name = "ijpeg",
346 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700347};
348
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800349static struct msm_iommu_dev vfe_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700350 .name = "vfe",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800351 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700352};
353
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800354static struct msm_iommu_dev vcodec_a_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800355 .name = "vcodec_a",
356 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700357};
358
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800359static struct msm_iommu_dev vcodec_b_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800360 .name = "vcodec_b",
361 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700362};
363
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800364static struct msm_iommu_dev gfx3d_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700365 .name = "gfx3d",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800366 .ncb = 3,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700367};
368
Joel King41d594e2011-10-14 13:18:20 -0700369static struct msm_iommu_dev gfx3d1_iommu = {
370 .name = "gfx3d1",
371 .ncb = 3,
372};
373
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800374static struct msm_iommu_dev gfx2d0_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700375 .name = "gfx2d0",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800376 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700377};
378
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800379static struct msm_iommu_dev gfx2d1_iommu = {
380 .name = "gfx2d1",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800381 .ncb = 2,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800382};
383
Joel King41d594e2011-10-14 13:18:20 -0700384static struct msm_iommu_dev vcap_iommu = {
385 .name = "vcap",
386 .ncb = 2,
387};
388
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800389static struct platform_device msm_device_iommu_jpegd = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700390 .name = "msm_iommu",
391 .id = 0,
392 .dev = {
393 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700394 .platform_data = &jpegd_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700395 },
396 .num_resources = ARRAY_SIZE(msm_iommu_jpegd_resources),
397 .resource = msm_iommu_jpegd_resources,
398};
399
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800400static struct platform_device msm_device_iommu_vpe = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700401 .name = "msm_iommu",
402 .id = 1,
403 .dev = {
404 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700405 .platform_data = &vpe_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700406 },
407 .num_resources = ARRAY_SIZE(msm_iommu_vpe_resources),
408 .resource = msm_iommu_vpe_resources,
409};
410
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800411static struct platform_device msm_device_iommu_mdp0 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700412 .name = "msm_iommu",
413 .id = 2,
414 .dev = {
415 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700416 .platform_data = &mdp0_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700417 },
418 .num_resources = ARRAY_SIZE(msm_iommu_mdp0_resources),
419 .resource = msm_iommu_mdp0_resources,
420};
421
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800422static struct platform_device msm_device_iommu_mdp1 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700423 .name = "msm_iommu",
424 .id = 3,
425 .dev = {
426 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700427 .platform_data = &mdp1_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700428 },
429 .num_resources = ARRAY_SIZE(msm_iommu_mdp1_resources),
430 .resource = msm_iommu_mdp1_resources,
431};
432
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800433static struct platform_device msm_device_iommu_rot = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700434 .name = "msm_iommu",
435 .id = 4,
436 .dev = {
437 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700438 .platform_data = &rot_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700439 },
440 .num_resources = ARRAY_SIZE(msm_iommu_rot_resources),
441 .resource = msm_iommu_rot_resources,
442};
443
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800444static struct platform_device msm_device_iommu_ijpeg = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700445 .name = "msm_iommu",
446 .id = 5,
447 .dev = {
448 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700449 .platform_data = &ijpeg_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700450 },
451 .num_resources = ARRAY_SIZE(msm_iommu_ijpeg_resources),
452 .resource = msm_iommu_ijpeg_resources,
453};
454
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800455static struct platform_device msm_device_iommu_vfe = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700456 .name = "msm_iommu",
457 .id = 6,
458 .dev = {
459 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700460 .platform_data = &vfe_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700461 },
462 .num_resources = ARRAY_SIZE(msm_iommu_vfe_resources),
463 .resource = msm_iommu_vfe_resources,
464};
465
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800466static struct platform_device msm_device_iommu_vcodec_a = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700467 .name = "msm_iommu",
468 .id = 7,
469 .dev = {
470 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700471 .platform_data = &vcodec_a_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700472 },
473 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_a_resources),
474 .resource = msm_iommu_vcodec_a_resources,
475};
476
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800477static struct platform_device msm_device_iommu_vcodec_b = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700478 .name = "msm_iommu",
479 .id = 8,
480 .dev = {
481 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700482 .platform_data = &vcodec_b_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700483 },
484 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_b_resources),
485 .resource = msm_iommu_vcodec_b_resources,
486};
487
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800488static struct platform_device msm_device_iommu_gfx3d = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700489 .name = "msm_iommu",
490 .id = 9,
491 .dev = {
492 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700493 .platform_data = &gfx3d_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700494 },
495 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d_resources),
496 .resource = msm_iommu_gfx3d_resources,
497};
498
Joel King41d594e2011-10-14 13:18:20 -0700499static struct platform_device msm_device_iommu_gfx3d1 = {
500 .name = "msm_iommu",
501 .id = 10,
502 .dev = {
503 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700504 .platform_data = &gfx3d1_iommu,
Joel King41d594e2011-10-14 13:18:20 -0700505 },
506 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d1_resources),
507 .resource = msm_iommu_gfx3d1_resources,
508};
509
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800510static struct platform_device msm_device_iommu_gfx2d0 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700511 .name = "msm_iommu",
512 .id = 10,
513 .dev = {
514 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700515 .platform_data = &gfx2d0_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700516 },
517 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d0_resources),
518 .resource = msm_iommu_gfx2d0_resources,
519};
520
Joel King41d594e2011-10-14 13:18:20 -0700521static struct platform_device msm_device_iommu_gfx2d1 = {
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800522 .name = "msm_iommu",
523 .id = 11,
524 .dev = {
525 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700526 .platform_data = &gfx2d1_iommu,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800527 },
528 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d1_resources),
529 .resource = msm_iommu_gfx2d1_resources,
530};
531
Joel King41d594e2011-10-14 13:18:20 -0700532static struct platform_device msm_device_iommu_vcap = {
533 .name = "msm_iommu",
534 .id = 11,
535 .dev = {
536 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700537 .platform_data = &vcap_iommu,
Joel King41d594e2011-10-14 13:18:20 -0700538 },
539 .num_resources = ARRAY_SIZE(msm_iommu_vcap_resources),
540 .resource = msm_iommu_vcap_resources,
541};
542
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700543static struct msm_iommu_ctx_dev jpegd_src_ctx = {
544 .name = "jpegd_src",
545 .num = 0,
546 .mids = {0, -1}
547};
548
549static struct msm_iommu_ctx_dev jpegd_dst_ctx = {
550 .name = "jpegd_dst",
551 .num = 1,
552 .mids = {1, -1}
553};
554
555static struct msm_iommu_ctx_dev vpe_src_ctx = {
556 .name = "vpe_src",
557 .num = 0,
558 .mids = {0, -1}
559};
560
561static struct msm_iommu_ctx_dev vpe_dst_ctx = {
562 .name = "vpe_dst",
563 .num = 1,
564 .mids = {1, -1}
565};
566
567static struct msm_iommu_ctx_dev mdp_vg1_ctx = {
568 .name = "mdp_vg1",
569 .num = 0,
570 .mids = {0, 2, -1}
571};
572
573static struct msm_iommu_ctx_dev mdp_rgb1_ctx = {
574 .name = "mdp_rgb1",
575 .num = 1,
576 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
577};
578
579static struct msm_iommu_ctx_dev mdp_vg2_ctx = {
580 .name = "mdp_vg2",
581 .num = 0,
582 .mids = {0, 2, -1}
583};
584
585static struct msm_iommu_ctx_dev mdp_rgb2_ctx = {
586 .name = "mdp_rgb2",
587 .num = 1,
588 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
589};
590
591static struct msm_iommu_ctx_dev rot_src_ctx = {
592 .name = "rot_src",
593 .num = 0,
594 .mids = {0, -1}
595};
596
597static struct msm_iommu_ctx_dev rot_dst_ctx = {
598 .name = "rot_dst",
599 .num = 1,
600 .mids = {1, -1}
601};
602
603static struct msm_iommu_ctx_dev ijpeg_src_ctx = {
604 .name = "ijpeg_src",
605 .num = 0,
606 .mids = {0, -1}
607};
608
609static struct msm_iommu_ctx_dev ijpeg_dst_ctx = {
610 .name = "ijpeg_dst",
611 .num = 1,
612 .mids = {1, -1}
613};
614
615static struct msm_iommu_ctx_dev vfe_imgwr_ctx = {
616 .name = "vfe_imgwr",
617 .num = 0,
618 .mids = {2, 3, 4, 5, 6, 7, 8, -1}
619};
620
621static struct msm_iommu_ctx_dev vfe_misc_ctx = {
622 .name = "vfe_misc",
623 .num = 1,
624 .mids = {0, 1, 9, -1}
625};
626
627static struct msm_iommu_ctx_dev vcodec_a_stream_ctx = {
628 .name = "vcodec_a_stream",
629 .num = 0,
630 .mids = {2, 5, -1}
631};
632
633static struct msm_iommu_ctx_dev vcodec_a_mm1_ctx = {
634 .name = "vcodec_a_mm1",
635 .num = 1,
636 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
637};
638
639static struct msm_iommu_ctx_dev vcodec_b_mm2_ctx = {
640 .name = "vcodec_b_mm2",
641 .num = 0,
642 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
643};
644
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800645static struct msm_iommu_ctx_dev gfx3d_user_ctx = {
646 .name = "gfx3d_user",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700647 .num = 0,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800648 .mids = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700649};
650
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800651static struct msm_iommu_ctx_dev gfx3d_priv_ctx = {
652 .name = "gfx3d_priv",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700653 .num = 1,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800654 .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
655 31, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700656};
657
Joel King41d594e2011-10-14 13:18:20 -0700658static struct msm_iommu_ctx_dev gfx3d1_user_ctx = {
659 .name = "gfx3d1_user",
660 .num = 0,
661 .mids = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
662};
663
664static struct msm_iommu_ctx_dev gfx3d1_priv_ctx = {
665 .name = "gfx3d1_priv",
666 .num = 1,
667 .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
668 31, -1}
669};
670
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800671static struct msm_iommu_ctx_dev gfx2d0_2d0_ctx = {
672 .name = "gfx2d0_2d0",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700673 .num = 0,
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800674 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700675};
676
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800677static struct msm_iommu_ctx_dev gfx2d1_2d1_ctx = {
678 .name = "gfx2d1_2d1",
679 .num = 0,
680 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
681};
682
Joel King41d594e2011-10-14 13:18:20 -0700683static struct msm_iommu_ctx_dev vcap_vc_ctx = {
684 .name = "vcap_vc",
685 .num = 0,
686 .mids = {0, -1}
687};
688
689static struct msm_iommu_ctx_dev vcap_vp_ctx = {
690 .name = "vcap_vp",
691 .num = 1,
692 .mids = {1, -1}
693};
694
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700695static struct platform_device msm_device_jpegd_src_ctx = {
696 .name = "msm_iommu_ctx",
697 .id = 0,
698 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800699 .parent = &msm_device_iommu_jpegd.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700700 .platform_data = &jpegd_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700701 },
702};
703
704static struct platform_device msm_device_jpegd_dst_ctx = {
705 .name = "msm_iommu_ctx",
706 .id = 1,
707 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800708 .parent = &msm_device_iommu_jpegd.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700709 .platform_data = &jpegd_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700710 },
711};
712
713static struct platform_device msm_device_vpe_src_ctx = {
714 .name = "msm_iommu_ctx",
715 .id = 2,
716 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800717 .parent = &msm_device_iommu_vpe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700718 .platform_data = &vpe_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700719 },
720};
721
722static struct platform_device msm_device_vpe_dst_ctx = {
723 .name = "msm_iommu_ctx",
724 .id = 3,
725 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800726 .parent = &msm_device_iommu_vpe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700727 .platform_data = &vpe_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700728 },
729};
730
731static struct platform_device msm_device_mdp_vg1_ctx = {
732 .name = "msm_iommu_ctx",
733 .id = 4,
734 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800735 .parent = &msm_device_iommu_mdp0.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700736 .platform_data = &mdp_vg1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700737 },
738};
739
740static struct platform_device msm_device_mdp_rgb1_ctx = {
741 .name = "msm_iommu_ctx",
742 .id = 5,
743 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800744 .parent = &msm_device_iommu_mdp0.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700745 .platform_data = &mdp_rgb1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700746 },
747};
748
749static struct platform_device msm_device_mdp_vg2_ctx = {
750 .name = "msm_iommu_ctx",
751 .id = 6,
752 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800753 .parent = &msm_device_iommu_mdp1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700754 .platform_data = &mdp_vg2_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700755 },
756};
757
758static struct platform_device msm_device_mdp_rgb2_ctx = {
759 .name = "msm_iommu_ctx",
760 .id = 7,
761 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800762 .parent = &msm_device_iommu_mdp1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700763 .platform_data = &mdp_rgb2_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700764 },
765};
766
767static struct platform_device msm_device_rot_src_ctx = {
768 .name = "msm_iommu_ctx",
769 .id = 8,
770 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800771 .parent = &msm_device_iommu_rot.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700772 .platform_data = &rot_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700773 },
774};
775
776static struct platform_device msm_device_rot_dst_ctx = {
777 .name = "msm_iommu_ctx",
778 .id = 9,
779 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800780 .parent = &msm_device_iommu_rot.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700781 .platform_data = &rot_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700782 },
783};
784
785static struct platform_device msm_device_ijpeg_src_ctx = {
786 .name = "msm_iommu_ctx",
787 .id = 10,
788 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800789 .parent = &msm_device_iommu_ijpeg.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700790 .platform_data = &ijpeg_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700791 },
792};
793
794static struct platform_device msm_device_ijpeg_dst_ctx = {
795 .name = "msm_iommu_ctx",
796 .id = 11,
797 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800798 .parent = &msm_device_iommu_ijpeg.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700799 .platform_data = &ijpeg_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700800 },
801};
802
803static struct platform_device msm_device_vfe_imgwr_ctx = {
804 .name = "msm_iommu_ctx",
805 .id = 12,
806 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800807 .parent = &msm_device_iommu_vfe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700808 .platform_data = &vfe_imgwr_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700809 },
810};
811
812static struct platform_device msm_device_vfe_misc_ctx = {
813 .name = "msm_iommu_ctx",
814 .id = 13,
815 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800816 .parent = &msm_device_iommu_vfe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700817 .platform_data = &vfe_misc_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700818 },
819};
820
821static struct platform_device msm_device_vcodec_a_stream_ctx = {
822 .name = "msm_iommu_ctx",
823 .id = 14,
824 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800825 .parent = &msm_device_iommu_vcodec_a.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700826 .platform_data = &vcodec_a_stream_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700827 },
828};
829
830static struct platform_device msm_device_vcodec_a_mm1_ctx = {
831 .name = "msm_iommu_ctx",
832 .id = 15,
833 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800834 .parent = &msm_device_iommu_vcodec_a.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700835 .platform_data = &vcodec_a_mm1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700836 },
837};
838
839static struct platform_device msm_device_vcodec_b_mm2_ctx = {
840 .name = "msm_iommu_ctx",
841 .id = 16,
842 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800843 .parent = &msm_device_iommu_vcodec_b.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700844 .platform_data = &vcodec_b_mm2_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700845 },
846};
847
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800848static struct platform_device msm_device_gfx3d_user_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700849 .name = "msm_iommu_ctx",
850 .id = 17,
851 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800852 .parent = &msm_device_iommu_gfx3d.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700853 .platform_data = &gfx3d_user_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700854 },
855};
856
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800857static struct platform_device msm_device_gfx3d_priv_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700858 .name = "msm_iommu_ctx",
859 .id = 18,
860 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800861 .parent = &msm_device_iommu_gfx3d.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700862 .platform_data = &gfx3d_priv_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700863 },
864};
865
Joel King41d594e2011-10-14 13:18:20 -0700866static struct platform_device msm_device_gfx3d1_user_ctx = {
867 .name = "msm_iommu_ctx",
868 .id = 19,
869 .dev = {
870 .parent = &msm_device_iommu_gfx3d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700871 .platform_data = &gfx3d1_user_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700872 },
873};
874
875static struct platform_device msm_device_gfx3d1_priv_ctx = {
876 .name = "msm_iommu_ctx",
877 .id = 20,
878 .dev = {
879 .parent = &msm_device_iommu_gfx3d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700880 .platform_data = &gfx3d1_priv_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700881 },
882};
883
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800884static struct platform_device msm_device_gfx2d0_2d0_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700885 .name = "msm_iommu_ctx",
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800886 .id = 19,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700887 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800888 .parent = &msm_device_iommu_gfx2d0.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700889 .platform_data = &gfx2d0_2d0_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700890 },
891};
892
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800893static struct platform_device msm_device_gfx2d1_2d1_ctx = {
894 .name = "msm_iommu_ctx",
895 .id = 20,
896 .dev = {
897 .parent = &msm_device_iommu_gfx2d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700898 .platform_data = &gfx2d1_2d1_ctx,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800899 },
900};
901
Joel King41d594e2011-10-14 13:18:20 -0700902static struct platform_device msm_device_vcap_vc_ctx = {
903 .name = "msm_iommu_ctx",
904 .id = 21,
905 .dev = {
906 .parent = &msm_device_iommu_vcap.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700907 .platform_data = &vcap_vc_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700908 },
909};
910
911static struct platform_device msm_device_vcap_vp_ctx = {
912 .name = "msm_iommu_ctx",
913 .id = 22,
914 .dev = {
915 .parent = &msm_device_iommu_vcap.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700916 .platform_data = &vcap_vp_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700917 },
918};
919
920static struct platform_device *msm_iommu_common_devs[] = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800921 &msm_device_iommu_vpe,
922 &msm_device_iommu_mdp0,
923 &msm_device_iommu_mdp1,
924 &msm_device_iommu_rot,
925 &msm_device_iommu_ijpeg,
926 &msm_device_iommu_vfe,
927 &msm_device_iommu_vcodec_a,
928 &msm_device_iommu_vcodec_b,
929 &msm_device_iommu_gfx3d,
Joel King41d594e2011-10-14 13:18:20 -0700930};
931
932static struct platform_device *msm_iommu_gfx2d_devs[] = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800933 &msm_device_iommu_gfx2d0,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800934 &msm_device_iommu_gfx2d1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700935};
936
Joel King41d594e2011-10-14 13:18:20 -0700937static struct platform_device *msm_iommu_8064_devs[] = {
938 &msm_device_iommu_gfx3d1,
939 &msm_device_iommu_vcap,
940};
941
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -0700942static struct platform_device *msm_iommu_jpegd_devs[] = {
943 &msm_device_iommu_jpegd,
944};
945
Joel King41d594e2011-10-14 13:18:20 -0700946static struct platform_device *msm_iommu_common_ctx_devs[] = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700947 &msm_device_vpe_src_ctx,
948 &msm_device_vpe_dst_ctx,
949 &msm_device_mdp_vg1_ctx,
950 &msm_device_mdp_rgb1_ctx,
951 &msm_device_mdp_vg2_ctx,
952 &msm_device_mdp_rgb2_ctx,
953 &msm_device_rot_src_ctx,
954 &msm_device_rot_dst_ctx,
955 &msm_device_ijpeg_src_ctx,
956 &msm_device_ijpeg_dst_ctx,
957 &msm_device_vfe_imgwr_ctx,
958 &msm_device_vfe_misc_ctx,
959 &msm_device_vcodec_a_stream_ctx,
960 &msm_device_vcodec_a_mm1_ctx,
961 &msm_device_vcodec_b_mm2_ctx,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800962 &msm_device_gfx3d_user_ctx,
963 &msm_device_gfx3d_priv_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700964};
965
966static struct platform_device *msm_iommu_gfx2d_ctx_devs[] = {
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800967 &msm_device_gfx2d0_2d0_ctx,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800968 &msm_device_gfx2d1_2d1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700969};
970
Joel King41d594e2011-10-14 13:18:20 -0700971static struct platform_device *msm_iommu_8064_ctx_devs[] = {
972 &msm_device_gfx3d1_user_ctx,
973 &msm_device_gfx3d1_priv_ctx,
974 &msm_device_vcap_vc_ctx,
975 &msm_device_vcap_vp_ctx,
976};
977
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -0700978static struct platform_device *msm_iommu_jpegd_ctx_devs[] = {
979 &msm_device_jpegd_src_ctx,
980 &msm_device_jpegd_dst_ctx,
981};
982
Joel King41d594e2011-10-14 13:18:20 -0700983static int __init iommu_init(void)
984{
985 int ret;
Stepan Moskovchenko15f209c2011-10-31 15:32:44 -0700986 if (!msm_soc_version_supports_iommu()) {
Stepan Moskovchenko75f1e672011-10-21 19:49:44 -0700987 pr_err("IOMMU is not supported on this SoC version.\n");
988 return -ENODEV;
989 }
990
Joel King41d594e2011-10-14 13:18:20 -0700991 ret = platform_device_register(&msm_root_iommu_dev);
992 if (ret != 0) {
993 pr_err("Failed to register root IOMMU device!\n");
994 goto failure;
995 }
996
997 /* Initialize common devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -0700998 platform_add_devices(msm_iommu_common_devs,
999 ARRAY_SIZE(msm_iommu_common_devs));
Joel King41d594e2011-10-14 13:18:20 -07001000
1001 /* Initialize soc-specific devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001002 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1003 platform_add_devices(msm_iommu_jpegd_devs,
1004 ARRAY_SIZE(msm_iommu_jpegd_devs));
1005 platform_add_devices(msm_iommu_gfx2d_devs,
1006 ARRAY_SIZE(msm_iommu_gfx2d_devs));
Joel King41d594e2011-10-14 13:18:20 -07001007 }
Joel King41d594e2011-10-14 13:18:20 -07001008
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001009 if (cpu_is_apq8064()) {
1010 platform_add_devices(msm_iommu_jpegd_devs,
1011 ARRAY_SIZE(msm_iommu_jpegd_devs));
1012 platform_add_devices(msm_iommu_8064_devs,
1013 ARRAY_SIZE(msm_iommu_8064_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001014 }
1015
Joel King41d594e2011-10-14 13:18:20 -07001016 /* Initialize common ctx_devs */
Stepan Moskovchenko6ca487f2012-03-13 18:12:29 -07001017 ret = platform_add_devices(msm_iommu_common_ctx_devs,
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001018 ARRAY_SIZE(msm_iommu_common_ctx_devs));
Joel King41d594e2011-10-14 13:18:20 -07001019
1020 /* Initialize soc-specific ctx_devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001021 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1022 platform_add_devices(msm_iommu_jpegd_ctx_devs,
1023 ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
1024 platform_add_devices(msm_iommu_gfx2d_ctx_devs,
1025 ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs));
Joel King41d594e2011-10-14 13:18:20 -07001026 }
Joel King41d594e2011-10-14 13:18:20 -07001027
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001028 if (cpu_is_apq8064()) {
1029 platform_add_devices(msm_iommu_jpegd_ctx_devs,
1030 ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
1031 platform_add_devices(msm_iommu_8064_ctx_devs,
1032 ARRAY_SIZE(msm_iommu_8064_ctx_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001033 }
1034
Joel King41d594e2011-10-14 13:18:20 -07001035 return 0;
1036
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001037failure:
1038 return ret;
1039}
1040
Joel King41d594e2011-10-14 13:18:20 -07001041static void __exit iommu_exit(void)
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001042{
1043 int i;
1044
Joel King41d594e2011-10-14 13:18:20 -07001045 /* Common ctx_devs */
1046 for (i = 0; i < ARRAY_SIZE(msm_iommu_common_ctx_devs); i++)
1047 platform_device_unregister(msm_iommu_common_ctx_devs[i]);
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001048
Joel King41d594e2011-10-14 13:18:20 -07001049 /* Common devs. */
1050 for (i = 0; i < ARRAY_SIZE(msm_iommu_common_devs); ++i)
1051 platform_device_unregister(msm_iommu_common_devs[i]);
1052
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001053 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1054 for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs); i++)
1055 platform_device_unregister(msm_iommu_gfx2d_ctx_devs[i]);
1056
1057 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs); i++)
1058 platform_device_unregister(msm_iommu_jpegd_ctx_devs[i]);
1059
Joel King41d594e2011-10-14 13:18:20 -07001060 for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_devs); i++)
1061 platform_device_unregister(msm_iommu_gfx2d_devs[i]);
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001062
1063 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
1064 platform_device_unregister(msm_iommu_jpegd_devs[i]);
Joel King41d594e2011-10-14 13:18:20 -07001065 }
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001066
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001067 if (cpu_is_apq8064()) {
1068 for (i = 0; i < ARRAY_SIZE(msm_iommu_8064_ctx_devs); i++)
1069 platform_device_unregister(msm_iommu_8064_ctx_devs[i]);
1070
1071 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs); i++)
1072 platform_device_unregister(msm_iommu_jpegd_ctx_devs[i]);
1073
1074 for (i = 0; i < ARRAY_SIZE(msm_iommu_8064_devs); i++)
1075 platform_device_unregister(msm_iommu_8064_devs[i]);
1076
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001077 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
1078 platform_device_unregister(msm_iommu_jpegd_devs[i]);
1079 }
1080
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001081 platform_device_unregister(&msm_root_iommu_dev);
1082}
1083
Joel King41d594e2011-10-14 13:18:20 -07001084subsys_initcall(iommu_init);
1085module_exit(iommu_exit);
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001086
1087MODULE_LICENSE("GPL v2");
1088MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");