blob: f5676d38aa189857596eeeb4b9f02d9cf5c2c5d2 [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,
Shubhraprakash Das5ff63522012-04-26 16:00:05 -0600379 .ttbr_split = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700380};
381
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800382static struct msm_iommu_dev gfx2d1_iommu = {
383 .name = "gfx2d1",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800384 .ncb = 2,
Shubhraprakash Das5ff63522012-04-26 16:00:05 -0600385 .ttbr_split = 2,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800386};
387
Joel King41d594e2011-10-14 13:18:20 -0700388static struct msm_iommu_dev vcap_iommu = {
389 .name = "vcap",
390 .ncb = 2,
391};
392
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800393static struct platform_device msm_device_iommu_jpegd = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700394 .name = "msm_iommu",
395 .id = 0,
396 .dev = {
397 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700398 .platform_data = &jpegd_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700399 },
400 .num_resources = ARRAY_SIZE(msm_iommu_jpegd_resources),
401 .resource = msm_iommu_jpegd_resources,
402};
403
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800404static struct platform_device msm_device_iommu_vpe = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700405 .name = "msm_iommu",
406 .id = 1,
407 .dev = {
408 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700409 .platform_data = &vpe_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700410 },
411 .num_resources = ARRAY_SIZE(msm_iommu_vpe_resources),
412 .resource = msm_iommu_vpe_resources,
413};
414
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800415static struct platform_device msm_device_iommu_mdp0 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700416 .name = "msm_iommu",
417 .id = 2,
418 .dev = {
419 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700420 .platform_data = &mdp0_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700421 },
422 .num_resources = ARRAY_SIZE(msm_iommu_mdp0_resources),
423 .resource = msm_iommu_mdp0_resources,
424};
425
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800426static struct platform_device msm_device_iommu_mdp1 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700427 .name = "msm_iommu",
428 .id = 3,
429 .dev = {
430 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700431 .platform_data = &mdp1_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700432 },
433 .num_resources = ARRAY_SIZE(msm_iommu_mdp1_resources),
434 .resource = msm_iommu_mdp1_resources,
435};
436
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800437static struct platform_device msm_device_iommu_rot = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700438 .name = "msm_iommu",
439 .id = 4,
440 .dev = {
441 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700442 .platform_data = &rot_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700443 },
444 .num_resources = ARRAY_SIZE(msm_iommu_rot_resources),
445 .resource = msm_iommu_rot_resources,
446};
447
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800448static struct platform_device msm_device_iommu_ijpeg = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700449 .name = "msm_iommu",
450 .id = 5,
451 .dev = {
452 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700453 .platform_data = &ijpeg_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700454 },
455 .num_resources = ARRAY_SIZE(msm_iommu_ijpeg_resources),
456 .resource = msm_iommu_ijpeg_resources,
457};
458
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800459static struct platform_device msm_device_iommu_vfe = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700460 .name = "msm_iommu",
461 .id = 6,
462 .dev = {
463 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700464 .platform_data = &vfe_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700465 },
466 .num_resources = ARRAY_SIZE(msm_iommu_vfe_resources),
467 .resource = msm_iommu_vfe_resources,
468};
469
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800470static struct platform_device msm_device_iommu_vcodec_a = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700471 .name = "msm_iommu",
472 .id = 7,
473 .dev = {
474 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700475 .platform_data = &vcodec_a_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700476 },
477 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_a_resources),
478 .resource = msm_iommu_vcodec_a_resources,
479};
480
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800481static struct platform_device msm_device_iommu_vcodec_b = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700482 .name = "msm_iommu",
483 .id = 8,
484 .dev = {
485 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700486 .platform_data = &vcodec_b_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700487 },
488 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_b_resources),
489 .resource = msm_iommu_vcodec_b_resources,
490};
491
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800492static struct platform_device msm_device_iommu_gfx3d = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700493 .name = "msm_iommu",
494 .id = 9,
495 .dev = {
496 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700497 .platform_data = &gfx3d_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700498 },
499 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d_resources),
500 .resource = msm_iommu_gfx3d_resources,
501};
502
Joel King41d594e2011-10-14 13:18:20 -0700503static struct platform_device msm_device_iommu_gfx3d1 = {
504 .name = "msm_iommu",
505 .id = 10,
506 .dev = {
507 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700508 .platform_data = &gfx3d1_iommu,
Joel King41d594e2011-10-14 13:18:20 -0700509 },
510 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d1_resources),
511 .resource = msm_iommu_gfx3d1_resources,
512};
513
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800514static struct platform_device msm_device_iommu_gfx2d0 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700515 .name = "msm_iommu",
516 .id = 10,
517 .dev = {
518 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700519 .platform_data = &gfx2d0_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700520 },
521 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d0_resources),
522 .resource = msm_iommu_gfx2d0_resources,
523};
524
Joel King41d594e2011-10-14 13:18:20 -0700525static struct platform_device msm_device_iommu_gfx2d1 = {
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800526 .name = "msm_iommu",
527 .id = 11,
528 .dev = {
529 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700530 .platform_data = &gfx2d1_iommu,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800531 },
532 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d1_resources),
533 .resource = msm_iommu_gfx2d1_resources,
534};
535
Joel King41d594e2011-10-14 13:18:20 -0700536static struct platform_device msm_device_iommu_vcap = {
537 .name = "msm_iommu",
538 .id = 11,
539 .dev = {
540 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700541 .platform_data = &vcap_iommu,
Joel King41d594e2011-10-14 13:18:20 -0700542 },
543 .num_resources = ARRAY_SIZE(msm_iommu_vcap_resources),
544 .resource = msm_iommu_vcap_resources,
545};
546
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700547static struct msm_iommu_ctx_dev jpegd_src_ctx = {
548 .name = "jpegd_src",
549 .num = 0,
550 .mids = {0, -1}
551};
552
553static struct msm_iommu_ctx_dev jpegd_dst_ctx = {
554 .name = "jpegd_dst",
555 .num = 1,
556 .mids = {1, -1}
557};
558
559static struct msm_iommu_ctx_dev vpe_src_ctx = {
560 .name = "vpe_src",
561 .num = 0,
562 .mids = {0, -1}
563};
564
565static struct msm_iommu_ctx_dev vpe_dst_ctx = {
566 .name = "vpe_dst",
567 .num = 1,
568 .mids = {1, -1}
569};
570
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700571static struct msm_iommu_ctx_dev mdp_port0_cb0_ctx = {
572 .name = "mdp_port0_cb0",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700573 .num = 0,
574 .mids = {0, 2, -1}
575};
576
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700577static struct msm_iommu_ctx_dev mdp_port0_cb1_ctx = {
578 .name = "mdp_port0_cb1",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700579 .num = 1,
580 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
581};
582
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700583static struct msm_iommu_ctx_dev mdp_port1_cb0_ctx = {
584 .name = "mdp_port1_cb0",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700585 .num = 0,
586 .mids = {0, 2, -1}
587};
588
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700589static struct msm_iommu_ctx_dev mdp_port1_cb1_ctx = {
590 .name = "mdp_port1_cb1",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700591 .num = 1,
592 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
593};
594
595static struct msm_iommu_ctx_dev rot_src_ctx = {
596 .name = "rot_src",
597 .num = 0,
598 .mids = {0, -1}
599};
600
601static struct msm_iommu_ctx_dev rot_dst_ctx = {
602 .name = "rot_dst",
603 .num = 1,
604 .mids = {1, -1}
605};
606
607static struct msm_iommu_ctx_dev ijpeg_src_ctx = {
608 .name = "ijpeg_src",
609 .num = 0,
610 .mids = {0, -1}
611};
612
613static struct msm_iommu_ctx_dev ijpeg_dst_ctx = {
614 .name = "ijpeg_dst",
615 .num = 1,
616 .mids = {1, -1}
617};
618
619static struct msm_iommu_ctx_dev vfe_imgwr_ctx = {
620 .name = "vfe_imgwr",
621 .num = 0,
622 .mids = {2, 3, 4, 5, 6, 7, 8, -1}
623};
624
625static struct msm_iommu_ctx_dev vfe_misc_ctx = {
626 .name = "vfe_misc",
627 .num = 1,
628 .mids = {0, 1, 9, -1}
629};
630
631static struct msm_iommu_ctx_dev vcodec_a_stream_ctx = {
632 .name = "vcodec_a_stream",
633 .num = 0,
634 .mids = {2, 5, -1}
635};
636
637static struct msm_iommu_ctx_dev vcodec_a_mm1_ctx = {
638 .name = "vcodec_a_mm1",
639 .num = 1,
640 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
641};
642
643static struct msm_iommu_ctx_dev vcodec_b_mm2_ctx = {
644 .name = "vcodec_b_mm2",
645 .num = 0,
646 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
647};
648
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800649static struct msm_iommu_ctx_dev gfx3d_user_ctx = {
650 .name = "gfx3d_user",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700651 .num = 0,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800652 .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 -0700653};
654
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800655static struct msm_iommu_ctx_dev gfx3d_priv_ctx = {
656 .name = "gfx3d_priv",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700657 .num = 1,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800658 .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
659 31, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700660};
661
Joel King41d594e2011-10-14 13:18:20 -0700662static struct msm_iommu_ctx_dev gfx3d1_user_ctx = {
663 .name = "gfx3d1_user",
664 .num = 0,
665 .mids = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
666};
667
668static struct msm_iommu_ctx_dev gfx3d1_priv_ctx = {
669 .name = "gfx3d1_priv",
670 .num = 1,
671 .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
672 31, -1}
673};
674
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800675static struct msm_iommu_ctx_dev gfx2d0_2d0_ctx = {
676 .name = "gfx2d0_2d0",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700677 .num = 0,
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800678 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700679};
680
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800681static struct msm_iommu_ctx_dev gfx2d1_2d1_ctx = {
682 .name = "gfx2d1_2d1",
683 .num = 0,
684 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
685};
686
Joel King41d594e2011-10-14 13:18:20 -0700687static struct msm_iommu_ctx_dev vcap_vc_ctx = {
688 .name = "vcap_vc",
689 .num = 0,
690 .mids = {0, -1}
691};
692
693static struct msm_iommu_ctx_dev vcap_vp_ctx = {
694 .name = "vcap_vp",
695 .num = 1,
696 .mids = {1, -1}
697};
698
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700699static struct platform_device msm_device_jpegd_src_ctx = {
700 .name = "msm_iommu_ctx",
701 .id = 0,
702 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800703 .parent = &msm_device_iommu_jpegd.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700704 .platform_data = &jpegd_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700705 },
706};
707
708static struct platform_device msm_device_jpegd_dst_ctx = {
709 .name = "msm_iommu_ctx",
710 .id = 1,
711 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800712 .parent = &msm_device_iommu_jpegd.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700713 .platform_data = &jpegd_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700714 },
715};
716
717static struct platform_device msm_device_vpe_src_ctx = {
718 .name = "msm_iommu_ctx",
719 .id = 2,
720 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800721 .parent = &msm_device_iommu_vpe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700722 .platform_data = &vpe_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700723 },
724};
725
726static struct platform_device msm_device_vpe_dst_ctx = {
727 .name = "msm_iommu_ctx",
728 .id = 3,
729 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800730 .parent = &msm_device_iommu_vpe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700731 .platform_data = &vpe_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700732 },
733};
734
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700735static struct platform_device msm_device_mdp_port0_cb0_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700736 .name = "msm_iommu_ctx",
737 .id = 4,
738 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800739 .parent = &msm_device_iommu_mdp0.dev,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700740 .platform_data = &mdp_port0_cb0_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700741 },
742};
743
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700744static struct platform_device msm_device_mdp_port0_cb1_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700745 .name = "msm_iommu_ctx",
746 .id = 5,
747 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800748 .parent = &msm_device_iommu_mdp0.dev,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700749 .platform_data = &mdp_port0_cb1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700750 },
751};
752
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700753static struct platform_device msm_device_mdp_port1_cb0_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700754 .name = "msm_iommu_ctx",
755 .id = 6,
756 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800757 .parent = &msm_device_iommu_mdp1.dev,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700758 .platform_data = &mdp_port1_cb0_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700759 },
760};
761
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700762static struct platform_device msm_device_mdp_port1_cb1_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700763 .name = "msm_iommu_ctx",
764 .id = 7,
765 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800766 .parent = &msm_device_iommu_mdp1.dev,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700767 .platform_data = &mdp_port1_cb1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700768 },
769};
770
771static struct platform_device msm_device_rot_src_ctx = {
772 .name = "msm_iommu_ctx",
773 .id = 8,
774 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800775 .parent = &msm_device_iommu_rot.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700776 .platform_data = &rot_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700777 },
778};
779
780static struct platform_device msm_device_rot_dst_ctx = {
781 .name = "msm_iommu_ctx",
782 .id = 9,
783 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800784 .parent = &msm_device_iommu_rot.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700785 .platform_data = &rot_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700786 },
787};
788
789static struct platform_device msm_device_ijpeg_src_ctx = {
790 .name = "msm_iommu_ctx",
791 .id = 10,
792 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800793 .parent = &msm_device_iommu_ijpeg.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700794 .platform_data = &ijpeg_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700795 },
796};
797
798static struct platform_device msm_device_ijpeg_dst_ctx = {
799 .name = "msm_iommu_ctx",
800 .id = 11,
801 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800802 .parent = &msm_device_iommu_ijpeg.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700803 .platform_data = &ijpeg_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700804 },
805};
806
807static struct platform_device msm_device_vfe_imgwr_ctx = {
808 .name = "msm_iommu_ctx",
809 .id = 12,
810 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800811 .parent = &msm_device_iommu_vfe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700812 .platform_data = &vfe_imgwr_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700813 },
814};
815
816static struct platform_device msm_device_vfe_misc_ctx = {
817 .name = "msm_iommu_ctx",
818 .id = 13,
819 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800820 .parent = &msm_device_iommu_vfe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700821 .platform_data = &vfe_misc_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700822 },
823};
824
825static struct platform_device msm_device_vcodec_a_stream_ctx = {
826 .name = "msm_iommu_ctx",
827 .id = 14,
828 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800829 .parent = &msm_device_iommu_vcodec_a.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700830 .platform_data = &vcodec_a_stream_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700831 },
832};
833
834static struct platform_device msm_device_vcodec_a_mm1_ctx = {
835 .name = "msm_iommu_ctx",
836 .id = 15,
837 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800838 .parent = &msm_device_iommu_vcodec_a.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700839 .platform_data = &vcodec_a_mm1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700840 },
841};
842
843static struct platform_device msm_device_vcodec_b_mm2_ctx = {
844 .name = "msm_iommu_ctx",
845 .id = 16,
846 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800847 .parent = &msm_device_iommu_vcodec_b.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700848 .platform_data = &vcodec_b_mm2_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700849 },
850};
851
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800852static struct platform_device msm_device_gfx3d_user_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700853 .name = "msm_iommu_ctx",
854 .id = 17,
855 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800856 .parent = &msm_device_iommu_gfx3d.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700857 .platform_data = &gfx3d_user_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700858 },
859};
860
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800861static struct platform_device msm_device_gfx3d_priv_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700862 .name = "msm_iommu_ctx",
863 .id = 18,
864 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800865 .parent = &msm_device_iommu_gfx3d.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700866 .platform_data = &gfx3d_priv_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700867 },
868};
869
Joel King41d594e2011-10-14 13:18:20 -0700870static struct platform_device msm_device_gfx3d1_user_ctx = {
871 .name = "msm_iommu_ctx",
872 .id = 19,
873 .dev = {
874 .parent = &msm_device_iommu_gfx3d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700875 .platform_data = &gfx3d1_user_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700876 },
877};
878
879static struct platform_device msm_device_gfx3d1_priv_ctx = {
880 .name = "msm_iommu_ctx",
881 .id = 20,
882 .dev = {
883 .parent = &msm_device_iommu_gfx3d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700884 .platform_data = &gfx3d1_priv_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700885 },
886};
887
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800888static struct platform_device msm_device_gfx2d0_2d0_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700889 .name = "msm_iommu_ctx",
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800890 .id = 19,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700891 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800892 .parent = &msm_device_iommu_gfx2d0.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700893 .platform_data = &gfx2d0_2d0_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700894 },
895};
896
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800897static struct platform_device msm_device_gfx2d1_2d1_ctx = {
898 .name = "msm_iommu_ctx",
899 .id = 20,
900 .dev = {
901 .parent = &msm_device_iommu_gfx2d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700902 .platform_data = &gfx2d1_2d1_ctx,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800903 },
904};
905
Joel King41d594e2011-10-14 13:18:20 -0700906static struct platform_device msm_device_vcap_vc_ctx = {
907 .name = "msm_iommu_ctx",
908 .id = 21,
909 .dev = {
910 .parent = &msm_device_iommu_vcap.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700911 .platform_data = &vcap_vc_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700912 },
913};
914
915static struct platform_device msm_device_vcap_vp_ctx = {
916 .name = "msm_iommu_ctx",
917 .id = 22,
918 .dev = {
919 .parent = &msm_device_iommu_vcap.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700920 .platform_data = &vcap_vp_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700921 },
922};
923
924static struct platform_device *msm_iommu_common_devs[] = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800925 &msm_device_iommu_vpe,
926 &msm_device_iommu_mdp0,
927 &msm_device_iommu_mdp1,
928 &msm_device_iommu_rot,
929 &msm_device_iommu_ijpeg,
930 &msm_device_iommu_vfe,
931 &msm_device_iommu_vcodec_a,
932 &msm_device_iommu_vcodec_b,
933 &msm_device_iommu_gfx3d,
Joel King41d594e2011-10-14 13:18:20 -0700934};
935
936static struct platform_device *msm_iommu_gfx2d_devs[] = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800937 &msm_device_iommu_gfx2d0,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800938 &msm_device_iommu_gfx2d1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700939};
940
Joel King41d594e2011-10-14 13:18:20 -0700941static struct platform_device *msm_iommu_8064_devs[] = {
942 &msm_device_iommu_gfx3d1,
943 &msm_device_iommu_vcap,
944};
945
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -0700946static struct platform_device *msm_iommu_jpegd_devs[] = {
947 &msm_device_iommu_jpegd,
948};
949
Joel King41d594e2011-10-14 13:18:20 -0700950static struct platform_device *msm_iommu_common_ctx_devs[] = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700951 &msm_device_vpe_src_ctx,
952 &msm_device_vpe_dst_ctx,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700953 &msm_device_mdp_port0_cb0_ctx,
954 &msm_device_mdp_port0_cb1_ctx,
955 &msm_device_mdp_port1_cb0_ctx,
956 &msm_device_mdp_port1_cb1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700957 &msm_device_rot_src_ctx,
958 &msm_device_rot_dst_ctx,
959 &msm_device_ijpeg_src_ctx,
960 &msm_device_ijpeg_dst_ctx,
961 &msm_device_vfe_imgwr_ctx,
962 &msm_device_vfe_misc_ctx,
963 &msm_device_vcodec_a_stream_ctx,
964 &msm_device_vcodec_a_mm1_ctx,
965 &msm_device_vcodec_b_mm2_ctx,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800966 &msm_device_gfx3d_user_ctx,
967 &msm_device_gfx3d_priv_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700968};
969
970static struct platform_device *msm_iommu_gfx2d_ctx_devs[] = {
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800971 &msm_device_gfx2d0_2d0_ctx,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800972 &msm_device_gfx2d1_2d1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700973};
974
Joel King41d594e2011-10-14 13:18:20 -0700975static struct platform_device *msm_iommu_8064_ctx_devs[] = {
976 &msm_device_gfx3d1_user_ctx,
977 &msm_device_gfx3d1_priv_ctx,
978 &msm_device_vcap_vc_ctx,
979 &msm_device_vcap_vp_ctx,
980};
981
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -0700982static struct platform_device *msm_iommu_jpegd_ctx_devs[] = {
983 &msm_device_jpegd_src_ctx,
984 &msm_device_jpegd_dst_ctx,
985};
986
Joel King41d594e2011-10-14 13:18:20 -0700987static int __init iommu_init(void)
988{
989 int ret;
Sathish Ambleyd1b89ed2012-02-07 21:47:47 -0800990 if (!msm_soc_version_supports_iommu_v1()) {
991 pr_err("IOMMU v1 is not supported on this SoC version.\n");
Stepan Moskovchenko75f1e672011-10-21 19:49:44 -0700992 return -ENODEV;
993 }
994
Joel King41d594e2011-10-14 13:18:20 -0700995 ret = platform_device_register(&msm_root_iommu_dev);
996 if (ret != 0) {
997 pr_err("Failed to register root IOMMU device!\n");
998 goto failure;
999 }
1000
1001 /* Initialize common devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001002 platform_add_devices(msm_iommu_common_devs,
1003 ARRAY_SIZE(msm_iommu_common_devs));
Joel King41d594e2011-10-14 13:18:20 -07001004
1005 /* Initialize soc-specific devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001006 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1007 platform_add_devices(msm_iommu_jpegd_devs,
1008 ARRAY_SIZE(msm_iommu_jpegd_devs));
1009 platform_add_devices(msm_iommu_gfx2d_devs,
1010 ARRAY_SIZE(msm_iommu_gfx2d_devs));
Joel King41d594e2011-10-14 13:18:20 -07001011 }
Joel King41d594e2011-10-14 13:18:20 -07001012
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001013 if (cpu_is_apq8064()) {
1014 platform_add_devices(msm_iommu_jpegd_devs,
1015 ARRAY_SIZE(msm_iommu_jpegd_devs));
1016 platform_add_devices(msm_iommu_8064_devs,
1017 ARRAY_SIZE(msm_iommu_8064_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001018 }
1019
Joel King41d594e2011-10-14 13:18:20 -07001020 /* Initialize common ctx_devs */
Stepan Moskovchenko6ca487f2012-03-13 18:12:29 -07001021 ret = platform_add_devices(msm_iommu_common_ctx_devs,
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001022 ARRAY_SIZE(msm_iommu_common_ctx_devs));
Joel King41d594e2011-10-14 13:18:20 -07001023
1024 /* Initialize soc-specific ctx_devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001025 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1026 platform_add_devices(msm_iommu_jpegd_ctx_devs,
1027 ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
1028 platform_add_devices(msm_iommu_gfx2d_ctx_devs,
1029 ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs));
Joel King41d594e2011-10-14 13:18:20 -07001030 }
Joel King41d594e2011-10-14 13:18:20 -07001031
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001032 if (cpu_is_apq8064()) {
1033 platform_add_devices(msm_iommu_jpegd_ctx_devs,
1034 ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
1035 platform_add_devices(msm_iommu_8064_ctx_devs,
1036 ARRAY_SIZE(msm_iommu_8064_ctx_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001037 }
1038
Joel King41d594e2011-10-14 13:18:20 -07001039 return 0;
1040
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001041failure:
1042 return ret;
1043}
1044
Joel King41d594e2011-10-14 13:18:20 -07001045static void __exit iommu_exit(void)
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001046{
1047 int i;
1048
Joel King41d594e2011-10-14 13:18:20 -07001049 /* Common ctx_devs */
1050 for (i = 0; i < ARRAY_SIZE(msm_iommu_common_ctx_devs); i++)
1051 platform_device_unregister(msm_iommu_common_ctx_devs[i]);
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001052
Joel King41d594e2011-10-14 13:18:20 -07001053 /* Common devs. */
1054 for (i = 0; i < ARRAY_SIZE(msm_iommu_common_devs); ++i)
1055 platform_device_unregister(msm_iommu_common_devs[i]);
1056
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001057 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1058 for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs); i++)
1059 platform_device_unregister(msm_iommu_gfx2d_ctx_devs[i]);
1060
1061 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs); i++)
1062 platform_device_unregister(msm_iommu_jpegd_ctx_devs[i]);
1063
Joel King41d594e2011-10-14 13:18:20 -07001064 for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_devs); i++)
1065 platform_device_unregister(msm_iommu_gfx2d_devs[i]);
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001066
1067 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
1068 platform_device_unregister(msm_iommu_jpegd_devs[i]);
Joel King41d594e2011-10-14 13:18:20 -07001069 }
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001070
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001071 if (cpu_is_apq8064()) {
1072 for (i = 0; i < ARRAY_SIZE(msm_iommu_8064_ctx_devs); i++)
1073 platform_device_unregister(msm_iommu_8064_ctx_devs[i]);
1074
1075 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs); i++)
1076 platform_device_unregister(msm_iommu_jpegd_ctx_devs[i]);
1077
1078 for (i = 0; i < ARRAY_SIZE(msm_iommu_8064_devs); i++)
1079 platform_device_unregister(msm_iommu_8064_devs[i]);
1080
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001081 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
1082 platform_device_unregister(msm_iommu_jpegd_devs[i]);
1083 }
1084
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001085 platform_device_unregister(&msm_root_iommu_dev);
1086}
1087
Joel King41d594e2011-10-14 13:18:20 -07001088subsys_initcall(iommu_init);
1089module_exit(iommu_exit);
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001090
1091MODULE_LICENSE("GPL v2");
1092MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");