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 | }, |
| 783 | }; |
| 784 | |
| 785 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 786 | [0] = { |
| 787 | .reg_base_addr = MSM_SAW0_BASE, |
| 788 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0, |
| 789 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 790 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 791 | .modes = msm_spm_seq_list, |
| 792 | }, |
| 793 | [1] = { |
| 794 | .reg_base_addr = MSM_SAW1_BASE, |
| 795 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0, |
| 796 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 797 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 798 | .modes = msm_spm_seq_list, |
| 799 | }, |
| 800 | }; |
| 801 | |
| 802 | void __init msm8x25_spm_device_init(void) |
| 803 | { |
| 804 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 805 | } |
| 806 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 807 | #define MDP_BASE 0xAA200000 |
| 808 | #define MIPI_DSI_HW_BASE 0xA1100000 |
| 809 | |
| 810 | static struct resource msm_mipi_dsi_resources[] = { |
| 811 | { |
| 812 | .name = "mipi_dsi", |
| 813 | .start = MIPI_DSI_HW_BASE, |
| 814 | .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1, |
| 815 | .flags = IORESOURCE_MEM, |
| 816 | }, |
| 817 | { |
| 818 | .start = INT_DSI_IRQ, |
| 819 | .end = INT_DSI_IRQ, |
| 820 | .flags = IORESOURCE_IRQ, |
| 821 | }, |
| 822 | }; |
| 823 | |
| 824 | static struct platform_device msm_mipi_dsi_device = { |
| 825 | .name = "mipi_dsi", |
| 826 | .id = 1, |
| 827 | .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources), |
| 828 | .resource = msm_mipi_dsi_resources, |
| 829 | }; |
| 830 | |
| 831 | static struct resource msm_mdp_resources[] = { |
| 832 | { |
| 833 | .name = "mdp", |
| 834 | .start = MDP_BASE, |
| 835 | .end = MDP_BASE + 0x000F1008 - 1, |
| 836 | .flags = IORESOURCE_MEM, |
| 837 | }, |
| 838 | { |
| 839 | .start = INT_MDP, |
| 840 | .end = INT_MDP, |
| 841 | .flags = IORESOURCE_IRQ, |
| 842 | }, |
| 843 | }; |
| 844 | |
| 845 | static struct platform_device msm_mdp_device = { |
| 846 | .name = "mdp", |
| 847 | .id = 0, |
| 848 | .num_resources = ARRAY_SIZE(msm_mdp_resources), |
| 849 | .resource = msm_mdp_resources, |
| 850 | }; |
| 851 | |
Padmanabhan Komanduru | e77bcf5 | 2012-07-26 12:43:39 +0530 | [diff] [blame] | 852 | struct platform_device msm_lcdc_device = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 853 | .name = "lcdc", |
| 854 | .id = 0, |
| 855 | }; |
| 856 | |
| 857 | static struct resource kgsl_3d0_resources[] = { |
| 858 | { |
| 859 | .name = KGSL_3D0_REG_MEMORY, |
| 860 | .start = 0xA0000000, |
| 861 | .end = 0xA001ffff, |
| 862 | .flags = IORESOURCE_MEM, |
| 863 | }, |
| 864 | { |
| 865 | .name = KGSL_3D0_IRQ, |
| 866 | .start = INT_GRAPHICS, |
| 867 | .end = INT_GRAPHICS, |
| 868 | .flags = IORESOURCE_IRQ, |
| 869 | }, |
| 870 | }; |
| 871 | |
| 872 | static struct kgsl_device_platform_data kgsl_3d0_pdata = { |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 873 | .pwrlevel = { |
| 874 | { |
| 875 | .gpu_freq = 245760000, |
| 876 | .bus_freq = 200000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 877 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 878 | { |
Lynus Vaz | eaf0aac | 2012-01-05 12:28:47 +0530 | [diff] [blame] | 879 | .gpu_freq = 192000000, |
| 880 | .bus_freq = 160000000, |
| 881 | }, |
| 882 | { |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 883 | .gpu_freq = 133330000, |
| 884 | .bus_freq = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 885 | }, |
| 886 | }, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 887 | .init_level = 0, |
Lynus Vaz | eaf0aac | 2012-01-05 12:28:47 +0530 | [diff] [blame] | 888 | .num_levels = 3, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 889 | .set_grp_async = set_grp_xbar_async, |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 890 | .idle_timeout = HZ, |
Lynus Vaz | fe4bede | 2012-04-06 11:53:30 -0700 | [diff] [blame] | 891 | .strtstp_sleepwake = true, |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 892 | .nap_allowed = false, |
| 893 | .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 894 | }; |
| 895 | |
| 896 | struct platform_device msm_kgsl_3d0 = { |
| 897 | .name = "kgsl-3d0", |
| 898 | .id = 0, |
| 899 | .num_resources = ARRAY_SIZE(kgsl_3d0_resources), |
| 900 | .resource = kgsl_3d0_resources, |
| 901 | .dev = { |
| 902 | .platform_data = &kgsl_3d0_pdata, |
| 903 | }, |
| 904 | }; |
| 905 | |
| 906 | void __init msm7x25a_kgsl_3d0_init(void) |
| 907 | { |
Pankaj Kumar | fee56a8 | 2012-04-17 14:26:49 +0530 | [diff] [blame] | 908 | if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) { |
Lynus Vaz | 971610e | 2012-01-06 11:00:32 +0530 | [diff] [blame] | 909 | kgsl_3d0_pdata.num_levels = 2; |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 910 | kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000; |
| 911 | kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000; |
| 912 | kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000; |
| 913 | kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0; |
Rajesh Kemisetti | df6e62f | 2012-03-12 14:02:30 +0530 | [diff] [blame] | 914 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 915 | } |
| 916 | |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 917 | void __init msm8x25_kgsl_3d0_init(void) |
| 918 | { |
Lynus Vaz | fe4bede | 2012-04-06 11:53:30 -0700 | [diff] [blame] | 919 | if (cpu_is_msm8625()) { |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 920 | kgsl_3d0_pdata.idle_timeout = HZ/5; |
Lynus Vaz | fe4bede | 2012-04-06 11:53:30 -0700 | [diff] [blame] | 921 | kgsl_3d0_pdata.strtstp_sleepwake = false; |
Ranjhith Kalisamy | 5fb30ef | 2012-08-12 16:26:36 +0530 | [diff] [blame] | 922 | |
| 923 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2) |
| 924 | /* 8x25 v2.0 & above supports a higher GPU frequency */ |
| 925 | kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000; |
| 926 | else |
| 927 | kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 300000000; |
| 928 | |
Ranjhith Kalisamy | 2469632 | 2012-04-11 22:09:17 +0530 | [diff] [blame] | 929 | kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000; |
Lynus Vaz | fe4bede | 2012-04-06 11:53:30 -0700 | [diff] [blame] | 930 | } |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 931 | } |
| 932 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 933 | static void __init msm_register_device(struct platform_device *pdev, void *data) |
| 934 | { |
| 935 | int ret; |
| 936 | |
| 937 | pdev->dev.platform_data = data; |
| 938 | |
| 939 | ret = platform_device_register(pdev); |
| 940 | |
| 941 | if (ret) |
| 942 | dev_err(&pdev->dev, |
| 943 | "%s: platform_device_register() failed = %d\n", |
| 944 | __func__, ret); |
| 945 | } |
| 946 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 947 | |
| 948 | #define PERPH_WEB_BLOCK_ADDR (0xA9D00040) |
| 949 | #define PDM0_CTL_OFFSET (0x04) |
| 950 | #define SIZE_8B (0x08) |
| 951 | |
| 952 | static struct resource resources_led[] = { |
| 953 | { |
| 954 | .start = PERPH_WEB_BLOCK_ADDR, |
| 955 | .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1, |
| 956 | .name = "led-gpio-pdm", |
| 957 | .flags = IORESOURCE_MEM, |
| 958 | }, |
| 959 | }; |
| 960 | |
| 961 | static struct led_info msm_kpbl_pdm_led_pdata = { |
| 962 | .name = "keyboard-backlight", |
| 963 | }; |
| 964 | |
| 965 | struct platform_device led_pdev = { |
| 966 | .name = "leds-msm-pdm", |
| 967 | /* use pdev id to represent pdm id */ |
| 968 | .id = 0, |
| 969 | .num_resources = ARRAY_SIZE(resources_led), |
| 970 | .resource = resources_led, |
| 971 | .dev = { |
| 972 | .platform_data = &msm_kpbl_pdm_led_pdata, |
| 973 | }, |
| 974 | }; |
| 975 | |
Manish Dewangan | 3a26099 | 2011-06-24 18:01:34 +0530 | [diff] [blame] | 976 | struct platform_device asoc_msm_pcm = { |
| 977 | .name = "msm-dsp-audio", |
| 978 | .id = 0, |
| 979 | }; |
| 980 | |
| 981 | struct platform_device asoc_msm_dai0 = { |
| 982 | .name = "msm-codec-dai", |
| 983 | .id = 0, |
| 984 | }; |
| 985 | |
| 986 | struct platform_device asoc_msm_dai1 = { |
| 987 | .name = "msm-cpu-dai", |
| 988 | .id = 0, |
| 989 | }; |
| 990 | |
Taniya Das | 2e94819 | 2011-12-20 11:15:13 +0530 | [diff] [blame] | 991 | static struct resource gpio_resources[] = { |
| 992 | { |
| 993 | .start = INT_GPIO_GROUP1, |
| 994 | .flags = IORESOURCE_IRQ, |
| 995 | }, |
| 996 | { |
| 997 | .start = INT_GPIO_GROUP2, |
| 998 | .flags = IORESOURCE_IRQ, |
| 999 | }, |
| 1000 | }; |
| 1001 | |
| 1002 | static struct platform_device msm_device_gpio = { |
| 1003 | .name = "msmgpio", |
| 1004 | .id = -1, |
| 1005 | .resource = gpio_resources, |
| 1006 | .num_resources = ARRAY_SIZE(gpio_resources), |
| 1007 | }; |
| 1008 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1009 | struct platform_device *msm_footswitch_devices[] = { |
Matt Wagantall | d6fbf23 | 2012-05-03 20:09:28 -0700 | [diff] [blame] | 1010 | FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"), |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1011 | }; |
| 1012 | unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices); |
| 1013 | |
| 1014 | /* MSM8625 Devices */ |
| 1015 | |
| 1016 | static struct resource msm8625_resources_uart1[] = { |
| 1017 | { |
| 1018 | .start = MSM8625_INT_UART1, |
| 1019 | .end = MSM8625_INT_UART1, |
| 1020 | .flags = IORESOURCE_IRQ, |
| 1021 | }, |
| 1022 | { |
Taniya Das | 13b811a | 2011-12-09 18:33:45 +0530 | [diff] [blame] | 1023 | .start = MSM7XXX_UART1_PHYS, |
| 1024 | .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1, |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1025 | .flags = IORESOURCE_MEM, |
| 1026 | }, |
| 1027 | }; |
| 1028 | |
| 1029 | struct platform_device msm8625_device_uart1 = { |
| 1030 | .name = "msm_serial", |
| 1031 | .id = 0, |
| 1032 | .num_resources = ARRAY_SIZE(msm8625_resources_uart1), |
| 1033 | .resource = msm8625_resources_uart1, |
| 1034 | }; |
| 1035 | |
Trilok Soni | 269fff4 | 2012-02-13 20:35:30 +0530 | [diff] [blame] | 1036 | static struct resource msm8625_uart1_dm_resources[] = { |
| 1037 | { |
| 1038 | .start = MSM_UART1DM_PHYS, |
| 1039 | .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1, |
| 1040 | .flags = IORESOURCE_MEM, |
| 1041 | }, |
| 1042 | { |
| 1043 | .start = MSM8625_INT_UART1DM_IRQ, |
| 1044 | .end = MSM8625_INT_UART1DM_IRQ, |
| 1045 | .flags = IORESOURCE_IRQ, |
| 1046 | }, |
| 1047 | { |
| 1048 | .start = MSM8625_INT_UART1DM_RX, |
| 1049 | .end = MSM8625_INT_UART1DM_RX, |
| 1050 | .flags = IORESOURCE_IRQ, |
| 1051 | }, |
| 1052 | { |
| 1053 | .start = DMOV_HSUART1_TX_CHAN, |
| 1054 | .end = DMOV_HSUART1_RX_CHAN, |
| 1055 | .name = "uartdm_channels", |
| 1056 | .flags = IORESOURCE_DMA, |
| 1057 | }, |
| 1058 | { |
| 1059 | .start = DMOV_HSUART1_TX_CRCI, |
| 1060 | .end = DMOV_HSUART1_RX_CRCI, |
| 1061 | .name = "uartdm_crci", |
| 1062 | .flags = IORESOURCE_DMA, |
| 1063 | }, |
| 1064 | }; |
| 1065 | |
| 1066 | struct platform_device msm8625_device_uart_dm1 = { |
| 1067 | .name = "msm_serial_hs", |
| 1068 | .id = 0, |
| 1069 | .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources), |
| 1070 | .resource = msm8625_uart1_dm_resources, |
| 1071 | .dev = { |
| 1072 | .dma_mask = &msm_uart_dm1_dma_mask, |
| 1073 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1074 | }, |
| 1075 | }; |
| 1076 | |
| 1077 | static struct resource msm8625_uart2dm_resources[] = { |
| 1078 | { |
| 1079 | .start = MSM_UART2DM_PHYS, |
| 1080 | .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1, |
| 1081 | .name = "uartdm_resource", |
| 1082 | .flags = IORESOURCE_MEM, |
| 1083 | }, |
| 1084 | { |
| 1085 | .start = MSM8625_INT_UART2DM_IRQ, |
| 1086 | .end = MSM8625_INT_UART2DM_IRQ, |
| 1087 | .flags = IORESOURCE_IRQ, |
| 1088 | }, |
| 1089 | }; |
| 1090 | |
| 1091 | struct platform_device msm8625_device_uart_dm2 = { |
| 1092 | .name = "msm_serial_hsl", |
| 1093 | .id = 0, |
| 1094 | .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources), |
| 1095 | .resource = msm8625_uart2dm_resources, |
| 1096 | }; |
| 1097 | |
Laxminath Kasam | 5faa1ca | 2012-02-15 12:06:45 +0530 | [diff] [blame] | 1098 | static struct resource msm8625_resources_adsp[] = { |
| 1099 | { |
| 1100 | .start = MSM8625_INT_ADSP_A9_A11, |
| 1101 | .end = MSM8625_INT_ADSP_A9_A11, |
| 1102 | .flags = IORESOURCE_IRQ, |
| 1103 | }, |
| 1104 | }; |
| 1105 | |
| 1106 | struct platform_device msm8625_device_adsp = { |
| 1107 | .name = "msm_adsp", |
| 1108 | .id = -1, |
| 1109 | .num_resources = ARRAY_SIZE(msm8625_resources_adsp), |
| 1110 | .resource = msm8625_resources_adsp, |
| 1111 | }; |
| 1112 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1113 | static struct resource msm8625_dmov_resource[] = { |
| 1114 | { |
| 1115 | .start = MSM8625_INT_ADM_AARM, |
| 1116 | .flags = IORESOURCE_IRQ, |
| 1117 | }, |
| 1118 | { |
| 1119 | .start = 0xA9700000, |
| 1120 | .end = 0xA9700000 + SZ_4K - 1, |
| 1121 | .flags = IORESOURCE_MEM, |
| 1122 | }, |
| 1123 | }; |
| 1124 | |
| 1125 | struct platform_device msm8625_device_dmov = { |
| 1126 | .name = "msm_dmov", |
| 1127 | .id = -1, |
| 1128 | .resource = msm8625_dmov_resource, |
| 1129 | .num_resources = ARRAY_SIZE(msm8625_dmov_resource), |
| 1130 | .dev = { |
| 1131 | .platform_data = &msm_dmov_pdata, |
| 1132 | }, |
| 1133 | }; |
Taniya Das | 2e94819 | 2011-12-20 11:15:13 +0530 | [diff] [blame] | 1134 | |
Taniya Das | 9d18714 | 2011-12-02 15:53:25 +0530 | [diff] [blame] | 1135 | static struct resource gsbi0_msm8625_qup_resources[] = { |
| 1136 | { |
| 1137 | .name = "qup_phys_addr", |
| 1138 | .start = MSM_GSBI0_QUP_PHYS, |
| 1139 | .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1, |
| 1140 | .flags = IORESOURCE_MEM, |
| 1141 | }, |
| 1142 | { |
| 1143 | .name = "gsbi_qup_i2c_addr", |
| 1144 | .start = MSM_GSBI0_PHYS, |
| 1145 | .end = MSM_GSBI0_PHYS + SZ_4K - 1, |
| 1146 | .flags = IORESOURCE_MEM, |
| 1147 | }, |
| 1148 | { |
| 1149 | .name = "qup_err_intr", |
| 1150 | .start = MSM8625_INT_PWB_I2C, |
| 1151 | .end = MSM8625_INT_PWB_I2C, |
| 1152 | .flags = IORESOURCE_IRQ, |
| 1153 | }, |
| 1154 | }; |
| 1155 | |
| 1156 | /* Use GSBI0 QUP for /dev/i2c-0 */ |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1157 | struct platform_device msm8625_gsbi0_qup_i2c_device = { |
Taniya Das | 9d18714 | 2011-12-02 15:53:25 +0530 | [diff] [blame] | 1158 | .name = "qup_i2c", |
| 1159 | .id = MSM_GSBI0_QUP_I2C_BUS_ID, |
| 1160 | .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources), |
| 1161 | .resource = gsbi0_msm8625_qup_resources, |
| 1162 | }; |
| 1163 | |
Trilok Soni | 633e59c | 2012-02-13 20:28:30 +0530 | [diff] [blame] | 1164 | static struct resource gsbi1_msm8625_qup_i2c_resources[] = { |
| 1165 | { |
| 1166 | .name = "qup_phys_addr", |
| 1167 | .start = MSM_GSBI1_QUP_PHYS, |
| 1168 | .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1, |
| 1169 | .flags = IORESOURCE_MEM, |
| 1170 | }, |
| 1171 | { |
| 1172 | .name = "gsbi_qup_i2c_addr", |
| 1173 | .start = MSM_GSBI1_PHYS, |
| 1174 | .end = MSM_GSBI1_PHYS + SZ_4K - 1, |
| 1175 | .flags = IORESOURCE_MEM, |
| 1176 | }, |
| 1177 | { |
| 1178 | .name = "qup_err_intr", |
| 1179 | .start = MSM8625_INT_ARM11_DMA, |
| 1180 | .end = MSM8625_INT_ARM11_DMA, |
| 1181 | .flags = IORESOURCE_IRQ, |
| 1182 | }, |
| 1183 | }; |
| 1184 | |
| 1185 | /* Use GSBI1 QUP for /dev/i2c-1 */ |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1186 | struct platform_device msm8625_gsbi1_qup_i2c_device = { |
Trilok Soni | 633e59c | 2012-02-13 20:28:30 +0530 | [diff] [blame] | 1187 | .name = "qup_i2c", |
| 1188 | .id = MSM_GSBI1_QUP_I2C_BUS_ID, |
| 1189 | .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources), |
| 1190 | .resource = gsbi1_msm8625_qup_i2c_resources, |
| 1191 | }; |
| 1192 | |
Taniya Das | 6684d62 | 2012-01-12 10:29:09 +0530 | [diff] [blame] | 1193 | static struct resource msm8625_gpio_resources[] = { |
| 1194 | { |
| 1195 | .start = MSM8625_INT_GPIO_GROUP1, |
| 1196 | .flags = IORESOURCE_IRQ, |
| 1197 | }, |
| 1198 | { |
| 1199 | .start = MSM8625_INT_GPIO_GROUP2, |
| 1200 | .flags = IORESOURCE_IRQ, |
| 1201 | }, |
| 1202 | }; |
| 1203 | |
| 1204 | static struct platform_device msm8625_device_gpio = { |
| 1205 | .name = "msmgpio", |
| 1206 | .id = -1, |
| 1207 | .resource = msm8625_gpio_resources, |
| 1208 | .num_resources = ARRAY_SIZE(msm8625_gpio_resources), |
| 1209 | }; |
| 1210 | |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1211 | static struct resource msm8625_resources_sdc1[] = { |
| 1212 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1213 | .name = "core_mem", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1214 | .start = MSM_SDC1_BASE, |
| 1215 | .end = MSM_SDC1_BASE + SZ_4K - 1, |
| 1216 | .flags = IORESOURCE_MEM, |
| 1217 | }, |
| 1218 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1219 | .name = "core_irq", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1220 | .start = MSM8625_INT_SDC1_0, |
| 1221 | .end = MSM8625_INT_SDC1_1, |
| 1222 | .flags = IORESOURCE_IRQ, |
| 1223 | }, |
| 1224 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1225 | .name = "dma_chnl", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1226 | .start = DMOV_SDC1_CHAN, |
| 1227 | .end = DMOV_SDC1_CHAN, |
| 1228 | .flags = IORESOURCE_DMA, |
| 1229 | }, |
| 1230 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1231 | .name = "dma_crci", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1232 | .start = DMOV_SDC1_CRCI, |
| 1233 | .end = DMOV_SDC1_CRCI, |
| 1234 | .flags = IORESOURCE_DMA, |
| 1235 | } |
| 1236 | }; |
| 1237 | |
| 1238 | static struct resource msm8625_resources_sdc2[] = { |
| 1239 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1240 | .name = "core_mem", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1241 | .start = MSM_SDC2_BASE, |
| 1242 | .end = MSM_SDC2_BASE + SZ_4K - 1, |
| 1243 | .flags = IORESOURCE_MEM, |
| 1244 | }, |
| 1245 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1246 | .name = "core_irq", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1247 | .start = MSM8625_INT_SDC2_0, |
| 1248 | .end = MSM8625_INT_SDC2_1, |
| 1249 | .flags = IORESOURCE_IRQ, |
| 1250 | }, |
| 1251 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1252 | .name = "dma_chnl", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1253 | .start = DMOV_SDC2_CHAN, |
| 1254 | .end = DMOV_SDC2_CHAN, |
| 1255 | .flags = IORESOURCE_DMA, |
| 1256 | }, |
| 1257 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1258 | .name = "dma_crci", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1259 | .start = DMOV_SDC2_CRCI, |
| 1260 | .end = DMOV_SDC2_CRCI, |
| 1261 | .flags = IORESOURCE_DMA, |
| 1262 | } |
| 1263 | }; |
| 1264 | |
| 1265 | static struct resource msm8625_resources_sdc3[] = { |
| 1266 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1267 | .name = "core_mem", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1268 | .start = MSM_SDC3_BASE, |
| 1269 | .end = MSM_SDC3_BASE + SZ_4K - 1, |
| 1270 | .flags = IORESOURCE_MEM, |
| 1271 | }, |
| 1272 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1273 | .name = "core_irq", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1274 | .start = MSM8625_INT_SDC3_0, |
| 1275 | .end = MSM8625_INT_SDC3_1, |
| 1276 | .flags = IORESOURCE_IRQ, |
| 1277 | }, |
| 1278 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1279 | .name = "dma_chnl", |
Pratibhasagar V | c483d20 | 2012-08-21 14:37:17 +0530 | [diff] [blame] | 1280 | .start = DMOV_NAND_CHAN, |
| 1281 | .end = DMOV_NAND_CHAN, |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1282 | .flags = IORESOURCE_DMA, |
| 1283 | }, |
| 1284 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1285 | .name = "dma_crci", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1286 | .start = DMOV_SDC3_CRCI, |
| 1287 | .end = DMOV_SDC3_CRCI, |
| 1288 | .flags = IORESOURCE_DMA, |
| 1289 | }, |
| 1290 | }; |
| 1291 | |
| 1292 | static struct resource msm8625_resources_sdc4[] = { |
| 1293 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1294 | .name = "core_mem", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1295 | .start = MSM_SDC4_BASE, |
| 1296 | .end = MSM_SDC4_BASE + SZ_4K - 1, |
| 1297 | .flags = IORESOURCE_MEM, |
| 1298 | }, |
| 1299 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1300 | .name = "core_irq", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1301 | .start = MSM8625_INT_SDC4_0, |
| 1302 | .end = MSM8625_INT_SDC4_1, |
| 1303 | .flags = IORESOURCE_IRQ, |
| 1304 | }, |
| 1305 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1306 | .name = "dma_chnl", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1307 | .start = DMOV_SDC4_CHAN, |
| 1308 | .end = DMOV_SDC4_CHAN, |
| 1309 | .flags = IORESOURCE_DMA, |
| 1310 | }, |
| 1311 | { |
Sujit Reddy Thumma | 1dfac2c | 2012-07-30 10:15:39 +0530 | [diff] [blame] | 1312 | .name = "dma_crci", |
Trilok Soni | ee75f6c | 2012-02-13 20:45:07 +0530 | [diff] [blame] | 1313 | .start = DMOV_SDC4_CRCI, |
| 1314 | .end = DMOV_SDC4_CRCI, |
| 1315 | .flags = IORESOURCE_DMA, |
| 1316 | }, |
| 1317 | }; |
| 1318 | |
| 1319 | struct platform_device msm8625_device_sdc1 = { |
| 1320 | .name = "msm_sdcc", |
| 1321 | .id = 1, |
| 1322 | .num_resources = ARRAY_SIZE(msm8625_resources_sdc1), |
| 1323 | .resource = msm8625_resources_sdc1, |
| 1324 | .dev = { |
| 1325 | .coherent_dma_mask = 0xffffffff, |
| 1326 | }, |
| 1327 | }; |
| 1328 | |
| 1329 | struct platform_device msm8625_device_sdc2 = { |
| 1330 | .name = "msm_sdcc", |
| 1331 | .id = 2, |
| 1332 | .num_resources = ARRAY_SIZE(msm8625_resources_sdc2), |
| 1333 | .resource = msm8625_resources_sdc2, |
| 1334 | .dev = { |
| 1335 | .coherent_dma_mask = 0xffffffff, |
| 1336 | }, |
| 1337 | }; |
| 1338 | |
| 1339 | struct platform_device msm8625_device_sdc3 = { |
| 1340 | .name = "msm_sdcc", |
| 1341 | .id = 3, |
| 1342 | .num_resources = ARRAY_SIZE(msm8625_resources_sdc3), |
| 1343 | .resource = msm8625_resources_sdc3, |
| 1344 | .dev = { |
| 1345 | .coherent_dma_mask = 0xffffffff, |
| 1346 | }, |
| 1347 | }; |
| 1348 | |
| 1349 | struct platform_device msm8625_device_sdc4 = { |
| 1350 | .name = "msm_sdcc", |
| 1351 | .id = 4, |
| 1352 | .num_resources = ARRAY_SIZE(msm8625_resources_sdc4), |
| 1353 | .resource = msm8625_resources_sdc4, |
| 1354 | .dev = { |
| 1355 | .coherent_dma_mask = 0xffffffff, |
| 1356 | }, |
| 1357 | }; |
| 1358 | |
| 1359 | static struct platform_device *msm8625_sdcc_devices[] __initdata = { |
| 1360 | &msm8625_device_sdc1, |
| 1361 | &msm8625_device_sdc2, |
| 1362 | &msm8625_device_sdc3, |
| 1363 | &msm8625_device_sdc4, |
| 1364 | }; |
| 1365 | |
| 1366 | int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat) |
| 1367 | { |
| 1368 | struct platform_device *pdev; |
| 1369 | |
| 1370 | if (controller < 1 || controller > 4) |
| 1371 | return -EINVAL; |
| 1372 | |
| 1373 | if (cpu_is_msm8625()) |
| 1374 | pdev = msm8625_sdcc_devices[controller-1]; |
| 1375 | else |
| 1376 | pdev = msm_sdcc_devices[controller-1]; |
| 1377 | |
| 1378 | pdev->dev.platform_data = plat; |
| 1379 | return platform_device_register(pdev); |
| 1380 | } |
| 1381 | |
Trilok Soni | da63a8b | 2012-02-13 20:50:03 +0530 | [diff] [blame] | 1382 | static struct resource msm8625_resources_hsusb_otg[] = { |
| 1383 | { |
| 1384 | .start = MSM_HSUSB_PHYS, |
| 1385 | .end = MSM_HSUSB_PHYS + SZ_1K - 1, |
| 1386 | .flags = IORESOURCE_MEM, |
| 1387 | }, |
| 1388 | { |
| 1389 | .start = MSM8625_INT_USB_HS, |
| 1390 | .end = MSM8625_INT_USB_HS, |
| 1391 | .flags = IORESOURCE_IRQ, |
| 1392 | }, |
| 1393 | }; |
| 1394 | |
| 1395 | struct platform_device msm8625_device_otg = { |
| 1396 | .name = "msm_otg", |
| 1397 | .id = -1, |
| 1398 | .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg), |
| 1399 | .resource = msm8625_resources_hsusb_otg, |
| 1400 | .dev = { |
| 1401 | .dma_mask = &dma_mask, |
| 1402 | .coherent_dma_mask = 0xffffffffULL, |
| 1403 | }, |
| 1404 | }; |
| 1405 | |
| 1406 | static struct resource msm8625_resources_gadget_peripheral[] = { |
| 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_gadget_peripheral = { |
| 1420 | .name = "msm_hsusb", |
| 1421 | .id = -1, |
| 1422 | .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral), |
| 1423 | .resource = msm8625_resources_gadget_peripheral, |
| 1424 | .dev = { |
| 1425 | .dma_mask = &dma_mask, |
| 1426 | .coherent_dma_mask = 0xffffffffULL, |
| 1427 | }, |
| 1428 | }; |
| 1429 | |
| 1430 | static struct resource msm8625_resources_hsusb_host[] = { |
| 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_hsusb_host = { |
| 1444 | .name = "msm_hsusb_host", |
| 1445 | .id = 0, |
| 1446 | .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host), |
| 1447 | .resource = msm8625_resources_hsusb_host, |
| 1448 | .dev = { |
| 1449 | .dma_mask = &dma_mask, |
| 1450 | .coherent_dma_mask = 0xffffffffULL, |
| 1451 | }, |
| 1452 | }; |
| 1453 | |
| 1454 | static struct platform_device *msm8625_host_devices[] = { |
| 1455 | &msm8625_device_hsusb_host, |
| 1456 | }; |
| 1457 | |
| 1458 | int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat) |
| 1459 | { |
| 1460 | struct platform_device *pdev; |
| 1461 | |
| 1462 | if (cpu_is_msm8625()) |
| 1463 | pdev = msm8625_host_devices[host]; |
| 1464 | else |
| 1465 | pdev = msm_host_devices[host]; |
| 1466 | if (!pdev) |
| 1467 | return -ENODEV; |
| 1468 | pdev->dev.platform_data = plat; |
| 1469 | return platform_device_register(pdev); |
| 1470 | } |
| 1471 | |
Trilok Soni | 88da255 | 2012-02-13 21:01:24 +0530 | [diff] [blame] | 1472 | #ifdef CONFIG_MSM_CAMERA_V4L2 |
| 1473 | static struct resource msm8625_csic0_resources[] = { |
| 1474 | { |
| 1475 | .name = "csic", |
| 1476 | .start = 0xA0F00000, |
| 1477 | .end = 0xA0F00000 + 0x00100000 - 1, |
| 1478 | .flags = IORESOURCE_MEM, |
| 1479 | }, |
| 1480 | { |
| 1481 | .name = "csic", |
| 1482 | .start = MSM8625_INT_CSI_IRQ_0, |
| 1483 | .end = MSM8625_INT_CSI_IRQ_0, |
| 1484 | .flags = IORESOURCE_IRQ, |
| 1485 | }, |
| 1486 | }; |
| 1487 | |
| 1488 | static struct resource msm8625_csic1_resources[] = { |
| 1489 | { |
| 1490 | .name = "csic", |
| 1491 | .start = 0xA1000000, |
| 1492 | .end = 0xA1000000 + 0x00100000 - 1, |
| 1493 | .flags = IORESOURCE_MEM, |
| 1494 | }, |
| 1495 | { |
| 1496 | .name = "csic", |
| 1497 | .start = MSM8625_INT_CSI_IRQ_1, |
| 1498 | .end = MSM8625_INT_CSI_IRQ_1, |
| 1499 | .flags = IORESOURCE_IRQ, |
| 1500 | }, |
| 1501 | }; |
| 1502 | |
| 1503 | struct platform_device msm8625_device_csic0 = { |
| 1504 | .name = "msm_csic", |
| 1505 | .id = 0, |
| 1506 | .resource = msm8625_csic0_resources, |
| 1507 | .num_resources = ARRAY_SIZE(msm8625_csic0_resources), |
| 1508 | }; |
| 1509 | |
| 1510 | struct platform_device msm8625_device_csic1 = { |
| 1511 | .name = "msm_csic", |
| 1512 | .id = 1, |
| 1513 | .resource = msm8625_csic1_resources, |
| 1514 | .num_resources = ARRAY_SIZE(msm8625_csic1_resources), |
| 1515 | }; |
| 1516 | #endif |
| 1517 | |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1518 | static struct resource msm8625_mipi_dsi_resources[] = { |
| 1519 | { |
| 1520 | .name = "mipi_dsi", |
| 1521 | .start = MIPI_DSI_HW_BASE, |
| 1522 | .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1, |
| 1523 | .flags = IORESOURCE_MEM, |
| 1524 | }, |
| 1525 | { |
| 1526 | .start = MSM8625_INT_DSI_IRQ, |
| 1527 | .end = MSM8625_INT_DSI_IRQ, |
| 1528 | .flags = IORESOURCE_IRQ, |
| 1529 | }, |
| 1530 | }; |
| 1531 | |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1532 | static struct platform_device msm8625_mipi_dsi_device = { |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1533 | .name = "mipi_dsi", |
| 1534 | .id = 1, |
| 1535 | .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources), |
| 1536 | .resource = msm8625_mipi_dsi_resources, |
| 1537 | }; |
| 1538 | |
| 1539 | static struct resource msm8625_mdp_resources[] = { |
| 1540 | { |
| 1541 | .name = "mdp", |
| 1542 | .start = MDP_BASE, |
| 1543 | .end = MDP_BASE + 0x000F1008 - 1, |
| 1544 | .flags = IORESOURCE_MEM, |
| 1545 | }, |
| 1546 | { |
| 1547 | .start = MSM8625_INT_MDP, |
| 1548 | .end = MSM8625_INT_MDP, |
| 1549 | .flags = IORESOURCE_IRQ, |
| 1550 | }, |
| 1551 | }; |
| 1552 | |
| 1553 | static struct platform_device msm8625_mdp_device = { |
| 1554 | .name = "mdp", |
| 1555 | .id = 0, |
| 1556 | .num_resources = ARRAY_SIZE(msm8625_mdp_resources), |
| 1557 | .resource = msm8625_mdp_resources, |
| 1558 | }; |
| 1559 | |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1560 | struct platform_device mipi_dsi_device; |
| 1561 | |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1562 | void __init msm_fb_register_device(char *name, void *data) |
| 1563 | { |
| 1564 | if (!strncmp(name, "mdp", 3)) { |
| 1565 | if (cpu_is_msm8625()) |
| 1566 | msm_register_device(&msm8625_mdp_device, data); |
| 1567 | else |
| 1568 | msm_register_device(&msm_mdp_device, data); |
| 1569 | } else if (!strncmp(name, "mipi_dsi", 8)) { |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1570 | if (cpu_is_msm8625()) { |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1571 | msm_register_device(&msm8625_mipi_dsi_device, data); |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1572 | mipi_dsi_device = msm8625_mipi_dsi_device; |
| 1573 | } else { |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1574 | msm_register_device(&msm_mipi_dsi_device, data); |
Padmanabhan Komanduru | 0b9517b | 2012-07-02 18:31:23 +0530 | [diff] [blame] | 1575 | mipi_dsi_device = msm_mipi_dsi_device; |
| 1576 | } |
Trilok Soni | ae4633d | 2012-02-13 21:08:32 +0530 | [diff] [blame] | 1577 | } else if (!strncmp(name, "lcdc", 4)) { |
| 1578 | msm_register_device(&msm_lcdc_device, data); |
| 1579 | } else { |
| 1580 | printk(KERN_ERR "%s: unknown device! %s\n", __func__, name); |
| 1581 | } |
| 1582 | } |
| 1583 | |
Trilok Soni | 664b95d | 2012-02-13 21:13:15 +0530 | [diff] [blame] | 1584 | static struct resource msm8625_kgsl_3d0_resources[] = { |
| 1585 | { |
| 1586 | .name = KGSL_3D0_REG_MEMORY, |
| 1587 | .start = 0xA0000000, |
| 1588 | .end = 0xA001ffff, |
| 1589 | .flags = IORESOURCE_MEM, |
| 1590 | }, |
| 1591 | { |
| 1592 | .name = KGSL_3D0_IRQ, |
| 1593 | .start = MSM8625_INT_GRAPHICS, |
| 1594 | .end = MSM8625_INT_GRAPHICS, |
| 1595 | .flags = IORESOURCE_IRQ, |
| 1596 | }, |
| 1597 | }; |
| 1598 | |
| 1599 | struct platform_device msm8625_kgsl_3d0 = { |
| 1600 | .name = "kgsl-3d0", |
| 1601 | .id = 0, |
| 1602 | .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources), |
| 1603 | .resource = msm8625_kgsl_3d0_resources, |
| 1604 | .dev = { |
| 1605 | .platform_data = &kgsl_3d0_pdata, |
| 1606 | }, |
| 1607 | }; |
| 1608 | |
Taniya Das | 364426e | 2012-09-28 17:09:51 +0530 | [diff] [blame] | 1609 | static struct resource pl310_resources[] = { |
| 1610 | { |
| 1611 | .start = 0xC0400000, |
| 1612 | .end = 0xC0400000 + SZ_4K - 1, |
| 1613 | .flags = IORESOURCE_MEM, |
| 1614 | }, |
| 1615 | { |
| 1616 | .name = "l2_irq", |
| 1617 | .start = MSM8625_INT_L2CC_INTR, |
| 1618 | .flags = IORESOURCE_IRQ, |
| 1619 | }, |
| 1620 | }; |
| 1621 | |
| 1622 | static struct platform_device pl310_erp_device = { |
| 1623 | .name = "pl310_erp", |
| 1624 | .id = -1, |
| 1625 | .resource = pl310_resources, |
| 1626 | .num_resources = ARRAY_SIZE(pl310_resources), |
| 1627 | }; |
| 1628 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1629 | enum { |
| 1630 | MSM8625, |
| 1631 | MSM8625A, |
| 1632 | MSM8625AB, |
| 1633 | }; |
| 1634 | |
| 1635 | static int __init msm8625_cpu_id(void) |
| 1636 | { |
| 1637 | int raw_id, cpu; |
| 1638 | |
| 1639 | raw_id = socinfo_get_raw_id(); |
| 1640 | switch (raw_id) { |
| 1641 | /* Part number for 1GHz part */ |
| 1642 | case 0x770: |
| 1643 | case 0x771: |
| 1644 | case 0x77C: |
| 1645 | case 0x780: |
Kaushal Kumar | c84b9c2 | 2012-10-12 12:47:55 +0530 | [diff] [blame^] | 1646 | case 0x785: /* Edge-only MSM8125-0 */ |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1647 | case 0x8D0: |
| 1648 | cpu = MSM8625; |
| 1649 | break; |
| 1650 | /* Part number for 1.2GHz part */ |
| 1651 | case 0x773: |
| 1652 | case 0x774: |
| 1653 | case 0x781: |
| 1654 | case 0x8D1: |
| 1655 | cpu = MSM8625A; |
| 1656 | break; |
| 1657 | case 0x775: |
| 1658 | case 0x776: |
Kaushal Kumar | 5b700f3 | 2012-09-05 16:50:19 +0530 | [diff] [blame] | 1659 | case 0x779: |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1660 | case 0x77D: |
| 1661 | case 0x782: |
| 1662 | case 0x8D2: |
| 1663 | cpu = MSM8625AB; |
| 1664 | break; |
| 1665 | default: |
| 1666 | pr_err("Invalid Raw ID\n"); |
| 1667 | return -ENODEV; |
| 1668 | } |
| 1669 | return cpu; |
| 1670 | } |
| 1671 | |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1672 | static struct resource cpr_resources[] = { |
| 1673 | { |
| 1674 | .start = MSM8625_INT_CPR_IRQ0, |
| 1675 | .flags = IORESOURCE_IRQ, |
| 1676 | }, |
| 1677 | { |
| 1678 | .start = MSM8625_CPR_PHYS, |
| 1679 | .end = MSM8625_CPR_PHYS + SZ_4K - 1, |
| 1680 | .flags = IORESOURCE_MEM, |
| 1681 | }, |
| 1682 | }; |
| 1683 | |
| 1684 | /** |
| 1685 | * These are various Vdd levels supported by PMIC |
| 1686 | */ |
| 1687 | static uint32_t msm_c2_pmic_mv[] __initdata = { |
Trilok Soni | 9573ce3 | 2012-09-02 03:50:18 +0530 | [diff] [blame] | 1688 | 1350000, 1337500, 1325000, 1312500, 1300000, |
| 1689 | 1287500, 1275000, 1262500, 1250000, 1237500, |
| 1690 | 1225000, 1212500, 1200000, 1187500, 1175000, |
| 1691 | 1162500, 1150000, 1137500, 1125000, 1112500, |
| 1692 | 1100000, 1087500, 1075000, 1062500, 0, |
| 1693 | 0, 0, 0, 0, 0, |
| 1694 | 0, 1050000, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1695 | }; |
| 1696 | |
| 1697 | /** |
| 1698 | * This data will be based on CPR mode of operation |
| 1699 | */ |
| 1700 | static struct msm_cpr_mode msm_cpr_mode_data[] = { |
| 1701 | [NORMAL_MODE] = { |
| 1702 | .ring_osc_data = { |
| 1703 | {0, }, |
| 1704 | {0, }, |
| 1705 | {0, }, |
| 1706 | {0, }, |
| 1707 | {0, }, |
| 1708 | {0, }, |
| 1709 | {0, }, |
| 1710 | {0, }, |
| 1711 | }, |
| 1712 | .ring_osc = 0, |
| 1713 | .step_quot = ~0, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1714 | .tgt_volt_offset = 0, |
Trilok Soni | db64ae9 | 2012-09-02 02:09:04 +0530 | [diff] [blame] | 1715 | .nom_Vmax = 1350000, |
| 1716 | .nom_Vmin = 1250000, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1717 | .calibrated_uV = 1100000, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1718 | }, |
| 1719 | [TURBO_MODE] = { |
| 1720 | .ring_osc_data = { |
| 1721 | {0, }, |
| 1722 | {0, }, |
| 1723 | {0, }, |
| 1724 | {0, }, |
| 1725 | {0, }, |
| 1726 | {0, }, |
| 1727 | {0, }, |
| 1728 | {0, }, |
| 1729 | }, |
| 1730 | .ring_osc = 0, |
| 1731 | .step_quot = ~0, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1732 | .tgt_volt_offset = 0, |
Trilok Soni | db64ae9 | 2012-09-02 02:09:04 +0530 | [diff] [blame] | 1733 | .turbo_Vmax = 1350000, |
Kaushal Kumar | 1f549fc | 2012-10-04 11:45:32 +0530 | [diff] [blame] | 1734 | .turbo_Vmin = 1150000, |
Trilok Soni | db64ae9 | 2012-09-02 02:09:04 +0530 | [diff] [blame] | 1735 | .nom_Vmax = 1350000, |
Kaushal Kumar | 1f549fc | 2012-10-04 11:45:32 +0530 | [diff] [blame] | 1736 | .nom_Vmin = 1150000, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1737 | .calibrated_uV = 1300000, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1738 | }, |
| 1739 | }; |
| 1740 | |
| 1741 | struct msm_cpr_vp_data vp_data = { |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1742 | .min_volt = 1000000, |
| 1743 | .max_volt = 1350000, |
| 1744 | .default_volt = 1300000, |
| 1745 | .step_size = 12500, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1746 | }; |
| 1747 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1748 | static uint32_t |
| 1749 | msm_cpr_get_quot(uint32_t max_quot, uint32_t max_freq, uint32_t new_freq) |
| 1750 | { |
| 1751 | uint32_t quot; |
| 1752 | |
| 1753 | /* This formula is as per chip characterization data */ |
Kaushal Kumar | ddd521c | 2012-09-18 19:50:53 +0530 | [diff] [blame] | 1754 | quot = max_quot - (((max_freq - new_freq) * 7) / 10); |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1755 | |
| 1756 | return quot; |
| 1757 | } |
| 1758 | |
| 1759 | static void msm_cpr_clk_enable(void) |
| 1760 | { |
| 1761 | uint32_t reg_val; |
| 1762 | |
| 1763 | /* Select TCXO (19.2MHz) as clock source */ |
| 1764 | reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR); |
| 1765 | reg_val |= RBCPR_CLK_MUX_SEL; |
| 1766 | writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR); |
| 1767 | |
| 1768 | /* Get CPR out of reset */ |
| 1769 | writel_relaxed(0x1, RBCPR_SW_RESET_N); |
| 1770 | } |
| 1771 | |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1772 | static struct msm_cpr_config msm_cpr_pdata = { |
| 1773 | .ref_clk_khz = 19200, |
Kaushal Kumar | 3e60a10 | 2012-10-15 16:54:16 +0530 | [diff] [blame] | 1774 | .delay_us = 25000, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1775 | .irq_line = 0, |
| 1776 | .cpr_mode_data = msm_cpr_mode_data, |
| 1777 | .tgt_count_div_N = 1, |
| 1778 | .floor = 0, |
| 1779 | .ceiling = 40, |
| 1780 | .sw_vlevel = 20, |
| 1781 | .up_threshold = 1, |
Kaushal Kumar | 3e60a10 | 2012-10-15 16:54:16 +0530 | [diff] [blame] | 1782 | .dn_threshold = 3, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1783 | .up_margin = 0, |
| 1784 | .dn_margin = 0, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1785 | .max_nom_freq = 700800, |
| 1786 | .max_freq = 1401600, |
| 1787 | .max_quot = 0, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1788 | .vp_data = &vp_data, |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1789 | .get_quot = msm_cpr_get_quot, |
| 1790 | .clk_enable = msm_cpr_clk_enable, |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1791 | }; |
| 1792 | |
| 1793 | static struct platform_device msm8625_device_cpr = { |
| 1794 | .name = "msm-cpr", |
| 1795 | .id = -1, |
| 1796 | .num_resources = ARRAY_SIZE(cpr_resources), |
| 1797 | .resource = cpr_resources, |
| 1798 | .dev = { |
| 1799 | .platform_data = &msm_cpr_pdata, |
| 1800 | }, |
| 1801 | }; |
| 1802 | |
| 1803 | static struct platform_device msm8625_vp_device = { |
| 1804 | .name = "vp-regulator", |
| 1805 | .id = -1, |
| 1806 | }; |
| 1807 | |
| 1808 | static void __init msm_cpr_init(void) |
| 1809 | { |
| 1810 | struct cpr_info_type *cpr_info = NULL; |
| 1811 | uint8_t ring_osc = 0; |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1812 | |
| 1813 | cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL); |
| 1814 | if (!cpr_info) { |
| 1815 | pr_err("%s: Out of memory %d\n", __func__, -ENOMEM); |
| 1816 | return; |
| 1817 | } |
| 1818 | |
| 1819 | msm_smem_get_cpr_info(cpr_info); |
| 1820 | |
| 1821 | /** |
| 1822 | * Set the ring_osc based on efuse BIT(0) |
| 1823 | * CPR_fuse[0] = 0 selects 2nd RO (010) |
| 1824 | * CPR_fuse[0] = 1 select 3rd RO (011) |
| 1825 | */ |
| 1826 | if (cpr_info->ring_osc == 0x0) |
| 1827 | ring_osc = 0x2; |
| 1828 | else if (cpr_info->ring_osc == 0x1) |
| 1829 | ring_osc = 0x3; |
| 1830 | |
| 1831 | msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc; |
| 1832 | msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc; |
| 1833 | |
| 1834 | /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */ |
| 1835 | msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19; |
| 1836 | msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19; |
| 1837 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1838 | /** |
| 1839 | * The scaling factor and offset are as per chip characterization data |
| 1840 | * This formula is used since available fuse bits in the chip are not |
| 1841 | * enough to represent the value of maximum quot |
| 1842 | */ |
Trilok Soni | 7f31117 | 2012-09-02 15:15:33 +0530 | [diff] [blame] | 1843 | msm_cpr_pdata.max_quot = cpr_info->turbo_quot * 10 + 600; |
Kaushal Kumar | bcb46d9 | 2012-10-04 11:31:14 +0530 | [diff] [blame] | 1844 | /** |
| 1845 | * Fused Quot value for 1.2GHz on a 1.2GHz part is lower than |
| 1846 | * the quot value calculated using the scaling factor formula for |
| 1847 | * 1.2GHz when running on a 1.4GHz part. So, prop up the Quot for |
| 1848 | * a 1.2GHz part by a chip characterization recommended value. |
| 1849 | * Ditto for a 1.0GHz part. |
| 1850 | */ |
| 1851 | if (msm8625_cpu_id() == MSM8625A) { |
Kaushal Kumar | 3a9f6c8 | 2012-10-19 15:30:28 +0530 | [diff] [blame] | 1852 | msm_cpr_pdata.max_quot += 30; |
Kaushal Kumar | bcb46d9 | 2012-10-04 11:31:14 +0530 | [diff] [blame] | 1853 | if (msm_cpr_pdata.max_quot > 1400) |
| 1854 | msm_cpr_pdata.max_quot = 1400; |
| 1855 | } else if (msm8625_cpu_id() == MSM8625) { |
Kaushal Kumar | 3a9f6c8 | 2012-10-19 15:30:28 +0530 | [diff] [blame] | 1856 | msm_cpr_pdata.max_quot += 50; |
Kaushal Kumar | bcb46d9 | 2012-10-04 11:31:14 +0530 | [diff] [blame] | 1857 | if (msm_cpr_pdata.max_quot > 1350) |
| 1858 | msm_cpr_pdata.max_quot = 1350; |
| 1859 | } |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1860 | |
| 1861 | /** |
| 1862 | * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage. |
| 1863 | * Boot up mode is by default Turbo. |
| 1864 | */ |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1865 | msm_cpr_mode_data[TURBO_MODE].calibrated_uV = |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1866 | msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F]; |
| 1867 | |
Kaushal Kumar | 1f549fc | 2012-10-04 11:45:32 +0530 | [diff] [blame] | 1868 | if ((cpr_info->floor_fuse & 0x3) == 0x0) { |
| 1869 | msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1000000; |
| 1870 | msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000; |
| 1871 | } else if ((cpr_info->floor_fuse & 0x3) == 0x1) { |
| 1872 | msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1050000; |
| 1873 | msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000; |
| 1874 | } else if ((cpr_info->floor_fuse & 0x3) == 0x2) { |
| 1875 | msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1100000; |
| 1876 | msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000; |
| 1877 | } |
| 1878 | |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1879 | pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__, |
| 1880 | msm_cpr_mode_data[TURBO_MODE].ring_osc); |
| 1881 | pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot); |
| 1882 | 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] | 1883 | pr_debug("%s: cpr: floor_fuse: 0x%x\n", __func__, cpr_info->floor_fuse); |
| 1884 | pr_debug("%s: cpr: nom_Vmin: %d, turbo_Vmin: %d\n", __func__, |
| 1885 | msm_cpr_mode_data[TURBO_MODE].nom_Vmin, |
| 1886 | msm_cpr_mode_data[TURBO_MODE].turbo_Vmin); |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1887 | kfree(cpr_info); |
| 1888 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1889 | if (msm8625_cpu_id() == MSM8625A) |
| 1890 | msm_cpr_pdata.max_freq = 1209600; |
| 1891 | else if (msm8625_cpu_id() == MSM8625) |
| 1892 | msm_cpr_pdata.max_freq = 1008000; |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1893 | |
Kaushal Kumar | d0e4c81 | 2012-08-22 16:30:09 +0530 | [diff] [blame] | 1894 | msm_cpr_clk_enable(); |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 1895 | |
| 1896 | platform_device_register(&msm8625_vp_device); |
| 1897 | platform_device_register(&msm8625_device_cpr); |
| 1898 | } |
| 1899 | |
Taniya Das | 7c9f051 | 2011-12-02 14:26:46 +0530 | [diff] [blame] | 1900 | static struct clk_lookup msm_clock_8625_dummy[] = { |
| 1901 | CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0), |
| 1902 | CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0), |
| 1903 | CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0), |
| 1904 | CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0), |
| 1905 | CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0), |
| 1906 | CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0), |
| 1907 | CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0), |
| 1908 | CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0), |
| 1909 | CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0), |
| 1910 | CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0), |
| 1911 | CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0), |
| 1912 | CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0), |
| 1913 | CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0), |
| 1914 | CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0), |
| 1915 | CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0), |
| 1916 | CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0), |
| 1917 | CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0), |
| 1918 | CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0), |
| 1919 | CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0), |
| 1920 | CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0), |
| 1921 | CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0), |
| 1922 | CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0), |
| 1923 | CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0), |
| 1924 | CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0), |
| 1925 | CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0), |
| 1926 | CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0), |
| 1927 | CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0), |
| 1928 | CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0), |
| 1929 | CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0), |
| 1930 | CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0), |
| 1931 | CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0), |
| 1932 | CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0), |
| 1933 | CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0), |
| 1934 | CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0), |
| 1935 | CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0), |
| 1936 | CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0), |
| 1937 | CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0), |
| 1938 | CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0), |
| 1939 | CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0), |
| 1940 | CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0), |
| 1941 | CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0), |
| 1942 | CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0), |
| 1943 | CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0), |
| 1944 | CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0), |
| 1945 | CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0), |
| 1946 | CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0), |
| 1947 | CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0), |
| 1948 | CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0), |
| 1949 | CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0), |
| 1950 | CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0), |
| 1951 | CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0), |
| 1952 | CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0), |
| 1953 | CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0), |
| 1954 | CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0), |
| 1955 | CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0), |
| 1956 | CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0), |
| 1957 | CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0), |
| 1958 | CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0), |
| 1959 | CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0), |
| 1960 | }; |
| 1961 | |
| 1962 | struct clock_init_data msm8625_dummy_clock_init_data __initdata = { |
| 1963 | .table = msm_clock_8625_dummy, |
| 1964 | .size = ARRAY_SIZE(msm_clock_8625_dummy), |
| 1965 | }; |
Pankaj Kumar | 50c705c | 2012-01-10 12:02:07 +0530 | [diff] [blame] | 1966 | |
Taniya Das | 6e0ff0d | 2012-10-12 11:38:32 +0530 | [diff] [blame] | 1967 | |
| 1968 | static int __init msm_gpio_config_gps(void) |
| 1969 | { |
| 1970 | unsigned int gps_gpio = 7; |
| 1971 | int ret = 0; |
| 1972 | |
| 1973 | if (!machine_is_msm8625_evb()) |
| 1974 | return ret; |
| 1975 | |
| 1976 | ret = gpio_tlmm_config(GPIO_CFG(gps_gpio, 0, GPIO_CFG_OUTPUT, |
| 1977 | GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 1978 | if (ret < 0) { |
| 1979 | pr_err("gpio tlmm failed for gpio-%d\n", gps_gpio); |
| 1980 | return ret; |
| 1981 | } |
| 1982 | |
| 1983 | ret = gpio_request(gps_gpio, "gnss-gpio"); |
| 1984 | if (ret < 0) { |
| 1985 | pr_err("failed to request gpio-%d\n", gps_gpio); |
| 1986 | return ret; |
| 1987 | } |
| 1988 | |
| 1989 | ret = gpio_direction_input(gps_gpio); |
| 1990 | if (ret < 0) { |
| 1991 | pr_err("failed to change direction for gpio-%d\n", gps_gpio); |
| 1992 | return ret; |
| 1993 | } |
| 1994 | |
| 1995 | ret = gpio_export(gps_gpio, true); |
| 1996 | if (ret < 0) |
| 1997 | pr_err("failed to export gpio for user\n"); |
| 1998 | |
| 1999 | return ret; |
| 2000 | } |
| 2001 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2002 | int __init msm7x2x_misc_init(void) |
| 2003 | { |
Taniya Das | 7c9f051 | 2011-12-02 14:26:46 +0530 | [diff] [blame] | 2004 | if (machine_is_msm8625_rumi3()) { |
| 2005 | msm_clock_init(&msm8625_dummy_clock_init_data); |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 2006 | msm_cpr_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2007 | return 0; |
Taniya Das | 7c9f051 | 2011-12-02 14:26:46 +0530 | [diff] [blame] | 2008 | } |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2009 | |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 2010 | msm_clock_init(&msm7x27a_clock_init_data); |
Pankaj Kumar | fee56a8 | 2012-04-17 14:26:49 +0530 | [diff] [blame] | 2011 | if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab()) |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 2012 | platform_device_register(&msm7x27aa_device_acpuclk); |
Pankaj Kumar | 50c705c | 2012-01-10 12:02:07 +0530 | [diff] [blame] | 2013 | else if (cpu_is_msm8625()) { |
| 2014 | if (msm8625_cpu_id() == MSM8625) |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 2015 | platform_device_register(&msm7x27aa_device_acpuclk); |
Pankaj Kumar | 50c705c | 2012-01-10 12:02:07 +0530 | [diff] [blame] | 2016 | else if (msm8625_cpu_id() == MSM8625A) |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 2017 | platform_device_register(&msm8625_device_acpuclk); |
Kaushal Kumar | 86473f0 | 2012-06-28 19:35:58 +0530 | [diff] [blame] | 2018 | else if (msm8625_cpu_id() == MSM8625AB) |
| 2019 | platform_device_register(&msm8625ab_device_acpuclk); |
Matt Wagantall | bf430eb | 2012-03-22 11:45:49 -0700 | [diff] [blame] | 2020 | } else { |
| 2021 | platform_device_register(&msm7x27a_device_acpuclk); |
| 2022 | } |
Kaushal Kumar | c0e5d67 | 2012-07-31 16:07:49 +0530 | [diff] [blame] | 2023 | |
| 2024 | if (cpu_is_msm8625() && |
| 2025 | (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)) |
| 2026 | msm_cpr_init(); |
| 2027 | |
Taniya Das | 364426e | 2012-09-28 17:09:51 +0530 | [diff] [blame] | 2028 | if (!cpu_is_msm8625()) |
| 2029 | pl310_resources[1].start = INT_L2CC_INTR; |
| 2030 | |
| 2031 | platform_device_register(&pl310_erp_device); |
| 2032 | |
Taniya Das | 6e0ff0d | 2012-10-12 11:38:32 +0530 | [diff] [blame] | 2033 | if (msm_gpio_config_gps() < 0) |
| 2034 | pr_err("Error for gpio config for GPS gpio\n"); |
| 2035 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2036 | return 0; |
| 2037 | } |
| 2038 | |
| 2039 | #ifdef CONFIG_CACHE_L2X0 |
| 2040 | static int __init msm7x27x_cache_init(void) |
| 2041 | { |
| 2042 | int aux_ctrl = 0; |
Prachee Ramsinghani | 86b1f65 | 2012-04-03 16:01:30 +0530 | [diff] [blame] | 2043 | int pctrl = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2044 | |
| 2045 | /* Way Size 010(0x2) 32KB */ |
| 2046 | aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \ |
| 2047 | (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \ |
| 2048 | (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT); |
| 2049 | |
Taniya Das | 379b568 | 2011-12-02 14:53:46 +0530 | [diff] [blame] | 2050 | if (cpu_is_msm8625()) { |
| 2051 | /* Way Size 011(0x3) 64KB */ |
| 2052 | aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \ |
| 2053 | (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \ |
Prachee Ramsinghani | 86b1f65 | 2012-04-03 16:01:30 +0530 | [diff] [blame] | 2054 | (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \ |
| 2055 | (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT); |
| 2056 | |
| 2057 | /* Write Prefetch Control settings */ |
| 2058 | pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL); |
| 2059 | pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \ |
| 2060 | (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \ |
| 2061 | (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT); |
| 2062 | writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL); |
Taniya Das | 379b568 | 2011-12-02 14:53:46 +0530 | [diff] [blame] | 2063 | } |
| 2064 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2065 | l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK); |
Prachee Ramsinghani | 86b1f65 | 2012-04-03 16:01:30 +0530 | [diff] [blame] | 2066 | if (cpu_is_msm8625()) { |
| 2067 | pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL); |
| 2068 | pr_info("Prfetch Ctrl: 0x%08x\n", pctrl); |
| 2069 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2070 | |
| 2071 | return 0; |
| 2072 | } |
| 2073 | #else |
pankaj kumar | 80d7cb6 | 2011-08-23 13:37:55 +0530 | [diff] [blame] | 2074 | static int __init msm7x27x_cache_init(void){ return 0; } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2075 | #endif |
| 2076 | |
| 2077 | void __init msm_common_io_init(void) |
| 2078 | { |
| 2079 | msm_map_common_io(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2080 | if (socinfo_init() < 0) |
| 2081 | pr_err("%s: socinfo_init() failed!\n", __func__); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2082 | msm7x27x_cache_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2083 | } |
| 2084 | |
| 2085 | void __init msm8625_init_irq(void) |
| 2086 | { |
Trilok Soni | 1a9fdee | 2012-05-28 19:54:11 +0530 | [diff] [blame] | 2087 | msm_gic_irq_extn_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2088 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 2089 | (void *)MSM_QGIC_CPU_BASE); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2090 | } |
| 2091 | |
| 2092 | void __init msm8625_map_io(void) |
| 2093 | { |
| 2094 | msm_map_msm8625_io(); |
| 2095 | |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 2096 | if (socinfo_init() < 0) |
| 2097 | pr_err("%s: socinfo_init() failed!\n", __func__); |
Taniya Das | 379b568 | 2011-12-02 14:53:46 +0530 | [diff] [blame] | 2098 | msm7x27x_cache_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2099 | } |
| 2100 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2101 | static int msm7627a_init_gpio(void) |
| 2102 | { |
Taniya Das | 6684d62 | 2012-01-12 10:29:09 +0530 | [diff] [blame] | 2103 | if (cpu_is_msm8625()) |
| 2104 | platform_device_register(&msm8625_device_gpio); |
| 2105 | else |
| 2106 | platform_device_register(&msm_device_gpio); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 2107 | return 0; |
| 2108 | } |
| 2109 | postcore_initcall(msm7627a_init_gpio); |
Taniya Das | 9d0c3c5 | 2012-05-04 14:40:55 +0530 | [diff] [blame] | 2110 | |
| 2111 | static int msm7627a_panic_handler(struct notifier_block *this, |
| 2112 | unsigned long event, void *ptr) |
| 2113 | { |
| 2114 | flush_cache_all(); |
| 2115 | outer_flush_all(); |
| 2116 | return NOTIFY_DONE; |
| 2117 | } |
| 2118 | |
| 2119 | static struct notifier_block panic_handler = { |
| 2120 | .notifier_call = msm7627a_panic_handler, |
Aparna Mallavarapu | a999047 | 2012-09-26 12:25:24 +0530 | [diff] [blame] | 2121 | .priority = INT_MAX, |
Taniya Das | 9d0c3c5 | 2012-05-04 14:40:55 +0530 | [diff] [blame] | 2122 | }; |
| 2123 | |
| 2124 | static int __init panic_register(void) |
| 2125 | { |
| 2126 | atomic_notifier_chain_register(&panic_notifier_list, |
| 2127 | &panic_handler); |
| 2128 | return 0; |
| 2129 | } |
| 2130 | module_init(panic_register); |