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