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