blob: 29e8180c657578d5b669f6f5452c27b8eedcc888 [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,
Shubhraprakash Das935e6a52012-04-05 14:47:30 -0600367 .ttbr_split = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700368};
369
Joel King41d594e2011-10-14 13:18:20 -0700370static struct msm_iommu_dev gfx3d1_iommu = {
371 .name = "gfx3d1",
372 .ncb = 3,
Shubhraprakash Das935e6a52012-04-05 14:47:30 -0600373 .ttbr_split = 2,
Joel King41d594e2011-10-14 13:18:20 -0700374};
375
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800376static struct msm_iommu_dev gfx2d0_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700377 .name = "gfx2d0",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800378 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700379};
380
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800381static struct msm_iommu_dev gfx2d1_iommu = {
382 .name = "gfx2d1",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800383 .ncb = 2,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800384};
385
Joel King41d594e2011-10-14 13:18:20 -0700386static struct msm_iommu_dev vcap_iommu = {
387 .name = "vcap",
388 .ncb = 2,
389};
390
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800391static struct platform_device msm_device_iommu_jpegd = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700392 .name = "msm_iommu",
393 .id = 0,
394 .dev = {
395 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700396 .platform_data = &jpegd_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700397 },
398 .num_resources = ARRAY_SIZE(msm_iommu_jpegd_resources),
399 .resource = msm_iommu_jpegd_resources,
400};
401
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800402static struct platform_device msm_device_iommu_vpe = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700403 .name = "msm_iommu",
404 .id = 1,
405 .dev = {
406 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700407 .platform_data = &vpe_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700408 },
409 .num_resources = ARRAY_SIZE(msm_iommu_vpe_resources),
410 .resource = msm_iommu_vpe_resources,
411};
412
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800413static struct platform_device msm_device_iommu_mdp0 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700414 .name = "msm_iommu",
415 .id = 2,
416 .dev = {
417 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700418 .platform_data = &mdp0_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700419 },
420 .num_resources = ARRAY_SIZE(msm_iommu_mdp0_resources),
421 .resource = msm_iommu_mdp0_resources,
422};
423
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800424static struct platform_device msm_device_iommu_mdp1 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700425 .name = "msm_iommu",
426 .id = 3,
427 .dev = {
428 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700429 .platform_data = &mdp1_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700430 },
431 .num_resources = ARRAY_SIZE(msm_iommu_mdp1_resources),
432 .resource = msm_iommu_mdp1_resources,
433};
434
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800435static struct platform_device msm_device_iommu_rot = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700436 .name = "msm_iommu",
437 .id = 4,
438 .dev = {
439 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700440 .platform_data = &rot_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700441 },
442 .num_resources = ARRAY_SIZE(msm_iommu_rot_resources),
443 .resource = msm_iommu_rot_resources,
444};
445
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800446static struct platform_device msm_device_iommu_ijpeg = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700447 .name = "msm_iommu",
448 .id = 5,
449 .dev = {
450 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700451 .platform_data = &ijpeg_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700452 },
453 .num_resources = ARRAY_SIZE(msm_iommu_ijpeg_resources),
454 .resource = msm_iommu_ijpeg_resources,
455};
456
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800457static struct platform_device msm_device_iommu_vfe = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700458 .name = "msm_iommu",
459 .id = 6,
460 .dev = {
461 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700462 .platform_data = &vfe_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700463 },
464 .num_resources = ARRAY_SIZE(msm_iommu_vfe_resources),
465 .resource = msm_iommu_vfe_resources,
466};
467
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800468static struct platform_device msm_device_iommu_vcodec_a = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700469 .name = "msm_iommu",
470 .id = 7,
471 .dev = {
472 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700473 .platform_data = &vcodec_a_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700474 },
475 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_a_resources),
476 .resource = msm_iommu_vcodec_a_resources,
477};
478
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800479static struct platform_device msm_device_iommu_vcodec_b = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700480 .name = "msm_iommu",
481 .id = 8,
482 .dev = {
483 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700484 .platform_data = &vcodec_b_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700485 },
486 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_b_resources),
487 .resource = msm_iommu_vcodec_b_resources,
488};
489
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800490static struct platform_device msm_device_iommu_gfx3d = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700491 .name = "msm_iommu",
492 .id = 9,
493 .dev = {
494 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700495 .platform_data = &gfx3d_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700496 },
497 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d_resources),
498 .resource = msm_iommu_gfx3d_resources,
499};
500
Joel King41d594e2011-10-14 13:18:20 -0700501static struct platform_device msm_device_iommu_gfx3d1 = {
502 .name = "msm_iommu",
503 .id = 10,
504 .dev = {
505 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700506 .platform_data = &gfx3d1_iommu,
Joel King41d594e2011-10-14 13:18:20 -0700507 },
508 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d1_resources),
509 .resource = msm_iommu_gfx3d1_resources,
510};
511
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800512static struct platform_device msm_device_iommu_gfx2d0 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700513 .name = "msm_iommu",
514 .id = 10,
515 .dev = {
516 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700517 .platform_data = &gfx2d0_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700518 },
519 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d0_resources),
520 .resource = msm_iommu_gfx2d0_resources,
521};
522
Joel King41d594e2011-10-14 13:18:20 -0700523static struct platform_device msm_device_iommu_gfx2d1 = {
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800524 .name = "msm_iommu",
525 .id = 11,
526 .dev = {
527 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700528 .platform_data = &gfx2d1_iommu,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800529 },
530 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d1_resources),
531 .resource = msm_iommu_gfx2d1_resources,
532};
533
Joel King41d594e2011-10-14 13:18:20 -0700534static struct platform_device msm_device_iommu_vcap = {
535 .name = "msm_iommu",
536 .id = 11,
537 .dev = {
538 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700539 .platform_data = &vcap_iommu,
Joel King41d594e2011-10-14 13:18:20 -0700540 },
541 .num_resources = ARRAY_SIZE(msm_iommu_vcap_resources),
542 .resource = msm_iommu_vcap_resources,
543};
544
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700545static struct msm_iommu_ctx_dev jpegd_src_ctx = {
546 .name = "jpegd_src",
547 .num = 0,
548 .mids = {0, -1}
549};
550
551static struct msm_iommu_ctx_dev jpegd_dst_ctx = {
552 .name = "jpegd_dst",
553 .num = 1,
554 .mids = {1, -1}
555};
556
557static struct msm_iommu_ctx_dev vpe_src_ctx = {
558 .name = "vpe_src",
559 .num = 0,
560 .mids = {0, -1}
561};
562
563static struct msm_iommu_ctx_dev vpe_dst_ctx = {
564 .name = "vpe_dst",
565 .num = 1,
566 .mids = {1, -1}
567};
568
569static struct msm_iommu_ctx_dev mdp_vg1_ctx = {
570 .name = "mdp_vg1",
571 .num = 0,
572 .mids = {0, 2, -1}
573};
574
575static struct msm_iommu_ctx_dev mdp_rgb1_ctx = {
576 .name = "mdp_rgb1",
577 .num = 1,
578 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
579};
580
581static struct msm_iommu_ctx_dev mdp_vg2_ctx = {
582 .name = "mdp_vg2",
583 .num = 0,
584 .mids = {0, 2, -1}
585};
586
587static struct msm_iommu_ctx_dev mdp_rgb2_ctx = {
588 .name = "mdp_rgb2",
589 .num = 1,
590 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
591};
592
593static struct msm_iommu_ctx_dev rot_src_ctx = {
594 .name = "rot_src",
595 .num = 0,
596 .mids = {0, -1}
597};
598
599static struct msm_iommu_ctx_dev rot_dst_ctx = {
600 .name = "rot_dst",
601 .num = 1,
602 .mids = {1, -1}
603};
604
605static struct msm_iommu_ctx_dev ijpeg_src_ctx = {
606 .name = "ijpeg_src",
607 .num = 0,
608 .mids = {0, -1}
609};
610
611static struct msm_iommu_ctx_dev ijpeg_dst_ctx = {
612 .name = "ijpeg_dst",
613 .num = 1,
614 .mids = {1, -1}
615};
616
617static struct msm_iommu_ctx_dev vfe_imgwr_ctx = {
618 .name = "vfe_imgwr",
619 .num = 0,
620 .mids = {2, 3, 4, 5, 6, 7, 8, -1}
621};
622
623static struct msm_iommu_ctx_dev vfe_misc_ctx = {
624 .name = "vfe_misc",
625 .num = 1,
626 .mids = {0, 1, 9, -1}
627};
628
629static struct msm_iommu_ctx_dev vcodec_a_stream_ctx = {
630 .name = "vcodec_a_stream",
631 .num = 0,
632 .mids = {2, 5, -1}
633};
634
635static struct msm_iommu_ctx_dev vcodec_a_mm1_ctx = {
636 .name = "vcodec_a_mm1",
637 .num = 1,
638 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
639};
640
641static struct msm_iommu_ctx_dev vcodec_b_mm2_ctx = {
642 .name = "vcodec_b_mm2",
643 .num = 0,
644 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
645};
646
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800647static struct msm_iommu_ctx_dev gfx3d_user_ctx = {
648 .name = "gfx3d_user",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700649 .num = 0,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800650 .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 -0700651};
652
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800653static struct msm_iommu_ctx_dev gfx3d_priv_ctx = {
654 .name = "gfx3d_priv",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700655 .num = 1,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800656 .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
657 31, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700658};
659
Joel King41d594e2011-10-14 13:18:20 -0700660static struct msm_iommu_ctx_dev gfx3d1_user_ctx = {
661 .name = "gfx3d1_user",
662 .num = 0,
663 .mids = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
664};
665
666static struct msm_iommu_ctx_dev gfx3d1_priv_ctx = {
667 .name = "gfx3d1_priv",
668 .num = 1,
669 .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
670 31, -1}
671};
672
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800673static struct msm_iommu_ctx_dev gfx2d0_2d0_ctx = {
674 .name = "gfx2d0_2d0",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700675 .num = 0,
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800676 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700677};
678
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800679static struct msm_iommu_ctx_dev gfx2d1_2d1_ctx = {
680 .name = "gfx2d1_2d1",
681 .num = 0,
682 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
683};
684
Joel King41d594e2011-10-14 13:18:20 -0700685static struct msm_iommu_ctx_dev vcap_vc_ctx = {
686 .name = "vcap_vc",
687 .num = 0,
688 .mids = {0, -1}
689};
690
691static struct msm_iommu_ctx_dev vcap_vp_ctx = {
692 .name = "vcap_vp",
693 .num = 1,
694 .mids = {1, -1}
695};
696
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700697static struct platform_device msm_device_jpegd_src_ctx = {
698 .name = "msm_iommu_ctx",
699 .id = 0,
700 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800701 .parent = &msm_device_iommu_jpegd.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700702 .platform_data = &jpegd_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700703 },
704};
705
706static struct platform_device msm_device_jpegd_dst_ctx = {
707 .name = "msm_iommu_ctx",
708 .id = 1,
709 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800710 .parent = &msm_device_iommu_jpegd.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700711 .platform_data = &jpegd_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700712 },
713};
714
715static struct platform_device msm_device_vpe_src_ctx = {
716 .name = "msm_iommu_ctx",
717 .id = 2,
718 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800719 .parent = &msm_device_iommu_vpe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700720 .platform_data = &vpe_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700721 },
722};
723
724static struct platform_device msm_device_vpe_dst_ctx = {
725 .name = "msm_iommu_ctx",
726 .id = 3,
727 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800728 .parent = &msm_device_iommu_vpe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700729 .platform_data = &vpe_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700730 },
731};
732
733static struct platform_device msm_device_mdp_vg1_ctx = {
734 .name = "msm_iommu_ctx",
735 .id = 4,
736 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800737 .parent = &msm_device_iommu_mdp0.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700738 .platform_data = &mdp_vg1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700739 },
740};
741
742static struct platform_device msm_device_mdp_rgb1_ctx = {
743 .name = "msm_iommu_ctx",
744 .id = 5,
745 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800746 .parent = &msm_device_iommu_mdp0.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700747 .platform_data = &mdp_rgb1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700748 },
749};
750
751static struct platform_device msm_device_mdp_vg2_ctx = {
752 .name = "msm_iommu_ctx",
753 .id = 6,
754 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800755 .parent = &msm_device_iommu_mdp1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700756 .platform_data = &mdp_vg2_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700757 },
758};
759
760static struct platform_device msm_device_mdp_rgb2_ctx = {
761 .name = "msm_iommu_ctx",
762 .id = 7,
763 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800764 .parent = &msm_device_iommu_mdp1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700765 .platform_data = &mdp_rgb2_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700766 },
767};
768
769static struct platform_device msm_device_rot_src_ctx = {
770 .name = "msm_iommu_ctx",
771 .id = 8,
772 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800773 .parent = &msm_device_iommu_rot.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700774 .platform_data = &rot_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700775 },
776};
777
778static struct platform_device msm_device_rot_dst_ctx = {
779 .name = "msm_iommu_ctx",
780 .id = 9,
781 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800782 .parent = &msm_device_iommu_rot.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700783 .platform_data = &rot_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700784 },
785};
786
787static struct platform_device msm_device_ijpeg_src_ctx = {
788 .name = "msm_iommu_ctx",
789 .id = 10,
790 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800791 .parent = &msm_device_iommu_ijpeg.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700792 .platform_data = &ijpeg_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700793 },
794};
795
796static struct platform_device msm_device_ijpeg_dst_ctx = {
797 .name = "msm_iommu_ctx",
798 .id = 11,
799 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800800 .parent = &msm_device_iommu_ijpeg.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700801 .platform_data = &ijpeg_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700802 },
803};
804
805static struct platform_device msm_device_vfe_imgwr_ctx = {
806 .name = "msm_iommu_ctx",
807 .id = 12,
808 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800809 .parent = &msm_device_iommu_vfe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700810 .platform_data = &vfe_imgwr_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700811 },
812};
813
814static struct platform_device msm_device_vfe_misc_ctx = {
815 .name = "msm_iommu_ctx",
816 .id = 13,
817 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800818 .parent = &msm_device_iommu_vfe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700819 .platform_data = &vfe_misc_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700820 },
821};
822
823static struct platform_device msm_device_vcodec_a_stream_ctx = {
824 .name = "msm_iommu_ctx",
825 .id = 14,
826 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800827 .parent = &msm_device_iommu_vcodec_a.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700828 .platform_data = &vcodec_a_stream_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700829 },
830};
831
832static struct platform_device msm_device_vcodec_a_mm1_ctx = {
833 .name = "msm_iommu_ctx",
834 .id = 15,
835 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800836 .parent = &msm_device_iommu_vcodec_a.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700837 .platform_data = &vcodec_a_mm1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700838 },
839};
840
841static struct platform_device msm_device_vcodec_b_mm2_ctx = {
842 .name = "msm_iommu_ctx",
843 .id = 16,
844 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800845 .parent = &msm_device_iommu_vcodec_b.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700846 .platform_data = &vcodec_b_mm2_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700847 },
848};
849
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800850static struct platform_device msm_device_gfx3d_user_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700851 .name = "msm_iommu_ctx",
852 .id = 17,
853 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800854 .parent = &msm_device_iommu_gfx3d.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700855 .platform_data = &gfx3d_user_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700856 },
857};
858
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800859static struct platform_device msm_device_gfx3d_priv_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700860 .name = "msm_iommu_ctx",
861 .id = 18,
862 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800863 .parent = &msm_device_iommu_gfx3d.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700864 .platform_data = &gfx3d_priv_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700865 },
866};
867
Joel King41d594e2011-10-14 13:18:20 -0700868static struct platform_device msm_device_gfx3d1_user_ctx = {
869 .name = "msm_iommu_ctx",
870 .id = 19,
871 .dev = {
872 .parent = &msm_device_iommu_gfx3d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700873 .platform_data = &gfx3d1_user_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700874 },
875};
876
877static struct platform_device msm_device_gfx3d1_priv_ctx = {
878 .name = "msm_iommu_ctx",
879 .id = 20,
880 .dev = {
881 .parent = &msm_device_iommu_gfx3d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700882 .platform_data = &gfx3d1_priv_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700883 },
884};
885
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800886static struct platform_device msm_device_gfx2d0_2d0_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700887 .name = "msm_iommu_ctx",
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800888 .id = 19,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700889 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800890 .parent = &msm_device_iommu_gfx2d0.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700891 .platform_data = &gfx2d0_2d0_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700892 },
893};
894
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800895static struct platform_device msm_device_gfx2d1_2d1_ctx = {
896 .name = "msm_iommu_ctx",
897 .id = 20,
898 .dev = {
899 .parent = &msm_device_iommu_gfx2d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700900 .platform_data = &gfx2d1_2d1_ctx,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800901 },
902};
903
Joel King41d594e2011-10-14 13:18:20 -0700904static struct platform_device msm_device_vcap_vc_ctx = {
905 .name = "msm_iommu_ctx",
906 .id = 21,
907 .dev = {
908 .parent = &msm_device_iommu_vcap.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700909 .platform_data = &vcap_vc_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700910 },
911};
912
913static struct platform_device msm_device_vcap_vp_ctx = {
914 .name = "msm_iommu_ctx",
915 .id = 22,
916 .dev = {
917 .parent = &msm_device_iommu_vcap.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700918 .platform_data = &vcap_vp_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700919 },
920};
921
922static struct platform_device *msm_iommu_common_devs[] = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800923 &msm_device_iommu_vpe,
924 &msm_device_iommu_mdp0,
925 &msm_device_iommu_mdp1,
926 &msm_device_iommu_rot,
927 &msm_device_iommu_ijpeg,
928 &msm_device_iommu_vfe,
929 &msm_device_iommu_vcodec_a,
930 &msm_device_iommu_vcodec_b,
931 &msm_device_iommu_gfx3d,
Joel King41d594e2011-10-14 13:18:20 -0700932};
933
934static struct platform_device *msm_iommu_gfx2d_devs[] = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800935 &msm_device_iommu_gfx2d0,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800936 &msm_device_iommu_gfx2d1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700937};
938
Joel King41d594e2011-10-14 13:18:20 -0700939static struct platform_device *msm_iommu_8064_devs[] = {
940 &msm_device_iommu_gfx3d1,
941 &msm_device_iommu_vcap,
942};
943
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -0700944static struct platform_device *msm_iommu_jpegd_devs[] = {
945 &msm_device_iommu_jpegd,
946};
947
Joel King41d594e2011-10-14 13:18:20 -0700948static struct platform_device *msm_iommu_common_ctx_devs[] = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700949 &msm_device_vpe_src_ctx,
950 &msm_device_vpe_dst_ctx,
951 &msm_device_mdp_vg1_ctx,
952 &msm_device_mdp_rgb1_ctx,
953 &msm_device_mdp_vg2_ctx,
954 &msm_device_mdp_rgb2_ctx,
955 &msm_device_rot_src_ctx,
956 &msm_device_rot_dst_ctx,
957 &msm_device_ijpeg_src_ctx,
958 &msm_device_ijpeg_dst_ctx,
959 &msm_device_vfe_imgwr_ctx,
960 &msm_device_vfe_misc_ctx,
961 &msm_device_vcodec_a_stream_ctx,
962 &msm_device_vcodec_a_mm1_ctx,
963 &msm_device_vcodec_b_mm2_ctx,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800964 &msm_device_gfx3d_user_ctx,
965 &msm_device_gfx3d_priv_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700966};
967
968static struct platform_device *msm_iommu_gfx2d_ctx_devs[] = {
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800969 &msm_device_gfx2d0_2d0_ctx,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800970 &msm_device_gfx2d1_2d1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700971};
972
Joel King41d594e2011-10-14 13:18:20 -0700973static struct platform_device *msm_iommu_8064_ctx_devs[] = {
974 &msm_device_gfx3d1_user_ctx,
975 &msm_device_gfx3d1_priv_ctx,
976 &msm_device_vcap_vc_ctx,
977 &msm_device_vcap_vp_ctx,
978};
979
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -0700980static struct platform_device *msm_iommu_jpegd_ctx_devs[] = {
981 &msm_device_jpegd_src_ctx,
982 &msm_device_jpegd_dst_ctx,
983};
984
Joel King41d594e2011-10-14 13:18:20 -0700985static int __init iommu_init(void)
986{
987 int ret;
Stepan Moskovchenko15f209c2011-10-31 15:32:44 -0700988 if (!msm_soc_version_supports_iommu()) {
Stepan Moskovchenko75f1e672011-10-21 19:49:44 -0700989 pr_err("IOMMU is not supported on this SoC version.\n");
990 return -ENODEV;
991 }
992
Joel King41d594e2011-10-14 13:18:20 -0700993 ret = platform_device_register(&msm_root_iommu_dev);
994 if (ret != 0) {
995 pr_err("Failed to register root IOMMU device!\n");
996 goto failure;
997 }
998
999 /* Initialize common devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001000 platform_add_devices(msm_iommu_common_devs,
1001 ARRAY_SIZE(msm_iommu_common_devs));
Joel King41d594e2011-10-14 13:18:20 -07001002
1003 /* Initialize soc-specific devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001004 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1005 platform_add_devices(msm_iommu_jpegd_devs,
1006 ARRAY_SIZE(msm_iommu_jpegd_devs));
1007 platform_add_devices(msm_iommu_gfx2d_devs,
1008 ARRAY_SIZE(msm_iommu_gfx2d_devs));
Joel King41d594e2011-10-14 13:18:20 -07001009 }
Joel King41d594e2011-10-14 13:18:20 -07001010
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001011 if (cpu_is_apq8064()) {
1012 platform_add_devices(msm_iommu_jpegd_devs,
1013 ARRAY_SIZE(msm_iommu_jpegd_devs));
1014 platform_add_devices(msm_iommu_8064_devs,
1015 ARRAY_SIZE(msm_iommu_8064_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001016 }
1017
Joel King41d594e2011-10-14 13:18:20 -07001018 /* Initialize common ctx_devs */
Stepan Moskovchenko6ca487f2012-03-13 18:12:29 -07001019 ret = platform_add_devices(msm_iommu_common_ctx_devs,
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001020 ARRAY_SIZE(msm_iommu_common_ctx_devs));
Joel King41d594e2011-10-14 13:18:20 -07001021
1022 /* Initialize soc-specific ctx_devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001023 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1024 platform_add_devices(msm_iommu_jpegd_ctx_devs,
1025 ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
1026 platform_add_devices(msm_iommu_gfx2d_ctx_devs,
1027 ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs));
Joel King41d594e2011-10-14 13:18:20 -07001028 }
Joel King41d594e2011-10-14 13:18:20 -07001029
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001030 if (cpu_is_apq8064()) {
1031 platform_add_devices(msm_iommu_jpegd_ctx_devs,
1032 ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
1033 platform_add_devices(msm_iommu_8064_ctx_devs,
1034 ARRAY_SIZE(msm_iommu_8064_ctx_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001035 }
1036
Joel King41d594e2011-10-14 13:18:20 -07001037 return 0;
1038
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001039failure:
1040 return ret;
1041}
1042
Joel King41d594e2011-10-14 13:18:20 -07001043static void __exit iommu_exit(void)
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001044{
1045 int i;
1046
Joel King41d594e2011-10-14 13:18:20 -07001047 /* Common ctx_devs */
1048 for (i = 0; i < ARRAY_SIZE(msm_iommu_common_ctx_devs); i++)
1049 platform_device_unregister(msm_iommu_common_ctx_devs[i]);
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001050
Joel King41d594e2011-10-14 13:18:20 -07001051 /* Common devs. */
1052 for (i = 0; i < ARRAY_SIZE(msm_iommu_common_devs); ++i)
1053 platform_device_unregister(msm_iommu_common_devs[i]);
1054
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001055 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1056 for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs); i++)
1057 platform_device_unregister(msm_iommu_gfx2d_ctx_devs[i]);
1058
1059 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs); i++)
1060 platform_device_unregister(msm_iommu_jpegd_ctx_devs[i]);
1061
Joel King41d594e2011-10-14 13:18:20 -07001062 for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_devs); i++)
1063 platform_device_unregister(msm_iommu_gfx2d_devs[i]);
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001064
1065 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
1066 platform_device_unregister(msm_iommu_jpegd_devs[i]);
Joel King41d594e2011-10-14 13:18:20 -07001067 }
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001068
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001069 if (cpu_is_apq8064()) {
1070 for (i = 0; i < ARRAY_SIZE(msm_iommu_8064_ctx_devs); i++)
1071 platform_device_unregister(msm_iommu_8064_ctx_devs[i]);
1072
1073 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs); i++)
1074 platform_device_unregister(msm_iommu_jpegd_ctx_devs[i]);
1075
1076 for (i = 0; i < ARRAY_SIZE(msm_iommu_8064_devs); i++)
1077 platform_device_unregister(msm_iommu_8064_devs[i]);
1078
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001079 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
1080 platform_device_unregister(msm_iommu_jpegd_devs[i]);
1081 }
1082
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001083 platform_device_unregister(&msm_root_iommu_dev);
1084}
1085
Joel King41d594e2011-10-14 13:18:20 -07001086subsys_initcall(iommu_init);
1087module_exit(iommu_exit);
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001088
1089MODULE_LICENSE("GPL v2");
1090MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");