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> |
Jordan Crouse | 914de9b | 2012-07-09 13:49:46 -0600 | [diff] [blame] | 16 | #include <mach/kgsl.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | #include <linux/regulator/machine.h> |
Taniya Das | 2e94819 | 2011-12-20 11:15:13 +0530 | [diff] [blame] | 18 | #include <linux/init.h> |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 19 | #include <linux/irq.h> |
Taniya Das | 9d0c3c5 | 2012-05-04 14:40:55 +0530 | [diff] [blame] | 20 | #include <linux/notifier.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 21 | #include <mach/irqs.h> |
| 22 | #include <mach/msm_iomap.h> |
| 23 | #include <mach/board.h> |
| 24 | #include <mach/dma.h> |
| 25 | #include <mach/dal_axi.h> |
| 26 | #include <asm/mach/flash.h> |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 27 | #include <asm/hardware/gic.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 28 | #include <asm/hardware/cache-l2x0.h> |
| 29 | #include <asm/mach/mmc.h> |
Taniya Das | 9d0c3c5 | 2012-05-04 14:40:55 +0530 | [diff] [blame] | 30 | #include <asm/cacheflush.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 31 | #include <mach/rpc_hsusb.h> |
| 32 | #include <mach/socinfo.h> |
Matt Wagantall | 33d01f5 | 2012-02-23 23:27:44 -0800 | [diff] [blame] | 33 | #include <mach/clk-provider.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 34 | |
| 35 | #include "devices.h" |
| 36 | #include "devices-msm7x2xa.h" |
| 37 | #include "footswitch.h" |
Matt Wagantall | 6d9ebee | 2011-08-26 12:15:24 -0700 | [diff] [blame] | 38 | #include "acpuclock.h" |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 39 | #include "spm.h" |
Taniya Das | fcb3500 | 2012-03-09 15:28:12 +0530 | [diff] [blame] | 40 | #include "mpm-8625.h" |
Murali Nalajala | 2a0bbda | 2012-03-28 12:12:54 +0530 | [diff] [blame] | 41 | #include "irq.h" |
| 42 | #include "pm.h" |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 43 | #include "msm_cpr.h" |
| 44 | #include "msm_smem_iface.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 45 | |
| 46 | /* Address of GSBI blocks */ |
| 47 | #define MSM_GSBI0_PHYS 0xA1200000 |
| 48 | #define MSM_GSBI1_PHYS 0xA1300000 |
| 49 | |
| 50 | /* GSBI QUPe devices */ |
| 51 | #define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000) |
| 52 | #define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000) |
| 53 | |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 54 | #define A11S_TEST_BUS_SEL_ADDR (MSM_CSR_BASE + 0x518) |
| 55 | #define RBCPR_CLK_MUX_SEL (1 << 13) |
| 56 | |
| 57 | /* Reset Address of RBCPR (Active Low)*/ |
| 58 | #define RBCPR_SW_RESET_N (MSM_CSR_BASE + 0x64) |
| 59 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 60 | static struct resource gsbi0_qup_i2c_resources[] = { |
| 61 | { |
| 62 | .name = "qup_phys_addr", |
| 63 | .start = MSM_GSBI0_QUP_PHYS, |
| 64 | .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1, |
| 65 | .flags = IORESOURCE_MEM, |
| 66 | }, |
| 67 | { |
| 68 | .name = "gsbi_qup_i2c_addr", |
| 69 | .start = MSM_GSBI0_PHYS, |
| 70 | .end = MSM_GSBI0_PHYS + SZ_4K - 1, |
| 71 | .flags = IORESOURCE_MEM, |
| 72 | }, |
| 73 | { |
| 74 | .name = "qup_err_intr", |
| 75 | .start = INT_PWB_I2C, |
| 76 | .end = INT_PWB_I2C, |
| 77 | .flags = IORESOURCE_IRQ, |
| 78 | }, |
| 79 | }; |
| 80 | |
| 81 | /* Use GSBI0 QUP for /dev/i2c-0 */ |
| 82 | struct platform_device msm_gsbi0_qup_i2c_device = { |
| 83 | .name = "qup_i2c", |
| 84 | .id = MSM_GSBI0_QUP_I2C_BUS_ID, |
| 85 | .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources), |
| 86 | .resource = gsbi0_qup_i2c_resources, |
| 87 | }; |
| 88 | |
| 89 | static struct resource gsbi1_qup_i2c_resources[] = { |
| 90 | { |
| 91 | .name = "qup_phys_addr", |
| 92 | .start = MSM_GSBI1_QUP_PHYS, |
| 93 | .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1, |
| 94 | .flags = IORESOURCE_MEM, |
| 95 | }, |
| 96 | { |
| 97 | .name = "gsbi_qup_i2c_addr", |
| 98 | .start = MSM_GSBI1_PHYS, |
| 99 | .end = MSM_GSBI1_PHYS + SZ_4K - 1, |
| 100 | .flags = IORESOURCE_MEM, |
| 101 | }, |
| 102 | { |
| 103 | .name = "qup_err_intr", |
| 104 | .start = INT_ARM11_DMA, |
| 105 | .end = INT_ARM11_DMA, |
| 106 | .flags = IORESOURCE_IRQ, |
| 107 | }, |
| 108 | }; |
| 109 | |
| 110 | /* Use GSBI1 QUP for /dev/i2c-1 */ |
| 111 | struct platform_device msm_gsbi1_qup_i2c_device = { |
| 112 | .name = "qup_i2c", |
| 113 | .id = MSM_GSBI1_QUP_I2C_BUS_ID, |
| 114 | .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources), |
| 115 | .resource = gsbi1_qup_i2c_resources, |
| 116 | }; |
| 117 | |
| 118 | #define MSM_HSUSB_PHYS 0xA0800000 |
| 119 | static struct resource resources_hsusb_otg[] = { |
| 120 | { |
| 121 | .start = MSM_HSUSB_PHYS, |
| 122 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 123 | .flags = IORESOURCE_MEM, |
| 124 | }, |
| 125 | { |
| 126 | .start = INT_USB_HS, |
| 127 | .end = INT_USB_HS, |
| 128 | .flags = IORESOURCE_IRQ, |
| 129 | }, |
| 130 | }; |
| 131 | |
| 132 | static u64 dma_mask = 0xffffffffULL; |
| 133 | struct platform_device msm_device_otg = { |
| 134 | .name = "msm_otg", |
| 135 | .id = -1, |
| 136 | .num_resources = ARRAY_SIZE(resources_hsusb_otg), |
| 137 | .resource = resources_hsusb_otg, |
| 138 | .dev = { |
| 139 | .dma_mask = &dma_mask, |
| 140 | .coherent_dma_mask = 0xffffffffULL, |
| 141 | }, |
| 142 | }; |
| 143 | |
| 144 | static struct resource resources_gadget_peripheral[] = { |
| 145 | { |
| 146 | .start = MSM_HSUSB_PHYS, |
| 147 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 148 | .flags = IORESOURCE_MEM, |
| 149 | }, |
| 150 | { |
| 151 | .start = INT_USB_HS, |
| 152 | .end = INT_USB_HS, |
| 153 | .flags = IORESOURCE_IRQ, |
| 154 | }, |
| 155 | }; |
| 156 | |
| 157 | struct platform_device msm_device_gadget_peripheral = { |
| 158 | .name = "msm_hsusb", |
| 159 | .id = -1, |
| 160 | .num_resources = ARRAY_SIZE(resources_gadget_peripheral), |
| 161 | .resource = resources_gadget_peripheral, |
| 162 | .dev = { |
| 163 | .dma_mask = &dma_mask, |
| 164 | .coherent_dma_mask = 0xffffffffULL, |
| 165 | }, |
| 166 | }; |
| 167 | |
| 168 | static struct resource resources_hsusb_host[] = { |
| 169 | { |
| 170 | .start = MSM_HSUSB_PHYS, |
| 171 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 172 | .flags = IORESOURCE_MEM, |
| 173 | }, |
| 174 | { |
| 175 | .start = INT_USB_HS, |
| 176 | .end = INT_USB_HS, |
| 177 | .flags = IORESOURCE_IRQ, |
| 178 | }, |
| 179 | }; |
| 180 | |
| 181 | struct platform_device msm_device_hsusb_host = { |
| 182 | .name = "msm_hsusb_host", |
| 183 | .id = 0, |
| 184 | .num_resources = ARRAY_SIZE(resources_hsusb_host), |
| 185 | .resource = resources_hsusb_host, |
| 186 | .dev = { |
| 187 | .dma_mask = &dma_mask, |
| 188 | .coherent_dma_mask = 0xffffffffULL, |
| 189 | }, |
| 190 | }; |
| 191 | |
| 192 | static struct platform_device *msm_host_devices[] = { |
| 193 | &msm_device_hsusb_host, |
| 194 | }; |
| 195 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 196 | static struct resource msm_dmov_resource[] = { |
| 197 | { |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 198 | .start = INT_ADM_AARM, |
| 199 | .flags = IORESOURCE_IRQ, |
| 200 | }, |
| 201 | { |
| 202 | .start = 0xA9700000, |
| 203 | .end = 0xA9700000 + SZ_4K - 1, |
| 204 | .flags = IORESOURCE_MEM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 205 | }, |
| 206 | }; |
| 207 | |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 208 | static struct msm_dmov_pdata msm_dmov_pdata = { |
| 209 | .sd = 3, |
| 210 | .sd_size = 0x400, |
| 211 | }; |
| 212 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 213 | struct platform_device msm_device_dmov = { |
Jeff Ohlstein | 905f1ce | 2011-09-07 18:50:18 -0700 | [diff] [blame] | 214 | .name = "msm_dmov", |
| 215 | .id = -1, |
| 216 | .resource = msm_dmov_resource, |
| 217 | .num_resources = ARRAY_SIZE(msm_dmov_resource), |
| 218 | .dev = { |
| 219 | .platform_data = &msm_dmov_pdata, |
| 220 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 221 | }; |
| 222 | |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 223 | static struct acpuclk_pdata msm7x27a_acpuclk_pdata = { |
| 224 | .max_speed_delta_khz = 400000, |
| 225 | }; |
| 226 | |
| 227 | struct platform_device msm7x27a_device_acpuclk = { |
| 228 | .name = "acpuclk-7627", |
| 229 | .id = -1, |
| 230 | .dev.platform_data = &msm7x27a_acpuclk_pdata, |
| 231 | }; |
| 232 | |
| 233 | static struct acpuclk_pdata msm7x27aa_acpuclk_pdata = { |
| 234 | .max_speed_delta_khz = 504000, |
| 235 | }; |
| 236 | |
| 237 | struct platform_device msm7x27aa_device_acpuclk = { |
| 238 | .name = "acpuclk-7627", |
| 239 | .id = -1, |
| 240 | .dev.platform_data = &msm7x27aa_acpuclk_pdata, |
| 241 | }; |
| 242 | |
| 243 | static struct acpuclk_pdata msm8625_acpuclk_pdata = { |
| 244 | /* TODO: Need to update speed delta from H/w Team */ |
| 245 | .max_speed_delta_khz = 604800, |
| 246 | }; |
| 247 | |
Kaushal Kumar | 86473f0 | 2012-06-28 19:35:58 +0530 | [diff] [blame] | 248 | static struct acpuclk_pdata msm8625ab_acpuclk_pdata = { |
| 249 | .max_speed_delta_khz = 801600, |
| 250 | }; |
| 251 | |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 252 | struct platform_device msm8625_device_acpuclk = { |
| 253 | .name = "acpuclk-7627", |
| 254 | .id = -1, |
| 255 | .dev.platform_data = &msm8625_acpuclk_pdata, |
| 256 | }; |
| 257 | |
Kaushal Kumar | 86473f0 | 2012-06-28 19:35:58 +0530 | [diff] [blame] | 258 | struct platform_device msm8625ab_device_acpuclk = { |
| 259 | .name = "acpuclk-7627", |
| 260 | .id = -1, |
| 261 | .dev.platform_data = &msm8625ab_acpuclk_pdata, |
| 262 | }; |
| 263 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 264 | struct platform_device msm_device_smd = { |
| 265 | .name = "msm_smd", |
| 266 | .id = -1, |
| 267 | }; |
| 268 | |
Angshuman Sarkar | fb1cce9 | 2012-02-21 15:20:43 +0530 | [diff] [blame] | 269 | static struct resource smd_8625_resource[] = { |
| 270 | { |
| 271 | .name = "a9_m2a_0", |
| 272 | .start = MSM8625_INT_A9_M2A_0, |
| 273 | .flags = IORESOURCE_IRQ, |
| 274 | }, |
| 275 | { |
| 276 | .name = "a9_m2a_5", |
| 277 | .start = MSM8625_INT_A9_M2A_5, |
| 278 | .flags = IORESOURCE_IRQ, |
| 279 | }, |
| 280 | }; |
| 281 | |
| 282 | static struct smd_subsystem_config smd_8625_config_list[] = { |
| 283 | { |
| 284 | .irq_config_id = SMD_MODEM, |
| 285 | .subsys_name = "modem", |
| 286 | .edge = SMD_APPS_MODEM, |
| 287 | |
| 288 | .smd_int.irq_name = "a9_m2a_0", |
| 289 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 290 | .smd_int.irq_id = -1, |
| 291 | .smd_int.device_name = "smd_dev", |
| 292 | .smd_int.dev_id = 0, |
| 293 | |
| 294 | .smd_int.out_bit_pos = 1, |
| 295 | .smd_int.out_base = (void __iomem *)MSM_CSR_BASE, |
| 296 | .smd_int.out_offset = 0x400 + (0) * 4, |
| 297 | |
| 298 | .smsm_int.irq_name = "a9_m2a_5", |
| 299 | .smsm_int.flags = IRQF_TRIGGER_RISING, |
| 300 | .smsm_int.irq_id = -1, |
| 301 | .smsm_int.device_name = "smsm_dev", |
| 302 | .smsm_int.dev_id = 0, |
| 303 | |
| 304 | .smsm_int.out_bit_pos = 1, |
| 305 | .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE, |
| 306 | .smsm_int.out_offset = 0x400 + (5) * 4, |
| 307 | |
| 308 | } |
| 309 | }; |
| 310 | |
| 311 | static struct smd_platform smd_8625_platform_data = { |
| 312 | .num_ss_configs = ARRAY_SIZE(smd_8625_config_list), |
| 313 | .smd_ss_configs = smd_8625_config_list, |
| 314 | }; |
| 315 | |
| 316 | struct platform_device msm8625_device_smd = { |
| 317 | .name = "msm_smd", |
| 318 | .id = -1, |
| 319 | .resource = smd_8625_resource, |
| 320 | .num_resources = ARRAY_SIZE(smd_8625_resource), |
| 321 | .dev = { |
| 322 | .platform_data = &smd_8625_platform_data, |
| 323 | } |
| 324 | }; |
| 325 | |
Laxminath Kasam | 5faa1ca | 2012-02-15 12:06:45 +0530 | [diff] [blame] | 326 | static struct resource resources_adsp[] = { |
| 327 | { |
| 328 | .start = INT_ADSP_A9_A11, |
| 329 | .end = INT_ADSP_A9_A11, |
| 330 | .flags = IORESOURCE_IRQ, |
| 331 | }, |
| 332 | }; |
| 333 | |
| 334 | struct platform_device msm_adsp_device = { |
| 335 | .name = "msm_adsp", |
| 336 | .id = -1, |
| 337 | .num_resources = ARRAY_SIZE(resources_adsp), |
| 338 | .resource = resources_adsp, |
| 339 | }; |
| 340 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 341 | static struct resource resources_uart1[] = { |
| 342 | { |
| 343 | .start = INT_UART1, |
| 344 | .end = INT_UART1, |
| 345 | .flags = IORESOURCE_IRQ, |
| 346 | }, |
| 347 | { |
Taniya Das | 13b811a | 2011-12-09 18:33:45 +0530 | [diff] [blame] | 348 | .start = MSM7XXX_UART1_PHYS, |
| 349 | .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 350 | .flags = IORESOURCE_MEM, |
| 351 | }, |
| 352 | }; |
| 353 | |
| 354 | struct platform_device msm_device_uart1 = { |
| 355 | .name = "msm_serial", |
| 356 | .id = 0, |
| 357 | .num_resources = ARRAY_SIZE(resources_uart1), |
| 358 | .resource = resources_uart1, |
| 359 | }; |
| 360 | |
| 361 | #define MSM_UART1DM_PHYS 0xA0200000 |
| 362 | static struct resource msm_uart1_dm_resources[] = { |
| 363 | { |
| 364 | .start = MSM_UART1DM_PHYS, |
| 365 | .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1, |
| 366 | .flags = IORESOURCE_MEM, |
| 367 | }, |
| 368 | { |
| 369 | .start = INT_UART1DM_IRQ, |
| 370 | .end = INT_UART1DM_IRQ, |
| 371 | .flags = IORESOURCE_IRQ, |
| 372 | }, |
| 373 | { |
| 374 | .start = INT_UART1DM_RX, |
| 375 | .end = INT_UART1DM_RX, |
| 376 | .flags = IORESOURCE_IRQ, |
| 377 | }, |
| 378 | { |
| 379 | .start = DMOV_HSUART1_TX_CHAN, |
| 380 | .end = DMOV_HSUART1_RX_CHAN, |
| 381 | .name = "uartdm_channels", |
| 382 | .flags = IORESOURCE_DMA, |
| 383 | }, |
| 384 | { |
| 385 | .start = DMOV_HSUART1_TX_CRCI, |
| 386 | .end = DMOV_HSUART1_RX_CRCI, |
| 387 | .name = "uartdm_crci", |
| 388 | .flags = IORESOURCE_DMA, |
| 389 | }, |
| 390 | }; |
| 391 | |
| 392 | static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32); |
| 393 | struct platform_device msm_device_uart_dm1 = { |
| 394 | .name = "msm_serial_hs", |
| 395 | .id = 0, |
| 396 | .num_resources = ARRAY_SIZE(msm_uart1_dm_resources), |
| 397 | .resource = msm_uart1_dm_resources, |
| 398 | .dev = { |
| 399 | .dma_mask = &msm_uart_dm1_dma_mask, |
| 400 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 401 | }, |
| 402 | }; |
| 403 | |
| 404 | #define MSM_UART2DM_PHYS 0xA0300000 |
| 405 | static struct resource msm_uart2dm_resources[] = { |
| 406 | { |
| 407 | .start = MSM_UART2DM_PHYS, |
| 408 | .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1, |
| 409 | .name = "uartdm_resource", |
| 410 | .flags = IORESOURCE_MEM, |
| 411 | }, |
| 412 | { |
| 413 | .start = INT_UART2DM_IRQ, |
| 414 | .end = INT_UART2DM_IRQ, |
| 415 | .flags = IORESOURCE_IRQ, |
| 416 | }, |
| 417 | }; |
| 418 | |
| 419 | struct platform_device msm_device_uart_dm2 = { |
| 420 | .name = "msm_serial_hsl", |
| 421 | .id = 0, |
| 422 | .num_resources = ARRAY_SIZE(msm_uart2dm_resources), |
| 423 | .resource = msm_uart2dm_resources, |
| 424 | }; |
| 425 | |
| 426 | #define MSM_NAND_PHYS 0xA0A00000 |
| 427 | #define MSM_NANDC01_PHYS 0xA0A40000 |
| 428 | #define MSM_NANDC10_PHYS 0xA0A80000 |
| 429 | #define MSM_NANDC11_PHYS 0xA0AC0000 |
| 430 | #define EBI2_REG_BASE 0xA0D00000 |
| 431 | static struct resource resources_nand[] = { |
| 432 | [0] = { |
| 433 | .name = "msm_nand_dmac", |
| 434 | .start = DMOV_NAND_CHAN, |
| 435 | .end = DMOV_NAND_CHAN, |
| 436 | .flags = IORESOURCE_DMA, |
| 437 | }, |
| 438 | [1] = { |
| 439 | .name = "msm_nand_phys", |
| 440 | .start = MSM_NAND_PHYS, |
| 441 | .end = MSM_NAND_PHYS + 0x7FF, |
| 442 | .flags = IORESOURCE_MEM, |
| 443 | }, |
| 444 | [2] = { |
| 445 | .name = "msm_nandc01_phys", |
| 446 | .start = MSM_NANDC01_PHYS, |
| 447 | .end = MSM_NANDC01_PHYS + 0x7FF, |
| 448 | .flags = IORESOURCE_MEM, |
| 449 | }, |
| 450 | [3] = { |
| 451 | .name = "msm_nandc10_phys", |
| 452 | .start = MSM_NANDC10_PHYS, |
| 453 | .end = MSM_NANDC10_PHYS + 0x7FF, |
| 454 | .flags = IORESOURCE_MEM, |
| 455 | }, |
| 456 | [4] = { |
| 457 | .name = "msm_nandc11_phys", |
| 458 | .start = MSM_NANDC11_PHYS, |
| 459 | .end = MSM_NANDC11_PHYS + 0x7FF, |
| 460 | .flags = IORESOURCE_MEM, |
| 461 | }, |
| 462 | [5] = { |
| 463 | .name = "ebi2_reg_base", |
| 464 | .start = EBI2_REG_BASE, |
| 465 | .end = EBI2_REG_BASE + 0x60, |
| 466 | .flags = IORESOURCE_MEM, |
| 467 | }, |
| 468 | }; |
| 469 | |
Sujit Reddy Thumma | ec9b325 | 2012-04-23 15:53:45 +0530 | [diff] [blame] | 470 | struct flash_platform_data msm_nand_data = { |
| 471 | .version = VERSION_2, |
| 472 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 473 | |
| 474 | struct platform_device msm_device_nand = { |
| 475 | .name = "msm_nand", |
| 476 | .id = -1, |
| 477 | .num_resources = ARRAY_SIZE(resources_nand), |
| 478 | .resource = resources_nand, |
| 479 | .dev = { |
| 480 | .platform_data = &msm_nand_data, |
| 481 | }, |
| 482 | }; |
| 483 | |
Murali Nalajala | 2a0bbda | 2012-03-28 12:12:54 +0530 | [diff] [blame] | 484 | static struct msm_pm_irq_calls msm7x27a_pm_irq_calls = { |
| 485 | .irq_pending = msm_irq_pending, |
| 486 | .idle_sleep_allowed = msm_irq_idle_sleep_allowed, |
| 487 | .enter_sleep1 = msm_irq_enter_sleep1, |
| 488 | .enter_sleep2 = msm_irq_enter_sleep2, |
| 489 | .exit_sleep1 = msm_irq_exit_sleep1, |
| 490 | .exit_sleep2 = msm_irq_exit_sleep2, |
| 491 | .exit_sleep3 = msm_irq_exit_sleep3, |
| 492 | }; |
| 493 | |
| 494 | static struct msm_pm_irq_calls msm8625_pm_irq_calls = { |
| 495 | .irq_pending = msm_gic_spi_ppi_pending, |
| 496 | .idle_sleep_allowed = msm_gic_irq_idle_sleep_allowed, |
| 497 | .enter_sleep1 = msm_gic_irq_enter_sleep1, |
| 498 | .enter_sleep2 = msm_gic_irq_enter_sleep2, |
| 499 | .exit_sleep1 = msm_gic_irq_exit_sleep1, |
| 500 | .exit_sleep2 = msm_gic_irq_exit_sleep2, |
| 501 | .exit_sleep3 = msm_gic_irq_exit_sleep3, |
| 502 | }; |
| 503 | |
Stephen Boyd | 986c963 | 2012-04-24 16:31:45 -0700 | [diff] [blame] | 504 | void __init msm_pm_register_irqs(void) |
Murali Nalajala | 2a0bbda | 2012-03-28 12:12:54 +0530 | [diff] [blame] | 505 | { |
| 506 | if (cpu_is_msm8625()) |
| 507 | msm_pm_set_irq_extns(&msm8625_pm_irq_calls); |
| 508 | else |
| 509 | msm_pm_set_irq_extns(&msm7x27a_pm_irq_calls); |
| 510 | |
| 511 | } |
| 512 | |
Murali Nalajala | ff723ec | 2012-07-13 16:54:40 +0530 | [diff] [blame] | 513 | static struct msm_pm_cpr_ops msm8625_pm_cpr_ops = { |
| 514 | .cpr_suspend = msm_cpr_pm_suspend, |
| 515 | .cpr_resume = msm_cpr_pm_resume, |
| 516 | }; |
| 517 | |
| 518 | void __init msm_pm_register_cpr_ops(void) |
| 519 | { |
| 520 | /* CPR presents on revision >= v2.0 chipsets */ |
| 521 | if (cpu_is_msm8625() && |
| 522 | SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2) |
| 523 | msm_pm_set_cpr_ops(&msm8625_pm_cpr_ops); |
| 524 | } |
| 525 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 526 | #define MSM_SDC1_BASE 0xA0400000 |
| 527 | #define MSM_SDC2_BASE 0xA0500000 |
| 528 | #define MSM_SDC3_BASE 0xA0600000 |
| 529 | #define MSM_SDC4_BASE 0xA0700000 |
| 530 | static struct resource resources_sdc1[] = { |
| 531 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 532 | .name = "core_mem", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 533 | .start = MSM_SDC1_BASE, |
| 534 | .end = MSM_SDC1_BASE + SZ_4K - 1, |
| 535 | .flags = IORESOURCE_MEM, |
| 536 | }, |
| 537 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 538 | .name = "core_irq", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 539 | .start = INT_SDC1_0, |
| 540 | .end = INT_SDC1_1, |
| 541 | .flags = IORESOURCE_IRQ, |
| 542 | }, |
| 543 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 544 | .name = "dma_chnl", |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 545 | .start = DMOV_SDC1_CHAN, |
| 546 | .end = DMOV_SDC1_CHAN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 547 | .flags = IORESOURCE_DMA, |
| 548 | }, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 549 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 550 | .name = "dma_crci", |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 551 | .start = DMOV_SDC1_CRCI, |
| 552 | .end = DMOV_SDC1_CRCI, |
| 553 | .flags = IORESOURCE_DMA, |
| 554 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 555 | }; |
| 556 | |
| 557 | static struct resource resources_sdc2[] = { |
| 558 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 559 | .name = "core_mem", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 560 | .start = MSM_SDC2_BASE, |
| 561 | .end = MSM_SDC2_BASE + SZ_4K - 1, |
| 562 | .flags = IORESOURCE_MEM, |
| 563 | }, |
| 564 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 565 | .name = "core_irq", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 566 | .start = INT_SDC2_0, |
| 567 | .end = INT_SDC2_1, |
| 568 | .flags = IORESOURCE_IRQ, |
| 569 | }, |
| 570 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 571 | .name = "dma_chnl", |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 572 | .start = DMOV_SDC2_CHAN, |
| 573 | .end = DMOV_SDC2_CHAN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 574 | .flags = IORESOURCE_DMA, |
| 575 | }, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 576 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 577 | .name = "dma_crci", |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 578 | .start = DMOV_SDC2_CRCI, |
| 579 | .end = DMOV_SDC2_CRCI, |
| 580 | .flags = IORESOURCE_DMA, |
| 581 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 582 | }; |
| 583 | |
| 584 | static struct resource resources_sdc3[] = { |
| 585 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 586 | .name = "core_mem", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 587 | .start = MSM_SDC3_BASE, |
| 588 | .end = MSM_SDC3_BASE + SZ_4K - 1, |
| 589 | .flags = IORESOURCE_MEM, |
| 590 | }, |
| 591 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 592 | .name = "core_irq", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 593 | .start = INT_SDC3_0, |
| 594 | .end = INT_SDC3_1, |
| 595 | .flags = IORESOURCE_IRQ, |
| 596 | }, |
| 597 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 598 | .name = "dma_chnl", |
Subhash Jadavani | f29aefd | 2012-06-21 00:43:15 +0530 | [diff] [blame] | 599 | .start = DMOV_NAND_CHAN, |
| 600 | .end = DMOV_NAND_CHAN, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 601 | .flags = IORESOURCE_DMA, |
| 602 | }, |
| 603 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 604 | .name = "dma_crci", |
Sujit Reddy Thumma | 119bfbb | 2011-10-12 11:52:21 +0530 | [diff] [blame] | 605 | .start = DMOV_SDC3_CRCI, |
| 606 | .end = DMOV_SDC3_CRCI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 607 | .flags = IORESOURCE_DMA, |
| 608 | }, |
| 609 | }; |
| 610 | |
| 611 | static struct resource resources_sdc4[] = { |
| 612 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 613 | .name = "core_mem", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 614 | .start = MSM_SDC4_BASE, |
| 615 | .end = MSM_SDC4_BASE + SZ_4K - 1, |
| 616 | .flags = IORESOURCE_MEM, |
| 617 | }, |
| 618 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 619 | .name = "core_irq", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 620 | .start = INT_SDC4_0, |
| 621 | .end = INT_SDC4_1, |
| 622 | .flags = IORESOURCE_IRQ, |
| 623 | }, |
| 624 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 625 | .name = "dma_chnl", |
Sujit Reddy Thumma | 119bfbb | 2011-10-12 11:52:21 +0530 | [diff] [blame] | 626 | .start = DMOV_SDC4_CHAN, |
| 627 | .end = DMOV_SDC4_CHAN, |
Krishna Konda | 25786ec | 2011-07-25 16:21:36 -0700 | [diff] [blame] | 628 | .flags = IORESOURCE_DMA, |
| 629 | }, |
| 630 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 631 | .name = "dma_crci", |
Sujit Reddy Thumma | 119bfbb | 2011-10-12 11:52:21 +0530 | [diff] [blame] | 632 | .start = DMOV_SDC4_CRCI, |
| 633 | .end = DMOV_SDC4_CRCI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 634 | .flags = IORESOURCE_DMA, |
| 635 | }, |
| 636 | }; |
| 637 | |
| 638 | struct platform_device msm_device_sdc1 = { |
| 639 | .name = "msm_sdcc", |
| 640 | .id = 1, |
| 641 | .num_resources = ARRAY_SIZE(resources_sdc1), |
| 642 | .resource = resources_sdc1, |
| 643 | .dev = { |
| 644 | .coherent_dma_mask = 0xffffffff, |
| 645 | }, |
| 646 | }; |
| 647 | |
| 648 | struct platform_device msm_device_sdc2 = { |
| 649 | .name = "msm_sdcc", |
| 650 | .id = 2, |
| 651 | .num_resources = ARRAY_SIZE(resources_sdc2), |
| 652 | .resource = resources_sdc2, |
| 653 | .dev = { |
| 654 | .coherent_dma_mask = 0xffffffff, |
| 655 | }, |
| 656 | }; |
| 657 | |
| 658 | struct platform_device msm_device_sdc3 = { |
| 659 | .name = "msm_sdcc", |
| 660 | .id = 3, |
| 661 | .num_resources = ARRAY_SIZE(resources_sdc3), |
| 662 | .resource = resources_sdc3, |
| 663 | .dev = { |
| 664 | .coherent_dma_mask = 0xffffffff, |
| 665 | }, |
| 666 | }; |
| 667 | |
| 668 | struct platform_device msm_device_sdc4 = { |
| 669 | .name = "msm_sdcc", |
| 670 | .id = 4, |
| 671 | .num_resources = ARRAY_SIZE(resources_sdc4), |
| 672 | .resource = resources_sdc4, |
| 673 | .dev = { |
| 674 | .coherent_dma_mask = 0xffffffff, |
| 675 | }, |
| 676 | }; |
| 677 | |
| 678 | static struct platform_device *msm_sdcc_devices[] __initdata = { |
| 679 | &msm_device_sdc1, |
| 680 | &msm_device_sdc2, |
| 681 | &msm_device_sdc3, |
| 682 | &msm_device_sdc4, |
| 683 | }; |
| 684 | |
Suresh Vankadara | 20cd3be7 | 2012-01-18 00:34:06 +0530 | [diff] [blame] | 685 | #ifdef CONFIG_MSM_CAMERA_V4L2 |
Suresh Vankadara | 6050cef5 | 2012-04-16 21:44:59 +0530 | [diff] [blame] | 686 | static int apps_reset; |
Suresh Vankadara | 20cd3be7 | 2012-01-18 00:34:06 +0530 | [diff] [blame] | 687 | static struct resource msm_csic0_resources[] = { |
| 688 | { |
| 689 | .name = "csic", |
| 690 | .start = 0xA0F00000, |
| 691 | .end = 0xA0F00000 + 0x00100000 - 1, |
| 692 | .flags = IORESOURCE_MEM, |
| 693 | }, |
| 694 | { |
| 695 | .name = "csic", |
| 696 | .start = INT_CSI_IRQ_0, |
| 697 | .end = INT_CSI_IRQ_0, |
| 698 | .flags = IORESOURCE_IRQ, |
| 699 | }, |
| 700 | }; |
| 701 | |
| 702 | static struct resource msm_csic1_resources[] = { |
| 703 | { |
| 704 | .name = "csic", |
| 705 | .start = 0xA1000000, |
| 706 | .end = 0xA1000000 + 0x00100000 - 1, |
| 707 | .flags = IORESOURCE_MEM, |
| 708 | }, |
| 709 | { |
| 710 | .name = "csic", |
| 711 | .start = INT_CSI_IRQ_1, |
| 712 | .end = INT_CSI_IRQ_1, |
| 713 | .flags = IORESOURCE_IRQ, |
| 714 | }, |
| 715 | }; |
| 716 | |
| 717 | struct platform_device msm7x27a_device_csic0 = { |
| 718 | .name = "msm_csic", |
| 719 | .id = 0, |
| 720 | .resource = msm_csic0_resources, |
| 721 | .num_resources = ARRAY_SIZE(msm_csic0_resources), |
| 722 | }; |
| 723 | |
| 724 | struct platform_device msm7x27a_device_csic1 = { |
| 725 | .name = "msm_csic", |
| 726 | .id = 1, |
| 727 | .resource = msm_csic1_resources, |
| 728 | .num_resources = ARRAY_SIZE(msm_csic1_resources), |
| 729 | }; |
| 730 | |
| 731 | static struct resource msm_clkctl_resources[] = { |
| 732 | { |
| 733 | .name = "clk_ctl", |
Taniya Das | 13b811a | 2011-12-09 18:33:45 +0530 | [diff] [blame] | 734 | .start = MSM7XXX_CLK_CTL_PHYS, |
| 735 | .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1, |
Suresh Vankadara | 20cd3be7 | 2012-01-18 00:34:06 +0530 | [diff] [blame] | 736 | .flags = IORESOURCE_MEM, |
| 737 | }, |
| 738 | }; |
| 739 | struct platform_device msm7x27a_device_clkctl = { |
| 740 | .name = "msm_clk_ctl", |
| 741 | .id = 0, |
| 742 | .resource = msm_clkctl_resources, |
| 743 | .num_resources = ARRAY_SIZE(msm_clkctl_resources), |
Suresh Vankadara | 6050cef5 | 2012-04-16 21:44:59 +0530 | [diff] [blame] | 744 | .dev = { |
| 745 | .platform_data = &apps_reset, |
| 746 | }, |
Suresh Vankadara | 20cd3be7 | 2012-01-18 00:34:06 +0530 | [diff] [blame] | 747 | }; |
| 748 | |
| 749 | struct platform_device msm7x27a_device_vfe = { |
| 750 | .name = "msm_vfe", |
| 751 | .id = 0, |
| 752 | }; |
| 753 | |
| 754 | #endif |
| 755 | |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 756 | /* Command sequence for simple WFI */ |
| 757 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
Murali Nalajala | 2250a27 | 2012-03-13 15:56:59 +0530 | [diff] [blame] | 758 | 0x04, 0x03, 0x04, 0x0f, |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 759 | }; |
| 760 | |
| 761 | /* Command sequence for GDFS, this won't send any interrupt to the modem */ |
| 762 | static uint8_t spm_pc_without_modem[] __initdata = { |
| 763 | 0x20, 0x00, 0x30, 0x10, |
Murali Nalajala | 2250a27 | 2012-03-13 15:56:59 +0530 | [diff] [blame] | 764 | 0x03, 0x1e, 0x0e, 0x3e, |
| 765 | 0x4e, 0x4e, 0x4e, 0x4e, |
| 766 | 0x4e, 0x4e, 0x4e, 0x4e, |
| 767 | 0x4e, 0x4e, 0x4e, 0x4e, |
| 768 | 0x4e, 0x4e, 0x4e, 0x4e, |
| 769 | 0x2E, 0x0f, |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 770 | }; |
| 771 | |
| 772 | static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { |
| 773 | [0] = { |
| 774 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 775 | .notify_rpm = false, |
| 776 | .cmd = spm_wfi_cmd_sequence, |
| 777 | }, |
| 778 | [1] = { |
| 779 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 780 | .notify_rpm = false, |
| 781 | .cmd = spm_pc_without_modem, |
| 782 | }, |
Murali Nalajala | f194f68 | 2012-10-19 20:10:07 +0530 | [diff] [blame] | 783 | [2] = { |
| 784 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 785 | .notify_rpm = false, |
| 786 | .cmd = spm_pc_without_modem, |
| 787 | }, |
| 788 | [3] = { |
| 789 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 790 | .notify_rpm = false, |
| 791 | .cmd = spm_pc_without_modem, |
| 792 | }, |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 793 | }; |
| 794 | |
| 795 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 796 | [0] = { |
| 797 | .reg_base_addr = MSM_SAW0_BASE, |
| 798 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0, |
| 799 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 800 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 801 | .modes = msm_spm_seq_list, |
| 802 | }, |
| 803 | [1] = { |
| 804 | .reg_base_addr = MSM_SAW1_BASE, |
| 805 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0, |
| 806 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 807 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 808 | .modes = msm_spm_seq_list, |
| 809 | }, |
Murali Nalajala | f194f68 | 2012-10-19 20:10:07 +0530 | [diff] [blame] | 810 | [2] = { |
| 811 | .reg_base_addr = MSM_SAW2_BASE, |
| 812 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0, |
| 813 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 814 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 815 | .modes = msm_spm_seq_list, |
| 816 | }, |
| 817 | [3] = { |
| 818 | .reg_base_addr = MSM_SAW3_BASE, |
| 819 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0, |
| 820 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 821 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 822 | .modes = msm_spm_seq_list, |
| 823 | }, |
Murali Nalajala | 41786ab | 2012-03-06 10:47:32 +0530 | [diff] [blame] | 824 | }; |
| 825 | |
| 826 | void __init msm8x25_spm_device_init(void) |
| 827 | { |
| 828 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 829 | } |
| 830 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 831 | #define MDP_BASE 0xAA200000 |
| 832 | #define MIPI_DSI_HW_BASE 0xA1100000 |
| 833 | |
| 834 | static struct resource msm_mipi_dsi_resources[] = { |
| 835 | { |
| 836 | .name = "mipi_dsi", |
| 837 | .start = MIPI_DSI_HW_BASE, |
| 838 | .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1, |
| 839 | .flags = IORESOURCE_MEM, |
| 840 | }, |
| 841 | { |
| 842 | .start = INT_DSI_IRQ, |
| 843 | .end = INT_DSI_IRQ, |
| 844 | .flags = IORESOURCE_IRQ, |
| 845 | }, |
| 846 | }; |
| 847 | |
| 848 | static struct platform_device msm_mipi_dsi_device = { |
| 849 | .name = "mipi_dsi", |
| 850 | .id = 1, |
| 851 | .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources), |
| 852 | .resource = msm_mipi_dsi_resources, |
| 853 | }; |
| 854 | |
| 855 | static struct resource msm_mdp_resources[] = { |
| 856 | { |
| 857 | .name = "mdp", |
| 858 | .start = MDP_BASE, |
| 859 | .end = MDP_BASE + 0x000F1008 - 1, |
| 860 | .flags = IORESOURCE_MEM, |
| 861 | }, |
| 862 | { |
| 863 | .start = INT_MDP, |
| 864 | .end = INT_MDP, |
| 865 | .flags = IORESOURCE_IRQ, |
| 866 | }, |
| 867 | }; |
| 868 | |
| 869 | static struct platform_device msm_mdp_device = { |
| 870 | .name = "mdp", |
| 871 | .id = 0, |
| 872 | .num_resources = ARRAY_SIZE(msm_mdp_resources), |
| 873 | .resource = msm_mdp_resources, |
| 874 | }; |
| 875 | |
Padmanabhan Komanduru | e77bcf5 | 2012-07-26 12:43:39 +0530 | [diff] [blame] | 876 | struct platform_device msm_lcdc_device = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 877 | .name = "lcdc", |
| 878 | .id = 0, |
| 879 | }; |
| 880 | |
| 881 | static struct resource kgsl_3d0_resources[] = { |
| 882 | { |
| 883 | .name = KGSL_3D0_REG_MEMORY, |
| 884 | .start = 0xA0000000, |
| 885 | .end = 0xA001ffff, |
| 886 | .flags = IORESOURCE_MEM, |
| 887 | }, |
| 888 | { |
| 889 | .name = KGSL_3D0_IRQ, |
| 890 | .start = INT_GRAPHICS, |
| 891 | .end = INT_GRAPHICS, |
| 892 | .flags = IORESOURCE_IRQ, |
| 893 | }, |
| 894 | }; |
| 895 | |
| 896 | static struct kgsl_device_platform_data kgsl_3d0_pdata = { |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 897 | .pwrlevel = { |
| 898 | { |
| 899 | .gpu_freq = 245760000, |
| 900 | .bus_freq = 200000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 901 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 902 | { |
Lynus Vaz | eaf0aac | 2012-01-05 12:28:47 +0530 | [diff] [blame] | 903 | .gpu_freq = 192000000, |
| 904 | .bus_freq = 160000000, |
| 905 | }, |
| 906 | { |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 907 | .gpu_freq = 133330000, |
| 908 | .bus_freq = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 909 | }, |
| 910 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 911 | .init_level = 0, |
Lynus Vaz | eaf0aac | 2012-01-05 12:28:47 +0530 | [diff] [blame] | 912 | .num_levels = 3, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 913 | .set_grp_async = set_grp_xbar_async, |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 914 | .idle_timeout = HZ, |
Lynus Vaz | fe4bede | 2012-04-06 11:53:30 -0700 | [diff] [blame] | 915 | .strtstp_sleepwake = true, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 916 | .nap_allowed = false, |
| 917 | .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 918 | }; |
| 919 | |
| 920 | struct platform_device msm_kgsl_3d0 = { |
| 921 | .name = "kgsl-3d0", |
| 922 | .id = 0, |
| 923 | .num_resources = ARRAY_SIZE(kgsl_3d0_resources), |
| 924 | .resource = kgsl_3d0_resources, |
| 925 | .dev = { |
| 926 | .platform_data = &kgsl_3d0_pdata, |
| 927 | }, |
| 928 | }; |
| 929 | |
| 930 | void __init msm7x25a_kgsl_3d0_init(void) |
| 931 | { |
Pankaj Kumar | fee56a8 | 2012-04-17 14:26:49 +0530 | [diff] [blame] | 932 | if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) { |
Lynus Vaz | 971610e | 2012-01-06 11:00:32 +0530 | [diff] [blame] | 933 | kgsl_3d0_pdata.num_levels = 2; |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 934 | kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000; |
| 935 | kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000; |
| 936 | kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000; |
| 937 | kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0; |
Rajesh Kemisetti | df6e62f | 2012-03-12 14:02:30 +0530 | [diff] [blame] | 938 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 939 | } |
| 940 | |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 941 | void __init msm8x25_kgsl_3d0_init(void) |
| 942 | { |
Lynus Vaz | fe4bede | 2012-04-06 11:53:30 -0700 | [diff] [blame] | 943 | if (cpu_is_msm8625()) { |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 944 | kgsl_3d0_pdata.idle_timeout = HZ/5; |
Lynus Vaz | fe4bede | 2012-04-06 11:53:30 -0700 | [diff] [blame] | 945 | kgsl_3d0_pdata.strtstp_sleepwake = false; |
Ranjhith Kalisamy | 5fb30ef | 2012-08-12 16:26:36 +0530 | [diff] [blame] | 946 | |
| 947 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2) |
| 948 | /* 8x25 v2.0 & above supports a higher GPU frequency */ |
| 949 | kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000; |
| 950 | else |
| 951 | kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 300000000; |
| 952 | |
Ranjhith Kalisamy | 2469632 | 2012-04-11 22:09:17 +0530 | [diff] [blame] | 953 | kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000; |
Lynus Vaz | fe4bede | 2012-04-06 11:53:30 -0700 | [diff] [blame] | 954 | } |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 955 | } |
| 956 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 957 | static void __init msm_register_device(struct platform_device *pdev, void *data) |
| 958 | { |
| 959 | int ret; |
| 960 | |
| 961 | pdev->dev.platform_data = data; |
| 962 | |
| 963 | ret = platform_device_register(pdev); |
| 964 | |
| 965 | if (ret) |
| 966 | dev_err(&pdev->dev, |
| 967 | "%s: platform_device_register() failed = %d\n", |
| 968 | __func__, ret); |
| 969 | } |
| 970 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 971 | |
| 972 | #define PERPH_WEB_BLOCK_ADDR (0xA9D00040) |
| 973 | #define PDM0_CTL_OFFSET (0x04) |
| 974 | #define SIZE_8B (0x08) |
| 975 | |
| 976 | static struct resource resources_led[] = { |
| 977 | { |
| 978 | .start = PERPH_WEB_BLOCK_ADDR, |
| 979 | .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1, |
| 980 | .name = "led-gpio-pdm", |
| 981 | .flags = IORESOURCE_MEM, |
| 982 | }, |
| 983 | }; |
| 984 | |
| 985 | static struct led_info msm_kpbl_pdm_led_pdata = { |
| 986 | .name = "keyboard-backlight", |
| 987 | }; |
| 988 | |
| 989 | struct platform_device led_pdev = { |
| 990 | .name = "leds-msm-pdm", |
| 991 | /* use pdev id to represent pdm id */ |
| 992 | .id = 0, |
| 993 | .num_resources = ARRAY_SIZE(resources_led), |
| 994 | .resource = resources_led, |
| 995 | .dev = { |
| 996 | .platform_data = &msm_kpbl_pdm_led_pdata, |
| 997 | }, |
| 998 | }; |
| 999 | |
Manish Dewangan | 3a26099 | 2011-06-24 18:01:34 +0530 | [diff] [blame] | 1000 | struct platform_device asoc_msm_pcm = { |
| 1001 | .name = "msm-dsp-audio", |
| 1002 | .id = 0, |
| 1003 | }; |
| 1004 | |
| 1005 | struct platform_device asoc_msm_dai0 = { |
| 1006 | .name = "msm-codec-dai", |
| 1007 | .id = 0, |
| 1008 | }; |
| 1009 | |
| 1010 | struct platform_device asoc_msm_dai1 = { |
| 1011 | .name = "msm-cpu-dai", |
| 1012 | .id = 0, |
| 1013 | }; |
| 1014 | |
Taniya Das | 2e94819 | 2011-12-20 11:15:13 +0530 | [diff] [blame] | 1015 | static struct resource gpio_resources[] = { |
| 1016 | { |
| 1017 | .start = INT_GPIO_GROUP1, |
| 1018 | .flags = IORESOURCE_IRQ, |
| 1019 | }, |
| 1020 | { |
| 1021 | .start = INT_GPIO_GROUP2, |
| 1022 | .flags = IORESOURCE_IRQ, |
| 1023 | }, |
| 1024 | }; |
| 1025 | |
| 1026 | static struct platform_device msm_device_gpio = { |
| 1027 | .name = "msmgpio", |
| 1028 | .id = -1, |
| 1029 | .resource = gpio_resources, |
| 1030 | .num_resources = ARRAY_SIZE(gpio_resources), |
| 1031 | }; |
| 1032 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1033 | struct platform_device *msm_footswitch_devices[] = { |
Matt Wagantall | d6fbf23 | 2012-05-03 20:09:28 -0700 | [diff] [blame] | 1034 | FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"), |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1035 | }; |
| 1036 | unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices); |
| 1037 | |
| 1038 | /* MSM8625 Devices */ |
| 1039 | |
| 1040 | static struct resource msm8625_resources_uart1[] = { |
| 1041 | { |
| 1042 | .start = MSM8625_INT_UART1, |
| 1043 | .end = MSM8625_INT_UART1, |
| 1044 | .flags = IORESOURCE_IRQ, |
| 1045 | }, |
| 1046 | { |
Taniya Das | 13b811a | 2011-12-09 18:33:45 +0530 | [diff] [blame] | 1047 | .start = MSM7XXX_UART1_PHYS, |
| 1048 | .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1, |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1049 | .flags = IORESOURCE_MEM, |
| 1050 | }, |
| 1051 | }; |
| 1052 | |
| 1053 | struct platform_device msm8625_device_uart1 = { |
| 1054 | .name = "msm_serial", |
| 1055 | .id = 0, |
| 1056 | .num_resources = ARRAY_SIZE(msm8625_resources_uart1), |
| 1057 | .resource = msm8625_resources_uart1, |
| 1058 | }; |
| 1059 | |
Trilok Soni | 269fff4 | 2012-02-13 20:35:30 +0530 | [diff] [blame] | 1060 | static struct resource msm8625_uart1_dm_resources[] = { |
| 1061 | { |
| 1062 | .start = MSM_UART1DM_PHYS, |
| 1063 | .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1, |
| 1064 | .flags = IORESOURCE_MEM, |
| 1065 | }, |
| 1066 | { |
| 1067 | .start = MSM8625_INT_UART1DM_IRQ, |
| 1068 | .end = MSM8625_INT_UART1DM_IRQ, |
| 1069 | .flags = IORESOURCE_IRQ, |
| 1070 | }, |
| 1071 | { |
| 1072 | .start = MSM8625_INT_UART1DM_RX, |
| 1073 | .end = MSM8625_INT_UART1DM_RX, |
| 1074 | .flags = IORESOURCE_IRQ, |
| 1075 | }, |
| 1076 | { |
| 1077 | .start = DMOV_HSUART1_TX_CHAN, |
| 1078 | .end = DMOV_HSUART1_RX_CHAN, |
| 1079 | .name = "uartdm_channels", |
| 1080 | .flags = IORESOURCE_DMA, |
| 1081 | }, |
| 1082 | { |
| 1083 | .start = DMOV_HSUART1_TX_CRCI, |
| 1084 | .end = DMOV_HSUART1_RX_CRCI, |
| 1085 | .name = "uartdm_crci", |
| 1086 | .flags = IORESOURCE_DMA, |
| 1087 | }, |
| 1088 | }; |
| 1089 | |
| 1090 | struct platform_device msm8625_device_uart_dm1 = { |
| 1091 | .name = "msm_serial_hs", |
| 1092 | .id = 0, |
| 1093 | .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources), |
| 1094 | .resource = msm8625_uart1_dm_resources, |
| 1095 | .dev = { |
| 1096 | .dma_mask = &msm_uart_dm1_dma_mask, |
| 1097 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1098 | }, |
| 1099 | }; |
| 1100 | |
| 1101 | static struct resource msm8625_uart2dm_resources[] = { |
| 1102 | { |
| 1103 | .start = MSM_UART2DM_PHYS, |
| 1104 | .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1, |
| 1105 | .name = "uartdm_resource", |
| 1106 | .flags = IORESOURCE_MEM, |
| 1107 | }, |
| 1108 | { |
| 1109 | .start = MSM8625_INT_UART2DM_IRQ, |
| 1110 | .end = MSM8625_INT_UART2DM_IRQ, |
| 1111 | .flags = IORESOURCE_IRQ, |
| 1112 | }, |
| 1113 | }; |
| 1114 | |
| 1115 | struct platform_device msm8625_device_uart_dm2 = { |
| 1116 | .name = "msm_serial_hsl", |
| 1117 | .id = 0, |
| 1118 | .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources), |
| 1119 | .resource = msm8625_uart2dm_resources, |
| 1120 | }; |
| 1121 | |
Laxminath Kasam | 5faa1ca | 2012-02-15 12:06:45 +0530 | [diff] [blame] | 1122 | static struct resource msm8625_resources_adsp[] = { |
| 1123 | { |
| 1124 | .start = MSM8625_INT_ADSP_A9_A11, |
| 1125 | .end = MSM8625_INT_ADSP_A9_A11, |
| 1126 | .flags = IORESOURCE_IRQ, |
| 1127 | }, |
| 1128 | }; |
| 1129 | |
| 1130 | struct platform_device msm8625_device_adsp = { |
| 1131 | .name = "msm_adsp", |
| 1132 | .id = -1, |
| 1133 | .num_resources = ARRAY_SIZE(msm8625_resources_adsp), |
| 1134 | .resource = msm8625_resources_adsp, |
| 1135 | }; |
| 1136 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1137 | static struct resource msm8625_dmov_resource[] = { |
| 1138 | { |
| 1139 | .start = MSM8625_INT_ADM_AARM, |
| 1140 | .flags = IORESOURCE_IRQ, |
| 1141 | }, |
| 1142 | { |
| 1143 | .start = 0xA9700000, |
| 1144 | .end = 0xA9700000 + SZ_4K - 1, |
| 1145 | .flags = IORESOURCE_MEM, |
| 1146 | }, |
| 1147 | }; |
| 1148 | |
| 1149 | struct platform_device msm8625_device_dmov = { |
| 1150 | .name = "msm_dmov", |
| 1151 | .id = -1, |
| 1152 | .resource = msm8625_dmov_resource, |
| 1153 | .num_resources = ARRAY_SIZE(msm8625_dmov_resource), |
| 1154 | .dev = { |
| 1155 | .platform_data = &msm_dmov_pdata, |
| 1156 | }, |
| 1157 | }; |
Taniya Das | 2e94819 | 2011-12-20 11:15:13 +0530 | [diff] [blame] | 1158 | |
Taniya Das | 9d18714 | 2011-12-02 15:53:25 +0530 | [diff] [blame] | 1159 | static struct resource gsbi0_msm8625_qup_resources[] = { |
| 1160 | { |
| 1161 | .name = "qup_phys_addr", |
| 1162 | .start = MSM_GSBI0_QUP_PHYS, |
| 1163 | .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1, |
| 1164 | .flags = IORESOURCE_MEM, |
| 1165 | }, |
| 1166 | { |
| 1167 | .name = "gsbi_qup_i2c_addr", |
| 1168 | .start = MSM_GSBI0_PHYS, |
| 1169 | .end = MSM_GSBI0_PHYS + SZ_4K - 1, |
| 1170 | .flags = IORESOURCE_MEM, |
| 1171 | }, |
| 1172 | { |
| 1173 | .name = "qup_err_intr", |
| 1174 | .start = MSM8625_INT_PWB_I2C, |
| 1175 | .end = MSM8625_INT_PWB_I2C, |
| 1176 | .flags = IORESOURCE_IRQ, |
| 1177 | }, |
| 1178 | }; |
| 1179 | |
| 1180 | /* Use GSBI0 QUP for /dev/i2c-0 */ |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1181 | struct platform_device msm8625_gsbi0_qup_i2c_device = { |
Taniya Das | 9d18714 | 2011-12-02 15:53:25 +0530 | [diff] [blame] | 1182 | .name = "qup_i2c", |
| 1183 | .id = MSM_GSBI0_QUP_I2C_BUS_ID, |
| 1184 | .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources), |
| 1185 | .resource = gsbi0_msm8625_qup_resources, |
| 1186 | }; |
| 1187 | |
Trilok Soni | 633e59c | 2012-02-13 20:28:30 +0530 | [diff] [blame] | 1188 | static struct resource gsbi1_msm8625_qup_i2c_resources[] = { |
| 1189 | { |
| 1190 | .name = "qup_phys_addr", |
| 1191 | .start = MSM_GSBI1_QUP_PHYS, |
| 1192 | .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1, |
| 1193 | .flags = IORESOURCE_MEM, |
| 1194 | }, |
| 1195 | { |
| 1196 | .name = "gsbi_qup_i2c_addr", |
| 1197 | .start = MSM_GSBI1_PHYS, |
| 1198 | .end = MSM_GSBI1_PHYS + SZ_4K - 1, |
| 1199 | .flags = IORESOURCE_MEM, |
| 1200 | }, |
| 1201 | { |
| 1202 | .name = "qup_err_intr", |
| 1203 | .start = MSM8625_INT_ARM11_DMA, |
| 1204 | .end = MSM8625_INT_ARM11_DMA, |
| 1205 | .flags = IORESOURCE_IRQ, |
| 1206 | }, |
| 1207 | }; |
| 1208 | |
| 1209 | /* Use GSBI1 QUP for /dev/i2c-1 */ |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1210 | struct platform_device msm8625_gsbi1_qup_i2c_device = { |
Trilok Soni | 633e59c | 2012-02-13 20:28:30 +0530 | [diff] [blame] | 1211 | .name = "qup_i2c", |
| 1212 | .id = MSM_GSBI1_QUP_I2C_BUS_ID, |
| 1213 | .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources), |
| 1214 | .resource = gsbi1_msm8625_qup_i2c_resources, |
| 1215 | }; |
| 1216 | |
Taniya Das | 6684d62 | 2012-01-12 10:29:09 +0530 | [diff] [blame] | 1217 | static struct resource msm8625_gpio_resources[] = { |
| 1218 | { |
| 1219 | .start = MSM8625_INT_GPIO_GROUP1, |
| 1220 | .flags = IORESOURCE_IRQ, |
| 1221 | }, |
| 1222 | { |
| 1223 | .start = MSM8625_INT_GPIO_GROUP2, |
| 1224 | .flags = IORESOURCE_IRQ, |
| 1225 | }, |
| 1226 | }; |
| 1227 | |
| 1228 | static struct platform_device msm8625_device_gpio = { |
| 1229 | .name = "msmgpio", |
| 1230 | .id = -1, |
| 1231 | .resource = msm8625_gpio_resources, |
| 1232 | .num_resources = ARRAY_SIZE(msm8625_gpio_resources), |
| 1233 | }; |
| 1234 | |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1235 | static struct resource msm8625_resources_sdc1[] = { |
| 1236 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1237 | .name = "core_mem", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1238 | .start = MSM_SDC1_BASE, |
| 1239 | .end = MSM_SDC1_BASE + SZ_4K - 1, |
| 1240 | .flags = IORESOURCE_MEM, |
| 1241 | }, |
| 1242 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1243 | .name = "core_irq", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1244 | .start = MSM8625_INT_SDC1_0, |
| 1245 | .end = MSM8625_INT_SDC1_1, |
| 1246 | .flags = IORESOURCE_IRQ, |
| 1247 | }, |
| 1248 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1249 | .name = "dma_chnl", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1250 | .start = DMOV_SDC1_CHAN, |
| 1251 | .end = DMOV_SDC1_CHAN, |
| 1252 | .flags = IORESOURCE_DMA, |
| 1253 | }, |
| 1254 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1255 | .name = "dma_crci", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1256 | .start = DMOV_SDC1_CRCI, |
| 1257 | .end = DMOV_SDC1_CRCI, |
| 1258 | .flags = IORESOURCE_DMA, |
| 1259 | } |
| 1260 | }; |
| 1261 | |
| 1262 | static struct resource msm8625_resources_sdc2[] = { |
| 1263 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1264 | .name = "core_mem", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1265 | .start = MSM_SDC2_BASE, |
| 1266 | .end = MSM_SDC2_BASE + SZ_4K - 1, |
| 1267 | .flags = IORESOURCE_MEM, |
| 1268 | }, |
| 1269 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1270 | .name = "core_irq", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1271 | .start = MSM8625_INT_SDC2_0, |
| 1272 | .end = MSM8625_INT_SDC2_1, |
| 1273 | .flags = IORESOURCE_IRQ, |
| 1274 | }, |
| 1275 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1276 | .name = "dma_chnl", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1277 | .start = DMOV_SDC2_CHAN, |
| 1278 | .end = DMOV_SDC2_CHAN, |
| 1279 | .flags = IORESOURCE_DMA, |
| 1280 | }, |
| 1281 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1282 | .name = "dma_crci", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1283 | .start = DMOV_SDC2_CRCI, |
| 1284 | .end = DMOV_SDC2_CRCI, |
| 1285 | .flags = IORESOURCE_DMA, |
| 1286 | } |
| 1287 | }; |
| 1288 | |
| 1289 | static struct resource msm8625_resources_sdc3[] = { |
| 1290 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1291 | .name = "core_mem", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1292 | .start = MSM_SDC3_BASE, |
| 1293 | .end = MSM_SDC3_BASE + SZ_4K - 1, |
| 1294 | .flags = IORESOURCE_MEM, |
| 1295 | }, |
| 1296 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1297 | .name = "core_irq", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1298 | .start = MSM8625_INT_SDC3_0, |
| 1299 | .end = MSM8625_INT_SDC3_1, |
| 1300 | .flags = IORESOURCE_IRQ, |
| 1301 | }, |
| 1302 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1303 | .name = "dma_chnl", |
Pratibhasagar V | c483d20 | 2012-08-21 14:37:17 +0530 | [diff] [blame] | 1304 | .start = DMOV_NAND_CHAN, |
| 1305 | .end = DMOV_NAND_CHAN, |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1306 | .flags = IORESOURCE_DMA, |
| 1307 | }, |
| 1308 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1309 | .name = "dma_crci", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1310 | .start = DMOV_SDC3_CRCI, |
| 1311 | .end = DMOV_SDC3_CRCI, |
| 1312 | .flags = IORESOURCE_DMA, |
| 1313 | }, |
| 1314 | }; |
| 1315 | |
| 1316 | static struct resource msm8625_resources_sdc4[] = { |
| 1317 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1318 | .name = "core_mem", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1319 | .start = MSM_SDC4_BASE, |
| 1320 | .end = MSM_SDC4_BASE + SZ_4K - 1, |
| 1321 | .flags = IORESOURCE_MEM, |
| 1322 | }, |
| 1323 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1324 | .name = "core_irq", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1325 | .start = MSM8625_INT_SDC4_0, |
| 1326 | .end = MSM8625_INT_SDC4_1, |
| 1327 | .flags = IORESOURCE_IRQ, |
| 1328 | }, |
| 1329 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1330 | .name = "dma_chnl", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1331 | .start = DMOV_SDC4_CHAN, |
| 1332 | .end = DMOV_SDC4_CHAN, |
| 1333 | .flags = IORESOURCE_DMA, |
| 1334 | }, |
| 1335 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1336 | .name = "dma_crci", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1337 | .start = DMOV_SDC4_CRCI, |
| 1338 | .end = DMOV_SDC4_CRCI, |
| 1339 | .flags = IORESOURCE_DMA, |
| 1340 | }, |
| 1341 | }; |
| 1342 | |
| 1343 | struct platform_device msm8625_device_sdc1 = { |
| 1344 | .name = "msm_sdcc", |
| 1345 | .id = 1, |
| 1346 | .num_resources = ARRAY_SIZE(msm8625_resources_sdc1), |
| 1347 | .resource = msm8625_resources_sdc1, |
| 1348 | .dev = { |
| 1349 | .coherent_dma_mask = 0xffffffff, |
| 1350 | }, |
| 1351 | }; |
| 1352 | |
| 1353 | struct platform_device msm8625_device_sdc2 = { |
| 1354 | .name = "msm_sdcc", |
| 1355 | .id = 2, |
| 1356 | .num_resources = ARRAY_SIZE(msm8625_resources_sdc2), |
| 1357 | .resource = msm8625_resources_sdc2, |
| 1358 | .dev = { |
| 1359 | .coherent_dma_mask = 0xffffffff, |
| 1360 | }, |
| 1361 | }; |
| 1362 | |
| 1363 | struct platform_device msm8625_device_sdc3 = { |
| 1364 | .name = "msm_sdcc", |
| 1365 | .id = 3, |
| 1366 | .num_resources = ARRAY_SIZE(msm8625_resources_sdc3), |
| 1367 | .resource = msm8625_resources_sdc3, |
| 1368 | .dev = { |
| 1369 | .coherent_dma_mask = 0xffffffff, |
| 1370 | }, |
| 1371 | }; |
| 1372 | |
| 1373 | struct platform_device msm8625_device_sdc4 = { |
| 1374 | .name = "msm_sdcc", |
| 1375 | .id = 4, |
| 1376 | .num_resources = ARRAY_SIZE(msm8625_resources_sdc4), |
| 1377 | .resource = msm8625_resources_sdc4, |
| 1378 | .dev = { |
| 1379 | .coherent_dma_mask = 0xffffffff, |
| 1380 | }, |
| 1381 | }; |
| 1382 | |
| 1383 | static struct platform_device *msm8625_sdcc_devices[] __initdata = { |
| 1384 | &msm8625_device_sdc1, |
| 1385 | &msm8625_device_sdc2, |
| 1386 | &msm8625_device_sdc3, |
| 1387 | &msm8625_device_sdc4, |
| 1388 | }; |
| 1389 | |
| 1390 | int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat) |
| 1391 | { |
| 1392 | struct platform_device *pdev; |
| 1393 | |
| 1394 | if (controller < 1 || controller > 4) |
| 1395 | return -EINVAL; |
| 1396 | |
| 1397 | if (cpu_is_msm8625()) |
| 1398 | pdev = msm8625_sdcc_devices[controller-1]; |
| 1399 | else |
| 1400 | pdev = msm_sdcc_devices[controller-1]; |
| 1401 | |
| 1402 | pdev->dev.platform_data = plat; |
| 1403 | return platform_device_register(pdev); |
| 1404 | } |
| 1405 | |
Trilok Soni | da63a8b | 2012-02-13 20:50:03 +0530 | [diff] [blame] | 1406 | static struct resource msm8625_resources_hsusb_otg[] = { |
| 1407 | { |
| 1408 | .start = MSM_HSUSB_PHYS, |
| 1409 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 1410 | .flags = IORESOURCE_MEM, |
| 1411 | }, |
| 1412 | { |
| 1413 | .start = MSM8625_INT_USB_HS, |
| 1414 | .end = MSM8625_INT_USB_HS, |
| 1415 | .flags = IORESOURCE_IRQ, |
| 1416 | }, |
| 1417 | }; |
| 1418 | |
| 1419 | struct platform_device msm8625_device_otg = { |
| 1420 | .name = "msm_otg", |
| 1421 | .id = -1, |
| 1422 | .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg), |
| 1423 | .resource = msm8625_resources_hsusb_otg, |
| 1424 | .dev = { |
| 1425 | .dma_mask = &dma_mask, |
| 1426 | .coherent_dma_mask = 0xffffffffULL, |
| 1427 | }, |
| 1428 | }; |
| 1429 | |
| 1430 | static struct resource msm8625_resources_gadget_peripheral[] = { |
| 1431 | { |
| 1432 | .start = MSM_HSUSB_PHYS, |
| 1433 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 1434 | .flags = IORESOURCE_MEM, |
| 1435 | }, |
| 1436 | { |
| 1437 | .start = MSM8625_INT_USB_HS, |
| 1438 | .end = MSM8625_INT_USB_HS, |
| 1439 | .flags = IORESOURCE_IRQ, |
| 1440 | }, |
| 1441 | }; |
| 1442 | |
| 1443 | struct platform_device msm8625_device_gadget_peripheral = { |
| 1444 | .name = "msm_hsusb", |
| 1445 | .id = -1, |
| 1446 | .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral), |
| 1447 | .resource = msm8625_resources_gadget_peripheral, |
| 1448 | .dev = { |
| 1449 | .dma_mask = &dma_mask, |
| 1450 | .coherent_dma_mask = 0xffffffffULL, |
| 1451 | }, |
| 1452 | }; |
| 1453 | |
| 1454 | static struct resource msm8625_resources_hsusb_host[] = { |
| 1455 | { |
| 1456 | .start = MSM_HSUSB_PHYS, |
| 1457 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 1458 | .flags = IORESOURCE_MEM, |
| 1459 | }, |
| 1460 | { |
| 1461 | .start = MSM8625_INT_USB_HS, |
| 1462 | .end = MSM8625_INT_USB_HS, |
| 1463 | .flags = IORESOURCE_IRQ, |
| 1464 | }, |
| 1465 | }; |
| 1466 | |
| 1467 | struct platform_device msm8625_device_hsusb_host = { |
| 1468 | .name = "msm_hsusb_host", |
| 1469 | .id = 0, |
| 1470 | .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host), |
| 1471 | .resource = msm8625_resources_hsusb_host, |
| 1472 | .dev = { |
| 1473 | .dma_mask = &dma_mask, |
| 1474 | .coherent_dma_mask = 0xffffffffULL, |
| 1475 | }, |
| 1476 | }; |
| 1477 | |
| 1478 | static struct platform_device *msm8625_host_devices[] = { |
| 1479 | &msm8625_device_hsusb_host, |
| 1480 | }; |
| 1481 | |
| 1482 | int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat) |
| 1483 | { |
| 1484 | struct platform_device *pdev; |
| 1485 | |
| 1486 | if (cpu_is_msm8625()) |
| 1487 | pdev = msm8625_host_devices[host]; |
| 1488 | else |
| 1489 | pdev = msm_host_devices[host]; |
| 1490 | if (!pdev) |
| 1491 | return -ENODEV; |
| 1492 | pdev->dev.platform_data = plat; |
| 1493 | return platform_device_register(pdev); |
| 1494 | } |
| 1495 | |
Trilok Soni | 88da255 | 2012-02-13 21:01:24 +0530 | [diff] [blame] | 1496 | #ifdef CONFIG_MSM_CAMERA_V4L2 |
| 1497 | static struct resource msm8625_csic0_resources[] = { |
| 1498 | { |
| 1499 | .name = "csic", |
| 1500 | .start = 0xA0F00000, |
| 1501 | .end = 0xA0F00000 + 0x00100000 - 1, |
| 1502 | .flags = IORESOURCE_MEM, |
| 1503 | }, |
| 1504 | { |
| 1505 | .name = "csic", |
| 1506 | .start = MSM8625_INT_CSI_IRQ_0, |
| 1507 | .end = MSM8625_INT_CSI_IRQ_0, |
| 1508 | .flags = IORESOURCE_IRQ, |
| 1509 | }, |
| 1510 | }; |
| 1511 | |
| 1512 | static struct resource msm8625_csic1_resources[] = { |
| 1513 | { |
| 1514 | .name = "csic", |
| 1515 | .start = 0xA1000000, |
| 1516 | .end = 0xA1000000 + 0x00100000 - 1, |
| 1517 | .flags = IORESOURCE_MEM, |
| 1518 | }, |
| 1519 | { |
| 1520 | .name = "csic", |
| 1521 | .start = MSM8625_INT_CSI_IRQ_1, |
| 1522 | .end = MSM8625_INT_CSI_IRQ_1, |
| 1523 | .flags = IORESOURCE_IRQ, |
| 1524 | }, |
| 1525 | }; |
| 1526 | |
| 1527 | struct platform_device msm8625_device_csic0 = { |
| 1528 | .name = "msm_csic", |
| 1529 | .id = 0, |
| 1530 | .resource = msm8625_csic0_resources, |
| 1531 | .num_resources = ARRAY_SIZE(msm8625_csic0_resources), |
| 1532 | }; |
| 1533 | |
| 1534 | struct platform_device msm8625_device_csic1 = { |
| 1535 | .name = "msm_csic", |
| 1536 | .id = 1, |
| 1537 | .resource = msm8625_csic1_resources, |
| 1538 | .num_resources = ARRAY_SIZE(msm8625_csic1_resources), |
| 1539 | }; |
| 1540 | #endif |
| 1541 | |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1542 | static struct resource msm8625_mipi_dsi_resources[] = { |
| 1543 | { |
| 1544 | .name = "mipi_dsi", |
| 1545 | .start = MIPI_DSI_HW_BASE, |
| 1546 | .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1, |
| 1547 | .flags = IORESOURCE_MEM, |
| 1548 | }, |
| 1549 | { |
| 1550 | .start = MSM8625_INT_DSI_IRQ, |
| 1551 | .end = MSM8625_INT_DSI_IRQ, |
| 1552 | .flags = IORESOURCE_IRQ, |
| 1553 | }, |
| 1554 | }; |
| 1555 | |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1556 | static struct platform_device msm8625_mipi_dsi_device = { |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1557 | .name = "mipi_dsi", |
| 1558 | .id = 1, |
| 1559 | .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources), |
| 1560 | .resource = msm8625_mipi_dsi_resources, |
| 1561 | }; |
| 1562 | |
| 1563 | static struct resource msm8625_mdp_resources[] = { |
| 1564 | { |
| 1565 | .name = "mdp", |
| 1566 | .start = MDP_BASE, |
| 1567 | .end = MDP_BASE + 0x000F1008 - 1, |
| 1568 | .flags = IORESOURCE_MEM, |
| 1569 | }, |
| 1570 | { |
| 1571 | .start = MSM8625_INT_MDP, |
| 1572 | .end = MSM8625_INT_MDP, |
| 1573 | .flags = IORESOURCE_IRQ, |
| 1574 | }, |
| 1575 | }; |
| 1576 | |
| 1577 | static struct platform_device msm8625_mdp_device = { |
| 1578 | .name = "mdp", |
| 1579 | .id = 0, |
| 1580 | .num_resources = ARRAY_SIZE(msm8625_mdp_resources), |
| 1581 | .resource = msm8625_mdp_resources, |
| 1582 | }; |
| 1583 | |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1584 | struct platform_device mipi_dsi_device; |
| 1585 | |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1586 | void __init msm_fb_register_device(char *name, void *data) |
| 1587 | { |
| 1588 | if (!strncmp(name, "mdp", 3)) { |
| 1589 | if (cpu_is_msm8625()) |
| 1590 | msm_register_device(&msm8625_mdp_device, data); |
| 1591 | else |
| 1592 | msm_register_device(&msm_mdp_device, data); |
| 1593 | } else if (!strncmp(name, "mipi_dsi", 8)) { |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1594 | if (cpu_is_msm8625()) { |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1595 | msm_register_device(&msm8625_mipi_dsi_device, data); |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1596 | mipi_dsi_device = msm8625_mipi_dsi_device; |
| 1597 | } else { |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1598 | msm_register_device(&msm_mipi_dsi_device, data); |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1599 | mipi_dsi_device = msm_mipi_dsi_device; |
| 1600 | } |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1601 | } else if (!strncmp(name, "lcdc", 4)) { |
| 1602 | msm_register_device(&msm_lcdc_device, data); |
| 1603 | } else { |
| 1604 | printk(KERN_ERR "%s: unknown device! %s\n", __func__, name); |
| 1605 | } |
| 1606 | } |
| 1607 | |
Trilok Soni | 664b95d | 2012-02-13 21:13:15 +0530 | [diff] [blame] | 1608 | static struct resource msm8625_kgsl_3d0_resources[] = { |
| 1609 | { |
| 1610 | .name = KGSL_3D0_REG_MEMORY, |
| 1611 | .start = 0xA0000000, |
| 1612 | .end = 0xA001ffff, |
| 1613 | .flags = IORESOURCE_MEM, |
| 1614 | }, |
| 1615 | { |
| 1616 | .name = KGSL_3D0_IRQ, |
| 1617 | .start = MSM8625_INT_GRAPHICS, |
| 1618 | .end = MSM8625_INT_GRAPHICS, |
| 1619 | .flags = IORESOURCE_IRQ, |
| 1620 | }, |
| 1621 | }; |
| 1622 | |
| 1623 | struct platform_device msm8625_kgsl_3d0 = { |
| 1624 | .name = "kgsl-3d0", |
| 1625 | .id = 0, |
| 1626 | .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources), |
| 1627 | .resource = msm8625_kgsl_3d0_resources, |
| 1628 | .dev = { |
| 1629 | .platform_data = &kgsl_3d0_pdata, |
| 1630 | }, |
| 1631 | }; |
| 1632 | |
Taniya Das | 364426e | 2012-09-28 17:09:51 +0530 | [diff] [blame] | 1633 | static struct resource pl310_resources[] = { |
| 1634 | { |
| 1635 | .start = 0xC0400000, |
| 1636 | .end = 0xC0400000 + SZ_4K - 1, |
| 1637 | .flags = IORESOURCE_MEM, |
| 1638 | }, |
| 1639 | { |
| 1640 | .name = "l2_irq", |
| 1641 | .start = MSM8625_INT_L2CC_INTR, |
| 1642 | .flags = IORESOURCE_IRQ, |
| 1643 | }, |
| 1644 | }; |
| 1645 | |
| 1646 | static struct platform_device pl310_erp_device = { |
| 1647 | .name = "pl310_erp", |
| 1648 | .id = -1, |
| 1649 | .resource = pl310_resources, |
| 1650 | .num_resources = ARRAY_SIZE(pl310_resources), |
| 1651 | }; |
| 1652 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1653 | enum { |
| 1654 | MSM8625, |
| 1655 | MSM8625A, |
| 1656 | MSM8625AB, |
| 1657 | }; |
| 1658 | |
| 1659 | static int __init msm8625_cpu_id(void) |
| 1660 | { |
| 1661 | int raw_id, cpu; |
| 1662 | |
| 1663 | raw_id = socinfo_get_raw_id(); |
| 1664 | switch (raw_id) { |
| 1665 | /* Part number for 1GHz part */ |
| 1666 | case 0x770: |
| 1667 | case 0x771: |
| 1668 | case 0x77C: |
| 1669 | case 0x780: |
Kaushal Kumar | c84b9c2 | 2012-10-12 12:47:55 +0530 | [diff] [blame] | 1670 | case 0x785: /* Edge-only MSM8125-0 */ |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1671 | case 0x8D0: |
| 1672 | cpu = MSM8625; |
| 1673 | break; |
| 1674 | /* Part number for 1.2GHz part */ |
| 1675 | case 0x773: |
| 1676 | case 0x774: |
| 1677 | case 0x781: |
| 1678 | case 0x8D1: |
| 1679 | cpu = MSM8625A; |
| 1680 | break; |
| 1681 | case 0x775: |
| 1682 | case 0x776: |
Kaushal Kumar | 5b700f3 | 2012-09-05 16:50:19 +0530 | [diff] [blame] | 1683 | case 0x779: |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1684 | case 0x77D: |
| 1685 | case 0x782: |
| 1686 | case 0x8D2: |
| 1687 | cpu = MSM8625AB; |
| 1688 | break; |
| 1689 | default: |
| 1690 | pr_err("Invalid Raw ID\n"); |
| 1691 | return -ENODEV; |
| 1692 | } |
| 1693 | return cpu; |
| 1694 | } |
| 1695 | |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1696 | static struct resource cpr_resources[] = { |
| 1697 | { |
| 1698 | .start = MSM8625_INT_CPR_IRQ0, |
| 1699 | .flags = IORESOURCE_IRQ, |
| 1700 | }, |
| 1701 | { |
| 1702 | .start = MSM8625_CPR_PHYS, |
| 1703 | .end = MSM8625_CPR_PHYS + SZ_4K - 1, |
| 1704 | .flags = IORESOURCE_MEM, |
| 1705 | }, |
| 1706 | }; |
| 1707 | |
| 1708 | /** |
| 1709 | * These are various Vdd levels supported by PMIC |
| 1710 | */ |
| 1711 | static uint32_t msm_c2_pmic_mv[] __initdata = { |
Trilok Soni | 9573ce3 | 2012-09-02 03:50:18 +0530 | [diff] [blame] | 1712 | 1350000, 1337500, 1325000, 1312500, 1300000, |
| 1713 | 1287500, 1275000, 1262500, 1250000, 1237500, |
| 1714 | 1225000, 1212500, 1200000, 1187500, 1175000, |
| 1715 | 1162500, 1150000, 1137500, 1125000, 1112500, |
| 1716 | 1100000, 1087500, 1075000, 1062500, 0, |
| 1717 | 0, 0, 0, 0, 0, |
| 1718 | 0, 1050000, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1719 | }; |
| 1720 | |
| 1721 | /** |
| 1722 | * This data will be based on CPR mode of operation |
| 1723 | */ |
| 1724 | static struct msm_cpr_mode msm_cpr_mode_data[] = { |
| 1725 | [NORMAL_MODE] = { |
| 1726 | .ring_osc_data = { |
| 1727 | {0, }, |
| 1728 | {0, }, |
| 1729 | {0, }, |
| 1730 | {0, }, |
| 1731 | {0, }, |
| 1732 | {0, }, |
| 1733 | {0, }, |
| 1734 | {0, }, |
| 1735 | }, |
| 1736 | .ring_osc = 0, |
| 1737 | .step_quot = ~0, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1738 | .tgt_volt_offset = 0, |
Trilok Soni | db64ae9 | 2012-09-02 02:09:04 +0530 | [diff] [blame] | 1739 | .nom_Vmax = 1350000, |
| 1740 | .nom_Vmin = 1250000, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1741 | .calibrated_uV = 1100000, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1742 | }, |
| 1743 | [TURBO_MODE] = { |
| 1744 | .ring_osc_data = { |
| 1745 | {0, }, |
| 1746 | {0, }, |
| 1747 | {0, }, |
| 1748 | {0, }, |
| 1749 | {0, }, |
| 1750 | {0, }, |
| 1751 | {0, }, |
| 1752 | {0, }, |
| 1753 | }, |
| 1754 | .ring_osc = 0, |
| 1755 | .step_quot = ~0, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1756 | .tgt_volt_offset = 0, |
Trilok Soni | db64ae9 | 2012-09-02 02:09:04 +0530 | [diff] [blame] | 1757 | .turbo_Vmax = 1350000, |
Kaushal Kumar | 1f549fc | 2012-10-04 11:45:32 +0530 | [diff] [blame] | 1758 | .turbo_Vmin = 1150000, |
Trilok Soni | db64ae9 | 2012-09-02 02:09:04 +0530 | [diff] [blame] | 1759 | .nom_Vmax = 1350000, |
Kaushal Kumar | 1f549fc | 2012-10-04 11:45:32 +0530 | [diff] [blame] | 1760 | .nom_Vmin = 1150000, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1761 | .calibrated_uV = 1300000, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1762 | }, |
| 1763 | }; |
| 1764 | |
| 1765 | struct msm_cpr_vp_data vp_data = { |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1766 | .min_volt = 1000000, |
| 1767 | .max_volt = 1350000, |
| 1768 | .default_volt = 1300000, |
| 1769 | .step_size = 12500, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1770 | }; |
| 1771 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1772 | static uint32_t |
| 1773 | msm_cpr_get_quot(uint32_t max_quot, uint32_t max_freq, uint32_t new_freq) |
| 1774 | { |
| 1775 | uint32_t quot; |
| 1776 | |
| 1777 | /* This formula is as per chip characterization data */ |
Kaushal Kumar | ddd521c | 2012-09-18 19:50:53 +0530 | [diff] [blame] | 1778 | quot = max_quot - (((max_freq - new_freq) * 7) / 10); |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1779 | |
| 1780 | return quot; |
| 1781 | } |
| 1782 | |
| 1783 | static void msm_cpr_clk_enable(void) |
| 1784 | { |
| 1785 | uint32_t reg_val; |
| 1786 | |
| 1787 | /* Select TCXO (19.2MHz) as clock source */ |
| 1788 | reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR); |
| 1789 | reg_val |= RBCPR_CLK_MUX_SEL; |
| 1790 | writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR); |
| 1791 | |
| 1792 | /* Get CPR out of reset */ |
| 1793 | writel_relaxed(0x1, RBCPR_SW_RESET_N); |
| 1794 | } |
| 1795 | |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1796 | static struct msm_cpr_config msm_cpr_pdata = { |
| 1797 | .ref_clk_khz = 19200, |
Kaushal Kumar | 3e60a10 | 2012-10-15 16:54:16 +0530 | [diff] [blame] | 1798 | .delay_us = 25000, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1799 | .irq_line = 0, |
| 1800 | .cpr_mode_data = msm_cpr_mode_data, |
| 1801 | .tgt_count_div_N = 1, |
| 1802 | .floor = 0, |
| 1803 | .ceiling = 40, |
| 1804 | .sw_vlevel = 20, |
| 1805 | .up_threshold = 1, |
Kaushal Kumar | 3e60a10 | 2012-10-15 16:54:16 +0530 | [diff] [blame] | 1806 | .dn_threshold = 3, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1807 | .up_margin = 0, |
| 1808 | .dn_margin = 0, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1809 | .max_nom_freq = 700800, |
| 1810 | .max_freq = 1401600, |
| 1811 | .max_quot = 0, |
Kaushal Kumar | ecfc918 | 2012-10-25 16:17:51 +0530 | [diff] [blame] | 1812 | .disable_cpr = false, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1813 | .vp_data = &vp_data, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1814 | .get_quot = msm_cpr_get_quot, |
| 1815 | .clk_enable = msm_cpr_clk_enable, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1816 | }; |
| 1817 | |
| 1818 | static struct platform_device msm8625_device_cpr = { |
| 1819 | .name = "msm-cpr", |
| 1820 | .id = -1, |
| 1821 | .num_resources = ARRAY_SIZE(cpr_resources), |
| 1822 | .resource = cpr_resources, |
| 1823 | .dev = { |
| 1824 | .platform_data = &msm_cpr_pdata, |
| 1825 | }, |
| 1826 | }; |
| 1827 | |
| 1828 | static struct platform_device msm8625_vp_device = { |
| 1829 | .name = "vp-regulator", |
| 1830 | .id = -1, |
| 1831 | }; |
| 1832 | |
| 1833 | static void __init msm_cpr_init(void) |
| 1834 | { |
| 1835 | struct cpr_info_type *cpr_info = NULL; |
| 1836 | uint8_t ring_osc = 0; |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1837 | |
| 1838 | cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL); |
| 1839 | if (!cpr_info) { |
| 1840 | pr_err("%s: Out of memory %d\n", __func__, -ENOMEM); |
| 1841 | return; |
| 1842 | } |
| 1843 | |
| 1844 | msm_smem_get_cpr_info(cpr_info); |
Kaushal Kumar | ecfc918 | 2012-10-25 16:17:51 +0530 | [diff] [blame] | 1845 | msm_cpr_pdata.disable_cpr = cpr_info->disable_cpr; |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1846 | |
| 1847 | /** |
| 1848 | * Set the ring_osc based on efuse BIT(0) |
| 1849 | * CPR_fuse[0] = 0 selects 2nd RO (010) |
| 1850 | * CPR_fuse[0] = 1 select 3rd RO (011) |
| 1851 | */ |
| 1852 | if (cpr_info->ring_osc == 0x0) |
| 1853 | ring_osc = 0x2; |
| 1854 | else if (cpr_info->ring_osc == 0x1) |
| 1855 | ring_osc = 0x3; |
| 1856 | |
| 1857 | msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc; |
| 1858 | msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc; |
| 1859 | |
| 1860 | /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */ |
| 1861 | msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19; |
| 1862 | msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19; |
| 1863 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1864 | /** |
| 1865 | * The scaling factor and offset are as per chip characterization data |
| 1866 | * This formula is used since available fuse bits in the chip are not |
| 1867 | * enough to represent the value of maximum quot |
| 1868 | */ |
Trilok Soni | 7f31117 | 2012-09-02 15:15:33 +0530 | [diff] [blame] | 1869 | msm_cpr_pdata.max_quot = cpr_info->turbo_quot * 10 + 600; |
Kaushal Kumar | bcb46d9 | 2012-10-04 11:31:14 +0530 | [diff] [blame] | 1870 | /** |
| 1871 | * Fused Quot value for 1.2GHz on a 1.2GHz part is lower than |
| 1872 | * the quot value calculated using the scaling factor formula for |
| 1873 | * 1.2GHz when running on a 1.4GHz part. So, prop up the Quot for |
| 1874 | * a 1.2GHz part by a chip characterization recommended value. |
| 1875 | * Ditto for a 1.0GHz part. |
| 1876 | */ |
| 1877 | if (msm8625_cpu_id() == MSM8625A) { |
Kaushal Kumar | 3a9f6c8 | 2012-10-19 15:30:28 +0530 | [diff] [blame] | 1878 | msm_cpr_pdata.max_quot += 30; |
Kaushal Kumar | bcb46d9 | 2012-10-04 11:31:14 +0530 | [diff] [blame] | 1879 | if (msm_cpr_pdata.max_quot > 1400) |
| 1880 | msm_cpr_pdata.max_quot = 1400; |
| 1881 | } else if (msm8625_cpu_id() == MSM8625) { |
Kaushal Kumar | 3a9f6c8 | 2012-10-19 15:30:28 +0530 | [diff] [blame] | 1882 | msm_cpr_pdata.max_quot += 50; |
Kaushal Kumar | bcb46d9 | 2012-10-04 11:31:14 +0530 | [diff] [blame] | 1883 | if (msm_cpr_pdata.max_quot > 1350) |
| 1884 | msm_cpr_pdata.max_quot = 1350; |
| 1885 | } |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1886 | |
| 1887 | /** |
| 1888 | * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage. |
| 1889 | * Boot up mode is by default Turbo. |
| 1890 | */ |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1891 | msm_cpr_mode_data[TURBO_MODE].calibrated_uV = |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1892 | msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F]; |
| 1893 | |
Kaushal Kumar | 1f549fc | 2012-10-04 11:45:32 +0530 | [diff] [blame] | 1894 | if ((cpr_info->floor_fuse & 0x3) == 0x0) { |
| 1895 | msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1000000; |
| 1896 | msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000; |
| 1897 | } else if ((cpr_info->floor_fuse & 0x3) == 0x1) { |
| 1898 | msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1050000; |
| 1899 | msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000; |
| 1900 | } else if ((cpr_info->floor_fuse & 0x3) == 0x2) { |
| 1901 | msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1100000; |
| 1902 | msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000; |
| 1903 | } |
| 1904 | |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1905 | pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__, |
| 1906 | msm_cpr_mode_data[TURBO_MODE].ring_osc); |
| 1907 | pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot); |
| 1908 | pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse); |
Kaushal Kumar | 1f549fc | 2012-10-04 11:45:32 +0530 | [diff] [blame] | 1909 | pr_debug("%s: cpr: floor_fuse: 0x%x\n", __func__, cpr_info->floor_fuse); |
| 1910 | pr_debug("%s: cpr: nom_Vmin: %d, turbo_Vmin: %d\n", __func__, |
| 1911 | msm_cpr_mode_data[TURBO_MODE].nom_Vmin, |
| 1912 | msm_cpr_mode_data[TURBO_MODE].turbo_Vmin); |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1913 | kfree(cpr_info); |
| 1914 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1915 | if (msm8625_cpu_id() == MSM8625A) |
| 1916 | msm_cpr_pdata.max_freq = 1209600; |
| 1917 | else if (msm8625_cpu_id() == MSM8625) |
| 1918 | msm_cpr_pdata.max_freq = 1008000; |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1919 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1920 | msm_cpr_clk_enable(); |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1921 | |
| 1922 | platform_device_register(&msm8625_vp_device); |
| 1923 | platform_device_register(&msm8625_device_cpr); |
| 1924 | } |
| 1925 | |
Taniya Das | 7c9f051 | 2011-12-02 14:26:46 +0530 | [diff] [blame] | 1926 | static struct clk_lookup msm_clock_8625_dummy[] = { |
| 1927 | CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0), |
| 1928 | CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0), |
| 1929 | CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0), |
| 1930 | CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0), |
| 1931 | CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0), |
| 1932 | CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0), |
| 1933 | CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0), |
| 1934 | CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0), |
| 1935 | CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0), |
| 1936 | CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0), |
| 1937 | CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0), |
| 1938 | CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0), |
| 1939 | CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0), |
| 1940 | CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0), |
| 1941 | CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0), |
| 1942 | CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0), |
| 1943 | CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0), |
| 1944 | CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0), |
| 1945 | CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0), |
| 1946 | CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0), |
| 1947 | CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0), |
| 1948 | CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0), |
| 1949 | CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0), |
| 1950 | CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0), |
| 1951 | CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0), |
| 1952 | CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0), |
| 1953 | CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0), |
| 1954 | CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0), |
| 1955 | CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0), |
| 1956 | CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0), |
| 1957 | CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0), |
| 1958 | CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0), |
| 1959 | CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0), |
| 1960 | CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0), |
| 1961 | CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0), |
| 1962 | CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0), |
| 1963 | CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0), |
| 1964 | CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0), |
| 1965 | CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0), |
| 1966 | CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0), |
| 1967 | CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0), |
| 1968 | CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0), |
| 1969 | CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0), |
| 1970 | CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0), |
| 1971 | CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0), |
| 1972 | CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0), |
| 1973 | CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0), |
| 1974 | CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0), |
| 1975 | CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0), |
| 1976 | CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0), |
| 1977 | CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0), |
| 1978 | CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0), |
| 1979 | CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0), |
| 1980 | CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0), |
| 1981 | CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0), |
| 1982 | CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0), |
| 1983 | CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0), |
| 1984 | CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0), |
| 1985 | CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0), |
| 1986 | }; |
| 1987 | |
| 1988 | struct clock_init_data msm8625_dummy_clock_init_data __initdata = { |
| 1989 | .table = msm_clock_8625_dummy, |
| 1990 | .size = ARRAY_SIZE(msm_clock_8625_dummy), |
| 1991 | }; |
Pankaj Kumar | 50c705c | 2012-01-10 12:02:07 +0530 | [diff] [blame] | 1992 | |
Taniya Das | 6e0ff0d | 2012-10-12 11:38:32 +0530 | [diff] [blame] | 1993 | |
| 1994 | static int __init msm_gpio_config_gps(void) |
| 1995 | { |
| 1996 | unsigned int gps_gpio = 7; |
| 1997 | int ret = 0; |
| 1998 | |
| 1999 | if (!machine_is_msm8625_evb()) |
| 2000 | return ret; |
| 2001 | |
| 2002 | ret = gpio_tlmm_config(GPIO_CFG(gps_gpio, 0, GPIO_CFG_OUTPUT, |
| 2003 | GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 2004 | if (ret < 0) { |
| 2005 | pr_err("gpio tlmm failed for gpio-%d\n", gps_gpio); |
| 2006 | return ret; |
| 2007 | } |
| 2008 | |
| 2009 | ret = gpio_request(gps_gpio, "gnss-gpio"); |
| 2010 | if (ret < 0) { |
| 2011 | pr_err("failed to request gpio-%d\n", gps_gpio); |
| 2012 | return ret; |
| 2013 | } |
| 2014 | |
| 2015 | ret = gpio_direction_input(gps_gpio); |
| 2016 | if (ret < 0) { |
| 2017 | pr_err("failed to change direction for gpio-%d\n", gps_gpio); |
| 2018 | return ret; |
| 2019 | } |
| 2020 | |
| 2021 | ret = gpio_export(gps_gpio, true); |
| 2022 | if (ret < 0) |
| 2023 | pr_err("failed to export gpio for user\n"); |
| 2024 | |
| 2025 | return ret; |
| 2026 | } |
| 2027 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2028 | int __init msm7x2x_misc_init(void) |
| 2029 | { |
Taniya Das | 7c9f051 | 2011-12-02 14:26:46 +0530 | [diff] [blame] | 2030 | if (machine_is_msm8625_rumi3()) { |
| 2031 | msm_clock_init(&msm8625_dummy_clock_init_data); |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 2032 | msm_cpr_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2033 | return 0; |
Taniya Das | 7c9f051 | 2011-12-02 14:26:46 +0530 | [diff] [blame] | 2034 | } |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2035 | |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 2036 | msm_clock_init(&msm7x27a_clock_init_data); |
Pankaj Kumar | fee56a8 | 2012-04-17 14:26:49 +0530 | [diff] [blame] | 2037 | if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab()) |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 2038 | platform_device_register(&msm7x27aa_device_acpuclk); |
Pankaj Kumar | 50c705c | 2012-01-10 12:02:07 +0530 | [diff] [blame] | 2039 | else if (cpu_is_msm8625()) { |
| 2040 | if (msm8625_cpu_id() == MSM8625) |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 2041 | platform_device_register(&msm7x27aa_device_acpuclk); |
Pankaj Kumar | 50c705c | 2012-01-10 12:02:07 +0530 | [diff] [blame] | 2042 | else if (msm8625_cpu_id() == MSM8625A) |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 2043 | platform_device_register(&msm8625_device_acpuclk); |
Kaushal Kumar | 86473f0 | 2012-06-28 19:35:58 +0530 | [diff] [blame] | 2044 | else if (msm8625_cpu_id() == MSM8625AB) |
| 2045 | platform_device_register(&msm8625ab_device_acpuclk); |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 2046 | } else { |
| 2047 | platform_device_register(&msm7x27a_device_acpuclk); |
| 2048 | } |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 2049 | |
| 2050 | if (cpu_is_msm8625() && |
| 2051 | (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)) |
| 2052 | msm_cpr_init(); |
| 2053 | |
Taniya Das | 364426e | 2012-09-28 17:09:51 +0530 | [diff] [blame] | 2054 | if (!cpu_is_msm8625()) |
| 2055 | pl310_resources[1].start = INT_L2CC_INTR; |
| 2056 | |
| 2057 | platform_device_register(&pl310_erp_device); |
| 2058 | |
Taniya Das | 6e0ff0d | 2012-10-12 11:38:32 +0530 | [diff] [blame] | 2059 | if (msm_gpio_config_gps() < 0) |
| 2060 | pr_err("Error for gpio config for GPS gpio\n"); |
| 2061 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2062 | return 0; |
| 2063 | } |
| 2064 | |
| 2065 | #ifdef CONFIG_CACHE_L2X0 |
| 2066 | static int __init msm7x27x_cache_init(void) |
| 2067 | { |
| 2068 | int aux_ctrl = 0; |
Prachee Ramsinghani | 86b1f65 | 2012-04-03 16:01:30 +0530 | [diff] [blame] | 2069 | int pctrl = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2070 | |
| 2071 | /* Way Size 010(0x2) 32KB */ |
| 2072 | aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \ |
| 2073 | (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \ |
| 2074 | (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT); |
| 2075 | |
Taniya Das | 379b568 | 2011-12-02 14:53:46 +0530 | [diff] [blame] | 2076 | if (cpu_is_msm8625()) { |
| 2077 | /* Way Size 011(0x3) 64KB */ |
| 2078 | aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \ |
| 2079 | (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \ |
Prachee Ramsinghani | 86b1f65 | 2012-04-03 16:01:30 +0530 | [diff] [blame] | 2080 | (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \ |
| 2081 | (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT); |
| 2082 | |
| 2083 | /* Write Prefetch Control settings */ |
| 2084 | pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL); |
| 2085 | pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \ |
| 2086 | (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \ |
| 2087 | (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT); |
| 2088 | writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL); |
Taniya Das | 379b568 | 2011-12-02 14:53:46 +0530 | [diff] [blame] | 2089 | } |
| 2090 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2091 | l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK); |
Prachee Ramsinghani | 86b1f65 | 2012-04-03 16:01:30 +0530 | [diff] [blame] | 2092 | if (cpu_is_msm8625()) { |
| 2093 | pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL); |
| 2094 | pr_info("Prfetch Ctrl: 0x%08x\n", pctrl); |
| 2095 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2096 | |
| 2097 | return 0; |
| 2098 | } |
| 2099 | #else |
pankaj kumar | 80d7cb6 | 2011-08-23 13:37:55 +0530 | [diff] [blame] | 2100 | static int __init msm7x27x_cache_init(void){ return 0; } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2101 | #endif |
| 2102 | |
| 2103 | void __init msm_common_io_init(void) |
| 2104 | { |
| 2105 | msm_map_common_io(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2106 | if (socinfo_init() < 0) |
| 2107 | pr_err("%s: socinfo_init() failed!\n", __func__); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2108 | msm7x27x_cache_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2109 | } |
| 2110 | |
| 2111 | void __init msm8625_init_irq(void) |
| 2112 | { |
Trilok Soni | 1a9fdee | 2012-05-28 19:54:11 +0530 | [diff] [blame] | 2113 | msm_gic_irq_extn_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2114 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 2115 | (void *)MSM_QGIC_CPU_BASE); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2116 | } |
| 2117 | |
| 2118 | void __init msm8625_map_io(void) |
| 2119 | { |
| 2120 | msm_map_msm8625_io(); |
| 2121 | |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 2122 | if (socinfo_init() < 0) |
| 2123 | pr_err("%s: socinfo_init() failed!\n", __func__); |
Taniya Das | 379b568 | 2011-12-02 14:53:46 +0530 | [diff] [blame] | 2124 | msm7x27x_cache_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2125 | } |
| 2126 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2127 | static int msm7627a_init_gpio(void) |
| 2128 | { |
Taniya Das | 6684d62 | 2012-01-12 10:29:09 +0530 | [diff] [blame] | 2129 | if (cpu_is_msm8625()) |
| 2130 | platform_device_register(&msm8625_device_gpio); |
| 2131 | else |
| 2132 | platform_device_register(&msm_device_gpio); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2133 | return 0; |
| 2134 | } |
| 2135 | postcore_initcall(msm7627a_init_gpio); |
Taniya Das | 9d0c3c5 | 2012-05-04 14:40:55 +0530 | [diff] [blame] | 2136 | |
| 2137 | static int msm7627a_panic_handler(struct notifier_block *this, |
| 2138 | unsigned long event, void *ptr) |
| 2139 | { |
| 2140 | flush_cache_all(); |
| 2141 | outer_flush_all(); |
| 2142 | return NOTIFY_DONE; |
| 2143 | } |
| 2144 | |
| 2145 | static struct notifier_block panic_handler = { |
| 2146 | .notifier_call = msm7627a_panic_handler, |
Aparna Mallavarapu | a999047 | 2012-09-26 12:25:24 +0530 | [diff] [blame] | 2147 | .priority = INT_MAX, |
Taniya Das | 9d0c3c5 | 2012-05-04 14:40:55 +0530 | [diff] [blame] | 2148 | }; |
| 2149 | |
| 2150 | static int __init panic_register(void) |
| 2151 | { |
| 2152 | atomic_notifier_chain_register(&panic_notifier_list, |
| 2153 | &panic_handler); |
| 2154 | return 0; |
| 2155 | } |
| 2156 | module_init(panic_register); |