Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -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 | |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/irq.h> |
| 17 | #include <linux/io.h> |
Siddartha Mohanadoss | 5d49cec | 2011-09-21 10:26:15 -0700 | [diff] [blame] | 18 | #include <linux/msm_tsens.h> |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame^] | 19 | #include <linux/dma-mapping.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 20 | #include <asm/hardware/gic.h> |
Sahitya Tummala | 3829543 | 2011-09-29 10:08:45 +0530 | [diff] [blame] | 21 | #include <asm/mach/flash.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 22 | #include <mach/board.h> |
| 23 | #include <mach/msm_iomap.h> |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame^] | 24 | #include <mach/msm_hsusb.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 25 | #include <mach/irqs.h> |
| 26 | #include <mach/socinfo.h> |
Praveen Chidambaram | ab3b1c4 | 2011-08-25 08:44:05 -0600 | [diff] [blame] | 27 | #include <mach/rpm.h> |
Rohit Vaswani | f0ce9ae | 2011-08-23 22:18:38 -0700 | [diff] [blame] | 28 | #include <asm/hardware/cache-l2x0.h> |
Yan He | 092b727 | 2011-09-21 15:25:03 -0700 | [diff] [blame] | 29 | #include <mach/msm_sps.h> |
Jeff Ohlstein | d19bf44 | 2011-09-09 12:48:18 -0700 | [diff] [blame] | 30 | #include <mach/dma.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 31 | #include "devices.h" |
Matt Wagantall | 44f672e | 2011-09-07 20:31:16 -0700 | [diff] [blame] | 32 | #include "acpuclock.h" |
Praveen Chidambaram | ab3b1c4 | 2011-08-25 08:44:05 -0600 | [diff] [blame] | 33 | #include "mpm.h" |
| 34 | #include "spm.h" |
| 35 | #include "pm.h" |
| 36 | #include "rpm_resources.h" |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 37 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 38 | /* Address of GSBI blocks */ |
| 39 | #define MSM_GSBI1_PHYS 0x16000000 |
| 40 | #define MSM_GSBI2_PHYS 0x16100000 |
| 41 | #define MSM_GSBI3_PHYS 0x16200000 |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 42 | #define MSM_GSBI4_PHYS 0x16300000 |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 43 | #define MSM_GSBI5_PHYS 0x16400000 |
| 44 | |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 45 | #define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000) |
| 46 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 47 | /* GSBI QUP devices */ |
| 48 | #define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000) |
| 49 | #define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000) |
| 50 | #define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000) |
| 51 | #define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000) |
| 52 | #define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000) |
| 53 | #define MSM_QUP_SIZE SZ_4K |
| 54 | |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 55 | /* Address of SSBI CMD */ |
| 56 | #define MSM_PMIC1_SSBI_CMD_PHYS 0x00500000 |
| 57 | #define MSM_PMIC_SSBI_SIZE SZ_4K |
| 58 | |
Jeff Ohlstein | d19bf44 | 2011-09-09 12:48:18 -0700 | [diff] [blame] | 59 | static struct resource msm_dmov_resource[] = { |
| 60 | { |
| 61 | .start = ADM_0_SCSS_1_IRQ, |
| 62 | .end = (resource_size_t)MSM_DMOV_BASE, |
| 63 | .flags = IORESOURCE_IRQ, |
| 64 | }, |
| 65 | }; |
| 66 | |
| 67 | struct platform_device msm9615_device_dmov = { |
| 68 | .name = "msm_dmov", |
| 69 | .id = -1, |
| 70 | .resource = msm_dmov_resource, |
| 71 | .num_resources = ARRAY_SIZE(msm_dmov_resource), |
| 72 | }; |
| 73 | |
Amit Blay | 5e4ec19 | 2011-10-20 09:16:54 +0200 | [diff] [blame^] | 74 | static struct resource resources_otg[] = { |
| 75 | { |
| 76 | .start = MSM9615_HSUSB_PHYS, |
| 77 | .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1, |
| 78 | .flags = IORESOURCE_MEM, |
| 79 | }, |
| 80 | { |
| 81 | .start = USB1_HS_IRQ, |
| 82 | .end = USB1_HS_IRQ, |
| 83 | .flags = IORESOURCE_IRQ, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | struct platform_device msm_device_otg = { |
| 88 | .name = "msm_otg", |
| 89 | .id = -1, |
| 90 | .num_resources = ARRAY_SIZE(resources_otg), |
| 91 | .resource = resources_otg, |
| 92 | .dev = { |
| 93 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 94 | }, |
| 95 | }; |
| 96 | |
| 97 | static struct resource resources_hsusb[] = { |
| 98 | { |
| 99 | .start = MSM9615_HSUSB_PHYS, |
| 100 | .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1, |
| 101 | .flags = IORESOURCE_MEM, |
| 102 | }, |
| 103 | { |
| 104 | .start = USB1_HS_IRQ, |
| 105 | .end = USB1_HS_IRQ, |
| 106 | .flags = IORESOURCE_IRQ, |
| 107 | }, |
| 108 | }; |
| 109 | |
| 110 | struct platform_device msm_device_gadget_peripheral = { |
| 111 | .name = "msm_hsusb", |
| 112 | .id = -1, |
| 113 | .num_resources = ARRAY_SIZE(resources_hsusb), |
| 114 | .resource = resources_hsusb, |
| 115 | .dev = { |
| 116 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 117 | }, |
| 118 | }; |
| 119 | |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 120 | static struct resource resources_uart_gsbi4[] = { |
| 121 | { |
| 122 | .start = GSBI4_UARTDM_IRQ, |
| 123 | .end = GSBI4_UARTDM_IRQ, |
| 124 | .flags = IORESOURCE_IRQ, |
| 125 | }, |
| 126 | { |
| 127 | .start = MSM_UART4DM_PHYS, |
| 128 | .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1, |
| 129 | .name = "uartdm_resource", |
| 130 | .flags = IORESOURCE_MEM, |
| 131 | }, |
| 132 | { |
| 133 | .start = MSM_GSBI4_PHYS, |
| 134 | .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1, |
| 135 | .name = "gsbi_resource", |
| 136 | .flags = IORESOURCE_MEM, |
| 137 | }, |
| 138 | }; |
| 139 | |
| 140 | struct platform_device msm9615_device_uart_gsbi4 = { |
| 141 | .name = "msm_serial_hsl", |
| 142 | .id = 0, |
| 143 | .num_resources = ARRAY_SIZE(resources_uart_gsbi4), |
| 144 | .resource = resources_uart_gsbi4, |
| 145 | }; |
| 146 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 147 | static struct resource resources_qup_i2c_gsbi5[] = { |
| 148 | { |
| 149 | .name = "gsbi_qup_i2c_addr", |
| 150 | .start = MSM_GSBI5_PHYS, |
Harini Jayaraman | 7a60bc1 | 2011-09-15 14:58:54 -0600 | [diff] [blame] | 151 | .end = MSM_GSBI5_PHYS + 4 - 1, |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 152 | .flags = IORESOURCE_MEM, |
| 153 | }, |
| 154 | { |
| 155 | .name = "qup_phys_addr", |
| 156 | .start = MSM_GSBI5_QUP_PHYS, |
Harini Jayaraman | 7a60bc1 | 2011-09-15 14:58:54 -0600 | [diff] [blame] | 157 | .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1, |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 158 | .flags = IORESOURCE_MEM, |
| 159 | }, |
| 160 | { |
| 161 | .name = "qup_err_intr", |
| 162 | .start = GSBI5_QUP_IRQ, |
| 163 | .end = GSBI5_QUP_IRQ, |
| 164 | .flags = IORESOURCE_IRQ, |
| 165 | }, |
| 166 | }; |
| 167 | |
| 168 | struct platform_device msm9615_device_qup_i2c_gsbi5 = { |
| 169 | .name = "qup_i2c", |
| 170 | .id = 0, |
| 171 | .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5), |
| 172 | .resource = resources_qup_i2c_gsbi5, |
| 173 | }; |
| 174 | |
Harini Jayaraman | 738c931 | 2011-09-08 15:22:38 -0600 | [diff] [blame] | 175 | static struct resource resources_qup_spi_gsbi3[] = { |
| 176 | { |
| 177 | .name = "spi_base", |
| 178 | .start = MSM_GSBI3_QUP_PHYS, |
| 179 | .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1, |
| 180 | .flags = IORESOURCE_MEM, |
| 181 | }, |
| 182 | { |
| 183 | .name = "gsbi_base", |
| 184 | .start = MSM_GSBI3_PHYS, |
| 185 | .end = MSM_GSBI3_PHYS + 4 - 1, |
| 186 | .flags = IORESOURCE_MEM, |
| 187 | }, |
| 188 | { |
| 189 | .name = "spi_irq_in", |
| 190 | .start = GSBI3_QUP_IRQ, |
| 191 | .end = GSBI3_QUP_IRQ, |
| 192 | .flags = IORESOURCE_IRQ, |
| 193 | }, |
| 194 | }; |
| 195 | |
| 196 | struct platform_device msm9615_device_qup_spi_gsbi3 = { |
| 197 | .name = "spi_qsd", |
| 198 | .id = 0, |
| 199 | .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3), |
| 200 | .resource = resources_qup_spi_gsbi3, |
| 201 | }; |
| 202 | |
Kenneth Heitke | af3d3cf | 2011-09-08 11:45:31 -0700 | [diff] [blame] | 203 | static struct resource resources_ssbi_pmic1[] = { |
| 204 | { |
| 205 | .start = MSM_PMIC1_SSBI_CMD_PHYS, |
| 206 | .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1, |
| 207 | .flags = IORESOURCE_MEM, |
| 208 | }, |
| 209 | }; |
| 210 | |
| 211 | struct platform_device msm9615_device_ssbi_pmic1 = { |
| 212 | .name = "msm_ssbi", |
| 213 | .id = 0, |
| 214 | .resource = resources_ssbi_pmic1, |
| 215 | .num_resources = ARRAY_SIZE(resources_ssbi_pmic1), |
| 216 | }; |
| 217 | |
Yan He | 092b727 | 2011-09-21 15:25:03 -0700 | [diff] [blame] | 218 | static struct resource resources_sps[] = { |
| 219 | { |
| 220 | .name = "pipe_mem", |
| 221 | .start = 0x12800000, |
| 222 | .end = 0x12800000 + 0x4000 - 1, |
| 223 | .flags = IORESOURCE_MEM, |
| 224 | }, |
| 225 | { |
| 226 | .name = "bamdma_dma", |
| 227 | .start = 0x12240000, |
| 228 | .end = 0x12240000 + 0x1000 - 1, |
| 229 | .flags = IORESOURCE_MEM, |
| 230 | }, |
| 231 | { |
| 232 | .name = "bamdma_bam", |
| 233 | .start = 0x12244000, |
| 234 | .end = 0x12244000 + 0x4000 - 1, |
| 235 | .flags = IORESOURCE_MEM, |
| 236 | }, |
| 237 | { |
| 238 | .name = "bamdma_irq", |
| 239 | .start = SPS_BAM_DMA_IRQ, |
| 240 | .end = SPS_BAM_DMA_IRQ, |
| 241 | .flags = IORESOURCE_IRQ, |
| 242 | }, |
| 243 | }; |
| 244 | |
| 245 | struct msm_sps_platform_data msm_sps_pdata = { |
| 246 | .bamdma_restricted_pipes = 0x06, |
| 247 | }; |
| 248 | |
| 249 | struct platform_device msm_device_sps = { |
| 250 | .name = "msm_sps", |
| 251 | .id = -1, |
| 252 | .num_resources = ARRAY_SIZE(resources_sps), |
| 253 | .resource = resources_sps, |
| 254 | .dev.platform_data = &msm_sps_pdata, |
| 255 | }; |
| 256 | |
Siddartha Mohanadoss | 5d49cec | 2011-09-21 10:26:15 -0700 | [diff] [blame] | 257 | static struct tsens_platform_data msm_tsens_pdata = { |
| 258 | .slope = 910, |
| 259 | .tsens_factor = 1000, |
| 260 | .hw_type = MSM_9615, |
| 261 | .tsens_num_sensor = 5, |
| 262 | }; |
| 263 | |
Sahitya Tummala | 3829543 | 2011-09-29 10:08:45 +0530 | [diff] [blame] | 264 | struct platform_device msm9615_device_tsens = { |
Siddartha Mohanadoss | 5d49cec | 2011-09-21 10:26:15 -0700 | [diff] [blame] | 265 | .name = "tsens8960-tm", |
| 266 | .id = -1, |
Sahitya Tummala | 3829543 | 2011-09-29 10:08:45 +0530 | [diff] [blame] | 267 | .dev = { |
| 268 | .platform_data = &msm_tsens_pdata, |
| 269 | }, |
| 270 | }; |
| 271 | |
| 272 | #define MSM_NAND_PHYS 0x1B400000 |
| 273 | static struct resource resources_nand[] = { |
| 274 | [0] = { |
| 275 | .name = "msm_nand_dmac", |
| 276 | .start = DMOV_NAND_CHAN, |
| 277 | .end = DMOV_NAND_CHAN, |
| 278 | .flags = IORESOURCE_DMA, |
| 279 | }, |
| 280 | [1] = { |
| 281 | .name = "msm_nand_phys", |
| 282 | .start = MSM_NAND_PHYS, |
| 283 | .end = MSM_NAND_PHYS + 0x7FF, |
| 284 | .flags = IORESOURCE_MEM, |
| 285 | }, |
| 286 | }; |
| 287 | |
| 288 | struct flash_platform_data msm_nand_data = { |
| 289 | .parts = NULL, |
| 290 | .nr_parts = 0, |
| 291 | }; |
| 292 | |
| 293 | struct platform_device msm_device_nand = { |
| 294 | .name = "msm_nand", |
| 295 | .id = -1, |
| 296 | .num_resources = ARRAY_SIZE(resources_nand), |
| 297 | .resource = resources_nand, |
Siddartha Mohanadoss | 5d49cec | 2011-09-21 10:26:15 -0700 | [diff] [blame] | 298 | .dev = { |
Sahitya Tummala | 3829543 | 2011-09-29 10:08:45 +0530 | [diff] [blame] | 299 | .platform_data = &msm_nand_data, |
Siddartha Mohanadoss | 5d49cec | 2011-09-21 10:26:15 -0700 | [diff] [blame] | 300 | }, |
| 301 | }; |
| 302 | |
Jeff Hugo | 56b933a | 2011-09-28 14:42:05 -0600 | [diff] [blame] | 303 | struct platform_device msm_device_smd = { |
| 304 | .name = "msm_smd", |
| 305 | .id = -1, |
| 306 | }; |
| 307 | |
Ramesh Masavarapu | 5ad3739 | 2011-10-10 10:44:10 -0700 | [diff] [blame] | 308 | #ifdef CONFIG_HW_RANDOM_MSM |
| 309 | /* PRNG device */ |
| 310 | #define MSM_PRNG_PHYS 0x1A500000 |
| 311 | static struct resource rng_resources = { |
| 312 | .flags = IORESOURCE_MEM, |
| 313 | .start = MSM_PRNG_PHYS, |
| 314 | .end = MSM_PRNG_PHYS + SZ_512 - 1, |
| 315 | }; |
| 316 | |
| 317 | struct platform_device msm_device_rng = { |
| 318 | .name = "msm_rng", |
| 319 | .id = 0, |
| 320 | .num_resources = 1, |
| 321 | .resource = &rng_resources, |
| 322 | }; |
| 323 | #endif |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 324 | |
| 325 | #define MSM_SDC1_BASE 0x12180000 |
| 326 | #define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800) |
| 327 | #define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000) |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 328 | #define MSM_SDC2_BASE 0x12140000 |
| 329 | #define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800) |
| 330 | #define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000) |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 331 | |
| 332 | static struct resource resources_sdc1[] = { |
| 333 | { |
| 334 | .name = "core_mem", |
| 335 | .flags = IORESOURCE_MEM, |
| 336 | .start = MSM_SDC1_BASE, |
| 337 | .end = MSM_SDC1_DML_BASE - 1, |
| 338 | }, |
| 339 | { |
| 340 | .name = "core_irq", |
| 341 | .flags = IORESOURCE_IRQ, |
| 342 | .start = SDC1_IRQ_0, |
| 343 | .end = SDC1_IRQ_0 |
| 344 | }, |
| 345 | #ifdef CONFIG_MMC_MSM_SPS_SUPPORT |
| 346 | { |
| 347 | .name = "sdcc_dml_addr", |
| 348 | .start = MSM_SDC1_DML_BASE, |
| 349 | .end = MSM_SDC1_BAM_BASE - 1, |
| 350 | .flags = IORESOURCE_MEM, |
| 351 | }, |
| 352 | { |
| 353 | .name = "sdcc_bam_addr", |
| 354 | .start = MSM_SDC1_BAM_BASE, |
| 355 | .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1, |
| 356 | .flags = IORESOURCE_MEM, |
| 357 | }, |
| 358 | { |
| 359 | .name = "sdcc_bam_irq", |
| 360 | .start = SDC1_BAM_IRQ, |
| 361 | .end = SDC1_BAM_IRQ, |
| 362 | .flags = IORESOURCE_IRQ, |
| 363 | }, |
| 364 | #endif |
| 365 | }; |
| 366 | |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 367 | static struct resource resources_sdc2[] = { |
| 368 | { |
| 369 | .name = "core_mem", |
| 370 | .flags = IORESOURCE_MEM, |
| 371 | .start = MSM_SDC2_BASE, |
| 372 | .end = MSM_SDC2_DML_BASE - 1, |
| 373 | }, |
| 374 | { |
| 375 | .name = "core_irq", |
| 376 | .flags = IORESOURCE_IRQ, |
| 377 | .start = SDC2_IRQ_0, |
| 378 | .end = SDC2_IRQ_0 |
| 379 | }, |
| 380 | #ifdef CONFIG_MMC_MSM_SPS_SUPPORT |
| 381 | { |
| 382 | .name = "sdcc_dml_addr", |
| 383 | .start = MSM_SDC2_DML_BASE, |
| 384 | .end = MSM_SDC2_BAM_BASE - 1, |
| 385 | .flags = IORESOURCE_MEM, |
| 386 | }, |
| 387 | { |
| 388 | .name = "sdcc_bam_addr", |
| 389 | .start = MSM_SDC2_BAM_BASE, |
| 390 | .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1, |
| 391 | .flags = IORESOURCE_MEM, |
| 392 | }, |
| 393 | { |
| 394 | .name = "sdcc_bam_irq", |
| 395 | .start = SDC2_BAM_IRQ, |
| 396 | .end = SDC2_BAM_IRQ, |
| 397 | .flags = IORESOURCE_IRQ, |
| 398 | }, |
| 399 | #endif |
| 400 | }; |
| 401 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 402 | struct platform_device msm_device_sdc1 = { |
| 403 | .name = "msm_sdcc", |
| 404 | .id = 1, |
| 405 | .num_resources = ARRAY_SIZE(resources_sdc1), |
| 406 | .resource = resources_sdc1, |
| 407 | .dev = { |
| 408 | .coherent_dma_mask = 0xffffffff, |
| 409 | }, |
| 410 | }; |
| 411 | |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 412 | struct platform_device msm_device_sdc2 = { |
| 413 | .name = "msm_sdcc", |
| 414 | .id = 2, |
| 415 | .num_resources = ARRAY_SIZE(resources_sdc2), |
| 416 | .resource = resources_sdc2, |
| 417 | .dev = { |
| 418 | .coherent_dma_mask = 0xffffffff, |
| 419 | }, |
| 420 | }; |
| 421 | |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 422 | static struct platform_device *msm_sdcc_devices[] __initdata = { |
| 423 | &msm_device_sdc1, |
Krishna Konda | 71aef18 | 2011-10-01 02:27:51 -0700 | [diff] [blame] | 424 | &msm_device_sdc2, |
Krishna Konda | dd79446 | 2011-10-01 00:19:29 -0700 | [diff] [blame] | 425 | }; |
| 426 | |
| 427 | int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat) |
| 428 | { |
| 429 | struct platform_device *pdev; |
| 430 | |
| 431 | if (controller < 1 || controller > 2) |
| 432 | return -EINVAL; |
| 433 | |
| 434 | pdev = msm_sdcc_devices[controller - 1]; |
| 435 | pdev->dev.platform_data = plat; |
| 436 | return platform_device_register(pdev); |
| 437 | } |
| 438 | |
Rohit Vaswani | f0ce9ae | 2011-08-23 22:18:38 -0700 | [diff] [blame] | 439 | #ifdef CONFIG_CACHE_L2X0 |
| 440 | static int __init l2x0_cache_init(void) |
| 441 | { |
| 442 | int aux_ctrl = 0; |
| 443 | |
| 444 | /* Way Size 010(0x2) 32KB */ |
| 445 | aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \ |
| 446 | (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \ |
| 447 | (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT); |
| 448 | |
| 449 | /* L2 Latency setting required by hardware. Default is 0x20 |
| 450 | which is no good. |
| 451 | */ |
| 452 | writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL); |
| 453 | l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK); |
| 454 | |
| 455 | return 0; |
| 456 | } |
| 457 | #else |
| 458 | static int __init l2x0_cache_init(void){ return 0; } |
| 459 | #endif |
| 460 | |
Praveen Chidambaram | ab3b1c4 | 2011-08-25 08:44:05 -0600 | [diff] [blame] | 461 | struct msm_rpm_map_data rpm_map_data[] __initdata = { |
| 462 | MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1), |
| 463 | MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1), |
| 464 | |
| 465 | MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1), |
| 466 | |
| 467 | MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1), |
| 468 | MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1), |
| 469 | MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1), |
| 470 | MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1), |
| 471 | MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1), |
| 472 | MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1), |
| 473 | |
| 474 | MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2), |
| 475 | MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3), |
| 476 | MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1), |
| 477 | MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27), |
| 478 | |
| 479 | MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2), |
| 480 | MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2), |
| 481 | MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2), |
| 482 | MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2), |
| 483 | MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2), |
| 484 | MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2), |
| 485 | MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2), |
| 486 | MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2), |
| 487 | MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2), |
| 488 | MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2), |
| 489 | MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2), |
| 490 | MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2), |
| 491 | MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2), |
| 492 | MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2), |
| 493 | MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2), |
| 494 | MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2), |
| 495 | MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2), |
| 496 | MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2), |
| 497 | MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2), |
| 498 | MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1), |
| 499 | MSM_RPM_MAP(NCP_0, NCP, 2), |
| 500 | MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1), |
| 501 | MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1), |
| 502 | MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1), |
| 503 | }; |
| 504 | unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data); |
| 505 | |
| 506 | static struct msm_rpm_platform_data msm_rpm_data = { |
| 507 | .reg_base_addrs = { |
| 508 | [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE, |
| 509 | [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400, |
| 510 | [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600, |
| 511 | [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00, |
| 512 | }, |
| 513 | |
| 514 | .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ, |
| 515 | .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ, |
| 516 | .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 517 | .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008, |
| 518 | .msm_apps_ipc_rpm_val = 4, |
| 519 | }; |
| 520 | |
| 521 | struct platform_device msm_rpm_device = { |
| 522 | .name = "msm_rpm", |
| 523 | .id = -1, |
| 524 | }; |
| 525 | |
| 526 | static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = { |
| 527 | [1] = MSM_GPIO_TO_INT(46), |
| 528 | [2] = MSM_GPIO_TO_INT(150), |
| 529 | [4] = MSM_GPIO_TO_INT(103), |
| 530 | [5] = MSM_GPIO_TO_INT(104), |
| 531 | [6] = MSM_GPIO_TO_INT(105), |
| 532 | [7] = MSM_GPIO_TO_INT(106), |
| 533 | [8] = MSM_GPIO_TO_INT(107), |
| 534 | [9] = MSM_GPIO_TO_INT(7), |
| 535 | [10] = MSM_GPIO_TO_INT(11), |
| 536 | [11] = MSM_GPIO_TO_INT(15), |
| 537 | [12] = MSM_GPIO_TO_INT(19), |
| 538 | [13] = MSM_GPIO_TO_INT(23), |
| 539 | [14] = MSM_GPIO_TO_INT(27), |
| 540 | [15] = MSM_GPIO_TO_INT(31), |
| 541 | [16] = MSM_GPIO_TO_INT(35), |
| 542 | [19] = MSM_GPIO_TO_INT(90), |
| 543 | [20] = MSM_GPIO_TO_INT(92), |
| 544 | [23] = MSM_GPIO_TO_INT(85), |
| 545 | [24] = MSM_GPIO_TO_INT(83), |
| 546 | [25] = USB1_HS_IRQ, |
| 547 | /*[27] = HDMI_IRQ,*/ |
| 548 | [29] = MSM_GPIO_TO_INT(10), |
| 549 | [30] = MSM_GPIO_TO_INT(102), |
| 550 | [31] = MSM_GPIO_TO_INT(81), |
| 551 | [32] = MSM_GPIO_TO_INT(78), |
| 552 | [33] = MSM_GPIO_TO_INT(94), |
| 553 | [34] = MSM_GPIO_TO_INT(72), |
| 554 | [35] = MSM_GPIO_TO_INT(39), |
| 555 | [36] = MSM_GPIO_TO_INT(43), |
| 556 | [37] = MSM_GPIO_TO_INT(61), |
| 557 | [38] = MSM_GPIO_TO_INT(50), |
| 558 | [39] = MSM_GPIO_TO_INT(42), |
| 559 | [41] = MSM_GPIO_TO_INT(62), |
| 560 | [42] = MSM_GPIO_TO_INT(76), |
| 561 | [43] = MSM_GPIO_TO_INT(75), |
| 562 | [44] = MSM_GPIO_TO_INT(70), |
| 563 | [45] = MSM_GPIO_TO_INT(69), |
| 564 | [46] = MSM_GPIO_TO_INT(67), |
| 565 | [47] = MSM_GPIO_TO_INT(65), |
| 566 | [48] = MSM_GPIO_TO_INT(58), |
| 567 | [49] = MSM_GPIO_TO_INT(54), |
| 568 | [50] = MSM_GPIO_TO_INT(52), |
| 569 | [51] = MSM_GPIO_TO_INT(49), |
| 570 | [52] = MSM_GPIO_TO_INT(40), |
| 571 | [53] = MSM_GPIO_TO_INT(37), |
| 572 | [54] = MSM_GPIO_TO_INT(24), |
| 573 | [55] = MSM_GPIO_TO_INT(14), |
| 574 | }; |
| 575 | |
| 576 | static uint16_t msm_mpm_bypassed_apps_irqs[] = { |
| 577 | TLMM_MSM_SUMMARY_IRQ, |
| 578 | RPM_APCC_CPU0_GP_HIGH_IRQ, |
| 579 | RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 580 | RPM_APCC_CPU0_GP_LOW_IRQ, |
| 581 | RPM_APCC_CPU0_WAKE_UP_IRQ, |
| 582 | LPASS_SCSS_GP_LOW_IRQ, |
| 583 | LPASS_SCSS_GP_MEDIUM_IRQ, |
| 584 | LPASS_SCSS_GP_HIGH_IRQ, |
| 585 | SPS_MTI_31, |
| 586 | }; |
| 587 | |
| 588 | struct msm_mpm_device_data msm_mpm_dev_data = { |
| 589 | .irqs_m2a = msm_mpm_irqs_m2a, |
| 590 | .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a), |
| 591 | .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs, |
| 592 | .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs), |
| 593 | .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8, |
| 594 | .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8, |
| 595 | .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008, |
| 596 | .mpm_apps_ipc_val = BIT(1), |
| 597 | .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
Maheshkumar Sivasubramanian | f07bd0b | 2011-09-06 17:33:17 -0600 | [diff] [blame] | 598 | }; |
Praveen Chidambaram | ab3b1c4 | 2011-08-25 08:44:05 -0600 | [diff] [blame] | 599 | |
Maheshkumar Sivasubramanian | f07bd0b | 2011-09-06 17:33:17 -0600 | [diff] [blame] | 600 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
| 601 | 0x00, 0x03, 0x0B, 0x00, |
| 602 | 0x0f, |
| 603 | }; |
| 604 | |
| 605 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { |
| 606 | 0x30, 0x20, 0x10, 0x00, |
| 607 | 0x50, 0x03, 0x50, 0x00, |
| 608 | 0x10, 0x20, 0x30, 0x0f, |
| 609 | }; |
| 610 | |
| 611 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { |
| 612 | 0x30, 0x20, 0x10, 0x00, |
| 613 | 0x50, 0x07, 0x50, 0x00, |
| 614 | 0x10, 0x20, 0x30, 0x0f, |
| 615 | }; |
| 616 | |
| 617 | static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { |
| 618 | [0] = { |
| 619 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 620 | .notify_rpm = false, |
| 621 | .cmd = spm_wfi_cmd_sequence, |
| 622 | }, |
| 623 | [1] = { |
| 624 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 625 | .notify_rpm = false, |
| 626 | .cmd = spm_power_collapse_without_rpm, |
| 627 | }, |
| 628 | [2] = { |
| 629 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 630 | .notify_rpm = true, |
| 631 | .cmd = spm_power_collapse_with_rpm, |
| 632 | }, |
| 633 | }; |
| 634 | |
| 635 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 636 | [0] = { |
| 637 | .reg_base_addr = MSM_SAW0_BASE, |
| 638 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 639 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 640 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 641 | .modes = msm_spm_seq_list, |
| 642 | }, |
Praveen Chidambaram | ab3b1c4 | 2011-08-25 08:44:05 -0600 | [diff] [blame] | 643 | }; |
| 644 | |
| 645 | static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = { |
| 646 | { |
| 647 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 648 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 649 | true, |
| 650 | 1, 8000, 100000, 1, |
| 651 | }, |
| 652 | |
| 653 | { |
| 654 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 655 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 656 | true, |
| 657 | 1500, 5000, 60100000, 3000, |
| 658 | }, |
| 659 | { |
| 660 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 661 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 662 | false, |
| 663 | 2800, 5000, 60350000, 3500, |
| 664 | }, |
| 665 | }; |
| 666 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 667 | void __init msm9615_device_init(void) |
| 668 | { |
Maheshkumar Sivasubramanian | f07bd0b | 2011-09-06 17:33:17 -0600 | [diff] [blame] | 669 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
Vikram Mulukutla | 489e39e | 2011-08-31 18:04:05 -0700 | [diff] [blame] | 670 | msm_clock_init(&msm9615_clock_init_data); |
Matt Wagantall | 44f672e | 2011-09-07 20:31:16 -0700 | [diff] [blame] | 671 | acpuclk_init(&acpuclk_9615_soc_data); |
Praveen Chidambaram | ab3b1c4 | 2011-08-25 08:44:05 -0600 | [diff] [blame] | 672 | BUG_ON(msm_rpm_init(&msm_rpm_data)); |
| 673 | BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, |
| 674 | ARRAY_SIZE(msm_rpmrs_levels))); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 675 | } |
| 676 | |
Jeff Hugo | 56b933a | 2011-09-28 14:42:05 -0600 | [diff] [blame] | 677 | #define MSM_SHARED_RAM_PHYS 0x40000000 |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 678 | void __init msm9615_map_io(void) |
| 679 | { |
Jeff Hugo | 56b933a | 2011-09-28 14:42:05 -0600 | [diff] [blame] | 680 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 681 | msm_map_msm9615_io(); |
Rohit Vaswani | f0ce9ae | 2011-08-23 22:18:38 -0700 | [diff] [blame] | 682 | l2x0_cache_init(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 683 | if (socinfo_init() < 0) |
| 684 | pr_err("socinfo_init() failed!\n"); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 685 | } |
| 686 | |
| 687 | void __init msm9615_init_irq(void) |
| 688 | { |
| 689 | unsigned int i; |
Rohit Vaswani | b2e42e1 | 2011-10-07 21:25:53 -0700 | [diff] [blame] | 690 | |
| 691 | msm_mpm_irq_extn_init(); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 692 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 693 | (void *)MSM_QGIC_CPU_BASE); |
| 694 | |
| 695 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 696 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 697 | |
| 698 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 699 | mb(); |
| 700 | |
| 701 | /* |
| 702 | * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 703 | * as they are configured as level, which does not play nice with |
| 704 | * handle_percpu_irq. |
| 705 | */ |
| 706 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 707 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
| 708 | irq_set_handler(i, handle_percpu_irq); |
| 709 | } |
| 710 | } |