blob: b939dc26268109c06a371b4b08c60298c6fdd906 [file] [log] [blame]
Michael Bohan0425f6f2012-01-17 14:36:39 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Sathish Ambleyc58afc22011-10-09 21:55:39 -07002 *
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 Mucklef132c6c2012-06-06 18:30:57 -070016#include <linux/gpio.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070017#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 Bohanc7224532012-01-06 16:02:52 -080022#include <linux/of_irq.h>
Olav Hauganb800c8c2012-01-30 08:50:45 -080023#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 Bohan037a0f52012-02-29 19:13:09 -080030#include <linux/regulator/stub-regulator.h>
Matt Wagantallecaa1172012-05-08 21:38:45 -070031#include <linux/regulator/machine.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070032#include <asm/mach/map.h>
33#include <asm/hardware/gic.h>
34#include <mach/board.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070035#include <mach/gpiomux.h>
36#include <mach/msm_iomap.h>
Olav Hauganb800c8c2012-01-30 08:50:45 -080037#ifdef CONFIG_ION_MSM
38#include <mach/ion.h>
39#endif
40#include <mach/msm_memtypes.h>
Jeff Hugo70946092012-02-10 11:30:43 -070041#include <mach/msm_smd.h>
Mahesh Sivasubramaniana8ff9922012-03-27 17:50:42 -060042#include <mach/rpm-smd.h>
David Collins8f4cebc2012-05-08 16:54:50 -070043#include <mach/rpm-regulator-smd.h>
Michael Bohan115cf652012-01-05 14:32:59 -080044#include <mach/qpnp-int.h>
Vikram Mulukutlaaeadb5f2012-05-04 14:03:07 -070045#include <mach/socinfo.h>
Gagan Macdd9bb792012-04-25 16:56:48 -060046#include <mach/msm_bus_board.h>
Mahesh Sivasubramanian1a995322012-07-12 15:26:46 -060047#include <mach/mpm.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070048#include "clock.h"
Michael Bohan037a0f52012-02-29 19:13:09 -080049#include "devices.h"
Praveen Chidambaramda9501d2012-04-26 19:48:29 -060050#include "spm.h"
Jeff Hugoa643ca12012-06-11 16:00:23 -060051#include "modem_notifier.h"
Girish Mahadevan40abbe12012-04-25 14:58:13 -060052#include "lpm_resources.h"
Sathish Ambleyc58afc22011-10-09 21:55:39 -070053
Olav Hauganb800c8c2012-01-30 08:50:45 -080054#define MSM_KERNEL_EBI1_MEM_SIZE 0x280000
55#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
56#define MSM_ION_SF_SIZE 0x4000000 /* 64 Mbytes */
57#else
58#define MSM_ION_SF_SIZE 0x2800000 /* 40 Mbytes */
59#endif
Ashray Kulkarni2ad8a7d2012-05-15 14:03:44 -070060#define MSM_ION_MM_FW_SIZE 0xa00000 /* (10MB) */
Olav Hauganb800c8c2012-01-30 08:50:45 -080061#define MSM_ION_MM_SIZE 0x7800000 /* (120MB) */
Olav Haugana692ceb2012-03-26 09:06:14 -070062#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Hauganb800c8c2012-01-30 08:50:45 -080063#define MSM_ION_MFC_SIZE SZ_8K
64#define MSM_ION_AUDIO_SIZE 0x2B4000
65#define MSM_ION_HEAP_NUM 8
66
67#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
68static unsigned kernel_ebi1_mem_size = MSM_KERNEL_EBI1_MEM_SIZE;
69static int __init kernel_ebi1_mem_size_setup(char *p)
70{
71 kernel_ebi1_mem_size = memparse(p, NULL);
72 return 0;
73}
74early_param("kernel_ebi1_mem_size", kernel_ebi1_mem_size_setup);
75#endif
76
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070077static struct memtype_reserve msm_8974_reserve_table[] __initdata = {
Olav Hauganb800c8c2012-01-30 08:50:45 -080078 [MEMTYPE_SMI] = {
79 },
80 [MEMTYPE_EBI0] = {
81 .flags = MEMTYPE_FLAGS_1M_ALIGN,
82 },
83 [MEMTYPE_EBI1] = {
84 .flags = MEMTYPE_FLAGS_1M_ALIGN,
85 },
86};
87
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070088static int msm_8974_paddr_to_memtype(unsigned int paddr)
Olav Hauganb800c8c2012-01-30 08:50:45 -080089{
90 return MEMTYPE_EBI1;
91}
92
93#ifdef CONFIG_ION_MSM
94static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
95 .permission_type = IPT_TYPE_MM_CARVEOUT,
96 .align = PAGE_SIZE,
97};
98
99static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
100 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
101 .align = PAGE_SIZE,
102};
103
104static struct ion_co_heap_pdata co_ion_pdata = {
105 .adjacent_mem_id = INVALID_HEAP_ID,
106 .align = PAGE_SIZE,
107};
108
109static struct ion_co_heap_pdata fw_co_ion_pdata = {
110 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
111 .align = SZ_128K,
112};
113
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800114/**
115 * These heaps are listed in the order they will be allocated. Due to
116 * video hardware restrictions and content protection the FW heap has to
117 * be allocated adjacent (below) the MM heap and the MFC heap has to be
118 * allocated after the MM heap to ensure MFC heap is not more than 256MB
119 * away from the base address of the FW heap.
120 * However, the order of FW heap and MM heap doesn't matter since these
121 * two heaps are taken care of by separate code to ensure they are adjacent
122 * to each other.
123 * Don't swap the order unless you know what you are doing!
124 */
Olav Hauganb800c8c2012-01-30 08:50:45 -0800125static struct ion_platform_data ion_pdata = {
126 .nr = MSM_ION_HEAP_NUM,
127 .heaps = {
128 {
129 .id = ION_SYSTEM_HEAP_ID,
130 .type = ION_HEAP_TYPE_SYSTEM,
131 .name = ION_VMALLOC_HEAP_NAME,
132 },
133 {
Olav Hauganb800c8c2012-01-30 08:50:45 -0800134 .id = ION_CP_MM_HEAP_ID,
135 .type = ION_HEAP_TYPE_CP,
136 .name = ION_MM_HEAP_NAME,
137 .size = MSM_ION_MM_SIZE,
138 .memory_type = ION_EBI_TYPE,
139 .extra_data = (void *) &cp_mm_ion_pdata,
140 },
141 {
142 .id = ION_MM_FIRMWARE_HEAP_ID,
143 .type = ION_HEAP_TYPE_CARVEOUT,
144 .name = ION_MM_FIRMWARE_HEAP_NAME,
145 .size = MSM_ION_MM_FW_SIZE,
146 .memory_type = ION_EBI_TYPE,
147 .extra_data = (void *) &fw_co_ion_pdata,
148 },
149 {
150 .id = ION_CP_MFC_HEAP_ID,
151 .type = ION_HEAP_TYPE_CP,
152 .name = ION_MFC_HEAP_NAME,
153 .size = MSM_ION_MFC_SIZE,
154 .memory_type = ION_EBI_TYPE,
155 .extra_data = (void *) &cp_mfc_ion_pdata,
156 },
157 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800158 .id = ION_SF_HEAP_ID,
159 .type = ION_HEAP_TYPE_CARVEOUT,
160 .name = ION_SF_HEAP_NAME,
161 .size = MSM_ION_SF_SIZE,
162 .memory_type = ION_EBI_TYPE,
163 .extra_data = (void *) &co_ion_pdata,
164 },
165 {
Olav Hauganb800c8c2012-01-30 08:50:45 -0800166 .id = ION_IOMMU_HEAP_ID,
167 .type = ION_HEAP_TYPE_IOMMU,
168 .name = ION_IOMMU_HEAP_NAME,
169 },
170 {
171 .id = ION_QSECOM_HEAP_ID,
172 .type = ION_HEAP_TYPE_CARVEOUT,
173 .name = ION_QSECOM_HEAP_NAME,
174 .size = MSM_ION_QSECOM_SIZE,
175 .memory_type = ION_EBI_TYPE,
176 .extra_data = (void *) &co_ion_pdata,
177 },
178 {
179 .id = ION_AUDIO_HEAP_ID,
180 .type = ION_HEAP_TYPE_CARVEOUT,
181 .name = ION_AUDIO_HEAP_NAME,
182 .size = MSM_ION_AUDIO_SIZE,
183 .memory_type = ION_EBI_TYPE,
184 .extra_data = (void *) &co_ion_pdata,
185 },
186 }
187};
188
189static struct platform_device ion_dev = {
190 .name = "ion-msm",
191 .id = 1,
192 .dev = { .platform_data = &ion_pdata },
193};
194
Stephen Boyd668d7652012-04-25 11:31:01 -0700195static void __init reserve_ion_memory(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800196{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700197 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
198 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
199 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
200 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
201 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
202 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Hauganb800c8c2012-01-30 08:50:45 -0800203#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700204 msm_8974_reserve_table[MEMTYPE_EBI1].size += kernel_ebi1_mem_size;
Olav Hauganb800c8c2012-01-30 08:50:45 -0800205#endif
206}
207#endif
208
Jeff Hugo70946092012-02-10 11:30:43 -0700209static struct resource smd_resource[] = {
210 {
211 .name = "modem_smd_in",
Jeff Hugo3417d072012-07-06 15:45:59 -0600212 .start = 32 + 25, /* mss_sw_to_kpss_ipc_irq0 */
Jeff Hugo70946092012-02-10 11:30:43 -0700213 .flags = IORESOURCE_IRQ,
214 },
215 {
216 .name = "modem_smsm_in",
Jeff Hugo3417d072012-07-06 15:45:59 -0600217 .start = 32 + 26, /* mss_sw_to_kpss_ipc_irq1 */
Jeff Hugo70946092012-02-10 11:30:43 -0700218 .flags = IORESOURCE_IRQ,
219 },
220 {
221 .name = "adsp_smd_in",
222 .start = 32 + 156, /* lpass_to_kpss_ipc_irq0 */
223 .flags = IORESOURCE_IRQ,
224 },
225 {
226 .name = "adsp_smsm_in",
227 .start = 32 + 157, /* lpass_to_kpss_ipc_irq1 */
228 .flags = IORESOURCE_IRQ,
229 },
230 {
231 .name = "wcnss_smd_in",
232 .start = 32 + 142, /* WcnssAppsSmdMedIrq */
233 .flags = IORESOURCE_IRQ,
234 },
235 {
236 .name = "wcnss_smsm_in",
Jeff Hugo89046272012-03-29 14:45:37 -0600237 .start = 32 + 144, /* RivaAppsWlanSmsmIrq */
Jeff Hugo70946092012-02-10 11:30:43 -0700238 .flags = IORESOURCE_IRQ,
239 },
Jeff Hugo9a5dc6e2012-03-29 14:39:42 -0600240 {
241 .name = "rpm_smd_in",
242 .start = 32 + 168, /* rpm_to_kpss_ipc_irq4 */
243 .flags = IORESOURCE_IRQ,
244 },
Jeff Hugo70946092012-02-10 11:30:43 -0700245};
246
247static struct smd_subsystem_config smd_config_list[] = {
248 {
249 .irq_config_id = SMD_MODEM,
250 .subsys_name = "modem",
251 .edge = SMD_APPS_MODEM,
252
253 .smd_int.irq_name = "modem_smd_in",
254 .smd_int.flags = IRQF_TRIGGER_RISING,
255 .smd_int.irq_id = -1,
256 .smd_int.device_name = "smd_dev",
257 .smd_int.dev_id = 0,
258 .smd_int.out_bit_pos = 1 << 12,
259 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
260 .smd_int.out_offset = 0x8,
261
262 .smsm_int.irq_name = "modem_smsm_in",
263 .smsm_int.flags = IRQF_TRIGGER_RISING,
264 .smsm_int.irq_id = -1,
265 .smsm_int.device_name = "smsm_dev",
266 .smsm_int.dev_id = 0,
267 .smsm_int.out_bit_pos = 1 << 13,
268 .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
269 .smsm_int.out_offset = 0x8,
270 },
271 {
272 .irq_config_id = SMD_Q6,
Jeff Hugoa1e3b8c2012-05-29 14:01:41 -0600273 .subsys_name = "adsp",
Jeff Hugo70946092012-02-10 11:30:43 -0700274 .edge = SMD_APPS_QDSP,
275
276 .smd_int.irq_name = "adsp_smd_in",
277 .smd_int.flags = IRQF_TRIGGER_RISING,
278 .smd_int.irq_id = -1,
279 .smd_int.device_name = "smd_dev",
280 .smd_int.dev_id = 0,
281 .smd_int.out_bit_pos = 1 << 8,
282 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
283 .smd_int.out_offset = 0x8,
284
285 .smsm_int.irq_name = "adsp_smsm_in",
286 .smsm_int.flags = IRQF_TRIGGER_RISING,
287 .smsm_int.irq_id = -1,
288 .smsm_int.device_name = "smsm_dev",
289 .smsm_int.dev_id = 0,
290 .smsm_int.out_bit_pos = 1 << 9,
291 .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
292 .smsm_int.out_offset = 0x8,
293 },
294 {
295 .irq_config_id = SMD_WCNSS,
296 .subsys_name = "wcnss",
297 .edge = SMD_APPS_WCNSS,
298
299 .smd_int.irq_name = "wcnss_smd_in",
300 .smd_int.flags = IRQF_TRIGGER_RISING,
301 .smd_int.irq_id = -1,
302 .smd_int.device_name = "smd_dev",
303 .smd_int.dev_id = 0,
304 .smd_int.out_bit_pos = 1 << 17,
305 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
306 .smd_int.out_offset = 0x8,
307
308 .smsm_int.irq_name = "wcnss_smsm_in",
309 .smsm_int.flags = IRQF_TRIGGER_RISING,
310 .smsm_int.irq_id = -1,
311 .smsm_int.device_name = "smsm_dev",
312 .smsm_int.dev_id = 0,
313 .smsm_int.out_bit_pos = 1 << 19,
314 .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
315 .smsm_int.out_offset = 0x8,
316 },
Jeff Hugo9a5dc6e2012-03-29 14:39:42 -0600317 {
318 .irq_config_id = SMD_RPM,
319 .subsys_name = NULL, /* do not use PIL to load RPM */
320 .edge = SMD_APPS_RPM,
321
322 .smd_int.irq_name = "rpm_smd_in",
323 .smd_int.flags = IRQF_TRIGGER_RISING,
324 .smd_int.irq_id = -1,
325 .smd_int.device_name = "smd_dev",
326 .smd_int.dev_id = 0,
327 .smd_int.out_bit_pos = 1 << 0,
328 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
329 .smd_int.out_offset = 0x8,
330
331 .smsm_int.irq_name = NULL, /* RPM does not support SMSM */
332 .smsm_int.flags = 0,
333 .smsm_int.irq_id = 0,
334 .smsm_int.device_name = NULL,
335 .smsm_int.dev_id = 0,
336 .smsm_int.out_bit_pos = 0,
337 .smsm_int.out_base = NULL,
338 .smsm_int.out_offset = 0,
339 },
340};
341
342static struct smd_smem_regions aux_smem_areas[] = {
343 {
344 .phys_addr = (void *)(0xfc428000),
345 .size = 0x4000,
346 },
Jeff Hugo70946092012-02-10 11:30:43 -0700347};
348
Jeff Hugo3e366292012-03-29 15:19:14 -0600349static struct smd_subsystem_restart_config smd_ssr_cfg = {
350 .disable_smsm_reset_handshake = 1,
351};
352
Jeff Hugo70946092012-02-10 11:30:43 -0700353static struct smd_platform smd_platform_data = {
354 .num_ss_configs = ARRAY_SIZE(smd_config_list),
355 .smd_ss_configs = smd_config_list,
Jeff Hugo3e366292012-03-29 15:19:14 -0600356 .smd_ssr_config = &smd_ssr_cfg,
Jeff Hugo9a5dc6e2012-03-29 14:39:42 -0600357 .num_smem_areas = ARRAY_SIZE(aux_smem_areas),
358 .smd_smem_areas = aux_smem_areas,
Jeff Hugo70946092012-02-10 11:30:43 -0700359};
360
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700361struct platform_device msm_device_smd_8974 = {
Jeff Hugo70946092012-02-10 11:30:43 -0700362 .name = "msm_smd",
363 .id = -1,
364 .resource = smd_resource,
365 .num_resources = ARRAY_SIZE(smd_resource),
366 .dev = {
367 .platform_data = &smd_platform_data,
368 }
369};
370
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700371static void __init msm_8974_calculate_reserve_sizes(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800372{
373#ifdef CONFIG_ION_MSM
374 reserve_ion_memory();
375#endif
376}
377
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700378static struct reserve_info msm_8974_reserve_info __initdata = {
379 .memtype_reserve_table = msm_8974_reserve_table,
380 .calculate_reserve_sizes = msm_8974_calculate_reserve_sizes,
381 .paddr_to_memtype = msm_8974_paddr_to_memtype,
Olav Hauganb800c8c2012-01-30 08:50:45 -0800382};
383
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700384static void __init msm_8974_early_memory(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800385{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700386 reserve_info = &msm_8974_reserve_info;
Laura Abbottd8d0f772012-07-10 10:27:06 -0700387 of_scan_flat_dt(dt_scan_for_memory_reserve, msm_8974_reserve_table);
Olav Hauganb800c8c2012-01-30 08:50:45 -0800388}
389
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700390void __init msm_8974_reserve(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800391{
392 msm_reserve();
393}
394
Pavankumar Kondeti8c447382012-03-29 09:02:09 +0530395static struct platform_device android_usb_device = {
396 .name = "android_usb",
397 .id = -1,
398};
399
Gagan Macdd9bb792012-04-25 16:56:48 -0600400#define BIMC_BASE 0xfc380000
401#define BIMC_SIZE 0x0006A000
402#define SYS_NOC_BASE 0xfc460000
403#define PERIPH_NOC_BASE 0xFC468000
404#define OCMEM_NOC_BASE 0xfc470000
405#define MMSS_NOC_BASE 0xfc478000
406#define CONFIG_NOC_BASE 0xfc480000
407#define NOC_SIZE 0x00004000
408
409static struct resource bimc_res[] = {
410 {
411 .start = BIMC_BASE,
412 .end = BIMC_BASE + BIMC_SIZE,
413 .flags = IORESOURCE_MEM,
414 .name = "bimc_mem",
415 },
416};
417
418static struct resource ocmem_noc_res[] = {
419 {
420 .start = OCMEM_NOC_BASE,
421 .end = OCMEM_NOC_BASE + NOC_SIZE,
422 .flags = IORESOURCE_MEM,
423 .name = "ocmem_noc_mem",
424 },
425};
426
427static struct resource mmss_noc_res[] = {
428 {
429 .start = MMSS_NOC_BASE,
430 .end = MMSS_NOC_BASE + NOC_SIZE,
431 .flags = IORESOURCE_MEM,
432 .name = "mmss_noc_mem",
433 },
434};
435
436static struct resource sys_noc_res[] = {
437 {
438 .start = SYS_NOC_BASE,
439 .end = SYS_NOC_BASE + NOC_SIZE,
440 .flags = IORESOURCE_MEM,
441 .name = "sys_noc_mem",
442 },
443};
444
445static struct resource config_noc_res[] = {
446 {
447 .start = CONFIG_NOC_BASE,
448 .end = CONFIG_NOC_BASE + NOC_SIZE,
449 .flags = IORESOURCE_MEM,
450 .name = "config_noc_mem",
451 },
452};
453
454static struct resource periph_noc_res[] = {
455 {
456 .start = PERIPH_NOC_BASE,
457 .end = PERIPH_NOC_BASE + NOC_SIZE,
458 .flags = IORESOURCE_MEM,
459 .name = "periph_noc_mem",
460 },
461};
462
463static struct platform_device msm_bus_sys_noc = {
464 .name = "msm_bus_fabric",
465 .id = MSM_BUS_FAB_SYS_NOC,
466 .num_resources = ARRAY_SIZE(sys_noc_res),
467 .resource = sys_noc_res,
468};
469
470static struct platform_device msm_bus_bimc = {
471 .name = "msm_bus_fabric",
472 .id = MSM_BUS_FAB_BIMC,
473 .num_resources = ARRAY_SIZE(bimc_res),
474 .resource = bimc_res,
475};
476
477static struct platform_device msm_bus_mmss_noc = {
478 .name = "msm_bus_fabric",
479 .id = MSM_BUS_FAB_MMSS_NOC,
480 .num_resources = ARRAY_SIZE(mmss_noc_res),
481 .resource = mmss_noc_res,
482};
483
484static struct platform_device msm_bus_ocmem_noc = {
485 .name = "msm_bus_fabric",
486 .id = MSM_BUS_FAB_OCMEM_NOC,
487 .num_resources = ARRAY_SIZE(ocmem_noc_res),
488 .resource = ocmem_noc_res,
489};
490
491static struct platform_device msm_bus_periph_noc = {
492 .name = "msm_bus_fabric",
493 .id = MSM_BUS_FAB_PERIPH_NOC,
494 .num_resources = ARRAY_SIZE(periph_noc_res),
495 .resource = periph_noc_res,
496};
497
498static struct platform_device msm_bus_config_noc = {
499 .name = "msm_bus_fabric",
500 .id = MSM_BUS_FAB_CONFIG_NOC,
501 .num_resources = ARRAY_SIZE(config_noc_res),
502 .resource = config_noc_res,
503};
504
505static struct platform_device msm_bus_ocmem_vnoc = {
506 .name = "msm_bus_fabric",
507 .id = MSM_BUS_FAB_OCMEM_VNOC,
508};
509
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700510static struct platform_device *msm_bus_8974_devices[] = {
Gagan Macdd9bb792012-04-25 16:56:48 -0600511 &msm_bus_sys_noc,
512 &msm_bus_bimc,
513 &msm_bus_mmss_noc,
514 &msm_bus_ocmem_noc,
515 &msm_bus_periph_noc,
516 &msm_bus_config_noc,
517 &msm_bus_ocmem_vnoc,
518};
519
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700520static void __init msm8974_init_buses(void)
Gagan Macdd9bb792012-04-25 16:56:48 -0600521{
522#ifdef CONFIG_MSM_BUS_SCALING
523 msm_bus_sys_noc.dev.platform_data =
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700524 &msm_bus_8974_sys_noc_pdata;
525 msm_bus_bimc.dev.platform_data = &msm_bus_8974_bimc_pdata;
526 msm_bus_mmss_noc.dev.platform_data = &msm_bus_8974_mmss_noc_pdata;
527 msm_bus_ocmem_noc.dev.platform_data = &msm_bus_8974_ocmem_noc_pdata;
528 msm_bus_periph_noc.dev.platform_data = &msm_bus_8974_periph_noc_pdata;
529 msm_bus_config_noc.dev.platform_data = &msm_bus_8974_config_noc_pdata;
530 msm_bus_ocmem_vnoc.dev.platform_data = &msm_bus_8974_ocmem_vnoc_pdata;
Gagan Macdd9bb792012-04-25 16:56:48 -0600531#endif
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700532 platform_add_devices(msm_bus_8974_devices,
533 ARRAY_SIZE(msm_bus_8974_devices));
Gagan Macdd9bb792012-04-25 16:56:48 -0600534};
Hariprasad Dhalinarasimhaf42732a2012-05-21 18:00:49 -0700535
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700536void __init msm_8974_add_devices(void)
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700537{
Olav Hauganb800c8c2012-01-30 08:50:45 -0800538#ifdef CONFIG_ION_MSM
539 platform_device_register(&ion_dev);
540#endif
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700541 platform_device_register(&msm_device_smd_8974);
Pavankumar Kondeti8c447382012-03-29 09:02:09 +0530542 platform_device_register(&android_usb_device);
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700543 platform_add_devices(msm_8974_stub_regulator_devices,
544 msm_8974_stub_regulator_devices_len);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700545}
546
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700547/*
548 * Used to satisfy dependencies for devices that need to be
549 * run early or in a particular order. Most likely your device doesn't fall
550 * into this category, and thus the driver should not be added here. The
551 * EPROBE_DEFER can satisfy most dependency problems.
552 */
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700553void __init msm_8974_add_drivers(void)
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700554{
Jeff Hugoa643ca12012-06-11 16:00:23 -0600555 msm_init_modem_notifier_list();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700556 msm_smd_init();
557 msm_rpm_driver_init();
Girish Mahadevan40abbe12012-04-25 14:58:13 -0600558 msm_lpmrs_module_init();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700559 rpm_regulator_smd_driver_init();
560 msm_spm_device_init();
561 regulator_stub_init();
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700562 if (machine_is_msm8974_rumi())
Vikram Mulukutla19245e02012-07-23 15:58:04 -0700563 msm_clock_init(&msm8974_rumi_clock_init_data);
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700564 else
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700565 msm_clock_init(&msm8974_clock_init_data);
566 msm8974_init_buses();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700567}
568
569static struct of_device_id irq_match[] __initdata = {
570 { .compatible = "qcom,msm-qgic2", .data = gic_of_init, },
571 { .compatible = "qcom,msm-gpio", .data = msm_gpio_of_init, },
572 { .compatible = "qcom,spmi-pmic-arb", .data = qpnpint_of_init, },
573 {}
574};
Mahesh Sivasubramanian1a995322012-07-12 15:26:46 -0600575static struct of_device_id mpm_match[] __initdata = {
576 {.compatible = "qcom,mpm-v2", },
577 {},
578};
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700579
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700580void __init msm_8974_init_irq(void)
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700581{
Mahesh Sivasubramanian1a995322012-07-12 15:26:46 -0600582 struct device_node *node;
583
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700584 of_irq_init(irq_match);
Mahesh Sivasubramanian1a995322012-07-12 15:26:46 -0600585 node = of_find_matching_node(NULL, mpm_match);
586
587 WARN_ON(!node);
588
589 if (node)
590 of_mpm_init(node);
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700591}
592
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700593static struct of_dev_auxdata msm_8974_auxdata_lookup[] __initdata = {
Sathish Ambleyab783ab2011-11-27 22:21:48 -0800594 OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \
Sathish Ambley3d50c762011-10-25 15:26:00 -0700595 "msm_serial_hsl.0", NULL),
Pavankumar Kondeti0063b842012-01-16 12:19:58 +0530596 OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \
597 "msm_otg", NULL),
Manu Gautam51be9712012-06-06 14:54:52 +0530598 OF_DEV_AUXDATA("qcom,dwc-usb3-msm", 0xF9200000, \
599 "msm_dwc3", NULL),
Harini Jayaraman5f98dbb2011-12-20 13:38:19 -0700600 OF_DEV_AUXDATA("qcom,spi-qup-v2", 0xF9924000, \
601 "spi_qsd.1", NULL),
Kenneth Heitkef3c829c2012-01-13 17:02:43 -0700602 OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \
603 "spmi-pmic-arb.0", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530604 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
David Ng665140f2012-04-12 16:03:45 -0700605 "msm_sdcc.1", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530606 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
607 "msm_sdcc.2", NULL),
608 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \
David Ng665140f2012-04-12 16:03:45 -0700609 "msm_sdcc.3", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530610 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98E4000, \
611 "msm_sdcc.4", NULL),
Matt Wagantallc2bbdc32012-03-21 19:44:50 -0700612 OF_DEV_AUXDATA("qcom,pil-q6v5-lpass", 0xFE200000, \
613 "pil-q6v5-lpass", NULL),
Matt Wagantall4e2599e2012-03-21 22:31:35 -0700614 OF_DEV_AUXDATA("qcom,pil-q6v5-mss", 0xFC880000, "pil-q6v5-mss", NULL),
Matt Wagantalle6e00d52012-03-08 17:39:07 -0800615 OF_DEV_AUXDATA("qcom,pil-mba", 0xFC820000, "pil-mba", NULL),
Tianyi Gouc1e049f82011-11-23 14:20:16 -0800616 OF_DEV_AUXDATA("qcom,pil-pronto", 0xFB21B000, \
617 "pil_pronto", NULL),
Hariprasad Dhalinarasimhade991f02012-05-31 13:15:51 -0700618 OF_DEV_AUXDATA("qcom,msm-rng", 0xF9BFF000, \
619 "msm_rng", NULL),
Ramesh Masavarapufb1f01e2012-06-14 09:40:40 -0700620 OF_DEV_AUXDATA("qcom,qseecom", 0xFE806000, \
621 "qseecom", NULL),
Adrian Salido-Moreno5ef3ac02012-05-14 18:40:47 -0700622 OF_DEV_AUXDATA("qcom,mdss_mdp", 0xFD900000, "mdp.0", NULL),
Siddartha Mohanadoss0a188882012-07-06 15:51:00 -0700623 OF_DEV_AUXDATA("qcom,msm-tsens", 0xFC4A8000, \
624 "msm-tsens", NULL),
Mona Hossainb43e94b2012-05-07 08:52:06 -0700625 OF_DEV_AUXDATA("qcom,qcedev", 0xFD440000, \
626 "qcedev.0", NULL),
627 OF_DEV_AUXDATA("qcom,qcrypto", 0xFD440000, \
628 "qcrypto.0", NULL),
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700629 {}
630};
631
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700632void __init msm_8974_init(struct of_dev_auxdata **adata)
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700633{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700634 msm_8974_init_gpiomux();
Vikram Mulukutlaaeadb5f2012-05-04 14:03:07 -0700635
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700636 *adata = msm_8974_auxdata_lookup;
Matt Wagantallecaa1172012-05-08 21:38:45 -0700637
638 regulator_has_full_constraints();
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700639}
Olav Hauganb800c8c2012-01-30 08:50:45 -0800640
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700641void __init msm_8974_very_early(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800642{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700643 msm_8974_early_memory();
Olav Hauganb800c8c2012-01-30 08:50:45 -0800644}