Michael Bohan | 0425f6f | 2012-01-17 14:36:39 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -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/io.h> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 16 | #include <linux/gpio.h> |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 17 | #include <linux/irq.h> |
| 18 | #include <linux/irqdomain.h> |
| 19 | #include <linux/of.h> |
| 20 | #include <linux/of_address.h> |
| 21 | #include <linux/of_platform.h> |
Michael Bohan | c722453 | 2012-01-06 16:02:52 -0800 | [diff] [blame] | 22 | #include <linux/of_irq.h> |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 23 | #ifdef CONFIG_ION_MSM |
| 24 | #include <linux/ion.h> |
| 25 | #endif |
| 26 | #include <linux/memory.h> |
| 27 | #ifdef CONFIG_ANDROID_PMEM |
| 28 | #include <linux/android_pmem.h> |
| 29 | #endif |
Michael Bohan | 037a0f5 | 2012-02-29 19:13:09 -0800 | [diff] [blame] | 30 | #include <linux/regulator/stub-regulator.h> |
Matt Wagantall | ecaa117 | 2012-05-08 21:38:45 -0700 | [diff] [blame] | 31 | #include <linux/regulator/machine.h> |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 32 | #include <asm/mach/map.h> |
| 33 | #include <asm/hardware/gic.h> |
| 34 | #include <mach/board.h> |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 35 | #include <mach/gpiomux.h> |
| 36 | #include <mach/msm_iomap.h> |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 37 | #ifdef CONFIG_ION_MSM |
| 38 | #include <mach/ion.h> |
| 39 | #endif |
| 40 | #include <mach/msm_memtypes.h> |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 41 | #include <mach/msm_smd.h> |
Mahesh Sivasubramanian | a8ff992 | 2012-03-27 17:50:42 -0600 | [diff] [blame] | 42 | #include <mach/rpm-smd.h> |
David Collins | 8f4cebc | 2012-05-08 16:54:50 -0700 | [diff] [blame] | 43 | #include <mach/rpm-regulator-smd.h> |
Michael Bohan | 115cf65 | 2012-01-05 14:32:59 -0800 | [diff] [blame] | 44 | #include <mach/qpnp-int.h> |
Vikram Mulukutla | aeadb5f | 2012-05-04 14:03:07 -0700 | [diff] [blame] | 45 | #include <mach/socinfo.h> |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 46 | #include "clock.h" |
Michael Bohan | 037a0f5 | 2012-02-29 19:13:09 -0800 | [diff] [blame] | 47 | #include "devices.h" |
Praveen Chidambaram | da9501d | 2012-04-26 19:48:29 -0600 | [diff] [blame] | 48 | #include "spm.h" |
Jeff Hugo | a643ca1 | 2012-06-11 16:00:23 -0600 | [diff] [blame] | 49 | #include "modem_notifier.h" |
Girish Mahadevan | 40abbe1 | 2012-04-25 14:58:13 -0600 | [diff] [blame] | 50 | #include "lpm_resources.h" |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 51 | |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 52 | #define MSM_KERNEL_EBI1_MEM_SIZE 0x280000 |
| 53 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 54 | #define MSM_ION_SF_SIZE 0x4000000 /* 64 Mbytes */ |
| 55 | #else |
| 56 | #define MSM_ION_SF_SIZE 0x2800000 /* 40 Mbytes */ |
| 57 | #endif |
Ashray Kulkarni | 2ad8a7d | 2012-05-15 14:03:44 -0700 | [diff] [blame] | 58 | #define MSM_ION_MM_FW_SIZE 0xa00000 /* (10MB) */ |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 59 | #define MSM_ION_MM_SIZE 0x7800000 /* (120MB) */ |
| 60 | #define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */ |
| 61 | #define MSM_ION_MFC_SIZE SZ_8K |
| 62 | #define MSM_ION_AUDIO_SIZE 0x2B4000 |
| 63 | #define MSM_ION_HEAP_NUM 8 |
| 64 | |
| 65 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 66 | static unsigned kernel_ebi1_mem_size = MSM_KERNEL_EBI1_MEM_SIZE; |
| 67 | static int __init kernel_ebi1_mem_size_setup(char *p) |
| 68 | { |
| 69 | kernel_ebi1_mem_size = memparse(p, NULL); |
| 70 | return 0; |
| 71 | } |
| 72 | early_param("kernel_ebi1_mem_size", kernel_ebi1_mem_size_setup); |
| 73 | #endif |
| 74 | |
| 75 | static struct memtype_reserve msm_copper_reserve_table[] __initdata = { |
| 76 | [MEMTYPE_SMI] = { |
| 77 | }, |
| 78 | [MEMTYPE_EBI0] = { |
| 79 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 80 | }, |
| 81 | [MEMTYPE_EBI1] = { |
| 82 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 83 | }, |
| 84 | }; |
| 85 | |
| 86 | static int msm_copper_paddr_to_memtype(unsigned int paddr) |
| 87 | { |
| 88 | return MEMTYPE_EBI1; |
| 89 | } |
| 90 | |
| 91 | #ifdef CONFIG_ION_MSM |
| 92 | static struct ion_cp_heap_pdata cp_mm_ion_pdata = { |
| 93 | .permission_type = IPT_TYPE_MM_CARVEOUT, |
| 94 | .align = PAGE_SIZE, |
| 95 | }; |
| 96 | |
| 97 | static struct ion_cp_heap_pdata cp_mfc_ion_pdata = { |
| 98 | .permission_type = IPT_TYPE_MFC_SHAREDMEM, |
| 99 | .align = PAGE_SIZE, |
| 100 | }; |
| 101 | |
| 102 | static struct ion_co_heap_pdata co_ion_pdata = { |
| 103 | .adjacent_mem_id = INVALID_HEAP_ID, |
| 104 | .align = PAGE_SIZE, |
| 105 | }; |
| 106 | |
| 107 | static struct ion_co_heap_pdata fw_co_ion_pdata = { |
| 108 | .adjacent_mem_id = ION_CP_MM_HEAP_ID, |
| 109 | .align = SZ_128K, |
| 110 | }; |
| 111 | |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 112 | /** |
| 113 | * These heaps are listed in the order they will be allocated. Due to |
| 114 | * video hardware restrictions and content protection the FW heap has to |
| 115 | * be allocated adjacent (below) the MM heap and the MFC heap has to be |
| 116 | * allocated after the MM heap to ensure MFC heap is not more than 256MB |
| 117 | * away from the base address of the FW heap. |
| 118 | * However, the order of FW heap and MM heap doesn't matter since these |
| 119 | * two heaps are taken care of by separate code to ensure they are adjacent |
| 120 | * to each other. |
| 121 | * Don't swap the order unless you know what you are doing! |
| 122 | */ |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 123 | static struct ion_platform_data ion_pdata = { |
| 124 | .nr = MSM_ION_HEAP_NUM, |
| 125 | .heaps = { |
| 126 | { |
| 127 | .id = ION_SYSTEM_HEAP_ID, |
| 128 | .type = ION_HEAP_TYPE_SYSTEM, |
| 129 | .name = ION_VMALLOC_HEAP_NAME, |
| 130 | }, |
| 131 | { |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 132 | .id = ION_CP_MM_HEAP_ID, |
| 133 | .type = ION_HEAP_TYPE_CP, |
| 134 | .name = ION_MM_HEAP_NAME, |
| 135 | .size = MSM_ION_MM_SIZE, |
| 136 | .memory_type = ION_EBI_TYPE, |
| 137 | .extra_data = (void *) &cp_mm_ion_pdata, |
| 138 | }, |
| 139 | { |
| 140 | .id = ION_MM_FIRMWARE_HEAP_ID, |
| 141 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 142 | .name = ION_MM_FIRMWARE_HEAP_NAME, |
| 143 | .size = MSM_ION_MM_FW_SIZE, |
| 144 | .memory_type = ION_EBI_TYPE, |
| 145 | .extra_data = (void *) &fw_co_ion_pdata, |
| 146 | }, |
| 147 | { |
| 148 | .id = ION_CP_MFC_HEAP_ID, |
| 149 | .type = ION_HEAP_TYPE_CP, |
| 150 | .name = ION_MFC_HEAP_NAME, |
| 151 | .size = MSM_ION_MFC_SIZE, |
| 152 | .memory_type = ION_EBI_TYPE, |
| 153 | .extra_data = (void *) &cp_mfc_ion_pdata, |
| 154 | }, |
| 155 | { |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 156 | .id = ION_SF_HEAP_ID, |
| 157 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 158 | .name = ION_SF_HEAP_NAME, |
| 159 | .size = MSM_ION_SF_SIZE, |
| 160 | .memory_type = ION_EBI_TYPE, |
| 161 | .extra_data = (void *) &co_ion_pdata, |
| 162 | }, |
| 163 | { |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 164 | .id = ION_IOMMU_HEAP_ID, |
| 165 | .type = ION_HEAP_TYPE_IOMMU, |
| 166 | .name = ION_IOMMU_HEAP_NAME, |
| 167 | }, |
| 168 | { |
| 169 | .id = ION_QSECOM_HEAP_ID, |
| 170 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 171 | .name = ION_QSECOM_HEAP_NAME, |
| 172 | .size = MSM_ION_QSECOM_SIZE, |
| 173 | .memory_type = ION_EBI_TYPE, |
| 174 | .extra_data = (void *) &co_ion_pdata, |
| 175 | }, |
| 176 | { |
| 177 | .id = ION_AUDIO_HEAP_ID, |
| 178 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 179 | .name = ION_AUDIO_HEAP_NAME, |
| 180 | .size = MSM_ION_AUDIO_SIZE, |
| 181 | .memory_type = ION_EBI_TYPE, |
| 182 | .extra_data = (void *) &co_ion_pdata, |
| 183 | }, |
| 184 | } |
| 185 | }; |
| 186 | |
| 187 | static struct platform_device ion_dev = { |
| 188 | .name = "ion-msm", |
| 189 | .id = 1, |
| 190 | .dev = { .platform_data = &ion_pdata }, |
| 191 | }; |
| 192 | |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 193 | static void __init reserve_ion_memory(void) |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 194 | { |
| 195 | msm_copper_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE; |
| 196 | msm_copper_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE; |
| 197 | msm_copper_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE; |
| 198 | msm_copper_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE; |
| 199 | msm_copper_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE; |
| 200 | msm_copper_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE; |
| 201 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 202 | msm_copper_reserve_table[MEMTYPE_EBI1].size += kernel_ebi1_mem_size; |
| 203 | #endif |
| 204 | } |
| 205 | #endif |
| 206 | |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 207 | static struct resource smd_resource[] = { |
| 208 | { |
| 209 | .name = "modem_smd_in", |
| 210 | .start = 32 + 17, /* mss_sw_to_kpss_ipc_irq0 */ |
| 211 | .flags = IORESOURCE_IRQ, |
| 212 | }, |
| 213 | { |
| 214 | .name = "modem_smsm_in", |
| 215 | .start = 32 + 18, /* mss_sw_to_kpss_ipc_irq1 */ |
| 216 | .flags = IORESOURCE_IRQ, |
| 217 | }, |
| 218 | { |
| 219 | .name = "adsp_smd_in", |
| 220 | .start = 32 + 156, /* lpass_to_kpss_ipc_irq0 */ |
| 221 | .flags = IORESOURCE_IRQ, |
| 222 | }, |
| 223 | { |
| 224 | .name = "adsp_smsm_in", |
| 225 | .start = 32 + 157, /* lpass_to_kpss_ipc_irq1 */ |
| 226 | .flags = IORESOURCE_IRQ, |
| 227 | }, |
| 228 | { |
| 229 | .name = "wcnss_smd_in", |
| 230 | .start = 32 + 142, /* WcnssAppsSmdMedIrq */ |
| 231 | .flags = IORESOURCE_IRQ, |
| 232 | }, |
| 233 | { |
| 234 | .name = "wcnss_smsm_in", |
Jeff Hugo | 8904627 | 2012-03-29 14:45:37 -0600 | [diff] [blame] | 235 | .start = 32 + 144, /* RivaAppsWlanSmsmIrq */ |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 236 | .flags = IORESOURCE_IRQ, |
| 237 | }, |
Jeff Hugo | 9a5dc6e | 2012-03-29 14:39:42 -0600 | [diff] [blame] | 238 | { |
| 239 | .name = "rpm_smd_in", |
| 240 | .start = 32 + 168, /* rpm_to_kpss_ipc_irq4 */ |
| 241 | .flags = IORESOURCE_IRQ, |
| 242 | }, |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 243 | }; |
| 244 | |
| 245 | static struct smd_subsystem_config smd_config_list[] = { |
| 246 | { |
| 247 | .irq_config_id = SMD_MODEM, |
| 248 | .subsys_name = "modem", |
| 249 | .edge = SMD_APPS_MODEM, |
| 250 | |
| 251 | .smd_int.irq_name = "modem_smd_in", |
| 252 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 253 | .smd_int.irq_id = -1, |
| 254 | .smd_int.device_name = "smd_dev", |
| 255 | .smd_int.dev_id = 0, |
| 256 | .smd_int.out_bit_pos = 1 << 12, |
| 257 | .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 258 | .smd_int.out_offset = 0x8, |
| 259 | |
| 260 | .smsm_int.irq_name = "modem_smsm_in", |
| 261 | .smsm_int.flags = IRQF_TRIGGER_RISING, |
| 262 | .smsm_int.irq_id = -1, |
| 263 | .smsm_int.device_name = "smsm_dev", |
| 264 | .smsm_int.dev_id = 0, |
| 265 | .smsm_int.out_bit_pos = 1 << 13, |
| 266 | .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 267 | .smsm_int.out_offset = 0x8, |
| 268 | }, |
| 269 | { |
| 270 | .irq_config_id = SMD_Q6, |
| 271 | .subsys_name = "q6", |
| 272 | .edge = SMD_APPS_QDSP, |
| 273 | |
| 274 | .smd_int.irq_name = "adsp_smd_in", |
| 275 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 276 | .smd_int.irq_id = -1, |
| 277 | .smd_int.device_name = "smd_dev", |
| 278 | .smd_int.dev_id = 0, |
| 279 | .smd_int.out_bit_pos = 1 << 8, |
| 280 | .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 281 | .smd_int.out_offset = 0x8, |
| 282 | |
| 283 | .smsm_int.irq_name = "adsp_smsm_in", |
| 284 | .smsm_int.flags = IRQF_TRIGGER_RISING, |
| 285 | .smsm_int.irq_id = -1, |
| 286 | .smsm_int.device_name = "smsm_dev", |
| 287 | .smsm_int.dev_id = 0, |
| 288 | .smsm_int.out_bit_pos = 1 << 9, |
| 289 | .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 290 | .smsm_int.out_offset = 0x8, |
| 291 | }, |
| 292 | { |
| 293 | .irq_config_id = SMD_WCNSS, |
| 294 | .subsys_name = "wcnss", |
| 295 | .edge = SMD_APPS_WCNSS, |
| 296 | |
| 297 | .smd_int.irq_name = "wcnss_smd_in", |
| 298 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 299 | .smd_int.irq_id = -1, |
| 300 | .smd_int.device_name = "smd_dev", |
| 301 | .smd_int.dev_id = 0, |
| 302 | .smd_int.out_bit_pos = 1 << 17, |
| 303 | .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 304 | .smd_int.out_offset = 0x8, |
| 305 | |
| 306 | .smsm_int.irq_name = "wcnss_smsm_in", |
| 307 | .smsm_int.flags = IRQF_TRIGGER_RISING, |
| 308 | .smsm_int.irq_id = -1, |
| 309 | .smsm_int.device_name = "smsm_dev", |
| 310 | .smsm_int.dev_id = 0, |
| 311 | .smsm_int.out_bit_pos = 1 << 19, |
| 312 | .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 313 | .smsm_int.out_offset = 0x8, |
| 314 | }, |
Jeff Hugo | 9a5dc6e | 2012-03-29 14:39:42 -0600 | [diff] [blame] | 315 | { |
| 316 | .irq_config_id = SMD_RPM, |
| 317 | .subsys_name = NULL, /* do not use PIL to load RPM */ |
| 318 | .edge = SMD_APPS_RPM, |
| 319 | |
| 320 | .smd_int.irq_name = "rpm_smd_in", |
| 321 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 322 | .smd_int.irq_id = -1, |
| 323 | .smd_int.device_name = "smd_dev", |
| 324 | .smd_int.dev_id = 0, |
| 325 | .smd_int.out_bit_pos = 1 << 0, |
| 326 | .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 327 | .smd_int.out_offset = 0x8, |
| 328 | |
| 329 | .smsm_int.irq_name = NULL, /* RPM does not support SMSM */ |
| 330 | .smsm_int.flags = 0, |
| 331 | .smsm_int.irq_id = 0, |
| 332 | .smsm_int.device_name = NULL, |
| 333 | .smsm_int.dev_id = 0, |
| 334 | .smsm_int.out_bit_pos = 0, |
| 335 | .smsm_int.out_base = NULL, |
| 336 | .smsm_int.out_offset = 0, |
| 337 | }, |
| 338 | }; |
| 339 | |
| 340 | static struct smd_smem_regions aux_smem_areas[] = { |
| 341 | { |
| 342 | .phys_addr = (void *)(0xfc428000), |
| 343 | .size = 0x4000, |
| 344 | }, |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 345 | }; |
| 346 | |
Jeff Hugo | 3e36629 | 2012-03-29 15:19:14 -0600 | [diff] [blame] | 347 | static struct smd_subsystem_restart_config smd_ssr_cfg = { |
| 348 | .disable_smsm_reset_handshake = 1, |
| 349 | }; |
| 350 | |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 351 | static struct smd_platform smd_platform_data = { |
| 352 | .num_ss_configs = ARRAY_SIZE(smd_config_list), |
| 353 | .smd_ss_configs = smd_config_list, |
Jeff Hugo | 3e36629 | 2012-03-29 15:19:14 -0600 | [diff] [blame] | 354 | .smd_ssr_config = &smd_ssr_cfg, |
Jeff Hugo | 9a5dc6e | 2012-03-29 14:39:42 -0600 | [diff] [blame] | 355 | .num_smem_areas = ARRAY_SIZE(aux_smem_areas), |
| 356 | .smd_smem_areas = aux_smem_areas, |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 357 | }; |
| 358 | |
| 359 | struct platform_device msm_device_smd_copper = { |
| 360 | .name = "msm_smd", |
| 361 | .id = -1, |
| 362 | .resource = smd_resource, |
| 363 | .num_resources = ARRAY_SIZE(smd_resource), |
| 364 | .dev = { |
| 365 | .platform_data = &smd_platform_data, |
| 366 | } |
| 367 | }; |
| 368 | |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 369 | static void __init msm_copper_calculate_reserve_sizes(void) |
| 370 | { |
| 371 | #ifdef CONFIG_ION_MSM |
| 372 | reserve_ion_memory(); |
| 373 | #endif |
| 374 | } |
| 375 | |
| 376 | static struct reserve_info msm_copper_reserve_info __initdata = { |
| 377 | .memtype_reserve_table = msm_copper_reserve_table, |
| 378 | .calculate_reserve_sizes = msm_copper_calculate_reserve_sizes, |
| 379 | .paddr_to_memtype = msm_copper_paddr_to_memtype, |
| 380 | }; |
| 381 | |
| 382 | static void __init msm_copper_early_memory(void) |
| 383 | { |
| 384 | reserve_info = &msm_copper_reserve_info; |
| 385 | } |
| 386 | |
| 387 | void __init msm_copper_reserve(void) |
| 388 | { |
| 389 | msm_reserve(); |
| 390 | } |
| 391 | |
Pavankumar Kondeti | 8c44738 | 2012-03-29 09:02:09 +0530 | [diff] [blame] | 392 | static struct platform_device android_usb_device = { |
| 393 | .name = "android_usb", |
| 394 | .id = -1, |
| 395 | }; |
| 396 | |
Hariprasad Dhalinarasimha | f42732a | 2012-05-21 18:00:49 -0700 | [diff] [blame] | 397 | #define SHARED_IMEM_TZ_BASE 0xFE805720 |
Hariprasad Dhalinarasimha | 5a6d7d6 | 2012-05-29 17:48:52 -0700 | [diff] [blame] | 398 | static struct resource copper_tzlog_resources[] = { |
Hariprasad Dhalinarasimha | f42732a | 2012-05-21 18:00:49 -0700 | [diff] [blame] | 399 | { |
| 400 | .start = SHARED_IMEM_TZ_BASE, |
| 401 | .end = SHARED_IMEM_TZ_BASE + SZ_4K - 1, |
| 402 | .flags = IORESOURCE_MEM, |
| 403 | }, |
| 404 | }; |
| 405 | |
Hariprasad Dhalinarasimha | 5a6d7d6 | 2012-05-29 17:48:52 -0700 | [diff] [blame] | 406 | struct platform_device copper_device_tz_log = { |
Hariprasad Dhalinarasimha | f42732a | 2012-05-21 18:00:49 -0700 | [diff] [blame] | 407 | .name = "tz_log", |
| 408 | .id = 0, |
Hariprasad Dhalinarasimha | 5a6d7d6 | 2012-05-29 17:48:52 -0700 | [diff] [blame] | 409 | .num_resources = ARRAY_SIZE(copper_tzlog_resources), |
| 410 | .resource = copper_tzlog_resources, |
Hariprasad Dhalinarasimha | f42732a | 2012-05-21 18:00:49 -0700 | [diff] [blame] | 411 | }; |
| 412 | |
| 413 | |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 414 | void __init msm_copper_add_devices(void) |
| 415 | { |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 416 | #ifdef CONFIG_ION_MSM |
| 417 | platform_device_register(&ion_dev); |
| 418 | #endif |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 419 | platform_device_register(&msm_device_smd_copper); |
Pavankumar Kondeti | 8c44738 | 2012-03-29 09:02:09 +0530 | [diff] [blame] | 420 | platform_device_register(&android_usb_device); |
Michael Bohan | 037a0f5 | 2012-02-29 19:13:09 -0800 | [diff] [blame] | 421 | platform_add_devices(msm_copper_stub_regulator_devices, |
| 422 | msm_copper_stub_regulator_devices_len); |
Hariprasad Dhalinarasimha | 5a6d7d6 | 2012-05-29 17:48:52 -0700 | [diff] [blame] | 423 | platform_device_register(&copper_device_tz_log); |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 424 | } |
| 425 | |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 426 | static struct clk_lookup msm_clocks_dummy[] = { |
Matt Wagantall | b3fe899 | 2011-12-07 19:26:55 -0800 | [diff] [blame] | 427 | CLK_DUMMY("xo", XO_CLK, NULL, OFF), |
Tianyi Gou | c1e049f8 | 2011-11-23 14:20:16 -0800 | [diff] [blame] | 428 | CLK_DUMMY("xo", XO_CLK, "pil_pronto", OFF), |
Sathish Ambley | 3d50c76 | 2011-10-25 15:26:00 -0700 | [diff] [blame] | 429 | CLK_DUMMY("core_clk", BLSP2_UART_CLK, "msm_serial_hsl.0", OFF), |
| 430 | CLK_DUMMY("iface_clk", BLSP2_UART_CLK, "msm_serial_hsl.0", OFF), |
Sujit Reddy Thumma | 1a4a79e | 2011-11-04 09:44:32 +0530 | [diff] [blame] | 431 | CLK_DUMMY("core_clk", SDC1_CLK, NULL, OFF), |
| 432 | CLK_DUMMY("iface_clk", SDC1_P_CLK, NULL, OFF), |
| 433 | CLK_DUMMY("core_clk", SDC3_CLK, NULL, OFF), |
| 434 | CLK_DUMMY("iface_clk", SDC3_P_CLK, NULL, OFF), |
Pavankumar Kondeti | 0063b84 | 2012-01-16 12:19:58 +0530 | [diff] [blame] | 435 | CLK_DUMMY("phy_clk", NULL, "msm_otg", OFF), |
| 436 | CLK_DUMMY("core_clk", NULL, "msm_otg", OFF), |
Pavankumar Kondeti | 0063b84 | 2012-01-16 12:19:58 +0530 | [diff] [blame] | 437 | CLK_DUMMY("iface_clk", NULL, "msm_otg", OFF), |
Pavankumar Kondeti | 066bfbf | 2012-02-20 14:10:20 +0530 | [diff] [blame] | 438 | CLK_DUMMY("xo", NULL, "msm_otg", OFF), |
Yan He | 1466daa | 2011-11-30 17:25:38 -0800 | [diff] [blame] | 439 | CLK_DUMMY("dfab_clk", DFAB_CLK, NULL, 0), |
| 440 | CLK_DUMMY("dma_bam_pclk", DMA_BAM_P_CLK, NULL, 0), |
| 441 | CLK_DUMMY("mem_clk", NULL, NULL, 0), |
Harini Jayaraman | 5f98dbb | 2011-12-20 13:38:19 -0700 | [diff] [blame] | 442 | CLK_DUMMY("core_clk", SPI_CLK, "spi_qsd.1", OFF), |
| 443 | CLK_DUMMY("iface_clk", SPI_P_CLK, "spi_qsd.1", OFF), |
Sagar Dharia | 218edb9 | 2012-01-15 18:03:01 -0700 | [diff] [blame] | 444 | CLK_DUMMY("core_clk", NULL, "f9966000.i2c", 0), |
| 445 | CLK_DUMMY("iface_clk", NULL, "f9966000.i2c", 0), |
Sagar Dharia | a316a96 | 2012-03-21 16:13:22 -0600 | [diff] [blame] | 446 | CLK_DUMMY("core_clk", NULL, "fe12f000.slim", OFF), |
Adrian Salido-Moreno | 5ef3ac0 | 2012-05-14 18:40:47 -0700 | [diff] [blame] | 447 | CLK_DUMMY("core_clk", "mdp.0", NULL, 0), |
| 448 | CLK_DUMMY("core_clk_src", "mdp.0", NULL, 0), |
| 449 | CLK_DUMMY("lut_clk", "mdp.0", NULL, 0), |
| 450 | CLK_DUMMY("vsync_clk", "mdp.0", NULL, 0), |
| 451 | CLK_DUMMY("iface_clk", "mdp.0", NULL, 0), |
| 452 | CLK_DUMMY("bus_clk", "mdp.0", NULL, 0), |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 453 | }; |
| 454 | |
| 455 | struct clock_init_data msm_dummy_clock_init_data __initdata = { |
| 456 | .table = msm_clocks_dummy, |
| 457 | .size = ARRAY_SIZE(msm_clocks_dummy), |
| 458 | }; |
| 459 | |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 460 | /* |
| 461 | * Used to satisfy dependencies for devices that need to be |
| 462 | * run early or in a particular order. Most likely your device doesn't fall |
| 463 | * into this category, and thus the driver should not be added here. The |
| 464 | * EPROBE_DEFER can satisfy most dependency problems. |
| 465 | */ |
| 466 | void __init msm_copper_add_drivers(void) |
| 467 | { |
Jeff Hugo | a643ca1 | 2012-06-11 16:00:23 -0600 | [diff] [blame] | 468 | msm_init_modem_notifier_list(); |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 469 | msm_smd_init(); |
| 470 | msm_rpm_driver_init(); |
Girish Mahadevan | 40abbe1 | 2012-04-25 14:58:13 -0600 | [diff] [blame] | 471 | msm_lpmrs_module_init(); |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 472 | rpm_regulator_smd_driver_init(); |
| 473 | msm_spm_device_init(); |
| 474 | regulator_stub_init(); |
| 475 | if (machine_is_copper_rumi()) |
| 476 | msm_clock_init(&msm_dummy_clock_init_data); |
| 477 | else |
| 478 | msm_clock_init(&msmcopper_clock_init_data); |
| 479 | } |
| 480 | |
| 481 | static struct of_device_id irq_match[] __initdata = { |
| 482 | { .compatible = "qcom,msm-qgic2", .data = gic_of_init, }, |
| 483 | { .compatible = "qcom,msm-gpio", .data = msm_gpio_of_init, }, |
| 484 | { .compatible = "qcom,spmi-pmic-arb", .data = qpnpint_of_init, }, |
| 485 | {} |
| 486 | }; |
| 487 | |
| 488 | void __init msm_copper_init_irq(void) |
| 489 | { |
| 490 | of_irq_init(irq_match); |
| 491 | } |
| 492 | |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 493 | static struct of_dev_auxdata msm_copper_auxdata_lookup[] __initdata = { |
Sathish Ambley | ab783ab | 2011-11-27 22:21:48 -0800 | [diff] [blame] | 494 | OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \ |
Sathish Ambley | 3d50c76 | 2011-10-25 15:26:00 -0700 | [diff] [blame] | 495 | "msm_serial_hsl.0", NULL), |
Pavankumar Kondeti | 0063b84 | 2012-01-16 12:19:58 +0530 | [diff] [blame] | 496 | OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \ |
| 497 | "msm_otg", NULL), |
Manu Gautam | 51be971 | 2012-06-06 14:54:52 +0530 | [diff] [blame] | 498 | OF_DEV_AUXDATA("qcom,dwc-usb3-msm", 0xF9200000, \ |
| 499 | "msm_dwc3", NULL), |
Harini Jayaraman | 5f98dbb | 2011-12-20 13:38:19 -0700 | [diff] [blame] | 500 | OF_DEV_AUXDATA("qcom,spi-qup-v2", 0xF9924000, \ |
| 501 | "spi_qsd.1", NULL), |
Kenneth Heitke | f3c829c | 2012-01-13 17:02:43 -0700 | [diff] [blame] | 502 | OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \ |
| 503 | "spmi-pmic-arb.0", NULL), |
Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 504 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \ |
David Ng | 665140f | 2012-04-12 16:03:45 -0700 | [diff] [blame] | 505 | "msm_sdcc.1", NULL), |
Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 506 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \ |
| 507 | "msm_sdcc.2", NULL), |
| 508 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \ |
David Ng | 665140f | 2012-04-12 16:03:45 -0700 | [diff] [blame] | 509 | "msm_sdcc.3", NULL), |
Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 510 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98E4000, \ |
| 511 | "msm_sdcc.4", NULL), |
Matt Wagantall | c2bbdc3 | 2012-03-21 19:44:50 -0700 | [diff] [blame] | 512 | OF_DEV_AUXDATA("qcom,pil-q6v5-lpass", 0xFE200000, \ |
| 513 | "pil-q6v5-lpass", NULL), |
Matt Wagantall | 4e2599e | 2012-03-21 22:31:35 -0700 | [diff] [blame] | 514 | OF_DEV_AUXDATA("qcom,pil-q6v5-mss", 0xFC880000, "pil-q6v5-mss", NULL), |
Matt Wagantall | e6e00d5 | 2012-03-08 17:39:07 -0800 | [diff] [blame] | 515 | OF_DEV_AUXDATA("qcom,pil-mba", 0xFC820000, "pil-mba", NULL), |
Tianyi Gou | c1e049f8 | 2011-11-23 14:20:16 -0800 | [diff] [blame] | 516 | OF_DEV_AUXDATA("qcom,pil-pronto", 0xFB21B000, \ |
| 517 | "pil_pronto", NULL), |
Hariprasad Dhalinarasimha | de991f0 | 2012-05-31 13:15:51 -0700 | [diff] [blame] | 518 | OF_DEV_AUXDATA("qcom,msm-rng", 0xF9BFF000, \ |
| 519 | "msm_rng", NULL), |
Ramesh Masavarapu | fb1f01e | 2012-06-14 09:40:40 -0700 | [diff] [blame] | 520 | OF_DEV_AUXDATA("qcom,qseecom", 0xFE806000, \ |
| 521 | "qseecom", NULL), |
Adrian Salido-Moreno | 5ef3ac0 | 2012-05-14 18:40:47 -0700 | [diff] [blame] | 522 | OF_DEV_AUXDATA("qcom,mdss_mdp", 0xFD900000, "mdp.0", NULL), |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 523 | {} |
| 524 | }; |
| 525 | |
| 526 | void __init msm_copper_init(struct of_dev_auxdata **adata) |
| 527 | { |
Sathish Ambley | b17ec7e | 2012-04-03 15:20:03 -0700 | [diff] [blame] | 528 | msm_copper_init_gpiomux(); |
Vikram Mulukutla | aeadb5f | 2012-05-04 14:03:07 -0700 | [diff] [blame] | 529 | |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 530 | *adata = msm_copper_auxdata_lookup; |
Matt Wagantall | ecaa117 | 2012-05-08 21:38:45 -0700 | [diff] [blame] | 531 | |
| 532 | regulator_has_full_constraints(); |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 533 | } |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 534 | |
| 535 | void __init msm_copper_very_early(void) |
| 536 | { |
| 537 | msm_copper_early_memory(); |
| 538 | } |