Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 Google, Inc. |
Taniya Das | 2e94819 | 2011-12-20 11:15:13 +0530 | [diff] [blame] | 3 | * Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved. |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/platform_device.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 18 | #include <linux/msm_rotator.h> |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 19 | #include <linux/dma-mapping.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | #include <linux/msm_kgsl.h> |
| 21 | #include <linux/android_pmem.h> |
| 22 | #include <linux/regulator/machine.h> |
Taniya Das | 2e94819 | 2011-12-20 11:15:13 +0530 | [diff] [blame] | 23 | #include <linux/init.h> |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 24 | #include <mach/irqs.h> |
| 25 | #include <mach/msm_iomap.h> |
| 26 | #include <mach/dma.h> |
| 27 | #include <mach/board.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 28 | #include <asm/clkdev.h> |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 29 | |
| 30 | #include "devices.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 31 | #include "gpio_hw.h" |
| 32 | #include "footswitch.h" |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 33 | |
| 34 | #include <asm/mach/flash.h> |
| 35 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 36 | #include <asm/mach/mmc.h> |
| 37 | #include <mach/msm_hsusb.h> |
| 38 | #ifdef CONFIG_PMIC8058 |
| 39 | #include <linux/mfd/pmic8058.h> |
| 40 | #endif |
| 41 | #include <mach/dal_axi.h> |
| 42 | #include <mach/msm_memtypes.h> |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 43 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 44 | /* EBI THERMAL DRIVER */ |
| 45 | static struct resource msm_ebi0_thermal_resources[] = { |
| 46 | { |
| 47 | .start = 0xA8600000, |
| 48 | .end = 0xA86005FF, |
| 49 | .name = "physbase", |
| 50 | .flags = IORESOURCE_MEM |
| 51 | } |
| 52 | }; |
| 53 | |
| 54 | struct platform_device msm_ebi0_thermal = { |
| 55 | .name = "msm_popmem-tm", |
| 56 | .id = 0, |
| 57 | .num_resources = 1, |
| 58 | .resource = msm_ebi0_thermal_resources |
| 59 | }; |
| 60 | |
| 61 | static struct resource msm_ebi1_thermal_resources[] = { |
| 62 | { |
| 63 | .start = 0xA8700000, |
| 64 | .end = 0xA87005FF, |
| 65 | .name = "physbase", |
| 66 | .flags = IORESOURCE_MEM |
| 67 | } |
| 68 | }; |
| 69 | |
| 70 | struct platform_device msm_ebi1_thermal = { |
| 71 | .name = "msm_popmem-tm", |
| 72 | .id = 1, |
| 73 | .num_resources = 1, |
| 74 | .resource = msm_ebi1_thermal_resources |
| 75 | }; |
| 76 | |
| 77 | |
| 78 | static struct resource resources_uart1[] = { |
| 79 | { |
| 80 | .start = INT_UART1, |
| 81 | .end = INT_UART1, |
| 82 | .flags = IORESOURCE_IRQ, |
| 83 | }, |
| 84 | { |
| 85 | .start = MSM_UART1_PHYS, |
| 86 | .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1, |
| 87 | .flags = IORESOURCE_MEM, |
| 88 | }, |
| 89 | }; |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 90 | |
| 91 | static struct resource resources_uart2[] = { |
| 92 | { |
| 93 | .start = INT_UART2, |
| 94 | .end = INT_UART2, |
| 95 | .flags = IORESOURCE_IRQ, |
| 96 | }, |
| 97 | { |
| 98 | .start = MSM_UART2_PHYS, |
| 99 | .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1, |
| 100 | .flags = IORESOURCE_MEM, |
Stepan Moskovchenko | d41cb8c | 2011-01-17 20:33:32 -0800 | [diff] [blame] | 101 | .name = "uart_resource" |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 102 | }, |
| 103 | }; |
| 104 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 105 | static struct resource resources_uart3[] = { |
| 106 | { |
| 107 | .start = INT_UART3, |
| 108 | .end = INT_UART3, |
| 109 | .flags = IORESOURCE_IRQ, |
| 110 | }, |
| 111 | { |
| 112 | .start = MSM_UART3_PHYS, |
| 113 | .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1, |
| 114 | .flags = IORESOURCE_MEM, |
| 115 | }, |
| 116 | }; |
| 117 | |
| 118 | struct platform_device msm_device_uart1 = { |
| 119 | .name = "msm_serial", |
| 120 | .id = 0, |
| 121 | .num_resources = ARRAY_SIZE(resources_uart1), |
| 122 | .resource = resources_uart1, |
| 123 | }; |
| 124 | |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 125 | struct platform_device msm_device_uart2 = { |
| 126 | .name = "msm_serial", |
| 127 | .id = 1, |
| 128 | .num_resources = ARRAY_SIZE(resources_uart2), |
| 129 | .resource = resources_uart2, |
| 130 | }; |
| 131 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 132 | struct platform_device msm_device_uart3 = { |
| 133 | .name = "msm_serial", |
| 134 | .id = 2, |
| 135 | .num_resources = ARRAY_SIZE(resources_uart3), |
| 136 | .resource = resources_uart3, |
Niranjana Vishwanathapura | a8855e9 | 2010-10-06 13:52:10 -0700 | [diff] [blame] | 137 | }; |
| 138 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 139 | #define MSM_UART1DM_PHYS 0xA3300000 |
| 140 | #define MSM_UART2DM_PHYS 0xA3200000 |
| 141 | static struct resource msm_uart1_dm_resources[] = { |
| 142 | { |
| 143 | .start = MSM_UART1DM_PHYS, |
| 144 | .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1, |
| 145 | .flags = IORESOURCE_MEM, |
| 146 | }, |
| 147 | { |
| 148 | .start = INT_UART1DM_IRQ, |
| 149 | .end = INT_UART1DM_IRQ, |
| 150 | .flags = IORESOURCE_IRQ, |
| 151 | }, |
| 152 | { |
| 153 | .start = INT_UART1DM_RX, |
| 154 | .end = INT_UART1DM_RX, |
| 155 | .flags = IORESOURCE_IRQ, |
| 156 | }, |
| 157 | { |
| 158 | .start = DMOV_HSUART1_TX_CHAN, |
| 159 | .end = DMOV_HSUART1_RX_CHAN, |
| 160 | .name = "uartdm_channels", |
| 161 | .flags = IORESOURCE_DMA, |
| 162 | }, |
| 163 | { |
| 164 | .start = DMOV_HSUART1_TX_CRCI, |
| 165 | .end = DMOV_HSUART1_RX_CRCI, |
| 166 | .name = "uartdm_crci", |
| 167 | .flags = IORESOURCE_DMA, |
| 168 | }, |
| 169 | }; |
| 170 | |
| 171 | static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32); |
| 172 | |
| 173 | struct platform_device msm_device_uart_dm1 = { |
| 174 | .name = "msm_serial_hs", |
| 175 | .id = 0, |
| 176 | .num_resources = ARRAY_SIZE(msm_uart1_dm_resources), |
| 177 | .resource = msm_uart1_dm_resources, |
| 178 | .dev = { |
| 179 | .dma_mask = &msm_uart_dm1_dma_mask, |
| 180 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 181 | }, |
| 182 | }; |
| 183 | |
| 184 | static struct resource msm_uart2_dm_resources[] = { |
| 185 | { |
| 186 | .start = MSM_UART2DM_PHYS, |
| 187 | .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1, |
| 188 | .flags = IORESOURCE_MEM, |
| 189 | }, |
| 190 | { |
| 191 | .start = INT_UART2DM_IRQ, |
| 192 | .end = INT_UART2DM_IRQ, |
| 193 | .flags = IORESOURCE_IRQ, |
| 194 | }, |
| 195 | { |
| 196 | .start = INT_UART2DM_RX, |
| 197 | .end = INT_UART2DM_RX, |
| 198 | .flags = IORESOURCE_IRQ, |
| 199 | }, |
| 200 | { |
| 201 | .start = DMOV_HSUART2_TX_CHAN, |
| 202 | .end = DMOV_HSUART2_RX_CHAN, |
| 203 | .name = "uartdm_channels", |
| 204 | .flags = IORESOURCE_DMA, |
| 205 | }, |
| 206 | { |
| 207 | .start = DMOV_HSUART2_TX_CRCI, |
| 208 | .end = DMOV_HSUART2_RX_CRCI, |
| 209 | .name = "uartdm_crci", |
| 210 | .flags = IORESOURCE_DMA, |
| 211 | }, |
| 212 | }; |
| 213 | |
| 214 | static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32); |
| 215 | |
| 216 | struct platform_device msm_device_uart_dm2 = { |
| 217 | .name = "msm_serial_hs", |
| 218 | .id = 1, |
| 219 | .num_resources = ARRAY_SIZE(msm_uart2_dm_resources), |
| 220 | .resource = msm_uart2_dm_resources, |
| 221 | .dev = { |
| 222 | .dma_mask = &msm_uart_dm2_dma_mask, |
| 223 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 224 | }, |
| 225 | }; |
| 226 | |
| 227 | #define MSM_I2C_SIZE SZ_4K |
| 228 | #define MSM_I2C_PHYS 0xACD00000 |
| 229 | #define MSM_I2C_2_PHYS 0xACF00000 |
| 230 | static struct resource resources_i2c_2[] = { |
| 231 | { |
| 232 | .start = MSM_I2C_2_PHYS, |
| 233 | .end = MSM_I2C_2_PHYS + MSM_I2C_SIZE - 1, |
| 234 | .flags = IORESOURCE_MEM, |
| 235 | }, |
| 236 | { |
| 237 | .start = INT_PWB_I2C_2, |
| 238 | .end = INT_PWB_I2C_2, |
| 239 | .flags = IORESOURCE_IRQ, |
| 240 | }, |
| 241 | }; |
| 242 | |
| 243 | struct platform_device msm_device_i2c_2 = { |
| 244 | .name = "msm_i2c", |
| 245 | .id = 2, |
| 246 | .num_resources = ARRAY_SIZE(resources_i2c_2), |
| 247 | .resource = resources_i2c_2, |
| 248 | }; |
| 249 | |
| 250 | static struct resource resources_i2c[] = { |
| 251 | { |
| 252 | .start = MSM_I2C_PHYS, |
| 253 | .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1, |
| 254 | .flags = IORESOURCE_MEM, |
| 255 | }, |
| 256 | { |
| 257 | .start = INT_PWB_I2C, |
| 258 | .end = INT_PWB_I2C, |
| 259 | .flags = IORESOURCE_IRQ, |
| 260 | }, |
| 261 | }; |
| 262 | |
| 263 | struct platform_device msm_device_i2c = { |
| 264 | .name = "msm_i2c", |
| 265 | .id = 0, |
| 266 | .num_resources = ARRAY_SIZE(resources_i2c), |
| 267 | .resource = resources_i2c, |
| 268 | }; |
| 269 | |
| 270 | #define MSM_QUP_PHYS 0xA8301000 |
| 271 | #define MSM_GSBI_QUP_I2C_PHYS 0xA8300000 |
| 272 | #define MSM_QUP_SIZE SZ_4K |
| 273 | static struct resource resources_qup[] = { |
| 274 | { |
| 275 | .name = "qup_phys_addr", |
| 276 | .start = MSM_QUP_PHYS, |
| 277 | .end = MSM_QUP_PHYS + MSM_QUP_SIZE - 1, |
| 278 | .flags = IORESOURCE_MEM, |
| 279 | }, |
| 280 | { |
| 281 | .name = "gsbi_qup_i2c_addr", |
| 282 | .start = MSM_GSBI_QUP_I2C_PHYS, |
| 283 | .end = MSM_GSBI_QUP_I2C_PHYS + 4 - 1, |
| 284 | .flags = IORESOURCE_MEM, |
| 285 | }, |
| 286 | { |
| 287 | .name = "qup_in_intr", |
| 288 | .start = INT_PWB_QUP_IN, |
| 289 | .end = INT_PWB_QUP_IN, |
| 290 | .flags = IORESOURCE_IRQ, |
| 291 | }, |
| 292 | { |
| 293 | .name = "qup_out_intr", |
| 294 | .start = INT_PWB_QUP_OUT, |
| 295 | .end = INT_PWB_QUP_OUT, |
| 296 | .flags = IORESOURCE_IRQ, |
| 297 | }, |
| 298 | { |
| 299 | .name = "qup_err_intr", |
| 300 | .start = INT_PWB_QUP_ERR, |
| 301 | .end = INT_PWB_QUP_ERR, |
| 302 | .flags = IORESOURCE_IRQ, |
| 303 | }, |
| 304 | }; |
| 305 | |
| 306 | struct platform_device qup_device_i2c = { |
| 307 | .name = "qup_i2c", |
| 308 | .id = 4, |
| 309 | .num_resources = ARRAY_SIZE(resources_qup), |
| 310 | .resource = resources_qup, |
| 311 | }; |
| 312 | |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 313 | #ifdef CONFIG_MSM_SSBI |
| 314 | #define MSM_SSBI_PMIC1_PHYS 0xAD900000 |
| 315 | static struct resource msm_ssbi_pmic1_resources[] = { |
| 316 | { |
| 317 | .start = MSM_SSBI_PMIC1_PHYS, |
| 318 | .end = MSM_SSBI_PMIC1_PHYS + SZ_4K - 1, |
| 319 | .flags = IORESOURCE_MEM, |
| 320 | }, |
| 321 | }; |
| 322 | |
| 323 | struct platform_device msm_device_ssbi_pmic1 = { |
| 324 | .name = "msm_ssbi", |
| 325 | .id = 0, |
| 326 | .resource = msm_ssbi_pmic1_resources, |
| 327 | .num_resources = ARRAY_SIZE(msm_ssbi_pmic1_resources), |
| 328 | }; |
| 329 | #endif |
| 330 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 331 | #ifdef CONFIG_I2C_SSBI |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 332 | #define MSM_SSBI7_PHYS 0xAC800000 |
| 333 | static struct resource msm_ssbi7_resources[] = { |
| 334 | { |
| 335 | .name = "ssbi_base", |
| 336 | .start = MSM_SSBI7_PHYS, |
| 337 | .end = MSM_SSBI7_PHYS + SZ_4K - 1, |
| 338 | .flags = IORESOURCE_MEM, |
| 339 | }, |
| 340 | }; |
| 341 | |
| 342 | struct platform_device msm_device_ssbi7 = { |
| 343 | .name = "i2c_ssbi", |
| 344 | .id = 7, |
| 345 | .num_resources = ARRAY_SIZE(msm_ssbi7_resources), |
| 346 | .resource = msm_ssbi7_resources, |
| 347 | }; |
| 348 | #endif /* CONFIG_I2C_SSBI */ |
| 349 | |
| 350 | #define MSM_HSUSB_PHYS 0xA3600000 |
| 351 | static struct resource resources_hsusb_otg[] = { |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 352 | { |
| 353 | .start = MSM_HSUSB_PHYS, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 354 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 355 | .flags = IORESOURCE_MEM, |
| 356 | }, |
| 357 | { |
| 358 | .start = INT_USB_HS, |
| 359 | .end = INT_USB_HS, |
| 360 | .flags = IORESOURCE_IRQ, |
| 361 | }, |
| 362 | }; |
| 363 | |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 364 | static u64 dma_mask = 0xffffffffULL; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 365 | struct platform_device msm_device_hsusb_otg = { |
| 366 | .name = "msm_hsusb_otg", |
| 367 | .id = -1, |
| 368 | .num_resources = ARRAY_SIZE(resources_hsusb_otg), |
| 369 | .resource = resources_hsusb_otg, |
| 370 | .dev = { |
| 371 | .dma_mask = &dma_mask, |
| 372 | .coherent_dma_mask = 0xffffffffULL, |
| 373 | }, |
| 374 | }; |
| 375 | |
| 376 | static struct resource resources_hsusb_peripheral[] = { |
| 377 | { |
| 378 | .start = MSM_HSUSB_PHYS, |
| 379 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 380 | .flags = IORESOURCE_MEM, |
| 381 | }, |
| 382 | { |
| 383 | .start = INT_USB_HS, |
| 384 | .end = INT_USB_HS, |
| 385 | .flags = IORESOURCE_IRQ, |
| 386 | }, |
| 387 | }; |
| 388 | |
| 389 | static struct resource resources_gadget_peripheral[] = { |
| 390 | { |
| 391 | .start = MSM_HSUSB_PHYS, |
| 392 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 393 | .flags = IORESOURCE_MEM, |
| 394 | }, |
| 395 | { |
| 396 | .start = INT_USB_HS, |
| 397 | .end = INT_USB_HS, |
| 398 | .flags = IORESOURCE_IRQ, |
| 399 | }, |
| 400 | }; |
| 401 | |
| 402 | struct platform_device msm_device_hsusb_peripheral = { |
| 403 | .name = "msm_hsusb_peripheral", |
| 404 | .id = -1, |
| 405 | .num_resources = ARRAY_SIZE(resources_hsusb_peripheral), |
| 406 | .resource = resources_hsusb_peripheral, |
| 407 | .dev = { |
| 408 | .dma_mask = &dma_mask, |
| 409 | .coherent_dma_mask = 0xffffffffULL, |
| 410 | }, |
| 411 | }; |
| 412 | |
| 413 | struct platform_device msm_device_gadget_peripheral = { |
| 414 | .name = "msm_hsusb", |
| 415 | .id = -1, |
| 416 | .num_resources = ARRAY_SIZE(resources_gadget_peripheral), |
| 417 | .resource = resources_gadget_peripheral, |
| 418 | .dev = { |
| 419 | .dma_mask = &dma_mask, |
| 420 | .coherent_dma_mask = 0xffffffffULL, |
| 421 | }, |
| 422 | }; |
| 423 | |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 424 | static struct resource resources_hsusb_host[] = { |
| 425 | { |
| 426 | .start = MSM_HSUSB_PHYS, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 427 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 428 | .flags = IORESOURCE_MEM, |
| 429 | }, |
| 430 | { |
| 431 | .start = INT_USB_HS, |
| 432 | .end = INT_USB_HS, |
| 433 | .flags = IORESOURCE_IRQ, |
| 434 | }, |
| 435 | }; |
| 436 | |
| 437 | struct platform_device msm_device_hsusb_host = { |
| 438 | .name = "msm_hsusb_host", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 439 | .id = 0, |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 440 | .num_resources = ARRAY_SIZE(resources_hsusb_host), |
| 441 | .resource = resources_hsusb_host, |
| 442 | .dev = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 443 | .dma_mask = &dma_mask, |
| 444 | .coherent_dma_mask = 0xffffffffULL, |
Pavankumar Kondeti | 5155e2c | 2010-12-08 13:37:08 +0530 | [diff] [blame] | 445 | }, |
| 446 | }; |
| 447 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 448 | static struct platform_device *msm_host_devices[] = { |
| 449 | &msm_device_hsusb_host, |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 450 | }; |
| 451 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 452 | int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat) |
| 453 | { |
| 454 | struct platform_device *pdev; |
Daniel Walker | 1093276 | 2010-05-12 12:02:25 -0700 | [diff] [blame] | 455 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 456 | pdev = msm_host_devices[host]; |
| 457 | if (!pdev) |
| 458 | return -ENODEV; |
| 459 | pdev->dev.platform_data = plat; |
| 460 | return platform_device_register(pdev); |
| 461 | } |
| 462 | |
| 463 | struct platform_device asoc_msm_pcm = { |
| 464 | .name = "msm-dsp-audio", |
| 465 | .id = 0, |
| 466 | }; |
| 467 | |
| 468 | struct platform_device asoc_msm_dai0 = { |
| 469 | .name = "msm-codec-dai", |
| 470 | .id = 0, |
| 471 | }; |
| 472 | |
| 473 | struct platform_device asoc_msm_dai1 = { |
| 474 | .name = "msm-cpu-dai", |
| 475 | .id = 0, |
| 476 | }; |
| 477 | |
| 478 | #if defined (CONFIG_SND_MSM_MVS_DAI_SOC) |
| 479 | struct platform_device asoc_msm_mvs = { |
| 480 | .name = "msm-mvs-audio", |
| 481 | .id = 0, |
| 482 | }; |
| 483 | |
| 484 | struct platform_device asoc_mvs_dai0 = { |
| 485 | .name = "mvs-codec-dai", |
| 486 | .id = 0, |
| 487 | }; |
| 488 | |
| 489 | struct platform_device asoc_mvs_dai1 = { |
| 490 | .name = "mvs-cpu-dai", |
| 491 | .id = 0, |
| 492 | }; |
| 493 | #endif |
| 494 | |
| 495 | #define MSM_NAND_PHYS 0xA0200000 |
| 496 | #define MSM_NANDC01_PHYS 0xA0240000 |
| 497 | #define MSM_NANDC10_PHYS 0xA0280000 |
| 498 | #define MSM_NANDC11_PHYS 0xA02C0000 |
| 499 | #define EBI2_REG_BASE 0xA0000000 |
| 500 | static struct resource resources_nand[] = { |
| 501 | [0] = { |
| 502 | .name = "msm_nand_dmac", |
| 503 | .start = DMOV_NAND_CHAN, |
| 504 | .end = DMOV_NAND_CHAN, |
| 505 | .flags = IORESOURCE_DMA, |
| 506 | }, |
| 507 | [1] = { |
| 508 | .name = "msm_nand_phys", |
| 509 | .start = MSM_NAND_PHYS, |
| 510 | .end = MSM_NAND_PHYS + 0x7FF, |
| 511 | .flags = IORESOURCE_MEM, |
| 512 | }, |
| 513 | [2] = { |
| 514 | .name = "msm_nandc01_phys", |
| 515 | .start = MSM_NANDC01_PHYS, |
| 516 | .end = MSM_NANDC01_PHYS + 0x7FF, |
| 517 | .flags = IORESOURCE_MEM, |
| 518 | }, |
| 519 | [3] = { |
| 520 | .name = "msm_nandc10_phys", |
| 521 | .start = MSM_NANDC10_PHYS, |
| 522 | .end = MSM_NANDC10_PHYS + 0x7FF, |
| 523 | .flags = IORESOURCE_MEM, |
| 524 | }, |
| 525 | [4] = { |
| 526 | .name = "msm_nandc11_phys", |
| 527 | .start = MSM_NANDC11_PHYS, |
| 528 | .end = MSM_NANDC11_PHYS + 0x7FF, |
| 529 | .flags = IORESOURCE_MEM, |
| 530 | }, |
| 531 | [5] = { |
| 532 | .name = "ebi2_reg_base", |
| 533 | .start = EBI2_REG_BASE, |
| 534 | .end = EBI2_REG_BASE + 0x60, |
| 535 | .flags = IORESOURCE_MEM, |
| 536 | }, |
| 537 | }; |
| 538 | |
| 539 | static struct resource resources_otg[] = { |
| 540 | { |
| 541 | .start = MSM_HSUSB_PHYS, |
| 542 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 543 | .flags = IORESOURCE_MEM, |
| 544 | }, |
| 545 | { |
| 546 | .start = INT_USB_HS, |
| 547 | .end = INT_USB_HS, |
| 548 | .flags = IORESOURCE_IRQ, |
| 549 | }, |
| 550 | { |
| 551 | .name = "vbus_on", |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 552 | .start = PMIC8058_IRQ_BASE + PM8058_CHGVAL_IRQ, |
| 553 | .end = PMIC8058_IRQ_BASE + PM8058_CHGVAL_IRQ, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 554 | .flags = IORESOURCE_IRQ, |
| 555 | }, |
| 556 | }; |
| 557 | |
| 558 | struct platform_device msm_device_otg = { |
| 559 | .name = "msm_otg", |
| 560 | .id = -1, |
| 561 | .num_resources = ARRAY_SIZE(resources_otg), |
| 562 | .resource = resources_otg, |
| 563 | .dev = { |
| 564 | .coherent_dma_mask = 0xffffffffULL, |
| 565 | }, |
| 566 | }; |
| 567 | |
| 568 | struct flash_platform_data msm_nand_data = { |
| 569 | .parts = NULL, |
| 570 | .nr_parts = 0, |
| 571 | .interleave = 0, |
| 572 | }; |
| 573 | |
| 574 | struct platform_device msm_device_nand = { |
| 575 | .name = "msm_nand", |
| 576 | .id = -1, |
| 577 | .num_resources = ARRAY_SIZE(resources_nand), |
| 578 | .resource = resources_nand, |
| 579 | .dev = { |
| 580 | .platform_data = &msm_nand_data, |
| 581 | }, |
| 582 | }; |
| 583 | |
Angshuman Sarkar | bad32df | 2012-02-01 19:52:52 +0530 | [diff] [blame^] | 584 | static struct resource smd_resource[] = { |
| 585 | { |
| 586 | .name = "a9_m2a_0", |
| 587 | .start = INT_A9_M2A_0, |
| 588 | .flags = IORESOURCE_IRQ, |
| 589 | }, |
| 590 | { |
| 591 | .name = "a9_m2a_5", |
| 592 | .start = INT_A9_M2A_5, |
| 593 | .flags = IORESOURCE_IRQ, |
| 594 | }, |
| 595 | { |
| 596 | .name = "adsp_a11_smsm", |
| 597 | .start = INT_ADSP_A11, |
| 598 | .flags = IORESOURCE_IRQ, |
| 599 | }, |
| 600 | }; |
| 601 | |
| 602 | static struct smd_subsystem_config smd_config_list[] = { |
| 603 | { |
| 604 | .irq_config_id = SMD_MODEM, |
| 605 | .subsys_name = "modem", |
| 606 | .edge = SMD_APPS_MODEM, |
| 607 | |
| 608 | .smd_int.irq_name = "a9_m2a_0", |
| 609 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 610 | .smd_int.irq_id = -1, |
| 611 | .smd_int.device_name = "smd_dev", |
| 612 | .smd_int.dev_id = 0, |
| 613 | |
| 614 | .smd_int.out_bit_pos = 1 << 0, |
| 615 | .smd_int.out_base = (void __iomem *)MSM_GCC_BASE, |
| 616 | .smd_int.out_offset = 0x8, |
| 617 | |
| 618 | .smsm_int.irq_name = "a9_m2a_5", |
| 619 | .smsm_int.flags = IRQF_TRIGGER_RISING, |
| 620 | .smsm_int.irq_id = -1, |
| 621 | .smsm_int.device_name = "smd_dev", |
| 622 | .smsm_int.dev_id = 0, |
| 623 | |
| 624 | .smsm_int.out_bit_pos = 1 << 5, |
| 625 | .smsm_int.out_base = (void __iomem *)MSM_GCC_BASE, |
| 626 | .smsm_int.out_offset = 0x8, |
| 627 | |
| 628 | } |
| 629 | }; |
| 630 | |
| 631 | static struct smd_platform smd_platform_data = { |
| 632 | .num_ss_configs = ARRAY_SIZE(smd_config_list), |
| 633 | .smd_ss_configs = smd_config_list, |
| 634 | }; |
| 635 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 636 | struct platform_device msm_device_smd = { |
| 637 | .name = "msm_smd", |
| 638 | .id = -1, |
Angshuman Sarkar | bad32df | 2012-02-01 19:52:52 +0530 | [diff] [blame^] | 639 | .resource = smd_resource, |
| 640 | .num_resources = ARRAY_SIZE(smd_resource), |
| 641 | .dev = { |
| 642 | .platform_data = &smd_platform_data, |
| 643 | } |
| 644 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 645 | }; |
| 646 | |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 647 | static struct resource msm_dmov_resource[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 648 | { |
| 649 | .start = INT_ADM_AARM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 650 | .flags = IORESOURCE_IRQ, |
| 651 | }, |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 652 | { |
| 653 | .start = 0xAC400000, |
| 654 | .end = 0xAC400000 + SZ_4K - 1, |
| 655 | .flags = IORESOURCE_MEM, |
| 656 | }, |
| 657 | }; |
| 658 | |
| 659 | static struct msm_dmov_pdata msm_dmov_pdata = { |
| 660 | .sd = 2, |
| 661 | .sd_size = 0x400, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 662 | }; |
| 663 | |
| 664 | struct platform_device msm_device_dmov = { |
| 665 | .name = "msm_dmov", |
| 666 | .id = -1, |
| 667 | .resource = msm_dmov_resource, |
| 668 | .num_resources = ARRAY_SIZE(msm_dmov_resource), |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 669 | .dev = { |
| 670 | .platform_data = &msm_dmov_pdata, |
| 671 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 672 | }; |
| 673 | |
| 674 | #define MSM_SDC1_BASE 0xA0400000 |
| 675 | #define MSM_SDC2_BASE 0xA0500000 |
| 676 | #define MSM_SDC3_BASE 0xA3000000 |
| 677 | #define MSM_SDC4_BASE 0xA3100000 |
| 678 | static struct resource resources_sdc1[] = { |
| 679 | { |
| 680 | .start = MSM_SDC1_BASE, |
| 681 | .end = MSM_SDC1_BASE + SZ_4K - 1, |
| 682 | .flags = IORESOURCE_MEM, |
| 683 | }, |
| 684 | { |
| 685 | .start = INT_SDC1_0, |
| 686 | .end = INT_SDC1_1, |
| 687 | .flags = IORESOURCE_IRQ, |
| 688 | }, |
| 689 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 690 | .name = "sdcc_dma_chnl", |
| 691 | .start = DMOV_SDC1_CHAN, |
| 692 | .end = DMOV_SDC1_CHAN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 693 | .flags = IORESOURCE_DMA, |
| 694 | }, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 695 | { |
| 696 | .name = "sdcc_dma_crci", |
| 697 | .start = DMOV_SDC1_CRCI, |
| 698 | .end = DMOV_SDC1_CRCI, |
| 699 | .flags = IORESOURCE_DMA, |
| 700 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 701 | }; |
| 702 | |
| 703 | static struct resource resources_sdc2[] = { |
| 704 | { |
| 705 | .start = MSM_SDC2_BASE, |
| 706 | .end = MSM_SDC2_BASE + SZ_4K - 1, |
| 707 | .flags = IORESOURCE_MEM, |
| 708 | }, |
| 709 | { |
| 710 | .start = INT_SDC2_0, |
| 711 | .end = INT_SDC2_1, |
| 712 | .flags = IORESOURCE_IRQ, |
| 713 | }, |
| 714 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 715 | .name = "sdcc_dma_chnl", |
| 716 | .start = DMOV_SDC2_CHAN, |
| 717 | .end = DMOV_SDC2_CHAN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 718 | .flags = IORESOURCE_DMA, |
| 719 | }, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 720 | { |
| 721 | .name = "sdcc_dma_crci", |
| 722 | .start = DMOV_SDC2_CRCI, |
| 723 | .end = DMOV_SDC2_CRCI, |
| 724 | .flags = IORESOURCE_DMA, |
| 725 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 726 | }; |
| 727 | |
| 728 | static struct resource resources_sdc3[] = { |
| 729 | { |
| 730 | .start = MSM_SDC3_BASE, |
| 731 | .end = MSM_SDC3_BASE + SZ_4K - 1, |
| 732 | .flags = IORESOURCE_MEM, |
| 733 | }, |
| 734 | { |
| 735 | .start = INT_SDC3_0, |
| 736 | .end = INT_SDC3_1, |
| 737 | .flags = IORESOURCE_IRQ, |
| 738 | }, |
| 739 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 740 | .name = "sdcc_dma_chnl", |
Pankaj Kumar | e657b9f | 2011-10-12 20:11:12 +0530 | [diff] [blame] | 741 | .start = DMOV_SDC3_CHAN, |
| 742 | .end = DMOV_SDC3_CHAN, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 743 | .flags = IORESOURCE_DMA, |
| 744 | }, |
| 745 | { |
| 746 | .name = "sdcc_dma_crci", |
Pankaj Kumar | e657b9f | 2011-10-12 20:11:12 +0530 | [diff] [blame] | 747 | .start = DMOV_SDC3_CRCI, |
| 748 | .end = DMOV_SDC3_CRCI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 749 | .flags = IORESOURCE_DMA, |
| 750 | }, |
| 751 | }; |
| 752 | |
| 753 | static struct resource resources_sdc4[] = { |
| 754 | { |
| 755 | .start = MSM_SDC4_BASE, |
| 756 | .end = MSM_SDC4_BASE + SZ_4K - 1, |
| 757 | .flags = IORESOURCE_MEM, |
| 758 | }, |
| 759 | { |
| 760 | .start = INT_SDC4_0, |
| 761 | .end = INT_SDC4_1, |
| 762 | .flags = IORESOURCE_IRQ, |
| 763 | }, |
| 764 | { |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 765 | .name = "sdcc_dma_chnl", |
Pankaj Kumar | e657b9f | 2011-10-12 20:11:12 +0530 | [diff] [blame] | 766 | .start = DMOV_SDC4_CHAN, |
| 767 | .end = DMOV_SDC4_CHAN, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 768 | .flags = IORESOURCE_DMA, |
| 769 | }, |
| 770 | { |
| 771 | .name = "sdcc_dma_crci", |
Pankaj Kumar | e657b9f | 2011-10-12 20:11:12 +0530 | [diff] [blame] | 772 | .start = DMOV_SDC4_CRCI, |
| 773 | .end = DMOV_SDC4_CRCI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 774 | .flags = IORESOURCE_DMA, |
| 775 | }, |
| 776 | }; |
| 777 | |
| 778 | struct platform_device msm_device_sdc1 = { |
| 779 | .name = "msm_sdcc", |
| 780 | .id = 1, |
| 781 | .num_resources = ARRAY_SIZE(resources_sdc1), |
| 782 | .resource = resources_sdc1, |
| 783 | .dev = { |
| 784 | .coherent_dma_mask = 0xffffffff, |
| 785 | }, |
| 786 | }; |
| 787 | |
| 788 | struct platform_device msm_device_sdc2 = { |
| 789 | .name = "msm_sdcc", |
| 790 | .id = 2, |
| 791 | .num_resources = ARRAY_SIZE(resources_sdc2), |
| 792 | .resource = resources_sdc2, |
| 793 | .dev = { |
| 794 | .coherent_dma_mask = 0xffffffff, |
| 795 | }, |
| 796 | }; |
| 797 | |
| 798 | struct platform_device msm_device_sdc3 = { |
| 799 | .name = "msm_sdcc", |
| 800 | .id = 3, |
| 801 | .num_resources = ARRAY_SIZE(resources_sdc3), |
| 802 | .resource = resources_sdc3, |
| 803 | .dev = { |
| 804 | .coherent_dma_mask = 0xffffffff, |
| 805 | }, |
| 806 | }; |
| 807 | |
| 808 | struct platform_device msm_device_sdc4 = { |
| 809 | .name = "msm_sdcc", |
| 810 | .id = 4, |
| 811 | .num_resources = ARRAY_SIZE(resources_sdc4), |
| 812 | .resource = resources_sdc4, |
| 813 | .dev = { |
| 814 | .coherent_dma_mask = 0xffffffff, |
| 815 | }, |
| 816 | }; |
| 817 | |
| 818 | static struct platform_device *msm_sdcc_devices[] __initdata = { |
| 819 | &msm_device_sdc1, |
| 820 | &msm_device_sdc2, |
| 821 | &msm_device_sdc3, |
| 822 | &msm_device_sdc4, |
| 823 | }; |
| 824 | |
| 825 | int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat) |
| 826 | { |
| 827 | struct platform_device *pdev; |
| 828 | |
| 829 | if (controller < 1 || controller > 4) |
| 830 | return -EINVAL; |
| 831 | |
| 832 | pdev = msm_sdcc_devices[controller-1]; |
| 833 | pdev->dev.platform_data = plat; |
| 834 | return platform_device_register(pdev); |
| 835 | } |
| 836 | |
| 837 | static struct resource msm_vidc_720p_resources[] = { |
| 838 | { |
| 839 | .start = 0xA3B00000, |
| 840 | .end = 0xA3B00000 + SZ_4K - 1, |
| 841 | .flags = IORESOURCE_MEM, |
| 842 | }, |
| 843 | { |
| 844 | .start = INT_MFC720, |
| 845 | .end = INT_MFC720, |
| 846 | .flags = IORESOURCE_IRQ, |
| 847 | }, |
| 848 | }; |
| 849 | |
| 850 | struct msm_vidc_platform_data vidc_platform_data = { |
Deepak Kotur | cb4f672 | 2011-10-31 14:06:57 -0700 | [diff] [blame] | 851 | .memtype = MEMTYPE_EBI0, |
Deepika Pepakayala | bebc762 | 2011-12-01 15:13:43 -0800 | [diff] [blame] | 852 | .enable_ion = 0, |
| 853 | .disable_dmx = 0 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 854 | }; |
| 855 | |
| 856 | struct platform_device msm_device_vidc_720p = { |
| 857 | .name = "msm_vidc", |
| 858 | .id = 0, |
| 859 | .num_resources = ARRAY_SIZE(msm_vidc_720p_resources), |
| 860 | .resource = msm_vidc_720p_resources, |
| 861 | .dev = { |
| 862 | .platform_data = &vidc_platform_data, |
| 863 | }, |
| 864 | }; |
| 865 | |
| 866 | #if defined(CONFIG_FB_MSM_MDP40) |
| 867 | #define MDP_BASE 0xA3F00000 |
| 868 | #define PMDH_BASE 0xAD600000 |
| 869 | #define EMDH_BASE 0xAD700000 |
| 870 | #define TVENC_BASE 0xAD400000 |
| 871 | #else |
| 872 | #define MDP_BASE 0xAA200000 |
| 873 | #define PMDH_BASE 0xAA600000 |
| 874 | #define EMDH_BASE 0xAA700000 |
| 875 | #define TVENC_BASE 0xAA400000 |
| 876 | #endif |
| 877 | |
| 878 | static struct resource msm_mdp_resources[] = { |
| 879 | { |
| 880 | .name = "mdp", |
| 881 | .start = MDP_BASE, |
| 882 | .end = MDP_BASE + 0x000F0000 - 1, |
| 883 | .flags = IORESOURCE_MEM, |
| 884 | }, |
| 885 | { |
| 886 | .start = INT_MDP, |
| 887 | .end = INT_MDP, |
| 888 | .flags = IORESOURCE_IRQ, |
| 889 | }, |
| 890 | }; |
| 891 | |
| 892 | static struct resource msm_mddi_resources[] = { |
| 893 | { |
| 894 | .name = "pmdh", |
| 895 | .start = PMDH_BASE, |
| 896 | .end = PMDH_BASE + PAGE_SIZE - 1, |
| 897 | .flags = IORESOURCE_MEM, |
| 898 | } |
| 899 | }; |
| 900 | |
| 901 | static struct resource msm_mddi_ext_resources[] = { |
| 902 | { |
| 903 | .name = "emdh", |
| 904 | .start = EMDH_BASE, |
| 905 | .end = EMDH_BASE + PAGE_SIZE - 1, |
| 906 | .flags = IORESOURCE_MEM, |
| 907 | } |
| 908 | }; |
| 909 | |
| 910 | static struct resource msm_ebi2_lcd_resources[] = { |
| 911 | { |
| 912 | .name = "base", |
| 913 | .start = 0xa0d00000, |
| 914 | .end = 0xa0d00000 + PAGE_SIZE - 1, |
| 915 | .flags = IORESOURCE_MEM, |
| 916 | }, |
| 917 | { |
| 918 | .name = "lcd01", |
| 919 | .start = 0x98000000, |
| 920 | .end = 0x98000000 + 0x80000 - 1, |
| 921 | .flags = IORESOURCE_MEM, |
| 922 | }, |
| 923 | { |
| 924 | .name = "lcd02", |
| 925 | .start = 0x9c000000, |
| 926 | .end = 0x9c000000 + 0x80000 - 1, |
| 927 | .flags = IORESOURCE_MEM, |
| 928 | }, |
| 929 | }; |
| 930 | |
| 931 | static struct resource msm_tvenc_resources[] = { |
| 932 | { |
| 933 | .name = "tvenc", |
| 934 | .start = TVENC_BASE, |
| 935 | .end = TVENC_BASE + PAGE_SIZE - 1, |
| 936 | .flags = IORESOURCE_MEM, |
| 937 | } |
| 938 | }; |
| 939 | |
| 940 | #ifdef CONFIG_FB_MSM_TVOUT |
| 941 | static struct resource tvout_device_resources[] = { |
| 942 | { |
| 943 | .name = "tvout_device_irq", |
| 944 | .start = INT_TV_ENC, |
| 945 | .end = INT_TV_ENC, |
| 946 | .flags = IORESOURCE_IRQ, |
| 947 | }, |
| 948 | }; |
| 949 | #endif |
| 950 | |
| 951 | static struct platform_device msm_mdp_device = { |
| 952 | .name = "mdp", |
| 953 | .id = 0, |
| 954 | .num_resources = ARRAY_SIZE(msm_mdp_resources), |
| 955 | .resource = msm_mdp_resources, |
| 956 | }; |
| 957 | |
| 958 | static struct platform_device msm_mddi_device = { |
| 959 | .name = "mddi", |
| 960 | .id = 0, |
| 961 | .num_resources = ARRAY_SIZE(msm_mddi_resources), |
| 962 | .resource = msm_mddi_resources, |
| 963 | }; |
| 964 | |
| 965 | static struct platform_device msm_mddi_ext_device = { |
| 966 | .name = "mddi_ext", |
| 967 | .id = 0, |
| 968 | .num_resources = ARRAY_SIZE(msm_mddi_ext_resources), |
| 969 | .resource = msm_mddi_ext_resources, |
| 970 | }; |
| 971 | |
| 972 | static struct platform_device msm_ebi2_lcd_device = { |
| 973 | .name = "ebi2_lcd", |
| 974 | .id = 0, |
| 975 | .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources), |
| 976 | .resource = msm_ebi2_lcd_resources, |
| 977 | }; |
| 978 | |
| 979 | static struct platform_device msm_lcdc_device = { |
| 980 | .name = "lcdc", |
| 981 | .id = 0, |
| 982 | }; |
| 983 | |
| 984 | static struct platform_device msm_dtv_device = { |
| 985 | .name = "dtv", |
| 986 | .id = 0, |
| 987 | }; |
| 988 | |
| 989 | static struct platform_device msm_tvenc_device = { |
| 990 | .name = "tvenc", |
| 991 | .id = 0, |
| 992 | .num_resources = ARRAY_SIZE(msm_tvenc_resources), |
| 993 | .resource = msm_tvenc_resources, |
| 994 | }; |
| 995 | |
| 996 | #ifdef CONFIG_FB_MSM_TVOUT |
| 997 | static struct platform_device tvout_msm_device = { |
| 998 | .name = "tvout_device", |
| 999 | .id = 0, |
| 1000 | .num_resources = ARRAY_SIZE(tvout_device_resources), |
| 1001 | .resource = tvout_device_resources, |
| 1002 | }; |
| 1003 | #endif |
| 1004 | |
| 1005 | /* TSIF begin */ |
| 1006 | #if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) |
| 1007 | |
| 1008 | #define MSM_TSIF_PHYS (0xa3400000) |
| 1009 | #define MSM_TSIF_SIZE (0x200) |
| 1010 | |
| 1011 | static struct resource tsif_resources[] = { |
| 1012 | [0] = { |
| 1013 | .flags = IORESOURCE_IRQ, |
| 1014 | .start = INT_TSIF, |
| 1015 | .end = INT_TSIF, |
| 1016 | }, |
| 1017 | [1] = { |
| 1018 | .flags = IORESOURCE_MEM, |
| 1019 | .start = MSM_TSIF_PHYS, |
| 1020 | .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1, |
| 1021 | }, |
| 1022 | [2] = { |
| 1023 | .flags = IORESOURCE_DMA, |
| 1024 | .start = DMOV_TSIF_CHAN, |
| 1025 | .end = DMOV_TSIF_CRCI, |
| 1026 | }, |
| 1027 | }; |
| 1028 | |
| 1029 | static void tsif_release(struct device *dev) |
| 1030 | { |
| 1031 | dev_info(dev, "release\n"); |
| 1032 | } |
| 1033 | |
| 1034 | struct platform_device msm_device_tsif = { |
| 1035 | .name = "msm_tsif", |
| 1036 | .id = 0, |
| 1037 | .num_resources = ARRAY_SIZE(tsif_resources), |
| 1038 | .resource = tsif_resources, |
| 1039 | .dev = { |
| 1040 | .release = tsif_release, |
| 1041 | }, |
| 1042 | }; |
| 1043 | #endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */ |
| 1044 | /* TSIF end */ |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | #ifdef CONFIG_MSM_ROTATOR |
| 1049 | static struct resource resources_msm_rotator[] = { |
| 1050 | { |
| 1051 | .start = 0xA3E00000, |
| 1052 | .end = 0xA3F00000 - 1, |
| 1053 | .flags = IORESOURCE_MEM, |
| 1054 | }, |
| 1055 | { |
| 1056 | .start = INT_ROTATOR, |
| 1057 | .end = INT_ROTATOR, |
| 1058 | .flags = IORESOURCE_IRQ, |
| 1059 | }, |
| 1060 | }; |
| 1061 | |
| 1062 | static struct msm_rot_clocks rotator_clocks[] = { |
| 1063 | { |
Matt Wagantall | bb90da9 | 2011-10-25 15:07:52 -0700 | [diff] [blame] | 1064 | .clk_name = "core_clk", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1065 | .clk_type = ROTATOR_CORE_CLK, |
| 1066 | .clk_rate = 0, |
| 1067 | }, |
| 1068 | { |
Matt Wagantall | bb90da9 | 2011-10-25 15:07:52 -0700 | [diff] [blame] | 1069 | .clk_name = "iface_clk", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1070 | .clk_type = ROTATOR_PCLK, |
| 1071 | .clk_rate = 0, |
| 1072 | }, |
| 1073 | { |
Matt Wagantall | bb90da9 | 2011-10-25 15:07:52 -0700 | [diff] [blame] | 1074 | .clk_name = "mem_clk", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1075 | .clk_type = ROTATOR_IMEM_CLK, |
| 1076 | .clk_rate = 0, |
| 1077 | }, |
| 1078 | }; |
| 1079 | |
| 1080 | static struct msm_rotator_platform_data rotator_pdata = { |
| 1081 | .number_of_clocks = ARRAY_SIZE(rotator_clocks), |
| 1082 | .hardware_version_number = 0x1000303, |
| 1083 | .rotator_clks = rotator_clocks, |
| 1084 | .regulator_name = "fs_rot", |
| 1085 | }; |
| 1086 | |
| 1087 | struct platform_device msm_rotator_device = { |
| 1088 | .name = "msm_rotator", |
| 1089 | .id = 0, |
| 1090 | .num_resources = ARRAY_SIZE(resources_msm_rotator), |
| 1091 | .resource = resources_msm_rotator, |
| 1092 | .dev = { |
| 1093 | .platform_data = &rotator_pdata, |
| 1094 | }, |
| 1095 | }; |
| 1096 | #endif |
| 1097 | |
| 1098 | static void __init msm_register_device(struct platform_device *pdev, void *data) |
| 1099 | { |
| 1100 | int ret; |
| 1101 | |
| 1102 | pdev->dev.platform_data = data; |
| 1103 | |
| 1104 | ret = platform_device_register(pdev); |
| 1105 | if (ret) |
| 1106 | dev_err(&pdev->dev, |
| 1107 | "%s: platform_device_register() failed = %d\n", |
| 1108 | __func__, ret); |
| 1109 | } |
| 1110 | |
| 1111 | void __init msm_fb_register_device(char *name, void *data) |
| 1112 | { |
| 1113 | if (!strncmp(name, "mdp", 3)) |
| 1114 | msm_register_device(&msm_mdp_device, data); |
| 1115 | else if (!strncmp(name, "pmdh", 4)) |
| 1116 | msm_register_device(&msm_mddi_device, data); |
| 1117 | else if (!strncmp(name, "emdh", 4)) |
| 1118 | msm_register_device(&msm_mddi_ext_device, data); |
| 1119 | else if (!strncmp(name, "ebi2", 4)) |
| 1120 | msm_register_device(&msm_ebi2_lcd_device, data); |
| 1121 | else if (!strncmp(name, "tvenc", 5)) |
| 1122 | msm_register_device(&msm_tvenc_device, data); |
| 1123 | else if (!strncmp(name, "lcdc", 4)) |
| 1124 | msm_register_device(&msm_lcdc_device, data); |
| 1125 | else if (!strncmp(name, "dtv", 3)) |
| 1126 | msm_register_device(&msm_dtv_device, data); |
| 1127 | #ifdef CONFIG_FB_MSM_TVOUT |
| 1128 | else if (!strncmp(name, "tvout_device", 12)) |
| 1129 | msm_register_device(&tvout_msm_device, data); |
| 1130 | #endif |
| 1131 | else |
| 1132 | printk(KERN_ERR "%s: unknown device! %s\n", __func__, name); |
| 1133 | } |
| 1134 | |
| 1135 | static struct platform_device msm_camera_device = { |
| 1136 | .name = "msm_camera", |
| 1137 | .id = 0, |
| 1138 | }; |
| 1139 | |
| 1140 | void __init msm_camera_register_device(void *res, uint32_t num, |
| 1141 | void *data) |
| 1142 | { |
| 1143 | msm_camera_device.num_resources = num; |
| 1144 | msm_camera_device.resource = res; |
| 1145 | |
| 1146 | msm_register_device(&msm_camera_device, data); |
| 1147 | } |
| 1148 | |
| 1149 | struct resource kgsl_3d0_resources[] = { |
| 1150 | { |
| 1151 | .name = KGSL_3D0_REG_MEMORY, |
| 1152 | .start = 0xA3500000, /* 3D GRP address */ |
| 1153 | .end = 0xA351ffff, |
| 1154 | .flags = IORESOURCE_MEM, |
| 1155 | }, |
| 1156 | { |
| 1157 | .name = KGSL_3D0_IRQ, |
| 1158 | .start = INT_GRP_3D, |
| 1159 | .end = INT_GRP_3D, |
| 1160 | .flags = IORESOURCE_IRQ, |
| 1161 | }, |
| 1162 | }; |
| 1163 | |
| 1164 | static struct kgsl_device_platform_data kgsl_3d0_pdata = { |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 1165 | .pwrlevel = { |
| 1166 | { |
| 1167 | .gpu_freq = 245760000, |
| 1168 | .bus_freq = 192000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1169 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 1170 | { |
| 1171 | .gpu_freq = 192000000, |
| 1172 | .bus_freq = 152000000, |
| 1173 | }, |
| 1174 | { |
| 1175 | .gpu_freq = 192000000, |
| 1176 | .bus_freq = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1177 | }, |
| 1178 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 1179 | .init_level = 0, |
| 1180 | .num_levels = 3, |
| 1181 | .set_grp_async = set_grp3d_async, |
| 1182 | .idle_timeout = HZ/20, |
| 1183 | .nap_allowed = true, |
| 1184 | .clk_map = KGSL_CLK_SRC | KGSL_CLK_CORE | |
| 1185 | KGSL_CLK_IFACE | KGSL_CLK_MEM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1186 | }; |
| 1187 | |
| 1188 | struct platform_device msm_kgsl_3d0 = { |
| 1189 | .name = "kgsl-3d0", |
| 1190 | .id = 0, |
| 1191 | .num_resources = ARRAY_SIZE(kgsl_3d0_resources), |
| 1192 | .resource = kgsl_3d0_resources, |
| 1193 | .dev = { |
| 1194 | .platform_data = &kgsl_3d0_pdata, |
| 1195 | }, |
| 1196 | }; |
| 1197 | |
| 1198 | static struct resource kgsl_2d0_resources[] = { |
| 1199 | { |
| 1200 | .name = KGSL_2D0_REG_MEMORY, |
| 1201 | .start = 0xA3900000, /* Z180 base address */ |
| 1202 | .end = 0xA3900FFF, |
| 1203 | .flags = IORESOURCE_MEM, |
| 1204 | }, |
| 1205 | { |
| 1206 | .name = KGSL_2D0_IRQ, |
| 1207 | .start = INT_GRP_2D, |
| 1208 | .end = INT_GRP_2D, |
| 1209 | .flags = IORESOURCE_IRQ, |
| 1210 | }, |
| 1211 | }; |
| 1212 | |
| 1213 | static struct kgsl_device_platform_data kgsl_2d0_pdata = { |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 1214 | .pwrlevel = { |
| 1215 | { |
| 1216 | .gpu_freq = 0, |
| 1217 | .bus_freq = 192000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1218 | }, |
| 1219 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 1220 | .init_level = 0, |
| 1221 | .num_levels = 1, |
| 1222 | /* HW workaround, run Z180 SYNC @ 192 MHZ */ |
| 1223 | .set_grp_async = NULL, |
| 1224 | .idle_timeout = HZ/10, |
| 1225 | .nap_allowed = true, |
| 1226 | .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1227 | }; |
| 1228 | |
| 1229 | struct platform_device msm_kgsl_2d0 = { |
| 1230 | .name = "kgsl-2d0", |
| 1231 | .id = 0, |
| 1232 | .num_resources = ARRAY_SIZE(kgsl_2d0_resources), |
| 1233 | .resource = kgsl_2d0_resources, |
| 1234 | .dev = { |
| 1235 | .platform_data = &kgsl_2d0_pdata, |
| 1236 | }, |
| 1237 | }; |
| 1238 | |
| 1239 | struct platform_device *msm_footswitch_devices[] = { |
| 1240 | FS_PCOM(FS_GFX2D0, "fs_gfx2d0"), |
| 1241 | FS_PCOM(FS_GFX3D, "fs_gfx3d"), |
| 1242 | FS_PCOM(FS_MDP, "fs_mdp"), |
| 1243 | FS_PCOM(FS_MFC, "fs_mfc"), |
| 1244 | FS_PCOM(FS_ROT, "fs_rot"), |
| 1245 | FS_PCOM(FS_VFE, "fs_vfe"), |
| 1246 | FS_PCOM(FS_VPE, "fs_vpe"), |
| 1247 | }; |
| 1248 | unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices); |
Taniya Das | 2e94819 | 2011-12-20 11:15:13 +0530 | [diff] [blame] | 1249 | |
| 1250 | static struct resource gpio_resources[] = { |
| 1251 | { |
| 1252 | .start = INT_GPIO_GROUP1, |
| 1253 | .flags = IORESOURCE_IRQ, |
| 1254 | }, |
| 1255 | { |
| 1256 | .start = INT_GPIO_GROUP2, |
| 1257 | .flags = IORESOURCE_IRQ, |
| 1258 | }, |
| 1259 | }; |
| 1260 | |
| 1261 | static struct platform_device msm_device_gpio = { |
| 1262 | .name = "msmgpio", |
| 1263 | .id = -1, |
| 1264 | .resource = gpio_resources, |
| 1265 | .num_resources = ARRAY_SIZE(gpio_resources), |
| 1266 | }; |
| 1267 | |
| 1268 | static int __init msm7630_init_gpio(void) |
| 1269 | { |
| 1270 | platform_device_register(&msm_device_gpio); |
| 1271 | return 0; |
| 1272 | } |
| 1273 | |
| 1274 | postcore_initcall(msm7630_init_gpio); |