Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 2 | * |
| 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 Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/bootmem.h> |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 16 | #include <mach/irqs.h> |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 17 | #include <mach/iommu.h> |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 18 | #include <mach/socinfo.h> |
| 19 | #include <mach/irqs-8960.h> |
| 20 | #include <mach/irqs-8064.h> |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 21 | |
| 22 | static struct resource msm_iommu_jpegd_resources[] = { |
| 23 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 24 | .start = 0x07300000, |
| 25 | .end = 0x07300000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 26 | .name = "physbase", |
| 27 | .flags = IORESOURCE_MEM, |
| 28 | }, |
| 29 | { |
| 30 | .name = "nonsecure_irq", |
| 31 | .start = SMMU_JPEGD_CB_SC_NON_SECURE_IRQ, |
| 32 | .end = SMMU_JPEGD_CB_SC_NON_SECURE_IRQ, |
| 33 | .flags = IORESOURCE_IRQ, |
| 34 | }, |
| 35 | { |
| 36 | .name = "secure_irq", |
| 37 | .start = SMMU_JPEGD_CB_SC_SECURE_IRQ, |
| 38 | .end = SMMU_JPEGD_CB_SC_SECURE_IRQ, |
| 39 | .flags = IORESOURCE_IRQ, |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | static struct resource msm_iommu_vpe_resources[] = { |
| 44 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 45 | .start = 0x07400000, |
| 46 | .end = 0x07400000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 47 | .name = "physbase", |
| 48 | .flags = IORESOURCE_MEM, |
| 49 | }, |
| 50 | { |
| 51 | .name = "nonsecure_irq", |
| 52 | .start = SMMU_VPE_CB_SC_NON_SECURE_IRQ, |
| 53 | .end = SMMU_VPE_CB_SC_NON_SECURE_IRQ, |
| 54 | .flags = IORESOURCE_IRQ, |
| 55 | }, |
| 56 | { |
| 57 | .name = "secure_irq", |
| 58 | .start = SMMU_VPE_CB_SC_SECURE_IRQ, |
| 59 | .end = SMMU_VPE_CB_SC_SECURE_IRQ, |
| 60 | .flags = IORESOURCE_IRQ, |
| 61 | }, |
| 62 | }; |
| 63 | |
| 64 | static struct resource msm_iommu_mdp0_resources[] = { |
| 65 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 66 | .start = 0x07500000, |
| 67 | .end = 0x07500000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 68 | .name = "physbase", |
| 69 | .flags = IORESOURCE_MEM, |
| 70 | }, |
| 71 | { |
| 72 | .name = "nonsecure_irq", |
| 73 | .start = SMMU_MDP0_CB_SC_NON_SECURE_IRQ, |
| 74 | .end = SMMU_MDP0_CB_SC_NON_SECURE_IRQ, |
| 75 | .flags = IORESOURCE_IRQ, |
| 76 | }, |
| 77 | { |
| 78 | .name = "secure_irq", |
| 79 | .start = SMMU_MDP0_CB_SC_SECURE_IRQ, |
| 80 | .end = SMMU_MDP0_CB_SC_SECURE_IRQ, |
| 81 | .flags = IORESOURCE_IRQ, |
| 82 | }, |
| 83 | }; |
| 84 | |
| 85 | static struct resource msm_iommu_mdp1_resources[] = { |
| 86 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 87 | .start = 0x07600000, |
| 88 | .end = 0x07600000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 89 | .name = "physbase", |
| 90 | .flags = IORESOURCE_MEM, |
| 91 | }, |
| 92 | { |
| 93 | .name = "nonsecure_irq", |
| 94 | .start = SMMU_MDP1_CB_SC_NON_SECURE_IRQ, |
| 95 | .end = SMMU_MDP1_CB_SC_NON_SECURE_IRQ, |
| 96 | .flags = IORESOURCE_IRQ, |
| 97 | }, |
| 98 | { |
| 99 | .name = "secure_irq", |
| 100 | .start = SMMU_MDP1_CB_SC_SECURE_IRQ, |
| 101 | .end = SMMU_MDP1_CB_SC_SECURE_IRQ, |
| 102 | .flags = IORESOURCE_IRQ, |
| 103 | }, |
| 104 | }; |
| 105 | |
| 106 | static struct resource msm_iommu_rot_resources[] = { |
| 107 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 108 | .start = 0x07700000, |
| 109 | .end = 0x07700000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 110 | .name = "physbase", |
| 111 | .flags = IORESOURCE_MEM, |
| 112 | }, |
| 113 | { |
| 114 | .name = "nonsecure_irq", |
| 115 | .start = SMMU_ROT_CB_SC_NON_SECURE_IRQ, |
| 116 | .end = SMMU_ROT_CB_SC_NON_SECURE_IRQ, |
| 117 | .flags = IORESOURCE_IRQ, |
| 118 | }, |
| 119 | { |
| 120 | .name = "secure_irq", |
| 121 | .start = SMMU_ROT_CB_SC_SECURE_IRQ, |
| 122 | .end = SMMU_ROT_CB_SC_SECURE_IRQ, |
| 123 | .flags = IORESOURCE_IRQ, |
| 124 | }, |
| 125 | }; |
| 126 | |
| 127 | static struct resource msm_iommu_ijpeg_resources[] = { |
| 128 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 129 | .start = 0x07800000, |
| 130 | .end = 0x07800000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 131 | .name = "physbase", |
| 132 | .flags = IORESOURCE_MEM, |
| 133 | }, |
| 134 | { |
| 135 | .name = "nonsecure_irq", |
| 136 | .start = SMMU_IJPEG_CB_SC_NON_SECURE_IRQ, |
| 137 | .end = SMMU_IJPEG_CB_SC_NON_SECURE_IRQ, |
| 138 | .flags = IORESOURCE_IRQ, |
| 139 | }, |
| 140 | { |
| 141 | .name = "secure_irq", |
| 142 | .start = SMMU_IJPEG_CB_SC_SECURE_IRQ, |
| 143 | .end = SMMU_IJPEG_CB_SC_SECURE_IRQ, |
| 144 | .flags = IORESOURCE_IRQ, |
| 145 | }, |
| 146 | }; |
| 147 | |
| 148 | static struct resource msm_iommu_vfe_resources[] = { |
| 149 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 150 | .start = 0x07900000, |
| 151 | .end = 0x07900000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 152 | .name = "physbase", |
| 153 | .flags = IORESOURCE_MEM, |
| 154 | }, |
| 155 | { |
| 156 | .name = "nonsecure_irq", |
| 157 | .start = SMMU_VFE_CB_SC_NON_SECURE_IRQ, |
| 158 | .end = SMMU_VFE_CB_SC_NON_SECURE_IRQ, |
| 159 | .flags = IORESOURCE_IRQ, |
| 160 | }, |
| 161 | { |
| 162 | .name = "secure_irq", |
| 163 | .start = SMMU_VFE_CB_SC_SECURE_IRQ, |
| 164 | .end = SMMU_VFE_CB_SC_SECURE_IRQ, |
| 165 | .flags = IORESOURCE_IRQ, |
| 166 | }, |
| 167 | }; |
| 168 | |
| 169 | static struct resource msm_iommu_vcodec_a_resources[] = { |
| 170 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 171 | .start = 0x07A00000, |
| 172 | .end = 0x07A00000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 173 | .name = "physbase", |
| 174 | .flags = IORESOURCE_MEM, |
| 175 | }, |
| 176 | { |
| 177 | .name = "nonsecure_irq", |
| 178 | .start = SMMU_VCODEC_A_CB_SC_NON_SECURE_IRQ, |
| 179 | .end = SMMU_VCODEC_A_CB_SC_NON_SECURE_IRQ, |
| 180 | .flags = IORESOURCE_IRQ, |
| 181 | }, |
| 182 | { |
| 183 | .name = "secure_irq", |
| 184 | .start = SMMU_VCODEC_A_CB_SC_SECURE_IRQ, |
| 185 | .end = SMMU_VCODEC_A_CB_SC_SECURE_IRQ, |
| 186 | .flags = IORESOURCE_IRQ, |
| 187 | }, |
| 188 | }; |
| 189 | |
| 190 | static struct resource msm_iommu_vcodec_b_resources[] = { |
| 191 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 192 | .start = 0x07B00000, |
| 193 | .end = 0x07B00000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 194 | .name = "physbase", |
| 195 | .flags = IORESOURCE_MEM, |
| 196 | }, |
| 197 | { |
| 198 | .name = "nonsecure_irq", |
| 199 | .start = SMMU_VCODEC_B_CB_SC_NON_SECURE_IRQ, |
| 200 | .end = SMMU_VCODEC_B_CB_SC_NON_SECURE_IRQ, |
| 201 | .flags = IORESOURCE_IRQ, |
| 202 | }, |
| 203 | { |
| 204 | .name = "secure_irq", |
| 205 | .start = SMMU_VCODEC_B_CB_SC_SECURE_IRQ, |
| 206 | .end = SMMU_VCODEC_B_CB_SC_SECURE_IRQ, |
| 207 | .flags = IORESOURCE_IRQ, |
| 208 | }, |
| 209 | }; |
| 210 | |
| 211 | static struct resource msm_iommu_gfx3d_resources[] = { |
| 212 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 213 | .start = 0x07C00000, |
| 214 | .end = 0x07C00000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 215 | .name = "physbase", |
| 216 | .flags = IORESOURCE_MEM, |
| 217 | }, |
| 218 | { |
| 219 | .name = "nonsecure_irq", |
| 220 | .start = SMMU_GFX3D_CB_SC_NON_SECURE_IRQ, |
| 221 | .end = SMMU_GFX3D_CB_SC_NON_SECURE_IRQ, |
| 222 | .flags = IORESOURCE_IRQ, |
| 223 | }, |
| 224 | { |
| 225 | .name = "secure_irq", |
| 226 | .start = SMMU_GFX3D_CB_SC_SECURE_IRQ, |
| 227 | .end = SMMU_GFX3D_CB_SC_SECURE_IRQ, |
| 228 | .flags = IORESOURCE_IRQ, |
| 229 | }, |
| 230 | }; |
| 231 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 232 | static struct resource msm_iommu_gfx3d1_resources[] = { |
| 233 | { |
| 234 | .start = 0x07D00000, |
| 235 | .end = 0x07D00000 + SZ_1M - 1, |
| 236 | .name = "physbase", |
| 237 | .flags = IORESOURCE_MEM, |
| 238 | }, |
| 239 | { |
| 240 | .name = "nonsecure_irq", |
| 241 | .start = SMMU_GFX3D1_CB_SC_NON_SECURE_IRQ, |
| 242 | .end = SMMU_GFX3D1_CB_SC_NON_SECURE_IRQ, |
| 243 | .flags = IORESOURCE_IRQ, |
| 244 | }, |
| 245 | { |
| 246 | .name = "secure_irq", |
| 247 | .start = SMMU_GFX3D1_CB_SC_SECURE_IRQ, |
| 248 | .end = SMMU_GFX3D1_CB_SC_SECURE_IRQ, |
| 249 | .flags = IORESOURCE_IRQ, |
| 250 | }, |
| 251 | }; |
| 252 | |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 253 | static struct resource msm_iommu_gfx2d0_resources[] = { |
| 254 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 255 | .start = 0x07D00000, |
| 256 | .end = 0x07D00000 + SZ_1M - 1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 257 | .name = "physbase", |
| 258 | .flags = IORESOURCE_MEM, |
| 259 | }, |
| 260 | { |
| 261 | .name = "nonsecure_irq", |
| 262 | .start = SMMU_GFX2D0_CB_SC_NON_SECURE_IRQ, |
| 263 | .end = SMMU_GFX2D0_CB_SC_NON_SECURE_IRQ, |
| 264 | .flags = IORESOURCE_IRQ, |
| 265 | }, |
| 266 | { |
| 267 | .name = "secure_irq", |
| 268 | .start = SMMU_GFX2D0_CB_SC_SECURE_IRQ, |
| 269 | .end = SMMU_GFX2D0_CB_SC_SECURE_IRQ, |
| 270 | .flags = IORESOURCE_IRQ, |
| 271 | }, |
| 272 | }; |
| 273 | |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 274 | static struct resource msm_iommu_gfx2d1_resources[] = { |
| 275 | { |
Stepan Moskovchenko | 69e2136 | 2011-02-11 12:28:17 -0800 | [diff] [blame] | 276 | .start = 0x07E00000, |
| 277 | .end = 0x07E00000 + SZ_1M - 1, |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 278 | .name = "physbase", |
| 279 | .flags = IORESOURCE_MEM, |
| 280 | }, |
| 281 | { |
| 282 | .name = "nonsecure_irq", |
| 283 | .start = SMMU_GFX2D1_CB_SC_NON_SECURE_IRQ, |
| 284 | .end = SMMU_GFX2D1_CB_SC_NON_SECURE_IRQ, |
| 285 | .flags = IORESOURCE_IRQ, |
| 286 | }, |
| 287 | { |
| 288 | .name = "secure_irq", |
| 289 | .start = SMMU_GFX2D1_CB_SC_SECURE_IRQ, |
| 290 | .end = SMMU_GFX2D1_CB_SC_SECURE_IRQ, |
| 291 | .flags = IORESOURCE_IRQ, |
| 292 | }, |
| 293 | }; |
| 294 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 295 | static struct resource msm_iommu_vcap_resources[] = { |
| 296 | { |
| 297 | .start = 0x07200000, |
| 298 | .end = 0x07200000 + SZ_1M - 1, |
| 299 | .name = "physbase", |
| 300 | .flags = IORESOURCE_MEM, |
| 301 | }, |
| 302 | { |
| 303 | .name = "nonsecure_irq", |
| 304 | .start = SMMU_VCAP_CB_SC_NON_SECURE_IRQ, |
| 305 | .end = SMMU_VCAP_CB_SC_NON_SECURE_IRQ, |
| 306 | .flags = IORESOURCE_IRQ, |
| 307 | }, |
| 308 | { |
| 309 | .name = "secure_irq", |
| 310 | .start = SMMU_VCAP_CB_SC_SECURE_IRQ, |
| 311 | .end = SMMU_VCAP_CB_SC_SECURE_IRQ, |
| 312 | .flags = IORESOURCE_IRQ, |
| 313 | }, |
| 314 | }; |
| 315 | |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 316 | static struct platform_device msm_root_iommu_dev = { |
| 317 | .name = "msm_iommu", |
| 318 | .id = -1, |
| 319 | }; |
| 320 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 321 | static struct msm_iommu_dev jpegd_iommu = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 322 | .name = "jpegd", |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 323 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 324 | }; |
| 325 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 326 | static struct msm_iommu_dev vpe_iommu = { |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 327 | .name = "vpe", |
| 328 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 329 | }; |
| 330 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 331 | static struct msm_iommu_dev mdp0_iommu = { |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 332 | .name = "mdp0", |
| 333 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 334 | }; |
| 335 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 336 | static struct msm_iommu_dev mdp1_iommu = { |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 337 | .name = "mdp1", |
| 338 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 339 | }; |
| 340 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 341 | static struct msm_iommu_dev rot_iommu = { |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 342 | .name = "rot", |
| 343 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 344 | }; |
| 345 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 346 | static struct msm_iommu_dev ijpeg_iommu = { |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 347 | .name = "ijpeg", |
| 348 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 349 | }; |
| 350 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 351 | static struct msm_iommu_dev vfe_iommu = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 352 | .name = "vfe", |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 353 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 354 | }; |
| 355 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 356 | static struct msm_iommu_dev vcodec_a_iommu = { |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 357 | .name = "vcodec_a", |
| 358 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 359 | }; |
| 360 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 361 | static struct msm_iommu_dev vcodec_b_iommu = { |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 362 | .name = "vcodec_b", |
| 363 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 364 | }; |
| 365 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 366 | static struct msm_iommu_dev gfx3d_iommu = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 367 | .name = "gfx3d", |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 368 | .ncb = 3, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 369 | }; |
| 370 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 371 | static struct msm_iommu_dev gfx3d1_iommu = { |
| 372 | .name = "gfx3d1", |
| 373 | .ncb = 3, |
| 374 | }; |
| 375 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 376 | static struct msm_iommu_dev gfx2d0_iommu = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 377 | .name = "gfx2d0", |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 378 | .ncb = 2, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 379 | }; |
| 380 | |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 381 | static struct msm_iommu_dev gfx2d1_iommu = { |
| 382 | .name = "gfx2d1", |
Stepan Moskovchenko | a43d8c1 | 2011-02-24 18:00:42 -0800 | [diff] [blame] | 383 | .ncb = 2, |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 384 | }; |
| 385 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 386 | static struct msm_iommu_dev vcap_iommu = { |
| 387 | .name = "vcap", |
| 388 | .ncb = 2, |
| 389 | }; |
| 390 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 391 | static struct platform_device msm_device_iommu_jpegd = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 392 | .name = "msm_iommu", |
| 393 | .id = 0, |
| 394 | .dev = { |
| 395 | .parent = &msm_root_iommu_dev.dev, |
| 396 | }, |
| 397 | .num_resources = ARRAY_SIZE(msm_iommu_jpegd_resources), |
| 398 | .resource = msm_iommu_jpegd_resources, |
| 399 | }; |
| 400 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 401 | static struct platform_device msm_device_iommu_vpe = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 402 | .name = "msm_iommu", |
| 403 | .id = 1, |
| 404 | .dev = { |
| 405 | .parent = &msm_root_iommu_dev.dev, |
| 406 | }, |
| 407 | .num_resources = ARRAY_SIZE(msm_iommu_vpe_resources), |
| 408 | .resource = msm_iommu_vpe_resources, |
| 409 | }; |
| 410 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 411 | static struct platform_device msm_device_iommu_mdp0 = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 412 | .name = "msm_iommu", |
| 413 | .id = 2, |
| 414 | .dev = { |
| 415 | .parent = &msm_root_iommu_dev.dev, |
| 416 | }, |
| 417 | .num_resources = ARRAY_SIZE(msm_iommu_mdp0_resources), |
| 418 | .resource = msm_iommu_mdp0_resources, |
| 419 | }; |
| 420 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 421 | static struct platform_device msm_device_iommu_mdp1 = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 422 | .name = "msm_iommu", |
| 423 | .id = 3, |
| 424 | .dev = { |
| 425 | .parent = &msm_root_iommu_dev.dev, |
| 426 | }, |
| 427 | .num_resources = ARRAY_SIZE(msm_iommu_mdp1_resources), |
| 428 | .resource = msm_iommu_mdp1_resources, |
| 429 | }; |
| 430 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 431 | static struct platform_device msm_device_iommu_rot = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 432 | .name = "msm_iommu", |
| 433 | .id = 4, |
| 434 | .dev = { |
| 435 | .parent = &msm_root_iommu_dev.dev, |
| 436 | }, |
| 437 | .num_resources = ARRAY_SIZE(msm_iommu_rot_resources), |
| 438 | .resource = msm_iommu_rot_resources, |
| 439 | }; |
| 440 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 441 | static struct platform_device msm_device_iommu_ijpeg = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 442 | .name = "msm_iommu", |
| 443 | .id = 5, |
| 444 | .dev = { |
| 445 | .parent = &msm_root_iommu_dev.dev, |
| 446 | }, |
| 447 | .num_resources = ARRAY_SIZE(msm_iommu_ijpeg_resources), |
| 448 | .resource = msm_iommu_ijpeg_resources, |
| 449 | }; |
| 450 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 451 | static struct platform_device msm_device_iommu_vfe = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 452 | .name = "msm_iommu", |
| 453 | .id = 6, |
| 454 | .dev = { |
| 455 | .parent = &msm_root_iommu_dev.dev, |
| 456 | }, |
| 457 | .num_resources = ARRAY_SIZE(msm_iommu_vfe_resources), |
| 458 | .resource = msm_iommu_vfe_resources, |
| 459 | }; |
| 460 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 461 | static struct platform_device msm_device_iommu_vcodec_a = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 462 | .name = "msm_iommu", |
| 463 | .id = 7, |
| 464 | .dev = { |
| 465 | .parent = &msm_root_iommu_dev.dev, |
| 466 | }, |
| 467 | .num_resources = ARRAY_SIZE(msm_iommu_vcodec_a_resources), |
| 468 | .resource = msm_iommu_vcodec_a_resources, |
| 469 | }; |
| 470 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 471 | static struct platform_device msm_device_iommu_vcodec_b = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 472 | .name = "msm_iommu", |
| 473 | .id = 8, |
| 474 | .dev = { |
| 475 | .parent = &msm_root_iommu_dev.dev, |
| 476 | }, |
| 477 | .num_resources = ARRAY_SIZE(msm_iommu_vcodec_b_resources), |
| 478 | .resource = msm_iommu_vcodec_b_resources, |
| 479 | }; |
| 480 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 481 | static struct platform_device msm_device_iommu_gfx3d = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 482 | .name = "msm_iommu", |
| 483 | .id = 9, |
| 484 | .dev = { |
| 485 | .parent = &msm_root_iommu_dev.dev, |
| 486 | }, |
| 487 | .num_resources = ARRAY_SIZE(msm_iommu_gfx3d_resources), |
| 488 | .resource = msm_iommu_gfx3d_resources, |
| 489 | }; |
| 490 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 491 | static struct platform_device msm_device_iommu_gfx3d1 = { |
| 492 | .name = "msm_iommu", |
| 493 | .id = 10, |
| 494 | .dev = { |
| 495 | .parent = &msm_root_iommu_dev.dev, |
| 496 | }, |
| 497 | .num_resources = ARRAY_SIZE(msm_iommu_gfx3d1_resources), |
| 498 | .resource = msm_iommu_gfx3d1_resources, |
| 499 | }; |
| 500 | |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 501 | static struct platform_device msm_device_iommu_gfx2d0 = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 502 | .name = "msm_iommu", |
| 503 | .id = 10, |
| 504 | .dev = { |
| 505 | .parent = &msm_root_iommu_dev.dev, |
| 506 | }, |
| 507 | .num_resources = ARRAY_SIZE(msm_iommu_gfx2d0_resources), |
| 508 | .resource = msm_iommu_gfx2d0_resources, |
| 509 | }; |
| 510 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 511 | static struct platform_device msm_device_iommu_gfx2d1 = { |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 512 | .name = "msm_iommu", |
| 513 | .id = 11, |
| 514 | .dev = { |
| 515 | .parent = &msm_root_iommu_dev.dev, |
| 516 | }, |
| 517 | .num_resources = ARRAY_SIZE(msm_iommu_gfx2d1_resources), |
| 518 | .resource = msm_iommu_gfx2d1_resources, |
| 519 | }; |
| 520 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 521 | static struct platform_device msm_device_iommu_vcap = { |
| 522 | .name = "msm_iommu", |
| 523 | .id = 11, |
| 524 | .dev = { |
| 525 | .parent = &msm_root_iommu_dev.dev, |
| 526 | }, |
| 527 | .num_resources = ARRAY_SIZE(msm_iommu_vcap_resources), |
| 528 | .resource = msm_iommu_vcap_resources, |
| 529 | }; |
| 530 | |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 531 | static struct msm_iommu_ctx_dev jpegd_src_ctx = { |
| 532 | .name = "jpegd_src", |
| 533 | .num = 0, |
| 534 | .mids = {0, -1} |
| 535 | }; |
| 536 | |
| 537 | static struct msm_iommu_ctx_dev jpegd_dst_ctx = { |
| 538 | .name = "jpegd_dst", |
| 539 | .num = 1, |
| 540 | .mids = {1, -1} |
| 541 | }; |
| 542 | |
| 543 | static struct msm_iommu_ctx_dev vpe_src_ctx = { |
| 544 | .name = "vpe_src", |
| 545 | .num = 0, |
| 546 | .mids = {0, -1} |
| 547 | }; |
| 548 | |
| 549 | static struct msm_iommu_ctx_dev vpe_dst_ctx = { |
| 550 | .name = "vpe_dst", |
| 551 | .num = 1, |
| 552 | .mids = {1, -1} |
| 553 | }; |
| 554 | |
| 555 | static struct msm_iommu_ctx_dev mdp_vg1_ctx = { |
| 556 | .name = "mdp_vg1", |
| 557 | .num = 0, |
| 558 | .mids = {0, 2, -1} |
| 559 | }; |
| 560 | |
| 561 | static struct msm_iommu_ctx_dev mdp_rgb1_ctx = { |
| 562 | .name = "mdp_rgb1", |
| 563 | .num = 1, |
| 564 | .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1} |
| 565 | }; |
| 566 | |
| 567 | static struct msm_iommu_ctx_dev mdp_vg2_ctx = { |
| 568 | .name = "mdp_vg2", |
| 569 | .num = 0, |
| 570 | .mids = {0, 2, -1} |
| 571 | }; |
| 572 | |
| 573 | static struct msm_iommu_ctx_dev mdp_rgb2_ctx = { |
| 574 | .name = "mdp_rgb2", |
| 575 | .num = 1, |
| 576 | .mids = {1, 3, 4, 5, 6, 7, 8, 9, 10, -1} |
| 577 | }; |
| 578 | |
| 579 | static struct msm_iommu_ctx_dev rot_src_ctx = { |
| 580 | .name = "rot_src", |
| 581 | .num = 0, |
| 582 | .mids = {0, -1} |
| 583 | }; |
| 584 | |
| 585 | static struct msm_iommu_ctx_dev rot_dst_ctx = { |
| 586 | .name = "rot_dst", |
| 587 | .num = 1, |
| 588 | .mids = {1, -1} |
| 589 | }; |
| 590 | |
| 591 | static struct msm_iommu_ctx_dev ijpeg_src_ctx = { |
| 592 | .name = "ijpeg_src", |
| 593 | .num = 0, |
| 594 | .mids = {0, -1} |
| 595 | }; |
| 596 | |
| 597 | static struct msm_iommu_ctx_dev ijpeg_dst_ctx = { |
| 598 | .name = "ijpeg_dst", |
| 599 | .num = 1, |
| 600 | .mids = {1, -1} |
| 601 | }; |
| 602 | |
| 603 | static struct msm_iommu_ctx_dev vfe_imgwr_ctx = { |
| 604 | .name = "vfe_imgwr", |
| 605 | .num = 0, |
| 606 | .mids = {2, 3, 4, 5, 6, 7, 8, -1} |
| 607 | }; |
| 608 | |
| 609 | static struct msm_iommu_ctx_dev vfe_misc_ctx = { |
| 610 | .name = "vfe_misc", |
| 611 | .num = 1, |
| 612 | .mids = {0, 1, 9, -1} |
| 613 | }; |
| 614 | |
| 615 | static struct msm_iommu_ctx_dev vcodec_a_stream_ctx = { |
| 616 | .name = "vcodec_a_stream", |
| 617 | .num = 0, |
| 618 | .mids = {2, 5, -1} |
| 619 | }; |
| 620 | |
| 621 | static struct msm_iommu_ctx_dev vcodec_a_mm1_ctx = { |
| 622 | .name = "vcodec_a_mm1", |
| 623 | .num = 1, |
| 624 | .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1} |
| 625 | }; |
| 626 | |
| 627 | static struct msm_iommu_ctx_dev vcodec_b_mm2_ctx = { |
| 628 | .name = "vcodec_b_mm2", |
| 629 | .num = 0, |
| 630 | .mids = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1} |
| 631 | }; |
| 632 | |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 633 | static struct msm_iommu_ctx_dev gfx3d_user_ctx = { |
| 634 | .name = "gfx3d_user", |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 635 | .num = 0, |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 636 | .mids = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1} |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 637 | }; |
| 638 | |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 639 | static struct msm_iommu_ctx_dev gfx3d_priv_ctx = { |
| 640 | .name = "gfx3d_priv", |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 641 | .num = 1, |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 642 | .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
| 643 | 31, -1} |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 644 | }; |
| 645 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 646 | static struct msm_iommu_ctx_dev gfx3d1_user_ctx = { |
| 647 | .name = "gfx3d1_user", |
| 648 | .num = 0, |
| 649 | .mids = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1} |
| 650 | }; |
| 651 | |
| 652 | static struct msm_iommu_ctx_dev gfx3d1_priv_ctx = { |
| 653 | .name = "gfx3d1_priv", |
| 654 | .num = 1, |
| 655 | .mids = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
| 656 | 31, -1} |
| 657 | }; |
| 658 | |
Stepan Moskovchenko | ff25ff8 | 2010-11-12 19:29:51 -0800 | [diff] [blame] | 659 | static struct msm_iommu_ctx_dev gfx2d0_2d0_ctx = { |
| 660 | .name = "gfx2d0_2d0", |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 661 | .num = 0, |
Stepan Moskovchenko | ff25ff8 | 2010-11-12 19:29:51 -0800 | [diff] [blame] | 662 | .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1} |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 663 | }; |
| 664 | |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 665 | static struct msm_iommu_ctx_dev gfx2d1_2d1_ctx = { |
| 666 | .name = "gfx2d1_2d1", |
| 667 | .num = 0, |
| 668 | .mids = {0, 1, 2, 3, 4, 5, 6, 7, -1} |
| 669 | }; |
| 670 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 671 | static struct msm_iommu_ctx_dev vcap_vc_ctx = { |
| 672 | .name = "vcap_vc", |
| 673 | .num = 0, |
| 674 | .mids = {0, -1} |
| 675 | }; |
| 676 | |
| 677 | static struct msm_iommu_ctx_dev vcap_vp_ctx = { |
| 678 | .name = "vcap_vp", |
| 679 | .num = 1, |
| 680 | .mids = {1, -1} |
| 681 | }; |
| 682 | |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 683 | static struct platform_device msm_device_jpegd_src_ctx = { |
| 684 | .name = "msm_iommu_ctx", |
| 685 | .id = 0, |
| 686 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 687 | .parent = &msm_device_iommu_jpegd.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 688 | }, |
| 689 | }; |
| 690 | |
| 691 | static struct platform_device msm_device_jpegd_dst_ctx = { |
| 692 | .name = "msm_iommu_ctx", |
| 693 | .id = 1, |
| 694 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 695 | .parent = &msm_device_iommu_jpegd.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 696 | }, |
| 697 | }; |
| 698 | |
| 699 | static struct platform_device msm_device_vpe_src_ctx = { |
| 700 | .name = "msm_iommu_ctx", |
| 701 | .id = 2, |
| 702 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 703 | .parent = &msm_device_iommu_vpe.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 704 | }, |
| 705 | }; |
| 706 | |
| 707 | static struct platform_device msm_device_vpe_dst_ctx = { |
| 708 | .name = "msm_iommu_ctx", |
| 709 | .id = 3, |
| 710 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 711 | .parent = &msm_device_iommu_vpe.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 712 | }, |
| 713 | }; |
| 714 | |
| 715 | static struct platform_device msm_device_mdp_vg1_ctx = { |
| 716 | .name = "msm_iommu_ctx", |
| 717 | .id = 4, |
| 718 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 719 | .parent = &msm_device_iommu_mdp0.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 720 | }, |
| 721 | }; |
| 722 | |
| 723 | static struct platform_device msm_device_mdp_rgb1_ctx = { |
| 724 | .name = "msm_iommu_ctx", |
| 725 | .id = 5, |
| 726 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 727 | .parent = &msm_device_iommu_mdp0.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 728 | }, |
| 729 | }; |
| 730 | |
| 731 | static struct platform_device msm_device_mdp_vg2_ctx = { |
| 732 | .name = "msm_iommu_ctx", |
| 733 | .id = 6, |
| 734 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 735 | .parent = &msm_device_iommu_mdp1.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 736 | }, |
| 737 | }; |
| 738 | |
| 739 | static struct platform_device msm_device_mdp_rgb2_ctx = { |
| 740 | .name = "msm_iommu_ctx", |
| 741 | .id = 7, |
| 742 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 743 | .parent = &msm_device_iommu_mdp1.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 744 | }, |
| 745 | }; |
| 746 | |
| 747 | static struct platform_device msm_device_rot_src_ctx = { |
| 748 | .name = "msm_iommu_ctx", |
| 749 | .id = 8, |
| 750 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 751 | .parent = &msm_device_iommu_rot.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 752 | }, |
| 753 | }; |
| 754 | |
| 755 | static struct platform_device msm_device_rot_dst_ctx = { |
| 756 | .name = "msm_iommu_ctx", |
| 757 | .id = 9, |
| 758 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 759 | .parent = &msm_device_iommu_rot.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 760 | }, |
| 761 | }; |
| 762 | |
| 763 | static struct platform_device msm_device_ijpeg_src_ctx = { |
| 764 | .name = "msm_iommu_ctx", |
| 765 | .id = 10, |
| 766 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 767 | .parent = &msm_device_iommu_ijpeg.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 768 | }, |
| 769 | }; |
| 770 | |
| 771 | static struct platform_device msm_device_ijpeg_dst_ctx = { |
| 772 | .name = "msm_iommu_ctx", |
| 773 | .id = 11, |
| 774 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 775 | .parent = &msm_device_iommu_ijpeg.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 776 | }, |
| 777 | }; |
| 778 | |
| 779 | static struct platform_device msm_device_vfe_imgwr_ctx = { |
| 780 | .name = "msm_iommu_ctx", |
| 781 | .id = 12, |
| 782 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 783 | .parent = &msm_device_iommu_vfe.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 784 | }, |
| 785 | }; |
| 786 | |
| 787 | static struct platform_device msm_device_vfe_misc_ctx = { |
| 788 | .name = "msm_iommu_ctx", |
| 789 | .id = 13, |
| 790 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 791 | .parent = &msm_device_iommu_vfe.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 792 | }, |
| 793 | }; |
| 794 | |
| 795 | static struct platform_device msm_device_vcodec_a_stream_ctx = { |
| 796 | .name = "msm_iommu_ctx", |
| 797 | .id = 14, |
| 798 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 799 | .parent = &msm_device_iommu_vcodec_a.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 800 | }, |
| 801 | }; |
| 802 | |
| 803 | static struct platform_device msm_device_vcodec_a_mm1_ctx = { |
| 804 | .name = "msm_iommu_ctx", |
| 805 | .id = 15, |
| 806 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 807 | .parent = &msm_device_iommu_vcodec_a.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 808 | }, |
| 809 | }; |
| 810 | |
| 811 | static struct platform_device msm_device_vcodec_b_mm2_ctx = { |
| 812 | .name = "msm_iommu_ctx", |
| 813 | .id = 16, |
| 814 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 815 | .parent = &msm_device_iommu_vcodec_b.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 816 | }, |
| 817 | }; |
| 818 | |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 819 | static struct platform_device msm_device_gfx3d_user_ctx = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 820 | .name = "msm_iommu_ctx", |
| 821 | .id = 17, |
| 822 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 823 | .parent = &msm_device_iommu_gfx3d.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 824 | }, |
| 825 | }; |
| 826 | |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 827 | static struct platform_device msm_device_gfx3d_priv_ctx = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 828 | .name = "msm_iommu_ctx", |
| 829 | .id = 18, |
| 830 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 831 | .parent = &msm_device_iommu_gfx3d.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 832 | }, |
| 833 | }; |
| 834 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 835 | static struct platform_device msm_device_gfx3d1_user_ctx = { |
| 836 | .name = "msm_iommu_ctx", |
| 837 | .id = 19, |
| 838 | .dev = { |
| 839 | .parent = &msm_device_iommu_gfx3d1.dev, |
| 840 | }, |
| 841 | }; |
| 842 | |
| 843 | static struct platform_device msm_device_gfx3d1_priv_ctx = { |
| 844 | .name = "msm_iommu_ctx", |
| 845 | .id = 20, |
| 846 | .dev = { |
| 847 | .parent = &msm_device_iommu_gfx3d1.dev, |
| 848 | }, |
| 849 | }; |
| 850 | |
Stepan Moskovchenko | ff25ff8 | 2010-11-12 19:29:51 -0800 | [diff] [blame] | 851 | static struct platform_device msm_device_gfx2d0_2d0_ctx = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 852 | .name = "msm_iommu_ctx", |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 853 | .id = 19, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 854 | .dev = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 855 | .parent = &msm_device_iommu_gfx2d0.dev, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 856 | }, |
| 857 | }; |
| 858 | |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 859 | static struct platform_device msm_device_gfx2d1_2d1_ctx = { |
| 860 | .name = "msm_iommu_ctx", |
| 861 | .id = 20, |
| 862 | .dev = { |
| 863 | .parent = &msm_device_iommu_gfx2d1.dev, |
| 864 | }, |
| 865 | }; |
| 866 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 867 | static struct platform_device msm_device_vcap_vc_ctx = { |
| 868 | .name = "msm_iommu_ctx", |
| 869 | .id = 21, |
| 870 | .dev = { |
| 871 | .parent = &msm_device_iommu_vcap.dev, |
| 872 | }, |
| 873 | }; |
| 874 | |
| 875 | static struct platform_device msm_device_vcap_vp_ctx = { |
| 876 | .name = "msm_iommu_ctx", |
| 877 | .id = 22, |
| 878 | .dev = { |
| 879 | .parent = &msm_device_iommu_vcap.dev, |
| 880 | }, |
| 881 | }; |
| 882 | |
| 883 | static struct platform_device *msm_iommu_common_devs[] = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 884 | &msm_device_iommu_jpegd, |
| 885 | &msm_device_iommu_vpe, |
| 886 | &msm_device_iommu_mdp0, |
| 887 | &msm_device_iommu_mdp1, |
| 888 | &msm_device_iommu_rot, |
| 889 | &msm_device_iommu_ijpeg, |
| 890 | &msm_device_iommu_vfe, |
| 891 | &msm_device_iommu_vcodec_a, |
| 892 | &msm_device_iommu_vcodec_b, |
| 893 | &msm_device_iommu_gfx3d, |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 894 | }; |
| 895 | |
| 896 | static struct platform_device *msm_iommu_gfx2d_devs[] = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 897 | &msm_device_iommu_gfx2d0, |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 898 | &msm_device_iommu_gfx2d1, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 899 | }; |
| 900 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 901 | static struct platform_device *msm_iommu_8064_devs[] = { |
| 902 | &msm_device_iommu_gfx3d1, |
| 903 | &msm_device_iommu_vcap, |
| 904 | }; |
| 905 | |
| 906 | static struct msm_iommu_dev *msm_iommu_common_data[] = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 907 | &jpegd_iommu, |
| 908 | &vpe_iommu, |
| 909 | &mdp0_iommu, |
| 910 | &mdp1_iommu, |
| 911 | &rot_iommu, |
| 912 | &ijpeg_iommu, |
| 913 | &vfe_iommu, |
| 914 | &vcodec_a_iommu, |
| 915 | &vcodec_b_iommu, |
| 916 | &gfx3d_iommu, |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 917 | }; |
| 918 | |
| 919 | static struct msm_iommu_dev *msm_iommu_gfx2d_data[] = { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 920 | &gfx2d0_iommu, |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 921 | &gfx2d1_iommu, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 922 | }; |
| 923 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 924 | static struct msm_iommu_dev *msm_iommu_8064_data[] = { |
| 925 | &gfx3d1_iommu, |
| 926 | &vcap_iommu, |
| 927 | }; |
| 928 | |
| 929 | static struct platform_device *msm_iommu_common_ctx_devs[] = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 930 | &msm_device_jpegd_src_ctx, |
| 931 | &msm_device_jpegd_dst_ctx, |
| 932 | &msm_device_vpe_src_ctx, |
| 933 | &msm_device_vpe_dst_ctx, |
| 934 | &msm_device_mdp_vg1_ctx, |
| 935 | &msm_device_mdp_rgb1_ctx, |
| 936 | &msm_device_mdp_vg2_ctx, |
| 937 | &msm_device_mdp_rgb2_ctx, |
| 938 | &msm_device_rot_src_ctx, |
| 939 | &msm_device_rot_dst_ctx, |
| 940 | &msm_device_ijpeg_src_ctx, |
| 941 | &msm_device_ijpeg_dst_ctx, |
| 942 | &msm_device_vfe_imgwr_ctx, |
| 943 | &msm_device_vfe_misc_ctx, |
| 944 | &msm_device_vcodec_a_stream_ctx, |
| 945 | &msm_device_vcodec_a_mm1_ctx, |
| 946 | &msm_device_vcodec_b_mm2_ctx, |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 947 | &msm_device_gfx3d_user_ctx, |
| 948 | &msm_device_gfx3d_priv_ctx, |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 949 | }; |
| 950 | |
| 951 | static struct platform_device *msm_iommu_gfx2d_ctx_devs[] = { |
Stepan Moskovchenko | ff25ff8 | 2010-11-12 19:29:51 -0800 | [diff] [blame] | 952 | &msm_device_gfx2d0_2d0_ctx, |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 953 | &msm_device_gfx2d1_2d1_ctx, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 954 | }; |
| 955 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 956 | static struct platform_device *msm_iommu_8064_ctx_devs[] = { |
| 957 | &msm_device_gfx3d1_user_ctx, |
| 958 | &msm_device_gfx3d1_priv_ctx, |
| 959 | &msm_device_vcap_vc_ctx, |
| 960 | &msm_device_vcap_vp_ctx, |
| 961 | }; |
| 962 | |
| 963 | static struct msm_iommu_ctx_dev *msm_iommu_common_ctx_data[] = { |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 964 | &jpegd_src_ctx, |
| 965 | &jpegd_dst_ctx, |
| 966 | &vpe_src_ctx, |
| 967 | &vpe_dst_ctx, |
| 968 | &mdp_vg1_ctx, |
| 969 | &mdp_rgb1_ctx, |
| 970 | &mdp_vg2_ctx, |
| 971 | &mdp_rgb2_ctx, |
| 972 | &rot_src_ctx, |
| 973 | &rot_dst_ctx, |
| 974 | &ijpeg_src_ctx, |
| 975 | &ijpeg_dst_ctx, |
| 976 | &vfe_imgwr_ctx, |
| 977 | &vfe_misc_ctx, |
| 978 | &vcodec_a_stream_ctx, |
| 979 | &vcodec_a_mm1_ctx, |
| 980 | &vcodec_b_mm2_ctx, |
Stepan Moskovchenko | a5fcd5f | 2010-11-12 19:29:50 -0800 | [diff] [blame] | 981 | &gfx3d_user_ctx, |
| 982 | &gfx3d_priv_ctx, |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 983 | }; |
| 984 | |
| 985 | static struct msm_iommu_ctx_dev *msm_iommu_gfx2d_ctx_data[] = { |
Stepan Moskovchenko | ff25ff8 | 2010-11-12 19:29:51 -0800 | [diff] [blame] | 986 | &gfx2d0_2d0_ctx, |
Stepan Moskovchenko | e8952e3 | 2010-11-12 19:29:52 -0800 | [diff] [blame] | 987 | &gfx2d1_2d1_ctx, |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 988 | }; |
| 989 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 990 | static struct msm_iommu_ctx_dev *msm_iommu_8064_ctx_data[] = { |
| 991 | &gfx3d1_user_ctx, |
| 992 | &gfx3d1_priv_ctx, |
| 993 | &vcap_vc_ctx, |
| 994 | &vcap_vp_ctx, |
| 995 | }; |
| 996 | |
| 997 | static int iommu_init_devs(struct platform_device *devs[], |
| 998 | struct msm_iommu_dev *data[], int size) |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 999 | { |
| 1000 | int ret, i; |
| 1001 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1002 | for (i = 0; i < size; i++) { |
| 1003 | ret = platform_device_add_data(devs[i], |
| 1004 | data[i], sizeof(struct msm_iommu_dev)); |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1005 | if (ret != 0) { |
| 1006 | pr_err("platform_device_add_data failed, " |
| 1007 | "i = %d\n", i); |
| 1008 | goto failure_unwind; |
| 1009 | } |
| 1010 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1011 | ret = platform_device_register(devs[i]); |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1012 | |
| 1013 | if (ret != 0) { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 1014 | pr_err("platform_device_register iommu failed, " |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1015 | "i = %d\n", i); |
| 1016 | goto failure_unwind; |
| 1017 | } |
| 1018 | } |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1019 | return 0; |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1020 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1021 | failure_unwind: |
| 1022 | while (--i >= 0) |
| 1023 | platform_device_unregister(devs[i]); |
| 1024 | |
| 1025 | return ret; |
| 1026 | } |
| 1027 | |
| 1028 | |
| 1029 | static int iommu_init_ctx_devs(struct platform_device *ctx_devs[], |
| 1030 | struct msm_iommu_ctx_dev *ctx_data[], int size) |
| 1031 | { |
| 1032 | int ret, i; |
| 1033 | |
| 1034 | for (i = 0; i < size; i++) { |
| 1035 | ret = platform_device_add_data(ctx_devs[i], |
| 1036 | ctx_data[i], sizeof(struct msm_iommu_ctx_dev)); |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1037 | if (ret != 0) { |
Stepan Moskovchenko | 1294332 | 2010-11-12 19:29:49 -0800 | [diff] [blame] | 1038 | pr_err("platform_device_add_data iommu failed, " |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1039 | "i = %d\n", i); |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1040 | goto failure_unwind; |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1041 | } |
| 1042 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1043 | ret = platform_device_register(ctx_devs[i]); |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1044 | if (ret != 0) { |
| 1045 | pr_err("platform_device_register ctx failed, " |
| 1046 | "i = %d\n", i); |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1047 | goto failure_unwind; |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1048 | } |
| 1049 | } |
| 1050 | return 0; |
| 1051 | |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1052 | failure_unwind: |
| 1053 | while (--i >= 0) |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1054 | platform_device_unregister(ctx_devs[i]); |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1055 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1056 | return ret; |
| 1057 | } |
| 1058 | |
| 1059 | static int __init iommu_init(void) |
| 1060 | { |
| 1061 | int ret; |
| 1062 | |
Stepan Moskovchenko | 75f1e67 | 2011-10-21 19:49:44 -0700 | [diff] [blame^] | 1063 | if (cpu_is_msm8960() && |
| 1064 | SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 2) { |
| 1065 | pr_err("IOMMU is not supported on this SoC version.\n"); |
| 1066 | return -ENODEV; |
| 1067 | } |
| 1068 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1069 | ret = platform_device_register(&msm_root_iommu_dev); |
| 1070 | if (ret != 0) { |
| 1071 | pr_err("Failed to register root IOMMU device!\n"); |
| 1072 | goto failure; |
| 1073 | } |
| 1074 | |
| 1075 | /* Initialize common devs */ |
| 1076 | ret = iommu_init_devs(msm_iommu_common_devs, |
| 1077 | msm_iommu_common_data, |
| 1078 | ARRAY_SIZE(msm_iommu_common_devs)); |
| 1079 | if (ret != 0) |
| 1080 | goto failure2; |
| 1081 | |
| 1082 | /* Initialize soc-specific devs */ |
| 1083 | if (cpu_is_apq8064()) { |
| 1084 | ret = iommu_init_devs(msm_iommu_8064_devs, |
| 1085 | msm_iommu_8064_data, |
| 1086 | ARRAY_SIZE(msm_iommu_8064_devs)); |
| 1087 | } else { |
| 1088 | ret = iommu_init_devs(msm_iommu_gfx2d_devs, |
| 1089 | msm_iommu_gfx2d_data, |
| 1090 | ARRAY_SIZE(msm_iommu_gfx2d_devs)); |
| 1091 | } |
| 1092 | if (ret != 0) |
| 1093 | goto failure2; |
| 1094 | |
| 1095 | /* Initialize common ctx_devs */ |
| 1096 | ret = iommu_init_ctx_devs(msm_iommu_common_ctx_devs, |
| 1097 | msm_iommu_common_ctx_data, |
| 1098 | ARRAY_SIZE(msm_iommu_common_ctx_devs)); |
| 1099 | if (ret != 0) |
| 1100 | goto failure2; |
| 1101 | |
| 1102 | /* Initialize soc-specific ctx_devs */ |
| 1103 | if (cpu_is_apq8064()) { |
| 1104 | ret = iommu_init_ctx_devs(msm_iommu_8064_ctx_devs, |
| 1105 | msm_iommu_8064_ctx_data, |
| 1106 | ARRAY_SIZE(msm_iommu_8064_ctx_devs)); |
| 1107 | } else { |
| 1108 | ret = iommu_init_ctx_devs(msm_iommu_gfx2d_ctx_devs, |
| 1109 | msm_iommu_gfx2d_ctx_data, |
| 1110 | ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs)); |
| 1111 | } |
| 1112 | if (ret != 0) |
| 1113 | goto failure2; |
| 1114 | |
| 1115 | return 0; |
| 1116 | |
| 1117 | failure2: |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1118 | platform_device_unregister(&msm_root_iommu_dev); |
| 1119 | failure: |
| 1120 | return ret; |
| 1121 | } |
| 1122 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1123 | static void __exit iommu_exit(void) |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1124 | { |
| 1125 | int i; |
| 1126 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1127 | /* Common ctx_devs */ |
| 1128 | for (i = 0; i < ARRAY_SIZE(msm_iommu_common_ctx_devs); i++) |
| 1129 | platform_device_unregister(msm_iommu_common_ctx_devs[i]); |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1130 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1131 | /* soc-specific ctx_devs. */ |
| 1132 | if (cpu_is_apq8064()) { |
| 1133 | for (i = 0; i < ARRAY_SIZE(msm_iommu_8064_ctx_devs); i++) |
| 1134 | platform_device_unregister(msm_iommu_8064_ctx_devs[i]); |
| 1135 | } else { |
| 1136 | for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs); i++) |
| 1137 | platform_device_unregister(msm_iommu_gfx2d_ctx_devs[i]); |
| 1138 | } |
| 1139 | |
| 1140 | /* Common devs. */ |
| 1141 | for (i = 0; i < ARRAY_SIZE(msm_iommu_common_devs); ++i) |
| 1142 | platform_device_unregister(msm_iommu_common_devs[i]); |
| 1143 | |
| 1144 | /* soc-specific devs. */ |
| 1145 | if (cpu_is_apq8064()) { |
| 1146 | for (i = 0; i < ARRAY_SIZE(msm_iommu_8064_devs); i++) |
| 1147 | platform_device_unregister(msm_iommu_8064_devs[i]); |
| 1148 | } else { |
| 1149 | for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_devs); i++) |
| 1150 | platform_device_unregister(msm_iommu_gfx2d_devs[i]); |
| 1151 | } |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1152 | |
| 1153 | platform_device_unregister(&msm_root_iommu_dev); |
| 1154 | } |
| 1155 | |
Joel King | 41d594e | 2011-10-14 13:18:20 -0700 | [diff] [blame] | 1156 | subsys_initcall(iommu_init); |
| 1157 | module_exit(iommu_exit); |
Stepan Moskovchenko | d9c8279 | 2010-08-24 19:51:15 -0700 | [diff] [blame] | 1158 | |
| 1159 | MODULE_LICENSE("GPL v2"); |
| 1160 | MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>"); |