| 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 | #include <linux/memory.h> |
| 24 | #ifdef CONFIG_ANDROID_PMEM |
| 25 | #include <linux/android_pmem.h> |
| 26 | #endif |
| Matt Wagantall | ecaa117 | 2012-05-08 21:38:45 -0700 | [diff] [blame] | 27 | #include <linux/regulator/machine.h> |
| Abhijeet Dharmapurikar | 34f263e | 2012-07-27 14:04:15 -0700 | [diff] [blame^] | 28 | #include <linux/regulator/krait-regulator.h> |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/hardware/gic.h> |
| 31 | #include <mach/board.h> |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 32 | #include <mach/gpiomux.h> |
| 33 | #include <mach/msm_iomap.h> |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 34 | #ifdef CONFIG_ION_MSM |
| 35 | #include <mach/ion.h> |
| 36 | #endif |
| 37 | #include <mach/msm_memtypes.h> |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 38 | #include <mach/msm_smd.h> |
| Mahesh Sivasubramanian | a8ff992 | 2012-03-27 17:50:42 -0600 | [diff] [blame] | 39 | #include <mach/rpm-smd.h> |
| David Collins | 8f4cebc | 2012-05-08 16:54:50 -0700 | [diff] [blame] | 40 | #include <mach/rpm-regulator-smd.h> |
| Michael Bohan | 115cf65 | 2012-01-05 14:32:59 -0800 | [diff] [blame] | 41 | #include <mach/qpnp-int.h> |
| Vikram Mulukutla | aeadb5f | 2012-05-04 14:03:07 -0700 | [diff] [blame] | 42 | #include <mach/socinfo.h> |
| Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 43 | #include <mach/msm_bus_board.h> |
| Mahesh Sivasubramanian | 1a99532 | 2012-07-12 15:26:46 -0600 | [diff] [blame] | 44 | #include <mach/mpm.h> |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 45 | #include "clock.h" |
| Michael Bohan | 037a0f5 | 2012-02-29 19:13:09 -0800 | [diff] [blame] | 46 | #include "devices.h" |
| Praveen Chidambaram | da9501d | 2012-04-26 19:48:29 -0600 | [diff] [blame] | 47 | #include "spm.h" |
| Jeff Hugo | a643ca1 | 2012-06-11 16:00:23 -0600 | [diff] [blame] | 48 | #include "modem_notifier.h" |
| Girish Mahadevan | 40abbe1 | 2012-04-25 14:58:13 -0600 | [diff] [blame] | 49 | #include "lpm_resources.h" |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 50 | |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 51 | #define MSM_KERNEL_EBI1_MEM_SIZE 0x280000 |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 52 | |
| 53 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 54 | static unsigned kernel_ebi1_mem_size = MSM_KERNEL_EBI1_MEM_SIZE; |
| 55 | static int __init kernel_ebi1_mem_size_setup(char *p) |
| 56 | { |
| 57 | kernel_ebi1_mem_size = memparse(p, NULL); |
| 58 | return 0; |
| 59 | } |
| 60 | early_param("kernel_ebi1_mem_size", kernel_ebi1_mem_size_setup); |
| 61 | #endif |
| 62 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 63 | static struct memtype_reserve msm_8974_reserve_table[] __initdata = { |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 64 | [MEMTYPE_SMI] = { |
| 65 | }, |
| 66 | [MEMTYPE_EBI0] = { |
| 67 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 68 | }, |
| 69 | [MEMTYPE_EBI1] = { |
| 70 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 71 | }, |
| 72 | }; |
| 73 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 74 | static int msm_8974_paddr_to_memtype(unsigned int paddr) |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 75 | { |
| 76 | return MEMTYPE_EBI1; |
| 77 | } |
| 78 | |
| Olav Haugan | 4917344 | 2012-08-01 13:23:18 -0700 | [diff] [blame] | 79 | static void __init reserve_ebi_memory(void) |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 80 | { |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 81 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 82 | msm_8974_reserve_table[MEMTYPE_EBI1].size += kernel_ebi1_mem_size; |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 83 | #endif |
| 84 | } |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 85 | |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 86 | static struct resource smd_resource[] = { |
| 87 | { |
| 88 | .name = "modem_smd_in", |
| Jeff Hugo | 3417d07 | 2012-07-06 15:45:59 -0600 | [diff] [blame] | 89 | .start = 32 + 25, /* mss_sw_to_kpss_ipc_irq0 */ |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 90 | .flags = IORESOURCE_IRQ, |
| 91 | }, |
| 92 | { |
| 93 | .name = "modem_smsm_in", |
| Jeff Hugo | 3417d07 | 2012-07-06 15:45:59 -0600 | [diff] [blame] | 94 | .start = 32 + 26, /* mss_sw_to_kpss_ipc_irq1 */ |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 95 | .flags = IORESOURCE_IRQ, |
| 96 | }, |
| 97 | { |
| 98 | .name = "adsp_smd_in", |
| 99 | .start = 32 + 156, /* lpass_to_kpss_ipc_irq0 */ |
| 100 | .flags = IORESOURCE_IRQ, |
| 101 | }, |
| 102 | { |
| 103 | .name = "adsp_smsm_in", |
| 104 | .start = 32 + 157, /* lpass_to_kpss_ipc_irq1 */ |
| 105 | .flags = IORESOURCE_IRQ, |
| 106 | }, |
| 107 | { |
| 108 | .name = "wcnss_smd_in", |
| 109 | .start = 32 + 142, /* WcnssAppsSmdMedIrq */ |
| 110 | .flags = IORESOURCE_IRQ, |
| 111 | }, |
| 112 | { |
| 113 | .name = "wcnss_smsm_in", |
| Jeff Hugo | 8904627 | 2012-03-29 14:45:37 -0600 | [diff] [blame] | 114 | .start = 32 + 144, /* RivaAppsWlanSmsmIrq */ |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 115 | .flags = IORESOURCE_IRQ, |
| 116 | }, |
| Jeff Hugo | 9a5dc6e | 2012-03-29 14:39:42 -0600 | [diff] [blame] | 117 | { |
| 118 | .name = "rpm_smd_in", |
| 119 | .start = 32 + 168, /* rpm_to_kpss_ipc_irq4 */ |
| 120 | .flags = IORESOURCE_IRQ, |
| 121 | }, |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 122 | }; |
| 123 | |
| 124 | static struct smd_subsystem_config smd_config_list[] = { |
| 125 | { |
| 126 | .irq_config_id = SMD_MODEM, |
| 127 | .subsys_name = "modem", |
| 128 | .edge = SMD_APPS_MODEM, |
| 129 | |
| 130 | .smd_int.irq_name = "modem_smd_in", |
| 131 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 132 | .smd_int.irq_id = -1, |
| 133 | .smd_int.device_name = "smd_dev", |
| 134 | .smd_int.dev_id = 0, |
| 135 | .smd_int.out_bit_pos = 1 << 12, |
| 136 | .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 137 | .smd_int.out_offset = 0x8, |
| 138 | |
| 139 | .smsm_int.irq_name = "modem_smsm_in", |
| 140 | .smsm_int.flags = IRQF_TRIGGER_RISING, |
| 141 | .smsm_int.irq_id = -1, |
| 142 | .smsm_int.device_name = "smsm_dev", |
| 143 | .smsm_int.dev_id = 0, |
| 144 | .smsm_int.out_bit_pos = 1 << 13, |
| 145 | .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 146 | .smsm_int.out_offset = 0x8, |
| 147 | }, |
| 148 | { |
| 149 | .irq_config_id = SMD_Q6, |
| Jeff Hugo | a1e3b8c | 2012-05-29 14:01:41 -0600 | [diff] [blame] | 150 | .subsys_name = "adsp", |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 151 | .edge = SMD_APPS_QDSP, |
| 152 | |
| 153 | .smd_int.irq_name = "adsp_smd_in", |
| 154 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 155 | .smd_int.irq_id = -1, |
| 156 | .smd_int.device_name = "smd_dev", |
| 157 | .smd_int.dev_id = 0, |
| 158 | .smd_int.out_bit_pos = 1 << 8, |
| 159 | .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 160 | .smd_int.out_offset = 0x8, |
| 161 | |
| 162 | .smsm_int.irq_name = "adsp_smsm_in", |
| 163 | .smsm_int.flags = IRQF_TRIGGER_RISING, |
| 164 | .smsm_int.irq_id = -1, |
| 165 | .smsm_int.device_name = "smsm_dev", |
| 166 | .smsm_int.dev_id = 0, |
| 167 | .smsm_int.out_bit_pos = 1 << 9, |
| 168 | .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 169 | .smsm_int.out_offset = 0x8, |
| 170 | }, |
| 171 | { |
| 172 | .irq_config_id = SMD_WCNSS, |
| 173 | .subsys_name = "wcnss", |
| 174 | .edge = SMD_APPS_WCNSS, |
| 175 | |
| 176 | .smd_int.irq_name = "wcnss_smd_in", |
| 177 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 178 | .smd_int.irq_id = -1, |
| 179 | .smd_int.device_name = "smd_dev", |
| 180 | .smd_int.dev_id = 0, |
| 181 | .smd_int.out_bit_pos = 1 << 17, |
| 182 | .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 183 | .smd_int.out_offset = 0x8, |
| 184 | |
| 185 | .smsm_int.irq_name = "wcnss_smsm_in", |
| 186 | .smsm_int.flags = IRQF_TRIGGER_RISING, |
| 187 | .smsm_int.irq_id = -1, |
| 188 | .smsm_int.device_name = "smsm_dev", |
| 189 | .smsm_int.dev_id = 0, |
| 190 | .smsm_int.out_bit_pos = 1 << 19, |
| 191 | .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 192 | .smsm_int.out_offset = 0x8, |
| 193 | }, |
| Jeff Hugo | 9a5dc6e | 2012-03-29 14:39:42 -0600 | [diff] [blame] | 194 | { |
| 195 | .irq_config_id = SMD_RPM, |
| 196 | .subsys_name = NULL, /* do not use PIL to load RPM */ |
| 197 | .edge = SMD_APPS_RPM, |
| 198 | |
| 199 | .smd_int.irq_name = "rpm_smd_in", |
| 200 | .smd_int.flags = IRQF_TRIGGER_RISING, |
| 201 | .smd_int.irq_id = -1, |
| 202 | .smd_int.device_name = "smd_dev", |
| 203 | .smd_int.dev_id = 0, |
| 204 | .smd_int.out_bit_pos = 1 << 0, |
| 205 | .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE, |
| 206 | .smd_int.out_offset = 0x8, |
| 207 | |
| 208 | .smsm_int.irq_name = NULL, /* RPM does not support SMSM */ |
| 209 | .smsm_int.flags = 0, |
| 210 | .smsm_int.irq_id = 0, |
| 211 | .smsm_int.device_name = NULL, |
| 212 | .smsm_int.dev_id = 0, |
| 213 | .smsm_int.out_bit_pos = 0, |
| 214 | .smsm_int.out_base = NULL, |
| 215 | .smsm_int.out_offset = 0, |
| 216 | }, |
| 217 | }; |
| 218 | |
| 219 | static struct smd_smem_regions aux_smem_areas[] = { |
| 220 | { |
| 221 | .phys_addr = (void *)(0xfc428000), |
| 222 | .size = 0x4000, |
| 223 | }, |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 224 | }; |
| 225 | |
| Jeff Hugo | 3e36629 | 2012-03-29 15:19:14 -0600 | [diff] [blame] | 226 | static struct smd_subsystem_restart_config smd_ssr_cfg = { |
| 227 | .disable_smsm_reset_handshake = 1, |
| 228 | }; |
| 229 | |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 230 | static struct smd_platform smd_platform_data = { |
| 231 | .num_ss_configs = ARRAY_SIZE(smd_config_list), |
| 232 | .smd_ss_configs = smd_config_list, |
| Jeff Hugo | 3e36629 | 2012-03-29 15:19:14 -0600 | [diff] [blame] | 233 | .smd_ssr_config = &smd_ssr_cfg, |
| Jeff Hugo | 9a5dc6e | 2012-03-29 14:39:42 -0600 | [diff] [blame] | 234 | .num_smem_areas = ARRAY_SIZE(aux_smem_areas), |
| 235 | .smd_smem_areas = aux_smem_areas, |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 236 | }; |
| 237 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 238 | struct platform_device msm_device_smd_8974 = { |
| Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 239 | .name = "msm_smd", |
| 240 | .id = -1, |
| 241 | .resource = smd_resource, |
| 242 | .num_resources = ARRAY_SIZE(smd_resource), |
| 243 | .dev = { |
| 244 | .platform_data = &smd_platform_data, |
| 245 | } |
| 246 | }; |
| 247 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 248 | static void __init msm_8974_calculate_reserve_sizes(void) |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 249 | { |
| Olav Haugan | 4917344 | 2012-08-01 13:23:18 -0700 | [diff] [blame] | 250 | reserve_ebi_memory(); |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 251 | } |
| 252 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 253 | static struct reserve_info msm_8974_reserve_info __initdata = { |
| 254 | .memtype_reserve_table = msm_8974_reserve_table, |
| 255 | .calculate_reserve_sizes = msm_8974_calculate_reserve_sizes, |
| 256 | .paddr_to_memtype = msm_8974_paddr_to_memtype, |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 257 | }; |
| 258 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 259 | static void __init msm_8974_early_memory(void) |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 260 | { |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 261 | reserve_info = &msm_8974_reserve_info; |
| Laura Abbott | d8d0f77 | 2012-07-10 10:27:06 -0700 | [diff] [blame] | 262 | of_scan_flat_dt(dt_scan_for_memory_reserve, msm_8974_reserve_table); |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 263 | } |
| 264 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 265 | void __init msm_8974_reserve(void) |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 266 | { |
| 267 | msm_reserve(); |
| 268 | } |
| 269 | |
| Pavankumar Kondeti | 8c44738 | 2012-03-29 09:02:09 +0530 | [diff] [blame] | 270 | static struct platform_device android_usb_device = { |
| 271 | .name = "android_usb", |
| 272 | .id = -1, |
| 273 | }; |
| 274 | |
| Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 275 | #define BIMC_BASE 0xfc380000 |
| 276 | #define BIMC_SIZE 0x0006A000 |
| 277 | #define SYS_NOC_BASE 0xfc460000 |
| 278 | #define PERIPH_NOC_BASE 0xFC468000 |
| 279 | #define OCMEM_NOC_BASE 0xfc470000 |
| 280 | #define MMSS_NOC_BASE 0xfc478000 |
| 281 | #define CONFIG_NOC_BASE 0xfc480000 |
| 282 | #define NOC_SIZE 0x00004000 |
| 283 | |
| 284 | static struct resource bimc_res[] = { |
| 285 | { |
| 286 | .start = BIMC_BASE, |
| 287 | .end = BIMC_BASE + BIMC_SIZE, |
| 288 | .flags = IORESOURCE_MEM, |
| 289 | .name = "bimc_mem", |
| 290 | }, |
| 291 | }; |
| 292 | |
| 293 | static struct resource ocmem_noc_res[] = { |
| 294 | { |
| 295 | .start = OCMEM_NOC_BASE, |
| 296 | .end = OCMEM_NOC_BASE + NOC_SIZE, |
| 297 | .flags = IORESOURCE_MEM, |
| 298 | .name = "ocmem_noc_mem", |
| 299 | }, |
| 300 | }; |
| 301 | |
| 302 | static struct resource mmss_noc_res[] = { |
| 303 | { |
| 304 | .start = MMSS_NOC_BASE, |
| 305 | .end = MMSS_NOC_BASE + NOC_SIZE, |
| 306 | .flags = IORESOURCE_MEM, |
| 307 | .name = "mmss_noc_mem", |
| 308 | }, |
| 309 | }; |
| 310 | |
| 311 | static struct resource sys_noc_res[] = { |
| 312 | { |
| 313 | .start = SYS_NOC_BASE, |
| 314 | .end = SYS_NOC_BASE + NOC_SIZE, |
| 315 | .flags = IORESOURCE_MEM, |
| 316 | .name = "sys_noc_mem", |
| 317 | }, |
| 318 | }; |
| 319 | |
| 320 | static struct resource config_noc_res[] = { |
| 321 | { |
| 322 | .start = CONFIG_NOC_BASE, |
| 323 | .end = CONFIG_NOC_BASE + NOC_SIZE, |
| 324 | .flags = IORESOURCE_MEM, |
| 325 | .name = "config_noc_mem", |
| 326 | }, |
| 327 | }; |
| 328 | |
| 329 | static struct resource periph_noc_res[] = { |
| 330 | { |
| 331 | .start = PERIPH_NOC_BASE, |
| 332 | .end = PERIPH_NOC_BASE + NOC_SIZE, |
| 333 | .flags = IORESOURCE_MEM, |
| 334 | .name = "periph_noc_mem", |
| 335 | }, |
| 336 | }; |
| 337 | |
| 338 | static struct platform_device msm_bus_sys_noc = { |
| 339 | .name = "msm_bus_fabric", |
| 340 | .id = MSM_BUS_FAB_SYS_NOC, |
| 341 | .num_resources = ARRAY_SIZE(sys_noc_res), |
| 342 | .resource = sys_noc_res, |
| 343 | }; |
| 344 | |
| 345 | static struct platform_device msm_bus_bimc = { |
| 346 | .name = "msm_bus_fabric", |
| 347 | .id = MSM_BUS_FAB_BIMC, |
| 348 | .num_resources = ARRAY_SIZE(bimc_res), |
| 349 | .resource = bimc_res, |
| 350 | }; |
| 351 | |
| 352 | static struct platform_device msm_bus_mmss_noc = { |
| 353 | .name = "msm_bus_fabric", |
| 354 | .id = MSM_BUS_FAB_MMSS_NOC, |
| 355 | .num_resources = ARRAY_SIZE(mmss_noc_res), |
| 356 | .resource = mmss_noc_res, |
| 357 | }; |
| 358 | |
| 359 | static struct platform_device msm_bus_ocmem_noc = { |
| 360 | .name = "msm_bus_fabric", |
| 361 | .id = MSM_BUS_FAB_OCMEM_NOC, |
| 362 | .num_resources = ARRAY_SIZE(ocmem_noc_res), |
| 363 | .resource = ocmem_noc_res, |
| 364 | }; |
| 365 | |
| 366 | static struct platform_device msm_bus_periph_noc = { |
| 367 | .name = "msm_bus_fabric", |
| 368 | .id = MSM_BUS_FAB_PERIPH_NOC, |
| 369 | .num_resources = ARRAY_SIZE(periph_noc_res), |
| 370 | .resource = periph_noc_res, |
| 371 | }; |
| 372 | |
| 373 | static struct platform_device msm_bus_config_noc = { |
| 374 | .name = "msm_bus_fabric", |
| 375 | .id = MSM_BUS_FAB_CONFIG_NOC, |
| 376 | .num_resources = ARRAY_SIZE(config_noc_res), |
| 377 | .resource = config_noc_res, |
| 378 | }; |
| 379 | |
| 380 | static struct platform_device msm_bus_ocmem_vnoc = { |
| 381 | .name = "msm_bus_fabric", |
| 382 | .id = MSM_BUS_FAB_OCMEM_VNOC, |
| 383 | }; |
| 384 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 385 | static struct platform_device *msm_bus_8974_devices[] = { |
| Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 386 | &msm_bus_sys_noc, |
| 387 | &msm_bus_bimc, |
| 388 | &msm_bus_mmss_noc, |
| 389 | &msm_bus_ocmem_noc, |
| 390 | &msm_bus_periph_noc, |
| 391 | &msm_bus_config_noc, |
| 392 | &msm_bus_ocmem_vnoc, |
| 393 | }; |
| 394 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 395 | static void __init msm8974_init_buses(void) |
| Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 396 | { |
| 397 | #ifdef CONFIG_MSM_BUS_SCALING |
| 398 | msm_bus_sys_noc.dev.platform_data = |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 399 | &msm_bus_8974_sys_noc_pdata; |
| 400 | msm_bus_bimc.dev.platform_data = &msm_bus_8974_bimc_pdata; |
| 401 | msm_bus_mmss_noc.dev.platform_data = &msm_bus_8974_mmss_noc_pdata; |
| 402 | msm_bus_ocmem_noc.dev.platform_data = &msm_bus_8974_ocmem_noc_pdata; |
| 403 | msm_bus_periph_noc.dev.platform_data = &msm_bus_8974_periph_noc_pdata; |
| 404 | msm_bus_config_noc.dev.platform_data = &msm_bus_8974_config_noc_pdata; |
| 405 | msm_bus_ocmem_vnoc.dev.platform_data = &msm_bus_8974_ocmem_vnoc_pdata; |
| Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 406 | #endif |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 407 | platform_add_devices(msm_bus_8974_devices, |
| 408 | ARRAY_SIZE(msm_bus_8974_devices)); |
| Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 409 | }; |
| Hariprasad Dhalinarasimha | f42732a | 2012-05-21 18:00:49 -0700 | [diff] [blame] | 410 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 411 | void __init msm_8974_add_devices(void) |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 412 | { |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 413 | platform_device_register(&msm_device_smd_8974); |
| Pavankumar Kondeti | 8c44738 | 2012-03-29 09:02:09 +0530 | [diff] [blame] | 414 | platform_device_register(&android_usb_device); |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 415 | } |
| 416 | |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 417 | /* |
| 418 | * Used to satisfy dependencies for devices that need to be |
| 419 | * run early or in a particular order. Most likely your device doesn't fall |
| 420 | * into this category, and thus the driver should not be added here. The |
| 421 | * EPROBE_DEFER can satisfy most dependency problems. |
| 422 | */ |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 423 | void __init msm_8974_add_drivers(void) |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 424 | { |
| Jeff Hugo | a643ca1 | 2012-06-11 16:00:23 -0600 | [diff] [blame] | 425 | msm_init_modem_notifier_list(); |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 426 | msm_smd_init(); |
| 427 | msm_rpm_driver_init(); |
| Girish Mahadevan | 40abbe1 | 2012-04-25 14:58:13 -0600 | [diff] [blame] | 428 | msm_lpmrs_module_init(); |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 429 | rpm_regulator_smd_driver_init(); |
| 430 | msm_spm_device_init(); |
| Abhijeet Dharmapurikar | 34f263e | 2012-07-27 14:04:15 -0700 | [diff] [blame^] | 431 | krait_power_init(); |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 432 | if (machine_is_msm8974_rumi()) |
| Vikram Mulukutla | 19245e0 | 2012-07-23 15:58:04 -0700 | [diff] [blame] | 433 | msm_clock_init(&msm8974_rumi_clock_init_data); |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 434 | else |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 435 | msm_clock_init(&msm8974_clock_init_data); |
| 436 | msm8974_init_buses(); |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | static struct of_device_id irq_match[] __initdata = { |
| 440 | { .compatible = "qcom,msm-qgic2", .data = gic_of_init, }, |
| 441 | { .compatible = "qcom,msm-gpio", .data = msm_gpio_of_init, }, |
| 442 | { .compatible = "qcom,spmi-pmic-arb", .data = qpnpint_of_init, }, |
| 443 | {} |
| 444 | }; |
| Mahesh Sivasubramanian | 1a99532 | 2012-07-12 15:26:46 -0600 | [diff] [blame] | 445 | static struct of_device_id mpm_match[] __initdata = { |
| 446 | {.compatible = "qcom,mpm-v2", }, |
| 447 | {}, |
| 448 | }; |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 449 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 450 | void __init msm_8974_init_irq(void) |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 451 | { |
| Mahesh Sivasubramanian | 1a99532 | 2012-07-12 15:26:46 -0600 | [diff] [blame] | 452 | struct device_node *node; |
| 453 | |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 454 | of_irq_init(irq_match); |
| Mahesh Sivasubramanian | 1a99532 | 2012-07-12 15:26:46 -0600 | [diff] [blame] | 455 | node = of_find_matching_node(NULL, mpm_match); |
| 456 | |
| 457 | WARN_ON(!node); |
| 458 | |
| 459 | if (node) |
| 460 | of_mpm_init(node); |
| Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 461 | } |
| 462 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 463 | static struct of_dev_auxdata msm_8974_auxdata_lookup[] __initdata = { |
| Sathish Ambley | ab783ab | 2011-11-27 22:21:48 -0800 | [diff] [blame] | 464 | OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \ |
| Sathish Ambley | 3d50c76 | 2011-10-25 15:26:00 -0700 | [diff] [blame] | 465 | "msm_serial_hsl.0", NULL), |
| Pavankumar Kondeti | 0063b84 | 2012-01-16 12:19:58 +0530 | [diff] [blame] | 466 | OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \ |
| 467 | "msm_otg", NULL), |
| Manu Gautam | 51be971 | 2012-06-06 14:54:52 +0530 | [diff] [blame] | 468 | OF_DEV_AUXDATA("qcom,dwc-usb3-msm", 0xF9200000, \ |
| 469 | "msm_dwc3", NULL), |
| Shimrit Malichi | 57ae149 | 2012-08-06 14:03:45 +0300 | [diff] [blame] | 470 | OF_DEV_AUXDATA("qcom,usb-bam-msm", 0xF9304000, \ |
| 471 | "usb_bam", NULL), |
| Harini Jayaraman | 5f98dbb | 2011-12-20 13:38:19 -0700 | [diff] [blame] | 472 | OF_DEV_AUXDATA("qcom,spi-qup-v2", 0xF9924000, \ |
| 473 | "spi_qsd.1", NULL), |
| Kenneth Heitke | f3c829c | 2012-01-13 17:02:43 -0700 | [diff] [blame] | 474 | OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \ |
| 475 | "spmi-pmic-arb.0", NULL), |
| Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 476 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \ |
| David Ng | 665140f | 2012-04-12 16:03:45 -0700 | [diff] [blame] | 477 | "msm_sdcc.1", NULL), |
| Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 478 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \ |
| 479 | "msm_sdcc.2", NULL), |
| 480 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \ |
| David Ng | 665140f | 2012-04-12 16:03:45 -0700 | [diff] [blame] | 481 | "msm_sdcc.3", NULL), |
| Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 482 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98E4000, \ |
| 483 | "msm_sdcc.4", NULL), |
| Matt Wagantall | c2bbdc3 | 2012-03-21 19:44:50 -0700 | [diff] [blame] | 484 | OF_DEV_AUXDATA("qcom,pil-q6v5-lpass", 0xFE200000, \ |
| 485 | "pil-q6v5-lpass", NULL), |
| Matt Wagantall | 4e2599e | 2012-03-21 22:31:35 -0700 | [diff] [blame] | 486 | OF_DEV_AUXDATA("qcom,pil-q6v5-mss", 0xFC880000, "pil-q6v5-mss", NULL), |
| Matt Wagantall | e6e00d5 | 2012-03-08 17:39:07 -0800 | [diff] [blame] | 487 | OF_DEV_AUXDATA("qcom,pil-mba", 0xFC820000, "pil-mba", NULL), |
| Tianyi Gou | c1e049f8 | 2011-11-23 14:20:16 -0800 | [diff] [blame] | 488 | OF_DEV_AUXDATA("qcom,pil-pronto", 0xFB21B000, \ |
| 489 | "pil_pronto", NULL), |
| Hariprasad Dhalinarasimha | de991f0 | 2012-05-31 13:15:51 -0700 | [diff] [blame] | 490 | OF_DEV_AUXDATA("qcom,msm-rng", 0xF9BFF000, \ |
| 491 | "msm_rng", NULL), |
| Ramesh Masavarapu | fb1f01e | 2012-06-14 09:40:40 -0700 | [diff] [blame] | 492 | OF_DEV_AUXDATA("qcom,qseecom", 0xFE806000, \ |
| 493 | "qseecom", NULL), |
| Adrian Salido-Moreno | 5ef3ac0 | 2012-05-14 18:40:47 -0700 | [diff] [blame] | 494 | OF_DEV_AUXDATA("qcom,mdss_mdp", 0xFD900000, "mdp.0", NULL), |
| Siddartha Mohanadoss | 0a18888 | 2012-07-06 15:51:00 -0700 | [diff] [blame] | 495 | OF_DEV_AUXDATA("qcom,msm-tsens", 0xFC4A8000, \ |
| 496 | "msm-tsens", NULL), |
| Mona Hossain | b43e94b | 2012-05-07 08:52:06 -0700 | [diff] [blame] | 497 | OF_DEV_AUXDATA("qcom,qcedev", 0xFD440000, \ |
| 498 | "qcedev.0", NULL), |
| 499 | OF_DEV_AUXDATA("qcom,qcrypto", 0xFD440000, \ |
| 500 | "qcrypto.0", NULL), |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 501 | {} |
| 502 | }; |
| 503 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 504 | void __init msm_8974_init(struct of_dev_auxdata **adata) |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 505 | { |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 506 | msm_8974_init_gpiomux(); |
| Vikram Mulukutla | aeadb5f | 2012-05-04 14:03:07 -0700 | [diff] [blame] | 507 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 508 | *adata = msm_8974_auxdata_lookup; |
| Matt Wagantall | ecaa117 | 2012-05-08 21:38:45 -0700 | [diff] [blame] | 509 | |
| 510 | regulator_has_full_constraints(); |
| Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 511 | } |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 512 | |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 513 | void __init msm_8974_very_early(void) |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 514 | { |
| Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 515 | msm_8974_early_memory(); |
| Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 516 | } |