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