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