blob: b65bd1f83b7006dcaddf6c4e06ba7d9efead0dbc [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>
Joerg Roedel96f176a2011-12-06 11:17:34 +010016#include <linux/module.h>
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080017#include <mach/irqs.h>
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070018#include <mach/iommu.h>
Joel King41d594e2011-10-14 13:18:20 -070019#include <mach/socinfo.h>
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070020
21static struct resource msm_iommu_jpegd_resources[] = {
22 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080023 .start = 0x07300000,
24 .end = 0x07300000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070025 .name = "physbase",
26 .flags = IORESOURCE_MEM,
27 },
28 {
29 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070030 .start = 98,
31 .end = 98,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070032 .flags = IORESOURCE_IRQ,
33 },
34 {
35 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070036 .start = 97,
37 .end = 97,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070038 .flags = IORESOURCE_IRQ,
39 },
40};
41
42static struct resource msm_iommu_vpe_resources[] = {
43 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080044 .start = 0x07400000,
45 .end = 0x07400000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070046 .name = "physbase",
47 .flags = IORESOURCE_MEM,
48 },
49 {
50 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070051 .start = 84,
52 .end = 84,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070053 .flags = IORESOURCE_IRQ,
54 },
55 {
56 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070057 .start = 83,
58 .end = 83,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070059 .flags = IORESOURCE_IRQ,
60 },
61};
62
63static struct resource msm_iommu_mdp0_resources[] = {
64 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080065 .start = 0x07500000,
66 .end = 0x07500000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070067 .name = "physbase",
68 .flags = IORESOURCE_MEM,
69 },
70 {
71 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070072 .start = 96,
73 .end = 96,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070074 .flags = IORESOURCE_IRQ,
75 },
76 {
77 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070078 .start = 95,
79 .end = 95,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070080 .flags = IORESOURCE_IRQ,
81 },
82};
83
84static struct resource msm_iommu_mdp1_resources[] = {
85 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -080086 .start = 0x07600000,
87 .end = 0x07600000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070088 .name = "physbase",
89 .flags = IORESOURCE_MEM,
90 },
91 {
92 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070093 .start = 94,
94 .end = 94,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -070095 .flags = IORESOURCE_IRQ,
96 },
97 {
98 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -070099 .start = 93,
100 .end = 93,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700101 .flags = IORESOURCE_IRQ,
102 },
103};
104
105static struct resource msm_iommu_rot_resources[] = {
106 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800107 .start = 0x07700000,
108 .end = 0x07700000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700109 .name = "physbase",
110 .flags = IORESOURCE_MEM,
111 },
112 {
113 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700114 .start = 92,
115 .end = 92,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700116 .flags = IORESOURCE_IRQ,
117 },
118 {
119 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700120 .start = 91,
121 .end = 91,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700122 .flags = IORESOURCE_IRQ,
123 },
124};
125
126static struct resource msm_iommu_ijpeg_resources[] = {
127 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800128 .start = 0x07800000,
129 .end = 0x07800000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700130 .name = "physbase",
131 .flags = IORESOURCE_MEM,
132 },
133 {
134 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700135 .start = 100,
136 .end = 100,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700137 .flags = IORESOURCE_IRQ,
138 },
139 {
140 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700141 .start = 99,
142 .end = 99,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147static struct resource msm_iommu_vfe_resources[] = {
148 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800149 .start = 0x07900000,
150 .end = 0x07900000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700151 .name = "physbase",
152 .flags = IORESOURCE_MEM,
153 },
154 {
155 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700156 .start = 86,
157 .end = 86,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700158 .flags = IORESOURCE_IRQ,
159 },
160 {
161 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700162 .start = 85,
163 .end = 85,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168static struct resource msm_iommu_vcodec_a_resources[] = {
169 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800170 .start = 0x07A00000,
171 .end = 0x07A00000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700172 .name = "physbase",
173 .flags = IORESOURCE_MEM,
174 },
175 {
176 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700177 .start = 90,
178 .end = 90,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700179 .flags = IORESOURCE_IRQ,
180 },
181 {
182 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700183 .start = 89,
184 .end = 89,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700185 .flags = IORESOURCE_IRQ,
186 },
187};
188
189static struct resource msm_iommu_vcodec_b_resources[] = {
190 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800191 .start = 0x07B00000,
192 .end = 0x07B00000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700193 .name = "physbase",
194 .flags = IORESOURCE_MEM,
195 },
196 {
197 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700198 .start = 88,
199 .end = 88,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700200 .flags = IORESOURCE_IRQ,
201 },
202 {
203 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700204 .start = 87,
205 .end = 87,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700206 .flags = IORESOURCE_IRQ,
207 },
208};
209
210static struct resource msm_iommu_gfx3d_resources[] = {
211 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800212 .start = 0x07C00000,
213 .end = 0x07C00000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700214 .name = "physbase",
215 .flags = IORESOURCE_MEM,
216 },
217 {
218 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700219 .start = 102,
220 .end = 102,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700221 .flags = IORESOURCE_IRQ,
222 },
223 {
224 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700225 .start = 101,
226 .end = 101,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700227 .flags = IORESOURCE_IRQ,
228 },
229};
230
Joel King41d594e2011-10-14 13:18:20 -0700231static struct resource msm_iommu_gfx3d1_resources[] = {
232 {
233 .start = 0x07D00000,
234 .end = 0x07D00000 + SZ_1M - 1,
235 .name = "physbase",
236 .flags = IORESOURCE_MEM,
237 },
238 {
239 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700240 .start = 243,
241 .end = 243,
Joel King41d594e2011-10-14 13:18:20 -0700242 .flags = IORESOURCE_IRQ,
243 },
244 {
245 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700246 .start = 242,
247 .end = 242,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700248 .flags = IORESOURCE_IRQ,
249 },
250};
251
252static struct resource msm_iommu_gfx2d0_resources[] = {
253 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800254 .start = 0x07D00000,
255 .end = 0x07D00000 + SZ_1M - 1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700256 .name = "physbase",
257 .flags = IORESOURCE_MEM,
258 },
259 {
260 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700261 .start = 104,
262 .end = 104,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700263 .flags = IORESOURCE_IRQ,
264 },
265 {
266 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700267 .start = 103,
268 .end = 103,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700269 .flags = IORESOURCE_IRQ,
270 },
271};
272
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800273static struct resource msm_iommu_gfx2d1_resources[] = {
274 {
Stepan Moskovchenko69e21362011-02-11 12:28:17 -0800275 .start = 0x07E00000,
276 .end = 0x07E00000 + SZ_1M - 1,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800277 .name = "physbase",
278 .flags = IORESOURCE_MEM,
279 },
280 {
281 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700282 .start = 243,
283 .end = 243,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800284 .flags = IORESOURCE_IRQ,
285 },
286 {
287 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700288 .start = 242,
289 .end = 242,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800290 .flags = IORESOURCE_IRQ,
291 },
292};
293
Joel King41d594e2011-10-14 13:18:20 -0700294static struct resource msm_iommu_vcap_resources[] = {
295 {
296 .start = 0x07200000,
297 .end = 0x07200000 + SZ_1M - 1,
298 .name = "physbase",
299 .flags = IORESOURCE_MEM,
300 },
301 {
302 .name = "nonsecure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700303 .start = 269,
304 .end = 269,
Joel King41d594e2011-10-14 13:18:20 -0700305 .flags = IORESOURCE_IRQ,
306 },
307 {
308 .name = "secure_irq",
Stepan Moskovchenkoc64fd942011-10-27 17:47:58 -0700309 .start = 268,
310 .end = 268,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700311 .flags = IORESOURCE_IRQ,
312 },
313};
314
315static struct platform_device msm_root_iommu_dev = {
316 .name = "msm_iommu",
317 .id = -1,
318};
319
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800320static struct msm_iommu_dev jpegd_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700321 .name = "jpegd",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800322 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700323};
324
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800325static struct msm_iommu_dev vpe_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800326 .name = "vpe",
327 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700328};
329
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800330static struct msm_iommu_dev mdp0_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800331 .name = "mdp0",
332 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700333};
334
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800335static struct msm_iommu_dev mdp1_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800336 .name = "mdp1",
337 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700338};
339
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800340static struct msm_iommu_dev rot_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800341 .name = "rot",
342 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700343};
344
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800345static struct msm_iommu_dev ijpeg_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800346 .name = "ijpeg",
347 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700348};
349
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800350static struct msm_iommu_dev vfe_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700351 .name = "vfe",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800352 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700353};
354
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800355static struct msm_iommu_dev vcodec_a_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800356 .name = "vcodec_a",
357 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700358};
359
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800360static struct msm_iommu_dev vcodec_b_iommu = {
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800361 .name = "vcodec_b",
362 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700363};
364
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800365static struct msm_iommu_dev gfx3d_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700366 .name = "gfx3d",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800367 .ncb = 3,
Shubhraprakash Das935e6a52012-04-05 14:47:30 -0600368 .ttbr_split = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700369};
370
Joel King41d594e2011-10-14 13:18:20 -0700371static struct msm_iommu_dev gfx3d1_iommu = {
372 .name = "gfx3d1",
373 .ncb = 3,
Shubhraprakash Das935e6a52012-04-05 14:47:30 -0600374 .ttbr_split = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700375};
376
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800377static struct msm_iommu_dev gfx2d0_iommu = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700378 .name = "gfx2d0",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800379 .ncb = 2,
Shubhraprakash Das5ff63522012-04-26 16:00:05 -0600380 .ttbr_split = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700381};
382
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800383static struct msm_iommu_dev gfx2d1_iommu = {
384 .name = "gfx2d1",
Stepan Moskovchenkoa43d8c12011-02-24 18:00:42 -0800385 .ncb = 2,
Shubhraprakash Das5ff63522012-04-26 16:00:05 -0600386 .ttbr_split = 2,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800387};
388
Joel King41d594e2011-10-14 13:18:20 -0700389static struct msm_iommu_dev vcap_iommu = {
390 .name = "vcap",
391 .ncb = 2,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700392};
393
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800394static struct platform_device msm_device_iommu_jpegd = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700395 .name = "msm_iommu",
396 .id = 0,
397 .dev = {
398 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700399 .platform_data = &jpegd_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700400 },
401 .num_resources = ARRAY_SIZE(msm_iommu_jpegd_resources),
402 .resource = msm_iommu_jpegd_resources,
403};
404
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800405static struct platform_device msm_device_iommu_vpe = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700406 .name = "msm_iommu",
407 .id = 1,
408 .dev = {
409 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700410 .platform_data = &vpe_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700411 },
412 .num_resources = ARRAY_SIZE(msm_iommu_vpe_resources),
413 .resource = msm_iommu_vpe_resources,
414};
415
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800416static struct platform_device msm_device_iommu_mdp0 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700417 .name = "msm_iommu",
418 .id = 2,
419 .dev = {
420 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700421 .platform_data = &mdp0_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700422 },
423 .num_resources = ARRAY_SIZE(msm_iommu_mdp0_resources),
424 .resource = msm_iommu_mdp0_resources,
425};
426
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800427static struct platform_device msm_device_iommu_mdp1 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700428 .name = "msm_iommu",
429 .id = 3,
430 .dev = {
431 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700432 .platform_data = &mdp1_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700433 },
434 .num_resources = ARRAY_SIZE(msm_iommu_mdp1_resources),
435 .resource = msm_iommu_mdp1_resources,
436};
437
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800438static struct platform_device msm_device_iommu_rot = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700439 .name = "msm_iommu",
440 .id = 4,
441 .dev = {
442 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700443 .platform_data = &rot_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700444 },
445 .num_resources = ARRAY_SIZE(msm_iommu_rot_resources),
446 .resource = msm_iommu_rot_resources,
447};
448
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800449static struct platform_device msm_device_iommu_ijpeg = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700450 .name = "msm_iommu",
451 .id = 5,
452 .dev = {
453 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700454 .platform_data = &ijpeg_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700455 },
456 .num_resources = ARRAY_SIZE(msm_iommu_ijpeg_resources),
457 .resource = msm_iommu_ijpeg_resources,
458};
459
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800460static struct platform_device msm_device_iommu_vfe = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700461 .name = "msm_iommu",
462 .id = 6,
463 .dev = {
464 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700465 .platform_data = &vfe_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700466 },
467 .num_resources = ARRAY_SIZE(msm_iommu_vfe_resources),
468 .resource = msm_iommu_vfe_resources,
469};
470
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800471static struct platform_device msm_device_iommu_vcodec_a = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700472 .name = "msm_iommu",
473 .id = 7,
474 .dev = {
475 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700476 .platform_data = &vcodec_a_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700477 },
478 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_a_resources),
479 .resource = msm_iommu_vcodec_a_resources,
480};
481
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800482static struct platform_device msm_device_iommu_vcodec_b = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700483 .name = "msm_iommu",
484 .id = 8,
485 .dev = {
486 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700487 .platform_data = &vcodec_b_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700488 },
489 .num_resources = ARRAY_SIZE(msm_iommu_vcodec_b_resources),
490 .resource = msm_iommu_vcodec_b_resources,
491};
492
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800493static struct platform_device msm_device_iommu_gfx3d = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700494 .name = "msm_iommu",
495 .id = 9,
496 .dev = {
497 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700498 .platform_data = &gfx3d_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700499 },
500 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d_resources),
501 .resource = msm_iommu_gfx3d_resources,
502};
503
Joel King41d594e2011-10-14 13:18:20 -0700504static struct platform_device msm_device_iommu_gfx3d1 = {
505 .name = "msm_iommu",
506 .id = 10,
507 .dev = {
508 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700509 .platform_data = &gfx3d1_iommu,
Joel King41d594e2011-10-14 13:18:20 -0700510 },
511 .num_resources = ARRAY_SIZE(msm_iommu_gfx3d1_resources),
512 .resource = msm_iommu_gfx3d1_resources,
513};
514
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800515static struct platform_device msm_device_iommu_gfx2d0 = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700516 .name = "msm_iommu",
517 .id = 10,
518 .dev = {
519 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700520 .platform_data = &gfx2d0_iommu,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700521 },
522 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d0_resources),
523 .resource = msm_iommu_gfx2d0_resources,
524};
525
Joel King41d594e2011-10-14 13:18:20 -0700526static struct platform_device msm_device_iommu_gfx2d1 = {
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800527 .name = "msm_iommu",
528 .id = 11,
529 .dev = {
530 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700531 .platform_data = &gfx2d1_iommu,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800532 },
533 .num_resources = ARRAY_SIZE(msm_iommu_gfx2d1_resources),
534 .resource = msm_iommu_gfx2d1_resources,
535};
536
Joel King41d594e2011-10-14 13:18:20 -0700537static struct platform_device msm_device_iommu_vcap = {
538 .name = "msm_iommu",
539 .id = 11,
540 .dev = {
541 .parent = &msm_root_iommu_dev.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700542 .platform_data = &vcap_iommu,
Joel King41d594e2011-10-14 13:18:20 -0700543 },
544 .num_resources = ARRAY_SIZE(msm_iommu_vcap_resources),
545 .resource = msm_iommu_vcap_resources,
546};
547
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700548static struct msm_iommu_ctx_dev jpegd_src_ctx = {
549 .name = "jpegd_src",
550 .num = 0,
551 .mids = {0, -1}
552};
553
554static struct msm_iommu_ctx_dev jpegd_dst_ctx = {
555 .name = "jpegd_dst",
556 .num = 1,
557 .mids = {1, -1}
558};
559
560static struct msm_iommu_ctx_dev vpe_src_ctx = {
561 .name = "vpe_src",
562 .num = 0,
563 .mids = {0, -1}
564};
565
566static struct msm_iommu_ctx_dev vpe_dst_ctx = {
567 .name = "vpe_dst",
568 .num = 1,
569 .mids = {1, -1}
570};
571
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700572static struct msm_iommu_ctx_dev mdp_port0_cb0_ctx = {
573 .name = "mdp_port0_cb0",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700574 .num = 0,
575 .mids = {0, 2, -1}
576};
577
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700578static struct msm_iommu_ctx_dev mdp_port0_cb1_ctx = {
579 .name = "mdp_port0_cb1",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700580 .num = 1,
581 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
582};
583
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700584static struct msm_iommu_ctx_dev mdp_port1_cb0_ctx = {
585 .name = "mdp_port1_cb0",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700586 .num = 0,
587 .mids = {0, 2, -1}
588};
589
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700590static struct msm_iommu_ctx_dev mdp_port1_cb1_ctx = {
591 .name = "mdp_port1_cb1",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700592 .num = 1,
593 .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1}
594};
595
596static struct msm_iommu_ctx_dev rot_src_ctx = {
597 .name = "rot_src",
598 .num = 0,
599 .mids = {0, -1}
600};
601
602static struct msm_iommu_ctx_dev rot_dst_ctx = {
603 .name = "rot_dst",
604 .num = 1,
605 .mids = {1, -1}
606};
607
608static struct msm_iommu_ctx_dev ijpeg_src_ctx = {
609 .name = "ijpeg_src",
610 .num = 0,
611 .mids = {0, -1}
612};
613
614static struct msm_iommu_ctx_dev ijpeg_dst_ctx = {
615 .name = "ijpeg_dst",
616 .num = 1,
617 .mids = {1, -1}
618};
619
620static struct msm_iommu_ctx_dev vfe_imgwr_ctx = {
621 .name = "vfe_imgwr",
622 .num = 0,
623 .mids = {2, 3, 4, 5, 6, 7, 8, -1}
624};
625
626static struct msm_iommu_ctx_dev vfe_misc_ctx = {
627 .name = "vfe_misc",
628 .num = 1,
629 .mids = {0, 1, 9, -1}
630};
631
632static struct msm_iommu_ctx_dev vcodec_a_stream_ctx = {
633 .name = "vcodec_a_stream",
634 .num = 0,
635 .mids = {2, 5, -1}
636};
637
638static struct msm_iommu_ctx_dev vcodec_a_mm1_ctx = {
639 .name = "vcodec_a_mm1",
640 .num = 1,
641 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
642};
643
644static struct msm_iommu_ctx_dev vcodec_b_mm2_ctx = {
645 .name = "vcodec_b_mm2",
646 .num = 0,
647 .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
648};
649
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800650static struct msm_iommu_ctx_dev gfx3d_user_ctx = {
651 .name = "gfx3d_user",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700652 .num = 0,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800653 .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 -0700654};
655
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800656static struct msm_iommu_ctx_dev gfx3d_priv_ctx = {
657 .name = "gfx3d_priv",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700658 .num = 1,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800659 .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
660 31, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700661};
662
Joel King41d594e2011-10-14 13:18:20 -0700663static struct msm_iommu_ctx_dev gfx3d1_user_ctx = {
664 .name = "gfx3d1_user",
665 .num = 0,
666 .mids = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}
667};
668
669static struct msm_iommu_ctx_dev gfx3d1_priv_ctx = {
670 .name = "gfx3d1_priv",
671 .num = 1,
672 .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
673 31, -1}
674};
675
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800676static struct msm_iommu_ctx_dev gfx2d0_2d0_ctx = {
677 .name = "gfx2d0_2d0",
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700678 .num = 0,
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800679 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700680};
681
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800682static struct msm_iommu_ctx_dev gfx2d1_2d1_ctx = {
683 .name = "gfx2d1_2d1",
684 .num = 0,
685 .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1}
686};
687
Joel King41d594e2011-10-14 13:18:20 -0700688static struct msm_iommu_ctx_dev vcap_vc_ctx = {
689 .name = "vcap_vc",
690 .num = 0,
691 .mids = {0, -1}
692};
693
694static struct msm_iommu_ctx_dev vcap_vp_ctx = {
695 .name = "vcap_vp",
696 .num = 1,
697 .mids = {1, -1}
698};
699
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700700static struct platform_device msm_device_jpegd_src_ctx = {
701 .name = "msm_iommu_ctx",
702 .id = 0,
703 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800704 .parent = &msm_device_iommu_jpegd.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700705 .platform_data = &jpegd_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700706 },
707};
708
709static struct platform_device msm_device_jpegd_dst_ctx = {
710 .name = "msm_iommu_ctx",
711 .id = 1,
712 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800713 .parent = &msm_device_iommu_jpegd.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700714 .platform_data = &jpegd_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700715 },
716};
717
718static struct platform_device msm_device_vpe_src_ctx = {
719 .name = "msm_iommu_ctx",
720 .id = 2,
721 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800722 .parent = &msm_device_iommu_vpe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700723 .platform_data = &vpe_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700724 },
725};
726
727static struct platform_device msm_device_vpe_dst_ctx = {
728 .name = "msm_iommu_ctx",
729 .id = 3,
730 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800731 .parent = &msm_device_iommu_vpe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700732 .platform_data = &vpe_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700733 },
734};
735
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700736static struct platform_device msm_device_mdp_port0_cb0_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700737 .name = "msm_iommu_ctx",
738 .id = 4,
739 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800740 .parent = &msm_device_iommu_mdp0.dev,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700741 .platform_data = &mdp_port0_cb0_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700742 },
743};
744
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700745static struct platform_device msm_device_mdp_port0_cb1_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700746 .name = "msm_iommu_ctx",
747 .id = 5,
748 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800749 .parent = &msm_device_iommu_mdp0.dev,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700750 .platform_data = &mdp_port0_cb1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700751 },
752};
753
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700754static struct platform_device msm_device_mdp_port1_cb0_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700755 .name = "msm_iommu_ctx",
756 .id = 6,
757 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800758 .parent = &msm_device_iommu_mdp1.dev,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700759 .platform_data = &mdp_port1_cb0_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700760 },
761};
762
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700763static struct platform_device msm_device_mdp_port1_cb1_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700764 .name = "msm_iommu_ctx",
765 .id = 7,
766 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800767 .parent = &msm_device_iommu_mdp1.dev,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700768 .platform_data = &mdp_port1_cb1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700769 },
770};
771
772static struct platform_device msm_device_rot_src_ctx = {
773 .name = "msm_iommu_ctx",
774 .id = 8,
775 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800776 .parent = &msm_device_iommu_rot.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700777 .platform_data = &rot_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700778 },
779};
780
781static struct platform_device msm_device_rot_dst_ctx = {
782 .name = "msm_iommu_ctx",
783 .id = 9,
784 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800785 .parent = &msm_device_iommu_rot.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700786 .platform_data = &rot_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700787 },
788};
789
790static struct platform_device msm_device_ijpeg_src_ctx = {
791 .name = "msm_iommu_ctx",
792 .id = 10,
793 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800794 .parent = &msm_device_iommu_ijpeg.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700795 .platform_data = &ijpeg_src_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700796 },
797};
798
799static struct platform_device msm_device_ijpeg_dst_ctx = {
800 .name = "msm_iommu_ctx",
801 .id = 11,
802 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800803 .parent = &msm_device_iommu_ijpeg.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700804 .platform_data = &ijpeg_dst_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700805 },
806};
807
808static struct platform_device msm_device_vfe_imgwr_ctx = {
809 .name = "msm_iommu_ctx",
810 .id = 12,
811 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800812 .parent = &msm_device_iommu_vfe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700813 .platform_data = &vfe_imgwr_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700814 },
815};
816
817static struct platform_device msm_device_vfe_misc_ctx = {
818 .name = "msm_iommu_ctx",
819 .id = 13,
820 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800821 .parent = &msm_device_iommu_vfe.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700822 .platform_data = &vfe_misc_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700823 },
824};
825
826static struct platform_device msm_device_vcodec_a_stream_ctx = {
827 .name = "msm_iommu_ctx",
828 .id = 14,
829 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800830 .parent = &msm_device_iommu_vcodec_a.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700831 .platform_data = &vcodec_a_stream_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700832 },
833};
834
835static struct platform_device msm_device_vcodec_a_mm1_ctx = {
836 .name = "msm_iommu_ctx",
837 .id = 15,
838 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800839 .parent = &msm_device_iommu_vcodec_a.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700840 .platform_data = &vcodec_a_mm1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700841 },
842};
843
844static struct platform_device msm_device_vcodec_b_mm2_ctx = {
845 .name = "msm_iommu_ctx",
846 .id = 16,
847 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800848 .parent = &msm_device_iommu_vcodec_b.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700849 .platform_data = &vcodec_b_mm2_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700850 },
851};
852
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800853static struct platform_device msm_device_gfx3d_user_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700854 .name = "msm_iommu_ctx",
855 .id = 17,
856 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800857 .parent = &msm_device_iommu_gfx3d.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700858 .platform_data = &gfx3d_user_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700859 },
860};
861
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800862static struct platform_device msm_device_gfx3d_priv_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700863 .name = "msm_iommu_ctx",
864 .id = 18,
865 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800866 .parent = &msm_device_iommu_gfx3d.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700867 .platform_data = &gfx3d_priv_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700868 },
869};
870
Joel King41d594e2011-10-14 13:18:20 -0700871static struct platform_device msm_device_gfx3d1_user_ctx = {
872 .name = "msm_iommu_ctx",
873 .id = 19,
874 .dev = {
875 .parent = &msm_device_iommu_gfx3d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700876 .platform_data = &gfx3d1_user_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700877 },
878};
879
880static struct platform_device msm_device_gfx3d1_priv_ctx = {
881 .name = "msm_iommu_ctx",
882 .id = 20,
883 .dev = {
884 .parent = &msm_device_iommu_gfx3d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700885 .platform_data = &gfx3d1_priv_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700886 },
887};
888
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800889static struct platform_device msm_device_gfx2d0_2d0_ctx = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700890 .name = "msm_iommu_ctx",
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800891 .id = 19,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700892 .dev = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800893 .parent = &msm_device_iommu_gfx2d0.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700894 .platform_data = &gfx2d0_2d0_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700895 },
896};
897
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800898static struct platform_device msm_device_gfx2d1_2d1_ctx = {
899 .name = "msm_iommu_ctx",
900 .id = 20,
901 .dev = {
902 .parent = &msm_device_iommu_gfx2d1.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700903 .platform_data = &gfx2d1_2d1_ctx,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800904 },
905};
906
Joel King41d594e2011-10-14 13:18:20 -0700907static struct platform_device msm_device_vcap_vc_ctx = {
908 .name = "msm_iommu_ctx",
909 .id = 21,
910 .dev = {
911 .parent = &msm_device_iommu_vcap.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700912 .platform_data = &vcap_vc_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700913 },
914};
915
916static struct platform_device msm_device_vcap_vp_ctx = {
917 .name = "msm_iommu_ctx",
918 .id = 22,
919 .dev = {
920 .parent = &msm_device_iommu_vcap.dev,
Stepan Moskovchenko8eea9412012-03-13 17:58:13 -0700921 .platform_data = &vcap_vp_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700922 },
923};
924
925static struct platform_device *msm_iommu_common_devs[] = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800926 &msm_device_iommu_vpe,
927 &msm_device_iommu_mdp0,
928 &msm_device_iommu_mdp1,
929 &msm_device_iommu_rot,
930 &msm_device_iommu_ijpeg,
931 &msm_device_iommu_vfe,
932 &msm_device_iommu_vcodec_a,
933 &msm_device_iommu_vcodec_b,
934 &msm_device_iommu_gfx3d,
Joel King41d594e2011-10-14 13:18:20 -0700935};
936
937static struct platform_device *msm_iommu_gfx2d_devs[] = {
Stepan Moskovchenko12943322010-11-12 19:29:49 -0800938 &msm_device_iommu_gfx2d0,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800939 &msm_device_iommu_gfx2d1,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700940};
941
Joel Kingb82921f2012-08-19 22:36:42 -0700942static struct platform_device *msm_iommu_adreno3xx_gfx_devs[] = {
Joel King41d594e2011-10-14 13:18:20 -0700943 &msm_device_iommu_gfx3d1,
Joel Kingb82921f2012-08-19 22:36:42 -0700944};
945
946static struct platform_device *msm_iommu_vcap_devs[] = {
Joel King41d594e2011-10-14 13:18:20 -0700947 &msm_device_iommu_vcap,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700948};
949
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -0700950static struct platform_device *msm_iommu_jpegd_devs[] = {
951 &msm_device_iommu_jpegd,
952};
953
Joel King41d594e2011-10-14 13:18:20 -0700954static struct platform_device *msm_iommu_common_ctx_devs[] = {
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700955 &msm_device_vpe_src_ctx,
956 &msm_device_vpe_dst_ctx,
Ravishangar Kalyaname9658eb2012-05-15 14:58:55 -0700957 &msm_device_mdp_port0_cb0_ctx,
958 &msm_device_mdp_port0_cb1_ctx,
959 &msm_device_mdp_port1_cb0_ctx,
960 &msm_device_mdp_port1_cb1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700961 &msm_device_rot_src_ctx,
962 &msm_device_rot_dst_ctx,
963 &msm_device_ijpeg_src_ctx,
964 &msm_device_ijpeg_dst_ctx,
965 &msm_device_vfe_imgwr_ctx,
966 &msm_device_vfe_misc_ctx,
967 &msm_device_vcodec_a_stream_ctx,
968 &msm_device_vcodec_a_mm1_ctx,
969 &msm_device_vcodec_b_mm2_ctx,
Stepan Moskovchenkoa5fcd5f2010-11-12 19:29:50 -0800970 &msm_device_gfx3d_user_ctx,
971 &msm_device_gfx3d_priv_ctx,
Joel King41d594e2011-10-14 13:18:20 -0700972};
973
974static struct platform_device *msm_iommu_gfx2d_ctx_devs[] = {
Stepan Moskovchenkoff25ff82010-11-12 19:29:51 -0800975 &msm_device_gfx2d0_2d0_ctx,
Stepan Moskovchenkoe8952e32010-11-12 19:29:52 -0800976 &msm_device_gfx2d1_2d1_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700977};
978
Joel Kingb82921f2012-08-19 22:36:42 -0700979static struct platform_device *msm_iommu_adreno3xx_ctx_devs[] = {
Joel King41d594e2011-10-14 13:18:20 -0700980 &msm_device_gfx3d1_user_ctx,
981 &msm_device_gfx3d1_priv_ctx,
Joel Kingb82921f2012-08-19 22:36:42 -0700982};
983
984static struct platform_device *msm_iommu_vcap_ctx_devs[] = {
Joel King41d594e2011-10-14 13:18:20 -0700985 &msm_device_vcap_vc_ctx,
986 &msm_device_vcap_vp_ctx,
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700987};
988
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -0700989static struct platform_device *msm_iommu_jpegd_ctx_devs[] = {
990 &msm_device_jpegd_src_ctx,
991 &msm_device_jpegd_dst_ctx,
992};
993
Joel King41d594e2011-10-14 13:18:20 -0700994static int __init iommu_init(void)
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -0700995{
Joel King41d594e2011-10-14 13:18:20 -0700996 int ret;
Sathish Ambleyd1b89ed2012-02-07 21:47:47 -0800997 if (!msm_soc_version_supports_iommu_v1()) {
998 pr_err("IOMMU v1 is not supported on this SoC version.\n");
Stepan Moskovchenko75f1e672011-10-21 19:49:44 -0700999 return -ENODEV;
1000 }
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001001
1002 ret = platform_device_register(&msm_root_iommu_dev);
1003 if (ret != 0) {
1004 pr_err("Failed to register root IOMMU device!\n");
1005 goto failure;
1006 }
1007
Joel King41d594e2011-10-14 13:18:20 -07001008 /* Initialize common devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001009 platform_add_devices(msm_iommu_common_devs,
1010 ARRAY_SIZE(msm_iommu_common_devs));
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001011
Joel King41d594e2011-10-14 13:18:20 -07001012 /* Initialize soc-specific devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001013 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1014 platform_add_devices(msm_iommu_jpegd_devs,
1015 ARRAY_SIZE(msm_iommu_jpegd_devs));
1016 platform_add_devices(msm_iommu_gfx2d_devs,
1017 ARRAY_SIZE(msm_iommu_gfx2d_devs));
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001018 }
1019
Stepan Moskovchenko9c749262012-07-09 19:30:44 -07001020 if (cpu_is_apq8064() || cpu_is_msm8960ab()) {
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001021 platform_add_devices(msm_iommu_jpegd_devs,
1022 ARRAY_SIZE(msm_iommu_jpegd_devs));
Joel Kingb82921f2012-08-19 22:36:42 -07001023 platform_add_devices(msm_iommu_adreno3xx_gfx_devs,
1024 ARRAY_SIZE(msm_iommu_adreno3xx_gfx_devs));
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001025 }
Joel Kingb82921f2012-08-19 22:36:42 -07001026 if (cpu_is_apq8064())
1027 platform_add_devices(msm_iommu_vcap_devs,
1028 ARRAY_SIZE(msm_iommu_vcap_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001029
Joel King41d594e2011-10-14 13:18:20 -07001030 /* Initialize common ctx_devs */
Stepan Moskovchenko6ca487f2012-03-13 18:12:29 -07001031 ret = platform_add_devices(msm_iommu_common_ctx_devs,
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001032 ARRAY_SIZE(msm_iommu_common_ctx_devs));
Joel King41d594e2011-10-14 13:18:20 -07001033
1034 /* Initialize soc-specific ctx_devs */
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001035 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1036 platform_add_devices(msm_iommu_jpegd_ctx_devs,
1037 ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
1038 platform_add_devices(msm_iommu_gfx2d_ctx_devs,
1039 ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs));
Joel King41d594e2011-10-14 13:18:20 -07001040 }
Joel King41d594e2011-10-14 13:18:20 -07001041
Stepan Moskovchenko9c749262012-07-09 19:30:44 -07001042 if (cpu_is_apq8064() || cpu_is_msm8960ab()) {
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001043 platform_add_devices(msm_iommu_jpegd_ctx_devs,
1044 ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
Joel Kingb82921f2012-08-19 22:36:42 -07001045
1046 platform_add_devices(msm_iommu_adreno3xx_ctx_devs,
1047 ARRAY_SIZE(msm_iommu_adreno3xx_ctx_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001048 }
Joel Kingb82921f2012-08-19 22:36:42 -07001049 if (cpu_is_apq8064())
1050 platform_add_devices(msm_iommu_vcap_ctx_devs,
1051 ARRAY_SIZE(msm_iommu_vcap_ctx_devs));
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001052
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001053 return 0;
1054
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001055failure:
1056 return ret;
1057}
1058
Joel King41d594e2011-10-14 13:18:20 -07001059static void __exit iommu_exit(void)
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001060{
1061 int i;
1062
Joel King41d594e2011-10-14 13:18:20 -07001063 /* Common ctx_devs */
1064 for (i = 0; i < ARRAY_SIZE(msm_iommu_common_ctx_devs); i++)
1065 platform_device_unregister(msm_iommu_common_ctx_devs[i]);
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001066
Joel King41d594e2011-10-14 13:18:20 -07001067 /* Common devs. */
1068 for (i = 0; i < ARRAY_SIZE(msm_iommu_common_devs); ++i)
1069 platform_device_unregister(msm_iommu_common_devs[i]);
1070
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001071 if (cpu_is_msm8x60() || cpu_is_msm8960()) {
1072 for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs); i++)
1073 platform_device_unregister(msm_iommu_gfx2d_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
Joel King41d594e2011-10-14 13:18:20 -07001078 for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_devs); i++)
1079 platform_device_unregister(msm_iommu_gfx2d_devs[i]);
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001080
1081 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
1082 platform_device_unregister(msm_iommu_jpegd_devs[i]);
Joel King41d594e2011-10-14 13:18:20 -07001083 }
Joel Kingb82921f2012-08-19 22:36:42 -07001084 if (cpu_is_apq8064()) {
1085 for (i = 0; i < ARRAY_SIZE(msm_iommu_vcap_ctx_devs); i++)
1086 platform_device_unregister(msm_iommu_vcap_ctx_devs[i]);
1087 }
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001088
Stepan Moskovchenko9c749262012-07-09 19:30:44 -07001089 if (cpu_is_apq8064() || cpu_is_msm8960ab()) {
Joel Kingb82921f2012-08-19 22:36:42 -07001090 for (i = 0; i < ARRAY_SIZE(msm_iommu_adreno3xx_ctx_devs);
1091 i++)
1092 platform_device_unregister(
1093 msm_iommu_adreno3xx_ctx_devs[i]);
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001094
Joel Kingb82921f2012-08-19 22:36:42 -07001095 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs);
1096 i++)
1097 platform_device_unregister(
1098 msm_iommu_jpegd_ctx_devs[i]);
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001099
Joel Kingb82921f2012-08-19 22:36:42 -07001100 if (cpu_is_apq8064()) {
1101 for (i = 0; i < ARRAY_SIZE(msm_iommu_vcap_devs);
1102 i++)
1103 platform_device_unregister(
1104 msm_iommu_vcap_devs[i]);
1105 }
1106
1107 for (i = 0; i < ARRAY_SIZE(msm_iommu_adreno3xx_gfx_devs);
1108 i++)
1109 platform_device_unregister(
1110 msm_iommu_adreno3xx_gfx_devs[i]);
Stepan Moskovchenko04f7d052012-03-22 13:33:48 -07001111
Stepan Moskovchenko0951b8c2012-03-13 19:02:04 -07001112 for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
1113 platform_device_unregister(msm_iommu_jpegd_devs[i]);
1114 }
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001115
1116 platform_device_unregister(&msm_root_iommu_dev);
1117}
1118
Joel King41d594e2011-10-14 13:18:20 -07001119subsys_initcall(iommu_init);
1120module_exit(iommu_exit);
Stepan Moskovchenkod9c82792010-08-24 19:51:15 -07001121
1122MODULE_LICENSE("GPL v2");
1123MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");