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