Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/dma-mapping.h> |
| 16 | #include <linux/msm_kgsl.h> |
| 17 | #include <linux/regulator/machine.h> |
| 18 | #include <mach/irqs.h> |
| 19 | #include <mach/msm_iomap.h> |
| 20 | #include <mach/board.h> |
| 21 | #include <mach/dma.h> |
| 22 | #include <mach/dal_axi.h> |
| 23 | #include <asm/mach/flash.h> |
| 24 | #include <asm/hardware/cache-l2x0.h> |
| 25 | #include <asm/mach/mmc.h> |
| 26 | #include <mach/rpc_hsusb.h> |
| 27 | #include <mach/socinfo.h> |
| 28 | |
| 29 | #include "devices.h" |
| 30 | #include "devices-msm7x2xa.h" |
| 31 | #include "footswitch.h" |
| 32 | |
| 33 | /* Address of GSBI blocks */ |
| 34 | #define MSM_GSBI0_PHYS 0xA1200000 |
| 35 | #define MSM_GSBI1_PHYS 0xA1300000 |
| 36 | |
| 37 | /* GSBI QUPe devices */ |
| 38 | #define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000) |
| 39 | #define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000) |
| 40 | |
| 41 | static struct resource gsbi0_qup_i2c_resources[] = { |
| 42 | { |
| 43 | .name = "qup_phys_addr", |
| 44 | .start = MSM_GSBI0_QUP_PHYS, |
| 45 | .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1, |
| 46 | .flags = IORESOURCE_MEM, |
| 47 | }, |
| 48 | { |
| 49 | .name = "gsbi_qup_i2c_addr", |
| 50 | .start = MSM_GSBI0_PHYS, |
| 51 | .end = MSM_GSBI0_PHYS + SZ_4K - 1, |
| 52 | .flags = IORESOURCE_MEM, |
| 53 | }, |
| 54 | { |
| 55 | .name = "qup_err_intr", |
| 56 | .start = INT_PWB_I2C, |
| 57 | .end = INT_PWB_I2C, |
| 58 | .flags = IORESOURCE_IRQ, |
| 59 | }, |
| 60 | }; |
| 61 | |
| 62 | /* Use GSBI0 QUP for /dev/i2c-0 */ |
| 63 | struct platform_device msm_gsbi0_qup_i2c_device = { |
| 64 | .name = "qup_i2c", |
| 65 | .id = MSM_GSBI0_QUP_I2C_BUS_ID, |
| 66 | .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources), |
| 67 | .resource = gsbi0_qup_i2c_resources, |
| 68 | }; |
| 69 | |
| 70 | static struct resource gsbi1_qup_i2c_resources[] = { |
| 71 | { |
| 72 | .name = "qup_phys_addr", |
| 73 | .start = MSM_GSBI1_QUP_PHYS, |
| 74 | .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1, |
| 75 | .flags = IORESOURCE_MEM, |
| 76 | }, |
| 77 | { |
| 78 | .name = "gsbi_qup_i2c_addr", |
| 79 | .start = MSM_GSBI1_PHYS, |
| 80 | .end = MSM_GSBI1_PHYS + SZ_4K - 1, |
| 81 | .flags = IORESOURCE_MEM, |
| 82 | }, |
| 83 | { |
| 84 | .name = "qup_err_intr", |
| 85 | .start = INT_ARM11_DMA, |
| 86 | .end = INT_ARM11_DMA, |
| 87 | .flags = IORESOURCE_IRQ, |
| 88 | }, |
| 89 | }; |
| 90 | |
| 91 | /* Use GSBI1 QUP for /dev/i2c-1 */ |
| 92 | struct platform_device msm_gsbi1_qup_i2c_device = { |
| 93 | .name = "qup_i2c", |
| 94 | .id = MSM_GSBI1_QUP_I2C_BUS_ID, |
| 95 | .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources), |
| 96 | .resource = gsbi1_qup_i2c_resources, |
| 97 | }; |
| 98 | |
| 99 | #define MSM_HSUSB_PHYS 0xA0800000 |
| 100 | static struct resource resources_hsusb_otg[] = { |
| 101 | { |
| 102 | .start = MSM_HSUSB_PHYS, |
| 103 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 104 | .flags = IORESOURCE_MEM, |
| 105 | }, |
| 106 | { |
| 107 | .start = INT_USB_HS, |
| 108 | .end = INT_USB_HS, |
| 109 | .flags = IORESOURCE_IRQ, |
| 110 | }, |
| 111 | }; |
| 112 | |
| 113 | static u64 dma_mask = 0xffffffffULL; |
| 114 | struct platform_device msm_device_otg = { |
| 115 | .name = "msm_otg", |
| 116 | .id = -1, |
| 117 | .num_resources = ARRAY_SIZE(resources_hsusb_otg), |
| 118 | .resource = resources_hsusb_otg, |
| 119 | .dev = { |
| 120 | .dma_mask = &dma_mask, |
| 121 | .coherent_dma_mask = 0xffffffffULL, |
| 122 | }, |
| 123 | }; |
| 124 | |
| 125 | static struct resource resources_gadget_peripheral[] = { |
| 126 | { |
| 127 | .start = MSM_HSUSB_PHYS, |
| 128 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 129 | .flags = IORESOURCE_MEM, |
| 130 | }, |
| 131 | { |
| 132 | .start = INT_USB_HS, |
| 133 | .end = INT_USB_HS, |
| 134 | .flags = IORESOURCE_IRQ, |
| 135 | }, |
| 136 | }; |
| 137 | |
| 138 | struct platform_device msm_device_gadget_peripheral = { |
| 139 | .name = "msm_hsusb", |
| 140 | .id = -1, |
| 141 | .num_resources = ARRAY_SIZE(resources_gadget_peripheral), |
| 142 | .resource = resources_gadget_peripheral, |
| 143 | .dev = { |
| 144 | .dma_mask = &dma_mask, |
| 145 | .coherent_dma_mask = 0xffffffffULL, |
| 146 | }, |
| 147 | }; |
| 148 | |
| 149 | static struct resource resources_hsusb_host[] = { |
| 150 | { |
| 151 | .start = MSM_HSUSB_PHYS, |
| 152 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 153 | .flags = IORESOURCE_MEM, |
| 154 | }, |
| 155 | { |
| 156 | .start = INT_USB_HS, |
| 157 | .end = INT_USB_HS, |
| 158 | .flags = IORESOURCE_IRQ, |
| 159 | }, |
| 160 | }; |
| 161 | |
| 162 | struct platform_device msm_device_hsusb_host = { |
| 163 | .name = "msm_hsusb_host", |
| 164 | .id = 0, |
| 165 | .num_resources = ARRAY_SIZE(resources_hsusb_host), |
| 166 | .resource = resources_hsusb_host, |
| 167 | .dev = { |
| 168 | .dma_mask = &dma_mask, |
| 169 | .coherent_dma_mask = 0xffffffffULL, |
| 170 | }, |
| 171 | }; |
| 172 | |
| 173 | static struct platform_device *msm_host_devices[] = { |
| 174 | &msm_device_hsusb_host, |
| 175 | }; |
| 176 | |
| 177 | int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat) |
| 178 | { |
| 179 | struct platform_device *pdev; |
| 180 | |
| 181 | pdev = msm_host_devices[host]; |
| 182 | if (!pdev) |
| 183 | return -ENODEV; |
| 184 | pdev->dev.platform_data = plat; |
| 185 | return platform_device_register(pdev); |
| 186 | } |
| 187 | |
| 188 | static struct resource msm_dmov_resource[] = { |
| 189 | { |
| 190 | .start = INT_ADM_AARM, |
| 191 | .end = (resource_size_t)MSM_DMOV_BASE, |
| 192 | .flags = IORESOURCE_IRQ, |
| 193 | }, |
| 194 | }; |
| 195 | |
| 196 | struct platform_device msm_device_dmov = { |
| 197 | .name = "msm_dmov", |
| 198 | .id = -1, |
| 199 | .resource = msm_dmov_resource, |
| 200 | .num_resources = ARRAY_SIZE(msm_dmov_resource), |
| 201 | }; |
| 202 | |
| 203 | struct platform_device msm_device_smd = { |
| 204 | .name = "msm_smd", |
| 205 | .id = -1, |
| 206 | }; |
| 207 | |
| 208 | static struct resource resources_uart1[] = { |
| 209 | { |
| 210 | .start = INT_UART1, |
| 211 | .end = INT_UART1, |
| 212 | .flags = IORESOURCE_IRQ, |
| 213 | }, |
| 214 | { |
| 215 | .start = MSM_UART1_PHYS, |
| 216 | .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1, |
| 217 | .flags = IORESOURCE_MEM, |
| 218 | }, |
| 219 | }; |
| 220 | |
| 221 | struct platform_device msm_device_uart1 = { |
| 222 | .name = "msm_serial", |
| 223 | .id = 0, |
| 224 | .num_resources = ARRAY_SIZE(resources_uart1), |
| 225 | .resource = resources_uart1, |
| 226 | }; |
| 227 | |
| 228 | #define MSM_UART1DM_PHYS 0xA0200000 |
| 229 | static struct resource msm_uart1_dm_resources[] = { |
| 230 | { |
| 231 | .start = MSM_UART1DM_PHYS, |
| 232 | .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1, |
| 233 | .flags = IORESOURCE_MEM, |
| 234 | }, |
| 235 | { |
| 236 | .start = INT_UART1DM_IRQ, |
| 237 | .end = INT_UART1DM_IRQ, |
| 238 | .flags = IORESOURCE_IRQ, |
| 239 | }, |
| 240 | { |
| 241 | .start = INT_UART1DM_RX, |
| 242 | .end = INT_UART1DM_RX, |
| 243 | .flags = IORESOURCE_IRQ, |
| 244 | }, |
| 245 | { |
| 246 | .start = DMOV_HSUART1_TX_CHAN, |
| 247 | .end = DMOV_HSUART1_RX_CHAN, |
| 248 | .name = "uartdm_channels", |
| 249 | .flags = IORESOURCE_DMA, |
| 250 | }, |
| 251 | { |
| 252 | .start = DMOV_HSUART1_TX_CRCI, |
| 253 | .end = DMOV_HSUART1_RX_CRCI, |
| 254 | .name = "uartdm_crci", |
| 255 | .flags = IORESOURCE_DMA, |
| 256 | }, |
| 257 | }; |
| 258 | |
| 259 | static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32); |
| 260 | struct platform_device msm_device_uart_dm1 = { |
| 261 | .name = "msm_serial_hs", |
| 262 | .id = 0, |
| 263 | .num_resources = ARRAY_SIZE(msm_uart1_dm_resources), |
| 264 | .resource = msm_uart1_dm_resources, |
| 265 | .dev = { |
| 266 | .dma_mask = &msm_uart_dm1_dma_mask, |
| 267 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 268 | }, |
| 269 | }; |
| 270 | |
| 271 | #define MSM_UART2DM_PHYS 0xA0300000 |
| 272 | static struct resource msm_uart2dm_resources[] = { |
| 273 | { |
| 274 | .start = MSM_UART2DM_PHYS, |
| 275 | .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1, |
| 276 | .name = "uartdm_resource", |
| 277 | .flags = IORESOURCE_MEM, |
| 278 | }, |
| 279 | { |
| 280 | .start = INT_UART2DM_IRQ, |
| 281 | .end = INT_UART2DM_IRQ, |
| 282 | .flags = IORESOURCE_IRQ, |
| 283 | }, |
| 284 | }; |
| 285 | |
| 286 | struct platform_device msm_device_uart_dm2 = { |
| 287 | .name = "msm_serial_hsl", |
| 288 | .id = 0, |
| 289 | .num_resources = ARRAY_SIZE(msm_uart2dm_resources), |
| 290 | .resource = msm_uart2dm_resources, |
| 291 | }; |
| 292 | |
| 293 | #define MSM_NAND_PHYS 0xA0A00000 |
| 294 | #define MSM_NANDC01_PHYS 0xA0A40000 |
| 295 | #define MSM_NANDC10_PHYS 0xA0A80000 |
| 296 | #define MSM_NANDC11_PHYS 0xA0AC0000 |
| 297 | #define EBI2_REG_BASE 0xA0D00000 |
| 298 | static struct resource resources_nand[] = { |
| 299 | [0] = { |
| 300 | .name = "msm_nand_dmac", |
| 301 | .start = DMOV_NAND_CHAN, |
| 302 | .end = DMOV_NAND_CHAN, |
| 303 | .flags = IORESOURCE_DMA, |
| 304 | }, |
| 305 | [1] = { |
| 306 | .name = "msm_nand_phys", |
| 307 | .start = MSM_NAND_PHYS, |
| 308 | .end = MSM_NAND_PHYS + 0x7FF, |
| 309 | .flags = IORESOURCE_MEM, |
| 310 | }, |
| 311 | [2] = { |
| 312 | .name = "msm_nandc01_phys", |
| 313 | .start = MSM_NANDC01_PHYS, |
| 314 | .end = MSM_NANDC01_PHYS + 0x7FF, |
| 315 | .flags = IORESOURCE_MEM, |
| 316 | }, |
| 317 | [3] = { |
| 318 | .name = "msm_nandc10_phys", |
| 319 | .start = MSM_NANDC10_PHYS, |
| 320 | .end = MSM_NANDC10_PHYS + 0x7FF, |
| 321 | .flags = IORESOURCE_MEM, |
| 322 | }, |
| 323 | [4] = { |
| 324 | .name = "msm_nandc11_phys", |
| 325 | .start = MSM_NANDC11_PHYS, |
| 326 | .end = MSM_NANDC11_PHYS + 0x7FF, |
| 327 | .flags = IORESOURCE_MEM, |
| 328 | }, |
| 329 | [5] = { |
| 330 | .name = "ebi2_reg_base", |
| 331 | .start = EBI2_REG_BASE, |
| 332 | .end = EBI2_REG_BASE + 0x60, |
| 333 | .flags = IORESOURCE_MEM, |
| 334 | }, |
| 335 | }; |
| 336 | |
| 337 | struct flash_platform_data msm_nand_data; |
| 338 | |
| 339 | struct platform_device msm_device_nand = { |
| 340 | .name = "msm_nand", |
| 341 | .id = -1, |
| 342 | .num_resources = ARRAY_SIZE(resources_nand), |
| 343 | .resource = resources_nand, |
| 344 | .dev = { |
| 345 | .platform_data = &msm_nand_data, |
| 346 | }, |
| 347 | }; |
| 348 | |
| 349 | #define MSM_SDC1_BASE 0xA0400000 |
| 350 | #define MSM_SDC2_BASE 0xA0500000 |
| 351 | #define MSM_SDC3_BASE 0xA0600000 |
| 352 | #define MSM_SDC4_BASE 0xA0700000 |
| 353 | static struct resource resources_sdc1[] = { |
| 354 | { |
| 355 | .start = MSM_SDC1_BASE, |
| 356 | .end = MSM_SDC1_BASE + SZ_4K - 1, |
| 357 | .flags = IORESOURCE_MEM, |
| 358 | }, |
| 359 | { |
| 360 | .start = INT_SDC1_0, |
| 361 | .end = INT_SDC1_1, |
| 362 | .flags = IORESOURCE_IRQ, |
| 363 | }, |
| 364 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame^] | 365 | .name = "sdcc_dma_chnl", |
| 366 | .start = DMOV_SDC1_CHAN, |
| 367 | .end = DMOV_SDC1_CHAN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 368 | .flags = IORESOURCE_DMA, |
| 369 | }, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame^] | 370 | { |
| 371 | .name = "sdcc_dma_crci", |
| 372 | .start = DMOV_SDC1_CRCI, |
| 373 | .end = DMOV_SDC1_CRCI, |
| 374 | .flags = IORESOURCE_DMA, |
| 375 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 376 | }; |
| 377 | |
| 378 | static struct resource resources_sdc2[] = { |
| 379 | { |
| 380 | .start = MSM_SDC2_BASE, |
| 381 | .end = MSM_SDC2_BASE + SZ_4K - 1, |
| 382 | .flags = IORESOURCE_MEM, |
| 383 | }, |
| 384 | { |
| 385 | .start = INT_SDC2_0, |
| 386 | .end = INT_SDC2_1, |
| 387 | .flags = IORESOURCE_IRQ, |
| 388 | }, |
| 389 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame^] | 390 | .name = "sdcc_dma_chnl", |
| 391 | .start = DMOV_SDC2_CHAN, |
| 392 | .end = DMOV_SDC2_CHAN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 393 | .flags = IORESOURCE_DMA, |
| 394 | }, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame^] | 395 | { |
| 396 | .name = "sdcc_dma_crci", |
| 397 | .start = DMOV_SDC2_CRCI, |
| 398 | .end = DMOV_SDC2_CRCI, |
| 399 | .flags = IORESOURCE_DMA, |
| 400 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 401 | }; |
| 402 | |
| 403 | static struct resource resources_sdc3[] = { |
| 404 | { |
| 405 | .start = MSM_SDC3_BASE, |
| 406 | .end = MSM_SDC3_BASE + SZ_4K - 1, |
| 407 | .flags = IORESOURCE_MEM, |
| 408 | }, |
| 409 | { |
| 410 | .start = INT_SDC3_0, |
| 411 | .end = INT_SDC3_1, |
| 412 | .flags = IORESOURCE_IRQ, |
| 413 | }, |
| 414 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame^] | 415 | .name = "sdcc_dma_chnl", |
| 416 | .start = DMOV_SDC4_CHAN, |
| 417 | .end = DMOV_SDC4_CHAN, |
| 418 | .flags = IORESOURCE_DMA, |
| 419 | }, |
| 420 | { |
| 421 | .name = "sdcc_dma_crci", |
| 422 | .start = DMOV_SDC4_CRCI, |
| 423 | .end = DMOV_SDC4_CRCI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 424 | .flags = IORESOURCE_DMA, |
| 425 | }, |
| 426 | }; |
| 427 | |
| 428 | static struct resource resources_sdc4[] = { |
| 429 | { |
| 430 | .start = MSM_SDC4_BASE, |
| 431 | .end = MSM_SDC4_BASE + SZ_4K - 1, |
| 432 | .flags = IORESOURCE_MEM, |
| 433 | }, |
| 434 | { |
| 435 | .start = INT_SDC4_0, |
| 436 | .end = INT_SDC4_1, |
| 437 | .flags = IORESOURCE_IRQ, |
| 438 | }, |
| 439 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame^] | 440 | .name = "sdcc_dma_chnl", |
| 441 | .start = DMOV_SDC3_CHAN, |
| 442 | .end = DMOV_SDC3_CHAN, |
| 443 | .flags = IORESOURCE_DMA, |
| 444 | }, |
| 445 | { |
| 446 | .name = "sdcc_dma_crci", |
| 447 | .start = DMOV_SDC3_CRCI, |
| 448 | .end = DMOV_SDC3_CRCI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 449 | .flags = IORESOURCE_DMA, |
| 450 | }, |
| 451 | }; |
| 452 | |
| 453 | struct platform_device msm_device_sdc1 = { |
| 454 | .name = "msm_sdcc", |
| 455 | .id = 1, |
| 456 | .num_resources = ARRAY_SIZE(resources_sdc1), |
| 457 | .resource = resources_sdc1, |
| 458 | .dev = { |
| 459 | .coherent_dma_mask = 0xffffffff, |
| 460 | }, |
| 461 | }; |
| 462 | |
| 463 | struct platform_device msm_device_sdc2 = { |
| 464 | .name = "msm_sdcc", |
| 465 | .id = 2, |
| 466 | .num_resources = ARRAY_SIZE(resources_sdc2), |
| 467 | .resource = resources_sdc2, |
| 468 | .dev = { |
| 469 | .coherent_dma_mask = 0xffffffff, |
| 470 | }, |
| 471 | }; |
| 472 | |
| 473 | struct platform_device msm_device_sdc3 = { |
| 474 | .name = "msm_sdcc", |
| 475 | .id = 3, |
| 476 | .num_resources = ARRAY_SIZE(resources_sdc3), |
| 477 | .resource = resources_sdc3, |
| 478 | .dev = { |
| 479 | .coherent_dma_mask = 0xffffffff, |
| 480 | }, |
| 481 | }; |
| 482 | |
| 483 | struct platform_device msm_device_sdc4 = { |
| 484 | .name = "msm_sdcc", |
| 485 | .id = 4, |
| 486 | .num_resources = ARRAY_SIZE(resources_sdc4), |
| 487 | .resource = resources_sdc4, |
| 488 | .dev = { |
| 489 | .coherent_dma_mask = 0xffffffff, |
| 490 | }, |
| 491 | }; |
| 492 | |
| 493 | static struct platform_device *msm_sdcc_devices[] __initdata = { |
| 494 | &msm_device_sdc1, |
| 495 | &msm_device_sdc2, |
| 496 | &msm_device_sdc3, |
| 497 | &msm_device_sdc4, |
| 498 | }; |
| 499 | |
| 500 | int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat) |
| 501 | { |
| 502 | struct platform_device *pdev; |
| 503 | |
| 504 | if (controller < 1 || controller > 4) |
| 505 | return -EINVAL; |
| 506 | |
| 507 | pdev = msm_sdcc_devices[controller-1]; |
| 508 | pdev->dev.platform_data = plat; |
| 509 | return platform_device_register(pdev); |
| 510 | } |
| 511 | |
| 512 | #define MDP_BASE 0xAA200000 |
| 513 | #define MIPI_DSI_HW_BASE 0xA1100000 |
| 514 | |
| 515 | static struct resource msm_mipi_dsi_resources[] = { |
| 516 | { |
| 517 | .name = "mipi_dsi", |
| 518 | .start = MIPI_DSI_HW_BASE, |
| 519 | .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1, |
| 520 | .flags = IORESOURCE_MEM, |
| 521 | }, |
| 522 | { |
| 523 | .start = INT_DSI_IRQ, |
| 524 | .end = INT_DSI_IRQ, |
| 525 | .flags = IORESOURCE_IRQ, |
| 526 | }, |
| 527 | }; |
| 528 | |
| 529 | static struct platform_device msm_mipi_dsi_device = { |
| 530 | .name = "mipi_dsi", |
| 531 | .id = 1, |
| 532 | .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources), |
| 533 | .resource = msm_mipi_dsi_resources, |
| 534 | }; |
| 535 | |
| 536 | static struct resource msm_mdp_resources[] = { |
| 537 | { |
| 538 | .name = "mdp", |
| 539 | .start = MDP_BASE, |
| 540 | .end = MDP_BASE + 0x000F1008 - 1, |
| 541 | .flags = IORESOURCE_MEM, |
| 542 | }, |
| 543 | { |
| 544 | .start = INT_MDP, |
| 545 | .end = INT_MDP, |
| 546 | .flags = IORESOURCE_IRQ, |
| 547 | }, |
| 548 | }; |
| 549 | |
| 550 | static struct platform_device msm_mdp_device = { |
| 551 | .name = "mdp", |
| 552 | .id = 0, |
| 553 | .num_resources = ARRAY_SIZE(msm_mdp_resources), |
| 554 | .resource = msm_mdp_resources, |
| 555 | }; |
| 556 | |
| 557 | static struct platform_device msm_lcdc_device = { |
| 558 | .name = "lcdc", |
| 559 | .id = 0, |
| 560 | }; |
| 561 | |
| 562 | static struct resource kgsl_3d0_resources[] = { |
| 563 | { |
| 564 | .name = KGSL_3D0_REG_MEMORY, |
| 565 | .start = 0xA0000000, |
| 566 | .end = 0xA001ffff, |
| 567 | .flags = IORESOURCE_MEM, |
| 568 | }, |
| 569 | { |
| 570 | .name = KGSL_3D0_IRQ, |
| 571 | .start = INT_GRAPHICS, |
| 572 | .end = INT_GRAPHICS, |
| 573 | .flags = IORESOURCE_IRQ, |
| 574 | }, |
| 575 | }; |
| 576 | |
| 577 | static struct kgsl_device_platform_data kgsl_3d0_pdata = { |
| 578 | .pwr_data = { |
| 579 | .pwrlevel = { |
| 580 | { |
| 581 | .gpu_freq = 245760000, |
| 582 | .bus_freq = 200000000, |
| 583 | }, |
| 584 | { |
| 585 | .gpu_freq = 133330000, |
| 586 | .bus_freq = 0, |
| 587 | }, |
| 588 | }, |
| 589 | .init_level = 0, |
| 590 | .num_levels = 2, |
| 591 | .set_grp_async = set_grp_xbar_async, |
| 592 | .idle_timeout = HZ/5, |
| 593 | .nap_allowed = false, |
| 594 | }, |
| 595 | .clk = { |
| 596 | .name = { |
| 597 | .clk = "grp_clk", |
| 598 | .pclk = "grp_pclk", |
| 599 | }, |
| 600 | }, |
| 601 | .imem_clk_name = { |
| 602 | .clk = "imem_clk", |
| 603 | .pclk = NULL, |
| 604 | }, |
| 605 | |
| 606 | }; |
| 607 | |
| 608 | struct platform_device msm_kgsl_3d0 = { |
| 609 | .name = "kgsl-3d0", |
| 610 | .id = 0, |
| 611 | .num_resources = ARRAY_SIZE(kgsl_3d0_resources), |
| 612 | .resource = kgsl_3d0_resources, |
| 613 | .dev = { |
| 614 | .platform_data = &kgsl_3d0_pdata, |
| 615 | }, |
| 616 | }; |
| 617 | |
| 618 | void __init msm7x25a_kgsl_3d0_init(void) |
| 619 | { |
| 620 | if (cpu_is_msm7x25a() || cpu_is_msm7x25aa()) { |
| 621 | kgsl_3d0_pdata.pwr_data.pwrlevel[0].gpu_freq = 133330000; |
Lynus Vaz | 8d3208c | 2011-07-06 20:27:46 +0530 | [diff] [blame] | 622 | kgsl_3d0_pdata.pwr_data.pwrlevel[0].bus_freq = 160000000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 623 | kgsl_3d0_pdata.pwr_data.pwrlevel[1].gpu_freq = 96000000; |
| 624 | kgsl_3d0_pdata.pwr_data.pwrlevel[1].bus_freq = 0; |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | static void __init msm_register_device(struct platform_device *pdev, void *data) |
| 629 | { |
| 630 | int ret; |
| 631 | |
| 632 | pdev->dev.platform_data = data; |
| 633 | |
| 634 | ret = platform_device_register(pdev); |
| 635 | |
| 636 | if (ret) |
| 637 | dev_err(&pdev->dev, |
| 638 | "%s: platform_device_register() failed = %d\n", |
| 639 | __func__, ret); |
| 640 | } |
| 641 | |
| 642 | void __init msm_fb_register_device(char *name, void *data) |
| 643 | { |
| 644 | if (!strncmp(name, "mdp", 3)) |
| 645 | msm_register_device(&msm_mdp_device, data); |
| 646 | else if (!strncmp(name, "mipi_dsi", 8)) |
| 647 | msm_register_device(&msm_mipi_dsi_device, data); |
| 648 | else if (!strncmp(name, "lcdc", 4)) |
| 649 | msm_register_device(&msm_lcdc_device, data); |
| 650 | else |
| 651 | printk(KERN_ERR "%s: unknown device! %s\n", __func__, name); |
| 652 | } |
| 653 | |
| 654 | #define PERPH_WEB_BLOCK_ADDR (0xA9D00040) |
| 655 | #define PDM0_CTL_OFFSET (0x04) |
| 656 | #define SIZE_8B (0x08) |
| 657 | |
| 658 | static struct resource resources_led[] = { |
| 659 | { |
| 660 | .start = PERPH_WEB_BLOCK_ADDR, |
| 661 | .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1, |
| 662 | .name = "led-gpio-pdm", |
| 663 | .flags = IORESOURCE_MEM, |
| 664 | }, |
| 665 | }; |
| 666 | |
| 667 | static struct led_info msm_kpbl_pdm_led_pdata = { |
| 668 | .name = "keyboard-backlight", |
| 669 | }; |
| 670 | |
| 671 | struct platform_device led_pdev = { |
| 672 | .name = "leds-msm-pdm", |
| 673 | /* use pdev id to represent pdm id */ |
| 674 | .id = 0, |
| 675 | .num_resources = ARRAY_SIZE(resources_led), |
| 676 | .resource = resources_led, |
| 677 | .dev = { |
| 678 | .platform_data = &msm_kpbl_pdm_led_pdata, |
| 679 | }, |
| 680 | }; |
| 681 | |
Manish Dewangan | 3a26099 | 2011-06-24 18:01:34 +0530 | [diff] [blame] | 682 | struct platform_device asoc_msm_pcm = { |
| 683 | .name = "msm-dsp-audio", |
| 684 | .id = 0, |
| 685 | }; |
| 686 | |
| 687 | struct platform_device asoc_msm_dai0 = { |
| 688 | .name = "msm-codec-dai", |
| 689 | .id = 0, |
| 690 | }; |
| 691 | |
| 692 | struct platform_device asoc_msm_dai1 = { |
| 693 | .name = "msm-cpu-dai", |
| 694 | .id = 0, |
| 695 | }; |
| 696 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 697 | static struct msm_acpu_clock_platform_data msm7x2x_clock_data = { |
| 698 | .acpu_switch_time_us = 50, |
| 699 | .max_speed_delta_khz = 400000, |
| 700 | .vdd_switch_time_us = 62, |
| 701 | .max_axi_khz = 200000, |
| 702 | }; |
| 703 | |
| 704 | int __init msm7x2x_misc_init(void) |
| 705 | { |
| 706 | if (socinfo_init() < 0) |
| 707 | pr_err("%s: socinfo_init() failed!\n", __func__); |
| 708 | |
Trilok Soni | f597e24 | 2011-06-06 12:37:16 +0530 | [diff] [blame] | 709 | if (cpu_is_msm7x27aa()) |
| 710 | msm7x2x_clock_data.max_speed_delta_khz = 504000; |
| 711 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 712 | msm_clock_init(msm_clocks_7x27a, msm_num_clocks_7x27a); |
| 713 | msm_acpu_clock_init(&msm7x2x_clock_data); |
| 714 | |
| 715 | return 0; |
| 716 | } |
| 717 | |
| 718 | #ifdef CONFIG_CACHE_L2X0 |
| 719 | static int __init msm7x27x_cache_init(void) |
| 720 | { |
| 721 | int aux_ctrl = 0; |
| 722 | |
| 723 | /* Way Size 010(0x2) 32KB */ |
| 724 | aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \ |
| 725 | (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \ |
| 726 | (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT); |
| 727 | |
| 728 | l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK); |
| 729 | |
| 730 | return 0; |
| 731 | } |
| 732 | #else |
| 733 | static int __init msm_cache_init(void){ return 0; } |
| 734 | #endif |
| 735 | |
| 736 | void __init msm_common_io_init(void) |
| 737 | { |
| 738 | msm_map_common_io(); |
| 739 | msm7x27x_cache_init(); |
| 740 | } |
| 741 | |
| 742 | struct platform_device *msm_footswitch_devices[] = { |
| 743 | FS_PCOM(FS_GFX3D, "fs_gfx3d"), |
| 744 | }; |
| 745 | unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices); |