Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 Google, Inc. |
| 3 | * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved. |
| 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/platform_device.h> |
| 18 | |
| 19 | #include <linux/dma-mapping.h> |
| 20 | #include <asm/clkdev.h> |
| 21 | #include <mach/irqs.h> |
| 22 | #include <mach/msm_iomap.h> |
| 23 | #include <mach/dma.h> |
| 24 | #include <mach/board.h> |
| 25 | |
| 26 | #include "devices.h" |
| 27 | |
| 28 | #include <asm/mach/flash.h> |
| 29 | |
| 30 | #include <asm/mach/mmc.h> |
| 31 | #include <mach/msm_hsusb.h> |
| 32 | |
| 33 | static struct resource resources_uart1[] = { |
| 34 | { |
| 35 | .start = INT_UART1, |
| 36 | .end = INT_UART1, |
| 37 | .flags = IORESOURCE_IRQ, |
| 38 | }, |
| 39 | { |
| 40 | .start = MSM_UART1_PHYS, |
| 41 | .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1, |
| 42 | .flags = IORESOURCE_MEM, |
| 43 | }, |
| 44 | }; |
| 45 | |
| 46 | static struct resource resources_uart2[] = { |
| 47 | { |
| 48 | .start = INT_UART2, |
| 49 | .end = INT_UART2, |
| 50 | .flags = IORESOURCE_IRQ, |
| 51 | }, |
| 52 | { |
| 53 | .start = MSM_UART2_PHYS, |
| 54 | .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1, |
| 55 | .flags = IORESOURCE_MEM, |
| 56 | }, |
| 57 | }; |
| 58 | |
| 59 | static struct resource resources_uart3[] = { |
| 60 | { |
| 61 | .start = INT_UART3, |
| 62 | .end = INT_UART3, |
| 63 | .flags = IORESOURCE_IRQ, |
| 64 | }, |
| 65 | { |
| 66 | .start = MSM_UART3_PHYS, |
| 67 | .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1, |
| 68 | .flags = IORESOURCE_MEM, |
| 69 | }, |
| 70 | }; |
| 71 | |
| 72 | struct platform_device msm_device_uart1 = { |
| 73 | .name = "msm_serial", |
| 74 | .id = 0, |
| 75 | .num_resources = ARRAY_SIZE(resources_uart1), |
| 76 | .resource = resources_uart1, |
| 77 | }; |
| 78 | |
| 79 | struct platform_device msm_device_uart2 = { |
| 80 | .name = "msm_serial", |
| 81 | .id = 1, |
| 82 | .num_resources = ARRAY_SIZE(resources_uart2), |
| 83 | .resource = resources_uart2, |
| 84 | }; |
| 85 | |
| 86 | struct platform_device msm_device_uart3 = { |
| 87 | .name = "msm_serial", |
| 88 | .id = 2, |
| 89 | .num_resources = ARRAY_SIZE(resources_uart3), |
| 90 | .resource = resources_uart3, |
| 91 | }; |
| 92 | |
| 93 | #define MSM_UART1DM_PHYS 0xA0200000 |
| 94 | #define MSM_UART2DM_PHYS 0xA0300000 |
| 95 | static struct resource msm_uart1_dm_resources[] = { |
| 96 | { |
| 97 | .start = MSM_UART1DM_PHYS, |
| 98 | .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1, |
| 99 | .flags = IORESOURCE_MEM, |
| 100 | }, |
| 101 | { |
| 102 | .start = INT_UART1DM_IRQ, |
| 103 | .end = INT_UART1DM_IRQ, |
| 104 | .flags = IORESOURCE_IRQ, |
| 105 | }, |
| 106 | { |
| 107 | .start = INT_UART1DM_RX, |
| 108 | .end = INT_UART1DM_RX, |
| 109 | .flags = IORESOURCE_IRQ, |
| 110 | }, |
| 111 | { |
| 112 | .start = DMOV_HSUART1_TX_CHAN, |
| 113 | .end = DMOV_HSUART1_RX_CHAN, |
| 114 | .name = "uartdm_channels", |
| 115 | .flags = IORESOURCE_DMA, |
| 116 | }, |
| 117 | { |
| 118 | .start = DMOV_HSUART1_TX_CRCI, |
| 119 | .end = DMOV_HSUART1_RX_CRCI, |
| 120 | .name = "uartdm_crci", |
| 121 | .flags = IORESOURCE_DMA, |
| 122 | }, |
| 123 | }; |
| 124 | |
| 125 | static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32); |
| 126 | |
| 127 | struct platform_device msm_device_uart_dm1 = { |
| 128 | .name = "msm_serial_hs", |
| 129 | .id = 0, |
| 130 | .num_resources = ARRAY_SIZE(msm_uart1_dm_resources), |
| 131 | .resource = msm_uart1_dm_resources, |
| 132 | .dev = { |
| 133 | .dma_mask = &msm_uart_dm1_dma_mask, |
| 134 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 135 | }, |
| 136 | }; |
| 137 | |
| 138 | static struct resource msm_uart2_dm_resources[] = { |
| 139 | { |
| 140 | .start = MSM_UART2DM_PHYS, |
| 141 | .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1, |
| 142 | .flags = IORESOURCE_MEM, |
| 143 | }, |
| 144 | { |
| 145 | .start = INT_UART2DM_IRQ, |
| 146 | .end = INT_UART2DM_IRQ, |
| 147 | .flags = IORESOURCE_IRQ, |
| 148 | }, |
| 149 | { |
| 150 | .start = INT_UART2DM_RX, |
| 151 | .end = INT_UART2DM_RX, |
| 152 | .flags = IORESOURCE_IRQ, |
| 153 | }, |
| 154 | { |
| 155 | .start = DMOV_HSUART2_TX_CHAN, |
| 156 | .end = DMOV_HSUART2_RX_CHAN, |
| 157 | .name = "uartdm_channels", |
| 158 | .flags = IORESOURCE_DMA, |
| 159 | }, |
| 160 | { |
| 161 | .start = DMOV_HSUART2_TX_CRCI, |
| 162 | .end = DMOV_HSUART2_RX_CRCI, |
| 163 | .name = "uartdm_crci", |
| 164 | .flags = IORESOURCE_DMA, |
| 165 | }, |
| 166 | }; |
| 167 | |
| 168 | static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32); |
| 169 | |
| 170 | struct platform_device msm_device_uart_dm2 = { |
| 171 | .name = "msm_serial_hs", |
| 172 | .id = 1, |
| 173 | .num_resources = ARRAY_SIZE(msm_uart2_dm_resources), |
| 174 | .resource = msm_uart2_dm_resources, |
| 175 | .dev = { |
| 176 | .dma_mask = &msm_uart_dm2_dma_mask, |
| 177 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 178 | }, |
| 179 | }; |
| 180 | |
| 181 | #define MSM_I2C_SIZE SZ_4K |
| 182 | #define MSM_I2C_PHYS 0xA9900000 |
| 183 | static struct resource resources_i2c[] = { |
| 184 | { |
| 185 | .start = MSM_I2C_PHYS, |
| 186 | .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1, |
| 187 | .flags = IORESOURCE_MEM, |
| 188 | }, |
| 189 | { |
| 190 | .start = INT_PWB_I2C, |
| 191 | .end = INT_PWB_I2C, |
| 192 | .flags = IORESOURCE_IRQ, |
| 193 | }, |
| 194 | }; |
| 195 | |
| 196 | struct platform_device msm_device_i2c = { |
| 197 | .name = "msm_i2c", |
| 198 | .id = 0, |
| 199 | .num_resources = ARRAY_SIZE(resources_i2c), |
| 200 | .resource = resources_i2c, |
| 201 | }; |
| 202 | |
| 203 | #define MSM_HSUSB_PHYS 0xA0800000 |
| 204 | static struct resource resources_hsusb_otg[] = { |
| 205 | { |
| 206 | .start = MSM_HSUSB_PHYS, |
| 207 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 208 | .flags = IORESOURCE_MEM, |
| 209 | }, |
| 210 | { |
| 211 | .start = INT_USB_HS, |
| 212 | .end = INT_USB_HS, |
| 213 | .flags = IORESOURCE_IRQ, |
| 214 | }, |
| 215 | }; |
| 216 | |
| 217 | static u64 dma_mask = 0xffffffffULL; |
| 218 | struct platform_device msm_device_hsusb_otg = { |
| 219 | .name = "msm_hsusb_otg", |
| 220 | .id = -1, |
| 221 | .num_resources = ARRAY_SIZE(resources_hsusb_otg), |
| 222 | .resource = resources_hsusb_otg, |
| 223 | .dev = { |
| 224 | .dma_mask = &dma_mask, |
| 225 | .coherent_dma_mask = 0xffffffffULL, |
| 226 | }, |
| 227 | }; |
| 228 | |
| 229 | static struct resource resources_hsusb_peripheral[] = { |
| 230 | { |
| 231 | .start = MSM_HSUSB_PHYS, |
| 232 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 233 | .flags = IORESOURCE_MEM, |
| 234 | }, |
| 235 | { |
| 236 | .start = INT_USB_HS, |
| 237 | .end = INT_USB_HS, |
| 238 | .flags = IORESOURCE_IRQ, |
| 239 | }, |
| 240 | { |
| 241 | .name = "vbus_interrupt", |
| 242 | .start = MSM_GPIO_TO_INT(112), |
| 243 | .end = MSM_GPIO_TO_INT(112), |
| 244 | .flags = IORESOURCE_IRQ, |
| 245 | }, |
| 246 | { |
| 247 | .name = "id_interrupt", |
| 248 | .start = MSM_GPIO_TO_INT(114), |
| 249 | .end = MSM_GPIO_TO_INT(114), |
| 250 | .flags = IORESOURCE_IRQ, |
| 251 | }, |
| 252 | }; |
| 253 | |
| 254 | static struct resource resources_gadget_peripheral[] = { |
| 255 | { |
| 256 | .start = MSM_HSUSB_PHYS, |
| 257 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 258 | .flags = IORESOURCE_MEM, |
| 259 | }, |
| 260 | { |
| 261 | .start = INT_USB_HS, |
| 262 | .end = INT_USB_HS, |
| 263 | .flags = IORESOURCE_IRQ, |
| 264 | }, |
| 265 | }; |
| 266 | |
| 267 | struct platform_device msm_device_hsusb_peripheral = { |
| 268 | .name = "msm_hsusb_peripheral", |
| 269 | .id = -1, |
| 270 | .num_resources = ARRAY_SIZE(resources_hsusb_peripheral), |
| 271 | .resource = resources_hsusb_peripheral, |
| 272 | .dev = { |
| 273 | .dma_mask = &dma_mask, |
| 274 | .coherent_dma_mask = 0xffffffffULL, |
| 275 | }, |
| 276 | }; |
| 277 | |
| 278 | struct platform_device msm_device_gadget_peripheral = { |
| 279 | .name = "msm_hsusb", |
| 280 | .id = -1, |
| 281 | .num_resources = ARRAY_SIZE(resources_gadget_peripheral), |
| 282 | .resource = resources_gadget_peripheral, |
| 283 | .dev = { |
| 284 | .dma_mask = &dma_mask, |
| 285 | .coherent_dma_mask = 0xffffffffULL, |
| 286 | }, |
| 287 | }; |
| 288 | |
| 289 | static struct resource resources_hsusb_host[] = { |
| 290 | { |
| 291 | .start = MSM_HSUSB_PHYS, |
| 292 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 293 | .flags = IORESOURCE_MEM, |
| 294 | }, |
| 295 | { |
| 296 | .start = INT_USB_HS, |
| 297 | .end = INT_USB_HS, |
| 298 | .flags = IORESOURCE_IRQ, |
| 299 | }, |
| 300 | }; |
| 301 | |
| 302 | struct platform_device msm_device_hsusb_host = { |
| 303 | .name = "msm_hsusb_host", |
| 304 | .id = 0, |
| 305 | .num_resources = ARRAY_SIZE(resources_hsusb_host), |
| 306 | .resource = resources_hsusb_host, |
| 307 | .dev = { |
| 308 | .dma_mask = &dma_mask, |
| 309 | .coherent_dma_mask = 0xffffffffULL, |
| 310 | }, |
| 311 | }; |
| 312 | |
| 313 | static struct platform_device *msm_host_devices[] = { |
| 314 | &msm_device_hsusb_host, |
| 315 | }; |
| 316 | |
| 317 | int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat) |
| 318 | { |
| 319 | struct platform_device *pdev; |
| 320 | |
| 321 | pdev = msm_host_devices[host]; |
| 322 | if (!pdev) |
| 323 | return -ENODEV; |
| 324 | pdev->dev.platform_data = plat; |
| 325 | return platform_device_register(pdev); |
| 326 | } |
| 327 | |
| 328 | #define MSM_NAND_PHYS 0xA0A00000 |
| 329 | static struct resource resources_nand[] = { |
| 330 | [0] = { |
| 331 | .name = "msm_nand_dmac", |
| 332 | .start = DMOV_NAND_CHAN, |
| 333 | .end = DMOV_NAND_CHAN, |
| 334 | .flags = IORESOURCE_DMA, |
| 335 | }, |
| 336 | [1] = { |
| 337 | .name = "msm_nand_phys", |
| 338 | .start = MSM_NAND_PHYS, |
| 339 | .end = MSM_NAND_PHYS + 0x7FF, |
| 340 | .flags = IORESOURCE_MEM, |
| 341 | }, |
| 342 | }; |
| 343 | |
| 344 | static struct resource resources_otg[] = { |
| 345 | { |
| 346 | .start = MSM_HSUSB_PHYS, |
| 347 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 348 | .flags = IORESOURCE_MEM, |
| 349 | }, |
| 350 | { |
| 351 | .start = INT_USB_HS, |
| 352 | .end = INT_USB_HS, |
| 353 | .flags = IORESOURCE_IRQ, |
| 354 | }, |
| 355 | }; |
| 356 | |
| 357 | struct platform_device msm_device_otg = { |
| 358 | .name = "msm_otg", |
| 359 | .id = -1, |
| 360 | .num_resources = ARRAY_SIZE(resources_otg), |
| 361 | .resource = resources_otg, |
| 362 | .dev = { |
| 363 | .coherent_dma_mask = 0xffffffffULL, |
| 364 | }, |
| 365 | }; |
| 366 | |
| 367 | struct flash_platform_data msm_nand_data = { |
| 368 | .parts = NULL, |
| 369 | .nr_parts = 0, |
| 370 | }; |
| 371 | |
| 372 | struct platform_device msm_device_nand = { |
| 373 | .name = "msm_nand", |
| 374 | .id = -1, |
| 375 | .num_resources = ARRAY_SIZE(resources_nand), |
| 376 | .resource = resources_nand, |
| 377 | .dev = { |
| 378 | .platform_data = &msm_nand_data, |
| 379 | }, |
| 380 | }; |
| 381 | |
| 382 | struct platform_device msm_device_smd = { |
| 383 | .name = "msm_smd", |
| 384 | .id = -1, |
| 385 | }; |
| 386 | |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 387 | static struct resource msm_dmov_resource[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 388 | { |
| 389 | .start = INT_ADM_AARM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 390 | .flags = IORESOURCE_IRQ, |
| 391 | }, |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 392 | { |
| 393 | .start = 0xA9700000, |
| 394 | .end = 0xA9700000 + SZ_4K - 1, |
| 395 | .flags = IORESOURCE_MEM, |
| 396 | }, |
| 397 | }; |
| 398 | |
| 399 | static struct msm_dmov_pdata msm_dmov_pdata = { |
| 400 | .sd = 3, |
| 401 | .sd_size = 0x400, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 402 | }; |
| 403 | |
| 404 | struct platform_device msm_device_dmov = { |
| 405 | .name = "msm_dmov", |
| 406 | .id = -1, |
| 407 | .resource = msm_dmov_resource, |
| 408 | .num_resources = ARRAY_SIZE(msm_dmov_resource), |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 409 | .dev = { |
| 410 | .platform_data = &msm_dmov_pdata, |
| 411 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 412 | }; |
| 413 | |
| 414 | #define MSM_SDC1_BASE 0xA0400000 |
| 415 | #define MSM_SDC2_BASE 0xA0500000 |
| 416 | #define MSM_SDC3_BASE 0xA0600000 |
| 417 | #define MSM_SDC4_BASE 0xA0700000 |
| 418 | static struct resource resources_sdc1[] = { |
| 419 | { |
| 420 | .start = MSM_SDC1_BASE, |
| 421 | .end = MSM_SDC1_BASE + SZ_4K - 1, |
| 422 | .flags = IORESOURCE_MEM, |
| 423 | }, |
| 424 | { |
| 425 | .start = INT_SDC1_0, |
| 426 | .end = INT_SDC1_1, |
| 427 | .flags = IORESOURCE_IRQ, |
| 428 | }, |
| 429 | { |
| 430 | .start = 8, |
| 431 | .end = 8, |
| 432 | .flags = IORESOURCE_DMA, |
| 433 | }, |
| 434 | }; |
| 435 | |
| 436 | static struct resource resources_sdc2[] = { |
| 437 | { |
| 438 | .start = MSM_SDC2_BASE, |
| 439 | .end = MSM_SDC2_BASE + SZ_4K - 1, |
| 440 | .flags = IORESOURCE_MEM, |
| 441 | }, |
| 442 | { |
| 443 | .start = INT_SDC2_0, |
| 444 | .end = INT_SDC2_1, |
| 445 | .flags = IORESOURCE_IRQ, |
| 446 | }, |
| 447 | { |
| 448 | .start = 8, |
| 449 | .end = 8, |
| 450 | .flags = IORESOURCE_DMA, |
| 451 | }, |
| 452 | }; |
| 453 | |
| 454 | static struct resource resources_sdc3[] = { |
| 455 | { |
| 456 | .start = MSM_SDC3_BASE, |
| 457 | .end = MSM_SDC3_BASE + SZ_4K - 1, |
| 458 | .flags = IORESOURCE_MEM, |
| 459 | }, |
| 460 | { |
| 461 | .start = INT_SDC3_0, |
| 462 | .end = INT_SDC3_1, |
| 463 | .flags = IORESOURCE_IRQ, |
| 464 | }, |
| 465 | { |
| 466 | .start = 8, |
| 467 | .end = 8, |
| 468 | .flags = IORESOURCE_DMA, |
| 469 | }, |
| 470 | }; |
| 471 | |
| 472 | static struct resource resources_sdc4[] = { |
| 473 | { |
| 474 | .start = MSM_SDC4_BASE, |
| 475 | .end = MSM_SDC4_BASE + SZ_4K - 1, |
| 476 | .flags = IORESOURCE_MEM, |
| 477 | }, |
| 478 | { |
| 479 | .start = INT_SDC4_0, |
| 480 | .end = INT_SDC4_1, |
| 481 | .flags = IORESOURCE_IRQ, |
| 482 | }, |
| 483 | { |
| 484 | .start = 8, |
| 485 | .end = 8, |
| 486 | .flags = IORESOURCE_DMA, |
| 487 | }, |
| 488 | }; |
| 489 | |
| 490 | struct platform_device msm_device_sdc1 = { |
| 491 | .name = "msm_sdcc", |
| 492 | .id = 1, |
| 493 | .num_resources = ARRAY_SIZE(resources_sdc1), |
| 494 | .resource = resources_sdc1, |
| 495 | .dev = { |
| 496 | .coherent_dma_mask = 0xffffffff, |
| 497 | }, |
| 498 | }; |
| 499 | |
| 500 | struct platform_device msm_device_sdc2 = { |
| 501 | .name = "msm_sdcc", |
| 502 | .id = 2, |
| 503 | .num_resources = ARRAY_SIZE(resources_sdc2), |
| 504 | .resource = resources_sdc2, |
| 505 | .dev = { |
| 506 | .coherent_dma_mask = 0xffffffff, |
| 507 | }, |
| 508 | }; |
| 509 | |
| 510 | struct platform_device msm_device_sdc3 = { |
| 511 | .name = "msm_sdcc", |
| 512 | .id = 3, |
| 513 | .num_resources = ARRAY_SIZE(resources_sdc3), |
| 514 | .resource = resources_sdc3, |
| 515 | .dev = { |
| 516 | .coherent_dma_mask = 0xffffffff, |
| 517 | }, |
| 518 | }; |
| 519 | |
| 520 | struct platform_device msm_device_sdc4 = { |
| 521 | .name = "msm_sdcc", |
| 522 | .id = 4, |
| 523 | .num_resources = ARRAY_SIZE(resources_sdc4), |
| 524 | .resource = resources_sdc4, |
| 525 | .dev = { |
| 526 | .coherent_dma_mask = 0xffffffff, |
| 527 | }, |
| 528 | }; |
| 529 | |
| 530 | static struct platform_device *msm_sdcc_devices[] __initdata = { |
| 531 | &msm_device_sdc1, |
| 532 | &msm_device_sdc2, |
| 533 | &msm_device_sdc3, |
| 534 | &msm_device_sdc4, |
| 535 | }; |
| 536 | |
| 537 | int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat) |
| 538 | { |
| 539 | struct platform_device *pdev; |
| 540 | |
| 541 | if (controller < 1 || controller > 4) |
| 542 | return -EINVAL; |
| 543 | |
| 544 | pdev = msm_sdcc_devices[controller-1]; |
| 545 | pdev->dev.platform_data = plat; |
| 546 | return platform_device_register(pdev); |
| 547 | } |
| 548 | |
| 549 | #if defined(CONFIG_FB_MSM_MDP40) |
| 550 | #define MDP_BASE 0xA3F00000 |
| 551 | #define PMDH_BASE 0xAD600000 |
| 552 | #define EMDH_BASE 0xAD700000 |
| 553 | #define TVENC_BASE 0xAD400000 |
| 554 | #else |
| 555 | #define MDP_BASE 0xAA200000 |
| 556 | #define PMDH_BASE 0xAA600000 |
| 557 | #define EMDH_BASE 0xAA700000 |
| 558 | #define TVENC_BASE 0xAA400000 |
| 559 | #endif |
| 560 | |
| 561 | static struct resource msm_mdp_resources[] = { |
| 562 | { |
| 563 | .name = "mdp", |
| 564 | .start = MDP_BASE, |
| 565 | .end = MDP_BASE + 0x000F0000 - 1, |
| 566 | .flags = IORESOURCE_MEM, |
| 567 | }, |
| 568 | { |
| 569 | .start = INT_MDP, |
| 570 | .end = INT_MDP, |
| 571 | .flags = IORESOURCE_IRQ, |
| 572 | }, |
| 573 | }; |
| 574 | |
| 575 | static struct resource msm_mddi_resources[] = { |
| 576 | { |
| 577 | .name = "pmdh", |
| 578 | .start = PMDH_BASE, |
| 579 | .end = PMDH_BASE + PAGE_SIZE - 1, |
| 580 | .flags = IORESOURCE_MEM, |
| 581 | } |
| 582 | }; |
| 583 | |
| 584 | static struct resource msm_mddi_ext_resources[] = { |
| 585 | { |
| 586 | .name = "emdh", |
| 587 | .start = EMDH_BASE, |
| 588 | .end = EMDH_BASE + PAGE_SIZE - 1, |
| 589 | .flags = IORESOURCE_MEM, |
| 590 | } |
| 591 | }; |
| 592 | |
| 593 | static struct resource msm_ebi2_lcd_resources[] = { |
| 594 | { |
| 595 | .name = "base", |
| 596 | .start = 0xa0d00000, |
| 597 | .end = 0xa0d00000 + PAGE_SIZE - 1, |
| 598 | .flags = IORESOURCE_MEM, |
| 599 | }, |
| 600 | { |
| 601 | .name = "lcd01", |
| 602 | .start = 0x98000000, |
| 603 | .end = 0x98000000 + 0x80000 - 1, |
| 604 | .flags = IORESOURCE_MEM, |
| 605 | }, |
| 606 | { |
| 607 | .name = "lcd02", |
| 608 | .start = 0x9c000000, |
| 609 | .end = 0x9c000000 + 0x80000 - 1, |
| 610 | .flags = IORESOURCE_MEM, |
| 611 | }, |
| 612 | }; |
| 613 | |
| 614 | static struct resource msm_tvenc_resources[] = { |
| 615 | { |
| 616 | .name = "tvenc", |
| 617 | .start = TVENC_BASE, |
| 618 | .end = TVENC_BASE + PAGE_SIZE - 1, |
| 619 | .flags = IORESOURCE_MEM, |
| 620 | } |
| 621 | }; |
| 622 | |
| 623 | static struct platform_device msm_mdp_device = { |
| 624 | .name = "mdp", |
| 625 | .id = 0, |
| 626 | .num_resources = ARRAY_SIZE(msm_mdp_resources), |
| 627 | .resource = msm_mdp_resources, |
| 628 | }; |
| 629 | |
| 630 | static struct platform_device msm_mddi_device = { |
| 631 | .name = "mddi", |
| 632 | .id = 0, |
| 633 | .num_resources = ARRAY_SIZE(msm_mddi_resources), |
| 634 | .resource = msm_mddi_resources, |
| 635 | }; |
| 636 | |
| 637 | static struct platform_device msm_mddi_ext_device = { |
| 638 | .name = "mddi_ext", |
| 639 | .id = 0, |
| 640 | .num_resources = ARRAY_SIZE(msm_mddi_ext_resources), |
| 641 | .resource = msm_mddi_ext_resources, |
| 642 | }; |
| 643 | |
| 644 | static struct platform_device msm_ebi2_lcd_device = { |
| 645 | .name = "ebi2_lcd", |
| 646 | .id = 0, |
| 647 | .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources), |
| 648 | .resource = msm_ebi2_lcd_resources, |
| 649 | }; |
| 650 | |
| 651 | static struct platform_device msm_lcdc_device = { |
| 652 | .name = "lcdc", |
| 653 | .id = 0, |
| 654 | }; |
| 655 | |
| 656 | static struct platform_device msm_tvenc_device = { |
| 657 | .name = "tvenc", |
| 658 | .id = 0, |
| 659 | .num_resources = ARRAY_SIZE(msm_tvenc_resources), |
| 660 | .resource = msm_tvenc_resources, |
| 661 | }; |
| 662 | |
| 663 | /* TSIF begin */ |
| 664 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) |
| 665 | |
| 666 | #define MSM_TSIF_PHYS (0xa0100000) |
| 667 | #define MSM_TSIF_SIZE (0x200) |
| 668 | |
| 669 | static struct resource tsif_resources[] = { |
| 670 | [0] = { |
| 671 | .flags = IORESOURCE_IRQ, |
| 672 | .start = INT_TSIF_IRQ, |
| 673 | .end = INT_TSIF_IRQ, |
| 674 | }, |
| 675 | [1] = { |
| 676 | .flags = IORESOURCE_MEM, |
| 677 | .start = MSM_TSIF_PHYS, |
| 678 | .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1, |
| 679 | }, |
| 680 | [2] = { |
| 681 | .flags = IORESOURCE_DMA, |
| 682 | .start = DMOV_TSIF_CHAN, |
| 683 | .end = DMOV_TSIF_CRCI, |
| 684 | }, |
| 685 | }; |
| 686 | |
| 687 | static void tsif_release(struct device *dev) |
| 688 | { |
| 689 | dev_info(dev, "release\n"); |
| 690 | } |
| 691 | |
| 692 | struct platform_device msm_device_tsif = { |
| 693 | .name = "msm_tsif", |
| 694 | .id = 0, |
| 695 | .num_resources = ARRAY_SIZE(tsif_resources), |
| 696 | .resource = tsif_resources, |
| 697 | .dev = { |
| 698 | .release = tsif_release, |
| 699 | }, |
| 700 | }; |
| 701 | #endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */ |
| 702 | /* TSIF end */ |
| 703 | |
| 704 | #define MSM_TSSC_PHYS 0xAA300000 |
| 705 | static struct resource resources_tssc[] = { |
| 706 | { |
| 707 | .start = MSM_TSSC_PHYS, |
| 708 | .end = MSM_TSSC_PHYS + SZ_4K - 1, |
| 709 | .name = "tssc", |
| 710 | .flags = IORESOURCE_MEM, |
| 711 | }, |
| 712 | { |
| 713 | .start = INT_TCHSCRN1, |
| 714 | .end = INT_TCHSCRN1, |
| 715 | .name = "tssc1", |
| 716 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
| 717 | }, |
| 718 | { |
| 719 | .start = INT_TCHSCRN2, |
| 720 | .end = INT_TCHSCRN2, |
| 721 | .name = "tssc2", |
| 722 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, |
| 723 | }, |
| 724 | }; |
| 725 | |
| 726 | struct platform_device msm_device_tssc = { |
| 727 | .name = "msm_touchscreen", |
| 728 | .id = 0, |
| 729 | .num_resources = ARRAY_SIZE(resources_tssc), |
| 730 | .resource = resources_tssc, |
| 731 | }; |
| 732 | |
| 733 | static void __init msm_register_device(struct platform_device *pdev, void *data) |
| 734 | { |
| 735 | int ret; |
| 736 | |
| 737 | pdev->dev.platform_data = data; |
| 738 | |
| 739 | ret = platform_device_register(pdev); |
| 740 | if (ret) |
| 741 | dev_err(&pdev->dev, |
| 742 | "%s: platform_device_register() failed = %d\n", |
| 743 | __func__, ret); |
| 744 | } |
| 745 | |
| 746 | void __init msm_fb_register_device(char *name, void *data) |
| 747 | { |
| 748 | if (!strncmp(name, "mdp", 3)) |
| 749 | msm_register_device(&msm_mdp_device, data); |
| 750 | else if (!strncmp(name, "pmdh", 4)) |
| 751 | msm_register_device(&msm_mddi_device, data); |
| 752 | else if (!strncmp(name, "emdh", 4)) |
| 753 | msm_register_device(&msm_mddi_ext_device, data); |
| 754 | else if (!strncmp(name, "ebi2", 4)) |
| 755 | msm_register_device(&msm_ebi2_lcd_device, data); |
| 756 | else if (!strncmp(name, "tvenc", 5)) |
| 757 | msm_register_device(&msm_tvenc_device, data); |
| 758 | else if (!strncmp(name, "lcdc", 4)) |
| 759 | msm_register_device(&msm_lcdc_device, data); |
| 760 | else |
| 761 | printk(KERN_ERR "%s: unknown device! %s\n", __func__, name); |
| 762 | } |
| 763 | |
| 764 | static struct platform_device msm_camera_device = { |
| 765 | .name = "msm_camera", |
| 766 | .id = 0, |
| 767 | }; |
| 768 | |
| 769 | void __init msm_camera_register_device(void *res, uint32_t num, |
| 770 | void *data) |
| 771 | { |
| 772 | msm_camera_device.num_resources = num; |
| 773 | msm_camera_device.resource = res; |
| 774 | |
| 775 | msm_register_device(&msm_camera_device, data); |
| 776 | } |