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