Rohit Vaswani | e897f84 | 2012-03-19 14:19:34 -0700 | [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 | |
| 16 | #include <linux/dma-mapping.h> |
| 17 | #include <mach/irqs.h> |
| 18 | #include <mach/msm_iomap.h> |
| 19 | #include <mach/dma.h> |
| 20 | #include <mach/board.h> |
| 21 | |
| 22 | #include "devices.h" |
| 23 | #include "smd_private.h" |
| 24 | #include "clock-local.h" |
Rohit Vaswani | e897f84 | 2012-03-19 14:19:34 -0700 | [diff] [blame] | 25 | #include "msm_watchdog.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 26 | |
| 27 | #include <asm/mach/flash.h> |
| 28 | #include <asm/mach/mmc.h> |
| 29 | |
| 30 | /* |
| 31 | * UARTs |
| 32 | */ |
| 33 | |
| 34 | static struct resource resources_uart1[] = { |
| 35 | { |
| 36 | .start = INT_UART1, |
| 37 | .end = INT_UART1, |
| 38 | .flags = IORESOURCE_IRQ, |
| 39 | }, |
| 40 | { |
| 41 | .start = MSM_UART1_PHYS, |
| 42 | .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1, |
| 43 | .flags = IORESOURCE_MEM, |
| 44 | }, |
| 45 | }; |
| 46 | |
| 47 | struct platform_device msm_device_uart1 = { |
| 48 | .name = "msm_serial", |
| 49 | .id = 0, |
| 50 | .num_resources = ARRAY_SIZE(resources_uart1), |
| 51 | .resource = resources_uart1, |
| 52 | }; |
| 53 | |
| 54 | static struct resource resources_uart2[] = { |
| 55 | { |
| 56 | .start = INT_UART2, |
| 57 | .end = INT_UART2, |
| 58 | .flags = IORESOURCE_IRQ, |
| 59 | }, |
| 60 | { |
| 61 | .start = MSM_UART2_PHYS, |
| 62 | .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1, |
| 63 | .flags = IORESOURCE_MEM, |
| 64 | }, |
| 65 | }; |
| 66 | |
| 67 | struct platform_device msm_device_uart2 = { |
| 68 | .name = "msm_serial", |
| 69 | .id = 1, |
| 70 | .num_resources = ARRAY_SIZE(resources_uart2), |
| 71 | .resource = resources_uart2, |
| 72 | }; |
| 73 | |
Rohit Vaswani | 0eafbe9 | 2012-06-21 15:21:24 -0700 | [diff] [blame] | 74 | static struct resource resources_uart3[] = { |
| 75 | { |
| 76 | .start = INT_UART3, |
| 77 | .end = INT_UART3, |
| 78 | .flags = IORESOURCE_IRQ, |
| 79 | }, |
| 80 | { |
| 81 | .start = MSM_UART3_PHYS, |
| 82 | .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1, |
| 83 | .flags = IORESOURCE_MEM, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | struct platform_device msm_device_uart3 = { |
| 88 | .name = "msm_uim", |
| 89 | .id = 2, |
| 90 | .num_resources = ARRAY_SIZE(resources_uart3), |
| 91 | .resource = resources_uart3, |
| 92 | }; |
| 93 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 94 | /* |
| 95 | * SSBIs |
| 96 | */ |
| 97 | |
Anirudh Ghayal | 9d9cdc2 | 2011-10-10 17:17:07 +0530 | [diff] [blame] | 98 | #ifdef CONFIG_MSM_SSBI |
| 99 | #define MSM_SSBI1_PHYS 0x94080000 |
| 100 | #define MSM_SSBI_PMIC1_PHYS MSM_SSBI1_PHYS |
| 101 | static struct resource msm_ssbi_pmic1_resources[] = { |
| 102 | { |
| 103 | .start = MSM_SSBI_PMIC1_PHYS, |
| 104 | .end = MSM_SSBI_PMIC1_PHYS + SZ_4K - 1, |
| 105 | .flags = IORESOURCE_MEM, |
| 106 | }, |
| 107 | }; |
| 108 | |
| 109 | struct platform_device msm_device_ssbi_pmic1 = { |
| 110 | .name = "msm_ssbi", |
| 111 | .id = 0, |
| 112 | .resource = msm_ssbi_pmic1_resources, |
| 113 | .num_resources = ARRAY_SIZE(msm_ssbi_pmic1_resources), |
| 114 | }; |
| 115 | #endif |
| 116 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 117 | #ifdef CONFIG_I2C_SSBI |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 118 | #define MSM_SSBI2_PHYS 0x94090000 |
| 119 | #define MSM_SSBI2_SIZE SZ_4K |
| 120 | |
| 121 | static struct resource msm_ssbi2_resources[] = { |
| 122 | { |
| 123 | .name = "ssbi_base", |
| 124 | .start = MSM_SSBI2_PHYS, |
| 125 | .end = MSM_SSBI2_PHYS + MSM_SSBI2_SIZE - 1, |
| 126 | .flags = IORESOURCE_MEM, |
| 127 | }, |
| 128 | }; |
| 129 | |
| 130 | struct platform_device msm_device_ssbi2 = { |
| 131 | .name = "i2c_ssbi", |
| 132 | .id = 1, |
| 133 | .num_resources = ARRAY_SIZE(msm_ssbi2_resources), |
| 134 | .resource = msm_ssbi2_resources, |
| 135 | }; |
| 136 | |
| 137 | #define MSM_SSBI3_PHYS 0x940c0000 |
| 138 | #define MSM_SSBI3_SIZE SZ_4K |
| 139 | |
| 140 | static struct resource msm_ssbi3_resources[] = { |
| 141 | { |
| 142 | .name = "ssbi_base", |
| 143 | .start = MSM_SSBI3_PHYS, |
| 144 | .end = MSM_SSBI3_PHYS + MSM_SSBI3_SIZE - 1, |
| 145 | .flags = IORESOURCE_MEM, |
| 146 | }, |
| 147 | }; |
| 148 | |
| 149 | struct platform_device msm_device_ssbi3 = { |
| 150 | .name = "i2c_ssbi", |
| 151 | .id = 2, |
| 152 | .num_resources = ARRAY_SIZE(msm_ssbi3_resources), |
| 153 | .resource = msm_ssbi3_resources, |
| 154 | }; |
| 155 | |
| 156 | #endif /* CONFIG_I2C_SSBI */ |
| 157 | |
| 158 | /* |
| 159 | * GSBI |
| 160 | */ |
| 161 | |
| 162 | #ifdef CONFIG_I2C_QUP |
| 163 | |
| 164 | #define MSM_GSBI1_PHYS 0x81200000 |
| 165 | #define MSM_GSBI1_QUP_PHYS 0x81a00000 |
| 166 | |
| 167 | static struct resource gsbi1_qup_i2c_resources[] = { |
| 168 | { |
| 169 | .name = "qup_phys_addr", |
| 170 | .start = MSM_GSBI1_QUP_PHYS, |
| 171 | .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1, |
| 172 | .flags = IORESOURCE_MEM, |
| 173 | }, |
| 174 | { |
| 175 | .name = "gsbi_qup_i2c_addr", |
| 176 | .start = MSM_GSBI1_PHYS, |
| 177 | .end = MSM_GSBI1_PHYS + 4 - 1, |
| 178 | .flags = IORESOURCE_MEM, |
| 179 | }, |
| 180 | { |
| 181 | .name = "qup_err_intr", |
| 182 | .start = INT_GSBI_QUP_ERROR, |
| 183 | .end = INT_GSBI_QUP_ERROR, |
| 184 | .flags = IORESOURCE_IRQ, |
| 185 | }, |
| 186 | }; |
| 187 | |
| 188 | struct platform_device msm_gsbi1_qup_i2c_device = { |
| 189 | .name = "qup_i2c", |
| 190 | .id = 3, |
| 191 | .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources), |
| 192 | .resource = gsbi1_qup_i2c_resources, |
| 193 | }; |
| 194 | |
| 195 | #endif /* CONFIG_I2C_QUP */ |
| 196 | |
| 197 | /* |
| 198 | * NAND |
| 199 | */ |
| 200 | |
| 201 | #define MSM_NAND_PHYS 0x81600000 |
| 202 | #define MSM_NAND_SIZE SZ_4K |
| 203 | #define MSM_EBI2_CTRL_PHYS 0x81400000 |
| 204 | #define MSM_EBI2_CTRL_SIZE SZ_4K |
| 205 | |
| 206 | static struct resource resources_nand[] = { |
| 207 | [0] = { |
| 208 | .name = "msm_nand_dmac", |
| 209 | .start = DMOV_NAND_CHAN, |
| 210 | .end = DMOV_NAND_CHAN, |
| 211 | .flags = IORESOURCE_DMA, |
| 212 | }, |
| 213 | [1] = { |
| 214 | .name = "msm_nand_phys", |
| 215 | .start = MSM_NAND_PHYS, |
| 216 | .end = MSM_NAND_PHYS + MSM_NAND_SIZE - 1, |
| 217 | .flags = IORESOURCE_MEM, |
| 218 | }, |
| 219 | [3] = { |
| 220 | .name = "ebi2_reg_base", |
| 221 | .start = MSM_EBI2_CTRL_PHYS, |
| 222 | .end = MSM_EBI2_CTRL_PHYS + MSM_EBI2_CTRL_SIZE - 1, |
| 223 | .flags = IORESOURCE_MEM, |
| 224 | }, |
| 225 | }; |
| 226 | |
| 227 | struct flash_platform_data msm_nand_data = { |
| 228 | .parts = NULL, |
| 229 | .nr_parts = 0, |
| 230 | .interleave = 0, |
Kalyan Thota | 8c9cd13 | 2012-10-26 22:23:35 +0530 | [diff] [blame^] | 231 | .version = VERSION_2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 232 | }; |
| 233 | |
| 234 | struct platform_device msm_device_nand = { |
| 235 | .name = "msm_nand", |
| 236 | .id = -1, |
| 237 | .num_resources = ARRAY_SIZE(resources_nand), |
| 238 | .resource = resources_nand, |
| 239 | .dev = { |
| 240 | .platform_data = &msm_nand_data, |
| 241 | }, |
| 242 | }; |
| 243 | |
| 244 | /* |
| 245 | * SMD |
| 246 | */ |
| 247 | |
| 248 | struct platform_device msm_device_smd = { |
| 249 | .name = "msm_smd", |
| 250 | .id = -1, |
| 251 | }; |
| 252 | |
| 253 | /* |
| 254 | * ADM |
| 255 | */ |
| 256 | |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 257 | static struct resource msm_dmov_resource[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 258 | { |
| 259 | .start = INT_ADM_AARM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 260 | .flags = IORESOURCE_IRQ, |
| 261 | }, |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 262 | { |
| 263 | .start = 0x94610000, |
| 264 | .end = 0x94610000 + SZ_4K - 1, |
| 265 | .flags = IORESOURCE_MEM, |
| 266 | }, |
| 267 | }; |
| 268 | |
| 269 | static struct msm_dmov_pdata msm_dmov_pdata = { |
| 270 | .sd = 3, |
| 271 | .sd_size = 0x400, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 272 | }; |
| 273 | |
| 274 | struct platform_device msm_device_dmov = { |
| 275 | .name = "msm_dmov", |
| 276 | .id = -1, |
| 277 | .resource = msm_dmov_resource, |
| 278 | .num_resources = ARRAY_SIZE(msm_dmov_resource), |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 279 | .dev = { |
| 280 | .platform_data = &msm_dmov_pdata, |
| 281 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 282 | }; |
| 283 | |
| 284 | /* |
| 285 | * SDC |
| 286 | */ |
| 287 | |
| 288 | #define MSM_SDC1_PHYS 0x80A00000 |
| 289 | #define MSM_SDC1_SIZE SZ_4K |
| 290 | |
| 291 | static struct resource resources_sdc1[] = { |
| 292 | { |
| 293 | .start = MSM_SDC1_PHYS, |
| 294 | .end = MSM_SDC1_PHYS + MSM_SDC1_SIZE - 1, |
| 295 | .flags = IORESOURCE_MEM, |
| 296 | }, |
| 297 | { |
| 298 | .start = INT_SDC1_0, |
| 299 | .end = INT_SDC1_1, |
| 300 | .flags = IORESOURCE_IRQ, |
| 301 | }, |
| 302 | { |
| 303 | .start = DMOV_SDC1_CHAN, |
| 304 | .end = DMOV_SDC1_CHAN, |
| 305 | .flags = IORESOURCE_DMA, |
| 306 | }, |
| 307 | }; |
| 308 | |
| 309 | struct platform_device msm_device_sdc1 = { |
| 310 | .name = "msm_sdcc", |
| 311 | .id = 1, |
| 312 | .num_resources = ARRAY_SIZE(resources_sdc1), |
| 313 | .resource = resources_sdc1, |
| 314 | .dev = { |
| 315 | .coherent_dma_mask = 0xffffffff, |
| 316 | }, |
| 317 | }; |
| 318 | |
| 319 | static struct platform_device *msm_sdcc_devices[] __initdata = { |
| 320 | &msm_device_sdc1, |
| 321 | }; |
| 322 | |
| 323 | int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat) |
| 324 | { |
| 325 | struct platform_device *pdev; |
| 326 | |
| 327 | if (controller != 1) |
| 328 | return -EINVAL; |
| 329 | |
| 330 | pdev = msm_sdcc_devices[controller-1]; |
| 331 | pdev->dev.platform_data = plat; |
| 332 | return platform_device_register(pdev); |
| 333 | } |
| 334 | |
| 335 | /* |
| 336 | * QFEC |
| 337 | */ |
| 338 | |
| 339 | # define QFEC_MAC_IRQ INT_SBD_IRQ |
| 340 | # define QFEC_MAC_BASE 0x40000000 |
| 341 | # define QFEC_CLK_BASE 0x94020000 |
| 342 | |
| 343 | # define QFEC_MAC_SIZE 0x2000 |
| 344 | # define QFEC_CLK_SIZE 0x18100 |
| 345 | |
| 346 | # define QFEC_MAC_FUSE_BASE 0x80004210 |
| 347 | # define QFEC_MAC_FUSE_SIZE 16 |
| 348 | |
| 349 | static struct resource qfec_resources[] = { |
| 350 | [0] = { |
| 351 | .start = QFEC_MAC_BASE, |
| 352 | .end = QFEC_MAC_BASE + QFEC_MAC_SIZE, |
| 353 | .flags = IORESOURCE_MEM, |
| 354 | }, |
| 355 | [1] = { |
| 356 | .start = QFEC_MAC_IRQ, |
| 357 | .end = QFEC_MAC_IRQ, |
| 358 | .flags = IORESOURCE_IRQ, |
| 359 | }, |
| 360 | [2] = { |
| 361 | .start = QFEC_CLK_BASE, |
| 362 | .end = QFEC_CLK_BASE + QFEC_CLK_SIZE, |
| 363 | .flags = IORESOURCE_IO, |
| 364 | }, |
| 365 | [3] = { |
| 366 | .start = QFEC_MAC_FUSE_BASE, |
| 367 | .end = QFEC_MAC_FUSE_BASE + QFEC_MAC_FUSE_SIZE, |
| 368 | .flags = IORESOURCE_DMA, |
| 369 | }, |
| 370 | }; |
| 371 | |
| 372 | struct platform_device qfec_device = { |
| 373 | .name = "qfec", |
| 374 | .id = 0, |
| 375 | .num_resources = ARRAY_SIZE(qfec_resources), |
| 376 | .resource = qfec_resources, |
| 377 | }; |
| 378 | |
| 379 | /* |
| 380 | * FUSE |
| 381 | */ |
| 382 | |
| 383 | #if defined(CONFIG_QFP_FUSE) |
| 384 | |
| 385 | char fuse_regulator_name[] = "8058_lvs0"; |
| 386 | |
| 387 | struct resource qfp_fuse_resources[] = { |
| 388 | { |
| 389 | .start = (uint32_t) MSM_QFP_FUSE_BASE, |
| 390 | .end = (uint32_t) MSM_QFP_FUSE_BASE + MSM_QFP_FUSE_SIZE, |
| 391 | .flags = IORESOURCE_MEM, |
| 392 | }, |
| 393 | }; |
| 394 | |
| 395 | struct platform_device fsm_qfp_fuse_device = { |
| 396 | .name = "qfp_fuse_driver", |
| 397 | .id = 0, |
| 398 | .dev = {.platform_data = fuse_regulator_name}, |
| 399 | .num_resources = ARRAY_SIZE(qfp_fuse_resources), |
| 400 | .resource = qfp_fuse_resources, |
| 401 | }; |
| 402 | |
| 403 | #endif |
| 404 | |
Rohit Vaswani | 4c0d304 | 2011-07-13 14:19:23 -0700 | [diff] [blame] | 405 | /* |
| 406 | * XO |
| 407 | */ |
| 408 | |
| 409 | struct platform_device fsm_xo_device = { |
| 410 | .name = "fsm_xo_driver", |
| 411 | .id = -1, |
| 412 | }; |
| 413 | |
Rohit Vaswani | e897f84 | 2012-03-19 14:19:34 -0700 | [diff] [blame] | 414 | /* |
| 415 | * Watchdog |
| 416 | */ |
| 417 | |
| 418 | static struct msm_watchdog_pdata fsm_watchdog_pdata = { |
| 419 | .pet_time = 10000, |
| 420 | .bark_time = 11000, |
| 421 | .has_secure = false, |
| 422 | .has_vic = true, |
Rohit Vaswani | c77e4a6 | 2012-08-09 18:10:28 -0700 | [diff] [blame] | 423 | .base = MSM_TMR_BASE + WDT1_OFFSET, |
| 424 | }; |
| 425 | |
| 426 | static struct resource msm_watchdog_resources[] = { |
| 427 | { |
| 428 | .start = INT_WDT1_ACCSCSSBARK, |
| 429 | .end = INT_WDT1_ACCSCSSBARK, |
| 430 | .flags = IORESOURCE_IRQ, |
| 431 | }, |
Rohit Vaswani | e897f84 | 2012-03-19 14:19:34 -0700 | [diff] [blame] | 432 | }; |
| 433 | |
| 434 | struct platform_device fsm9xxx_device_watchdog = { |
| 435 | .name = "msm_watchdog", |
| 436 | .id = -1, |
| 437 | .dev = { |
| 438 | .platform_data = &fsm_watchdog_pdata, |
| 439 | }, |
Rohit Vaswani | c77e4a6 | 2012-08-09 18:10:28 -0700 | [diff] [blame] | 440 | .num_resources = ARRAY_SIZE(msm_watchdog_resources), |
| 441 | .resource = msm_watchdog_resources, |
Rohit Vaswani | e897f84 | 2012-03-19 14:19:34 -0700 | [diff] [blame] | 442 | }; |
| 443 | |