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