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 | { |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 191 | .start = INT_ADM_AARM, |
| 192 | .flags = IORESOURCE_IRQ, |
| 193 | }, |
| 194 | { |
| 195 | .start = 0xA9700000, |
| 196 | .end = 0xA9700000 + SZ_4K - 1, |
| 197 | .flags = IORESOURCE_MEM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 198 | }, |
| 199 | }; |
| 200 | |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 201 | static struct msm_dmov_pdata msm_dmov_pdata = { |
| 202 | .sd = 3, |
| 203 | .sd_size = 0x400, |
| 204 | }; |
| 205 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 206 | struct platform_device msm_device_dmov = { |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 207 | .name = "msm_dmov", |
| 208 | .id = -1, |
| 209 | .resource = msm_dmov_resource, |
| 210 | .num_resources = ARRAY_SIZE(msm_dmov_resource), |
| 211 | .dev = { |
| 212 | .platform_data = &msm_dmov_pdata, |
| 213 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 214 | }; |
| 215 | |
| 216 | struct platform_device msm_device_smd = { |
| 217 | .name = "msm_smd", |
| 218 | .id = -1, |
| 219 | }; |
| 220 | |
| 221 | static struct resource resources_uart1[] = { |
| 222 | { |
| 223 | .start = INT_UART1, |
| 224 | .end = INT_UART1, |
| 225 | .flags = IORESOURCE_IRQ, |
| 226 | }, |
| 227 | { |
| 228 | .start = MSM_UART1_PHYS, |
| 229 | .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1, |
| 230 | .flags = IORESOURCE_MEM, |
| 231 | }, |
| 232 | }; |
| 233 | |
| 234 | struct platform_device msm_device_uart1 = { |
| 235 | .name = "msm_serial", |
| 236 | .id = 0, |
| 237 | .num_resources = ARRAY_SIZE(resources_uart1), |
| 238 | .resource = resources_uart1, |
| 239 | }; |
| 240 | |
| 241 | #define MSM_UART1DM_PHYS 0xA0200000 |
| 242 | static struct resource msm_uart1_dm_resources[] = { |
| 243 | { |
| 244 | .start = MSM_UART1DM_PHYS, |
| 245 | .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1, |
| 246 | .flags = IORESOURCE_MEM, |
| 247 | }, |
| 248 | { |
| 249 | .start = INT_UART1DM_IRQ, |
| 250 | .end = INT_UART1DM_IRQ, |
| 251 | .flags = IORESOURCE_IRQ, |
| 252 | }, |
| 253 | { |
| 254 | .start = INT_UART1DM_RX, |
| 255 | .end = INT_UART1DM_RX, |
| 256 | .flags = IORESOURCE_IRQ, |
| 257 | }, |
| 258 | { |
| 259 | .start = DMOV_HSUART1_TX_CHAN, |
| 260 | .end = DMOV_HSUART1_RX_CHAN, |
| 261 | .name = "uartdm_channels", |
| 262 | .flags = IORESOURCE_DMA, |
| 263 | }, |
| 264 | { |
| 265 | .start = DMOV_HSUART1_TX_CRCI, |
| 266 | .end = DMOV_HSUART1_RX_CRCI, |
| 267 | .name = "uartdm_crci", |
| 268 | .flags = IORESOURCE_DMA, |
| 269 | }, |
| 270 | }; |
| 271 | |
| 272 | static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32); |
| 273 | struct platform_device msm_device_uart_dm1 = { |
| 274 | .name = "msm_serial_hs", |
| 275 | .id = 0, |
| 276 | .num_resources = ARRAY_SIZE(msm_uart1_dm_resources), |
| 277 | .resource = msm_uart1_dm_resources, |
| 278 | .dev = { |
| 279 | .dma_mask = &msm_uart_dm1_dma_mask, |
| 280 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 281 | }, |
| 282 | }; |
| 283 | |
| 284 | #define MSM_UART2DM_PHYS 0xA0300000 |
| 285 | static struct resource msm_uart2dm_resources[] = { |
| 286 | { |
| 287 | .start = MSM_UART2DM_PHYS, |
| 288 | .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1, |
| 289 | .name = "uartdm_resource", |
| 290 | .flags = IORESOURCE_MEM, |
| 291 | }, |
| 292 | { |
| 293 | .start = INT_UART2DM_IRQ, |
| 294 | .end = INT_UART2DM_IRQ, |
| 295 | .flags = IORESOURCE_IRQ, |
| 296 | }, |
| 297 | }; |
| 298 | |
| 299 | struct platform_device msm_device_uart_dm2 = { |
| 300 | .name = "msm_serial_hsl", |
| 301 | .id = 0, |
| 302 | .num_resources = ARRAY_SIZE(msm_uart2dm_resources), |
| 303 | .resource = msm_uart2dm_resources, |
| 304 | }; |
| 305 | |
| 306 | #define MSM_NAND_PHYS 0xA0A00000 |
| 307 | #define MSM_NANDC01_PHYS 0xA0A40000 |
| 308 | #define MSM_NANDC10_PHYS 0xA0A80000 |
| 309 | #define MSM_NANDC11_PHYS 0xA0AC0000 |
| 310 | #define EBI2_REG_BASE 0xA0D00000 |
| 311 | static struct resource resources_nand[] = { |
| 312 | [0] = { |
| 313 | .name = "msm_nand_dmac", |
| 314 | .start = DMOV_NAND_CHAN, |
| 315 | .end = DMOV_NAND_CHAN, |
| 316 | .flags = IORESOURCE_DMA, |
| 317 | }, |
| 318 | [1] = { |
| 319 | .name = "msm_nand_phys", |
| 320 | .start = MSM_NAND_PHYS, |
| 321 | .end = MSM_NAND_PHYS + 0x7FF, |
| 322 | .flags = IORESOURCE_MEM, |
| 323 | }, |
| 324 | [2] = { |
| 325 | .name = "msm_nandc01_phys", |
| 326 | .start = MSM_NANDC01_PHYS, |
| 327 | .end = MSM_NANDC01_PHYS + 0x7FF, |
| 328 | .flags = IORESOURCE_MEM, |
| 329 | }, |
| 330 | [3] = { |
| 331 | .name = "msm_nandc10_phys", |
| 332 | .start = MSM_NANDC10_PHYS, |
| 333 | .end = MSM_NANDC10_PHYS + 0x7FF, |
| 334 | .flags = IORESOURCE_MEM, |
| 335 | }, |
| 336 | [4] = { |
| 337 | .name = "msm_nandc11_phys", |
| 338 | .start = MSM_NANDC11_PHYS, |
| 339 | .end = MSM_NANDC11_PHYS + 0x7FF, |
| 340 | .flags = IORESOURCE_MEM, |
| 341 | }, |
| 342 | [5] = { |
| 343 | .name = "ebi2_reg_base", |
| 344 | .start = EBI2_REG_BASE, |
| 345 | .end = EBI2_REG_BASE + 0x60, |
| 346 | .flags = IORESOURCE_MEM, |
| 347 | }, |
| 348 | }; |
| 349 | |
| 350 | struct flash_platform_data msm_nand_data; |
| 351 | |
| 352 | struct platform_device msm_device_nand = { |
| 353 | .name = "msm_nand", |
| 354 | .id = -1, |
| 355 | .num_resources = ARRAY_SIZE(resources_nand), |
| 356 | .resource = resources_nand, |
| 357 | .dev = { |
| 358 | .platform_data = &msm_nand_data, |
| 359 | }, |
| 360 | }; |
| 361 | |
| 362 | #define MSM_SDC1_BASE 0xA0400000 |
| 363 | #define MSM_SDC2_BASE 0xA0500000 |
| 364 | #define MSM_SDC3_BASE 0xA0600000 |
| 365 | #define MSM_SDC4_BASE 0xA0700000 |
| 366 | static struct resource resources_sdc1[] = { |
| 367 | { |
| 368 | .start = MSM_SDC1_BASE, |
| 369 | .end = MSM_SDC1_BASE + SZ_4K - 1, |
| 370 | .flags = IORESOURCE_MEM, |
| 371 | }, |
| 372 | { |
| 373 | .start = INT_SDC1_0, |
| 374 | .end = INT_SDC1_1, |
| 375 | .flags = IORESOURCE_IRQ, |
| 376 | }, |
| 377 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 378 | .name = "sdcc_dma_chnl", |
| 379 | .start = DMOV_SDC1_CHAN, |
| 380 | .end = DMOV_SDC1_CHAN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 381 | .flags = IORESOURCE_DMA, |
| 382 | }, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 383 | { |
| 384 | .name = "sdcc_dma_crci", |
| 385 | .start = DMOV_SDC1_CRCI, |
| 386 | .end = DMOV_SDC1_CRCI, |
| 387 | .flags = IORESOURCE_DMA, |
| 388 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 389 | }; |
| 390 | |
| 391 | static struct resource resources_sdc2[] = { |
| 392 | { |
| 393 | .start = MSM_SDC2_BASE, |
| 394 | .end = MSM_SDC2_BASE + SZ_4K - 1, |
| 395 | .flags = IORESOURCE_MEM, |
| 396 | }, |
| 397 | { |
| 398 | .start = INT_SDC2_0, |
| 399 | .end = INT_SDC2_1, |
| 400 | .flags = IORESOURCE_IRQ, |
| 401 | }, |
| 402 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 403 | .name = "sdcc_dma_chnl", |
| 404 | .start = DMOV_SDC2_CHAN, |
| 405 | .end = DMOV_SDC2_CHAN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 406 | .flags = IORESOURCE_DMA, |
| 407 | }, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 408 | { |
| 409 | .name = "sdcc_dma_crci", |
| 410 | .start = DMOV_SDC2_CRCI, |
| 411 | .end = DMOV_SDC2_CRCI, |
| 412 | .flags = IORESOURCE_DMA, |
| 413 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 414 | }; |
| 415 | |
| 416 | static struct resource resources_sdc3[] = { |
| 417 | { |
| 418 | .start = MSM_SDC3_BASE, |
| 419 | .end = MSM_SDC3_BASE + SZ_4K - 1, |
| 420 | .flags = IORESOURCE_MEM, |
| 421 | }, |
| 422 | { |
| 423 | .start = INT_SDC3_0, |
| 424 | .end = INT_SDC3_1, |
| 425 | .flags = IORESOURCE_IRQ, |
| 426 | }, |
| 427 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 428 | .name = "sdcc_dma_chnl", |
Sujit Reddy Thumma | 119bfbb | 2011-10-12 11:52:21 +0530 | [diff] [blame] | 429 | .start = DMOV_SDC3_CHAN, |
| 430 | .end = DMOV_SDC3_CHAN, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 431 | .flags = IORESOURCE_DMA, |
| 432 | }, |
| 433 | { |
| 434 | .name = "sdcc_dma_crci", |
Sujit Reddy Thumma | 119bfbb | 2011-10-12 11:52:21 +0530 | [diff] [blame] | 435 | .start = DMOV_SDC3_CRCI, |
| 436 | .end = DMOV_SDC3_CRCI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 437 | .flags = IORESOURCE_DMA, |
| 438 | }, |
| 439 | }; |
| 440 | |
| 441 | static struct resource resources_sdc4[] = { |
| 442 | { |
| 443 | .start = MSM_SDC4_BASE, |
| 444 | .end = MSM_SDC4_BASE + SZ_4K - 1, |
| 445 | .flags = IORESOURCE_MEM, |
| 446 | }, |
| 447 | { |
| 448 | .start = INT_SDC4_0, |
| 449 | .end = INT_SDC4_1, |
| 450 | .flags = IORESOURCE_IRQ, |
| 451 | }, |
| 452 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 453 | .name = "sdcc_dma_chnl", |
Sujit Reddy Thumma | 119bfbb | 2011-10-12 11:52:21 +0530 | [diff] [blame] | 454 | .start = DMOV_SDC4_CHAN, |
| 455 | .end = DMOV_SDC4_CHAN, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 456 | .flags = IORESOURCE_DMA, |
| 457 | }, |
| 458 | { |
| 459 | .name = "sdcc_dma_crci", |
Sujit Reddy Thumma | 119bfbb | 2011-10-12 11:52:21 +0530 | [diff] [blame] | 460 | .start = DMOV_SDC4_CRCI, |
| 461 | .end = DMOV_SDC4_CRCI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 462 | .flags = IORESOURCE_DMA, |
| 463 | }, |
| 464 | }; |
| 465 | |
| 466 | struct platform_device msm_device_sdc1 = { |
| 467 | .name = "msm_sdcc", |
| 468 | .id = 1, |
| 469 | .num_resources = ARRAY_SIZE(resources_sdc1), |
| 470 | .resource = resources_sdc1, |
| 471 | .dev = { |
| 472 | .coherent_dma_mask = 0xffffffff, |
| 473 | }, |
| 474 | }; |
| 475 | |
| 476 | struct platform_device msm_device_sdc2 = { |
| 477 | .name = "msm_sdcc", |
| 478 | .id = 2, |
| 479 | .num_resources = ARRAY_SIZE(resources_sdc2), |
| 480 | .resource = resources_sdc2, |
| 481 | .dev = { |
| 482 | .coherent_dma_mask = 0xffffffff, |
| 483 | }, |
| 484 | }; |
| 485 | |
| 486 | struct platform_device msm_device_sdc3 = { |
| 487 | .name = "msm_sdcc", |
| 488 | .id = 3, |
| 489 | .num_resources = ARRAY_SIZE(resources_sdc3), |
| 490 | .resource = resources_sdc3, |
| 491 | .dev = { |
| 492 | .coherent_dma_mask = 0xffffffff, |
| 493 | }, |
| 494 | }; |
| 495 | |
| 496 | struct platform_device msm_device_sdc4 = { |
| 497 | .name = "msm_sdcc", |
| 498 | .id = 4, |
| 499 | .num_resources = ARRAY_SIZE(resources_sdc4), |
| 500 | .resource = resources_sdc4, |
| 501 | .dev = { |
| 502 | .coherent_dma_mask = 0xffffffff, |
| 503 | }, |
| 504 | }; |
| 505 | |
| 506 | static struct platform_device *msm_sdcc_devices[] __initdata = { |
| 507 | &msm_device_sdc1, |
| 508 | &msm_device_sdc2, |
| 509 | &msm_device_sdc3, |
| 510 | &msm_device_sdc4, |
| 511 | }; |
| 512 | |
| 513 | int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat) |
| 514 | { |
| 515 | struct platform_device *pdev; |
| 516 | |
| 517 | if (controller < 1 || controller > 4) |
| 518 | return -EINVAL; |
| 519 | |
| 520 | pdev = msm_sdcc_devices[controller-1]; |
| 521 | pdev->dev.platform_data = plat; |
| 522 | return platform_device_register(pdev); |
| 523 | } |
| 524 | |
| 525 | #define MDP_BASE 0xAA200000 |
| 526 | #define MIPI_DSI_HW_BASE 0xA1100000 |
| 527 | |
| 528 | static struct resource msm_mipi_dsi_resources[] = { |
| 529 | { |
| 530 | .name = "mipi_dsi", |
| 531 | .start = MIPI_DSI_HW_BASE, |
| 532 | .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1, |
| 533 | .flags = IORESOURCE_MEM, |
| 534 | }, |
| 535 | { |
| 536 | .start = INT_DSI_IRQ, |
| 537 | .end = INT_DSI_IRQ, |
| 538 | .flags = IORESOURCE_IRQ, |
| 539 | }, |
| 540 | }; |
| 541 | |
| 542 | static struct platform_device msm_mipi_dsi_device = { |
| 543 | .name = "mipi_dsi", |
| 544 | .id = 1, |
| 545 | .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources), |
| 546 | .resource = msm_mipi_dsi_resources, |
| 547 | }; |
| 548 | |
| 549 | static struct resource msm_mdp_resources[] = { |
| 550 | { |
| 551 | .name = "mdp", |
| 552 | .start = MDP_BASE, |
| 553 | .end = MDP_BASE + 0x000F1008 - 1, |
| 554 | .flags = IORESOURCE_MEM, |
| 555 | }, |
| 556 | { |
| 557 | .start = INT_MDP, |
| 558 | .end = INT_MDP, |
| 559 | .flags = IORESOURCE_IRQ, |
| 560 | }, |
| 561 | }; |
| 562 | |
| 563 | static struct platform_device msm_mdp_device = { |
| 564 | .name = "mdp", |
| 565 | .id = 0, |
| 566 | .num_resources = ARRAY_SIZE(msm_mdp_resources), |
| 567 | .resource = msm_mdp_resources, |
| 568 | }; |
| 569 | |
| 570 | static struct platform_device msm_lcdc_device = { |
| 571 | .name = "lcdc", |
| 572 | .id = 0, |
| 573 | }; |
| 574 | |
| 575 | static struct resource kgsl_3d0_resources[] = { |
| 576 | { |
| 577 | .name = KGSL_3D0_REG_MEMORY, |
| 578 | .start = 0xA0000000, |
| 579 | .end = 0xA001ffff, |
| 580 | .flags = IORESOURCE_MEM, |
| 581 | }, |
| 582 | { |
| 583 | .name = KGSL_3D0_IRQ, |
| 584 | .start = INT_GRAPHICS, |
| 585 | .end = INT_GRAPHICS, |
| 586 | .flags = IORESOURCE_IRQ, |
| 587 | }, |
| 588 | }; |
| 589 | |
| 590 | static struct kgsl_device_platform_data kgsl_3d0_pdata = { |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame^] | 591 | .pwrlevel = { |
| 592 | { |
| 593 | .gpu_freq = 245760000, |
| 594 | .bus_freq = 200000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 595 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame^] | 596 | { |
| 597 | .gpu_freq = 133330000, |
| 598 | .bus_freq = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 599 | }, |
| 600 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame^] | 601 | .init_level = 0, |
| 602 | .num_levels = 2, |
| 603 | .set_grp_async = set_grp_xbar_async, |
| 604 | .idle_timeout = HZ/5, |
| 605 | .nap_allowed = false, |
| 606 | .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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()) { |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame^] | 622 | kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000; |
| 623 | kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000; |
| 624 | kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000; |
| 625 | kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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); |