blob: 6b46a2f00231ee5d33af7a005ca908873c48b7d5 [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>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070047#include "clock.h"
Michael Bohan037a0f52012-02-29 19:13:09 -080048#include "devices.h"
Praveen Chidambaramda9501d2012-04-26 19:48:29 -060049#include "spm.h"
Jeff Hugoa643ca12012-06-11 16:00:23 -060050#include "modem_notifier.h"
Girish Mahadevan40abbe12012-04-25 14:58:13 -060051#include "lpm_resources.h"
Sathish Ambleyc58afc22011-10-09 21:55:39 -070052
Olav Hauganb800c8c2012-01-30 08:50:45 -080053#define MSM_KERNEL_EBI1_MEM_SIZE 0x280000
54#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
55#define MSM_ION_SF_SIZE 0x4000000 /* 64 Mbytes */
56#else
57#define MSM_ION_SF_SIZE 0x2800000 /* 40 Mbytes */
58#endif
Ashray Kulkarni2ad8a7d2012-05-15 14:03:44 -070059#define MSM_ION_MM_FW_SIZE 0xa00000 /* (10MB) */
Olav Hauganb800c8c2012-01-30 08:50:45 -080060#define MSM_ION_MM_SIZE 0x7800000 /* (120MB) */
61#define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */
62#define MSM_ION_MFC_SIZE SZ_8K
63#define MSM_ION_AUDIO_SIZE 0x2B4000
64#define MSM_ION_HEAP_NUM 8
65
66#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
67static unsigned kernel_ebi1_mem_size = MSM_KERNEL_EBI1_MEM_SIZE;
68static int __init kernel_ebi1_mem_size_setup(char *p)
69{
70 kernel_ebi1_mem_size = memparse(p, NULL);
71 return 0;
72}
73early_param("kernel_ebi1_mem_size", kernel_ebi1_mem_size_setup);
74#endif
75
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070076static struct memtype_reserve msm_8974_reserve_table[] __initdata = {
Olav Hauganb800c8c2012-01-30 08:50:45 -080077 [MEMTYPE_SMI] = {
78 },
79 [MEMTYPE_EBI0] = {
80 .flags = MEMTYPE_FLAGS_1M_ALIGN,
81 },
82 [MEMTYPE_EBI1] = {
83 .flags = MEMTYPE_FLAGS_1M_ALIGN,
84 },
85};
86
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070087static int msm_8974_paddr_to_memtype(unsigned int paddr)
Olav Hauganb800c8c2012-01-30 08:50:45 -080088{
89 return MEMTYPE_EBI1;
90}
91
92#ifdef CONFIG_ION_MSM
93static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
94 .permission_type = IPT_TYPE_MM_CARVEOUT,
95 .align = PAGE_SIZE,
96};
97
98static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
99 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
100 .align = PAGE_SIZE,
101};
102
103static struct ion_co_heap_pdata co_ion_pdata = {
104 .adjacent_mem_id = INVALID_HEAP_ID,
105 .align = PAGE_SIZE,
106};
107
108static struct ion_co_heap_pdata fw_co_ion_pdata = {
109 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
110 .align = SZ_128K,
111};
112
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800113/**
114 * These heaps are listed in the order they will be allocated. Due to
115 * video hardware restrictions and content protection the FW heap has to
116 * be allocated adjacent (below) the MM heap and the MFC heap has to be
117 * allocated after the MM heap to ensure MFC heap is not more than 256MB
118 * away from the base address of the FW heap.
119 * However, the order of FW heap and MM heap doesn't matter since these
120 * two heaps are taken care of by separate code to ensure they are adjacent
121 * to each other.
122 * Don't swap the order unless you know what you are doing!
123 */
Olav Hauganb800c8c2012-01-30 08:50:45 -0800124static struct ion_platform_data ion_pdata = {
125 .nr = MSM_ION_HEAP_NUM,
126 .heaps = {
127 {
128 .id = ION_SYSTEM_HEAP_ID,
129 .type = ION_HEAP_TYPE_SYSTEM,
130 .name = ION_VMALLOC_HEAP_NAME,
131 },
132 {
Olav Hauganb800c8c2012-01-30 08:50:45 -0800133 .id = ION_CP_MM_HEAP_ID,
134 .type = ION_HEAP_TYPE_CP,
135 .name = ION_MM_HEAP_NAME,
136 .size = MSM_ION_MM_SIZE,
137 .memory_type = ION_EBI_TYPE,
138 .extra_data = (void *) &cp_mm_ion_pdata,
139 },
140 {
141 .id = ION_MM_FIRMWARE_HEAP_ID,
142 .type = ION_HEAP_TYPE_CARVEOUT,
143 .name = ION_MM_FIRMWARE_HEAP_NAME,
144 .size = MSM_ION_MM_FW_SIZE,
145 .memory_type = ION_EBI_TYPE,
146 .extra_data = (void *) &fw_co_ion_pdata,
147 },
148 {
149 .id = ION_CP_MFC_HEAP_ID,
150 .type = ION_HEAP_TYPE_CP,
151 .name = ION_MFC_HEAP_NAME,
152 .size = MSM_ION_MFC_SIZE,
153 .memory_type = ION_EBI_TYPE,
154 .extra_data = (void *) &cp_mfc_ion_pdata,
155 },
156 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800157 .id = ION_SF_HEAP_ID,
158 .type = ION_HEAP_TYPE_CARVEOUT,
159 .name = ION_SF_HEAP_NAME,
160 .size = MSM_ION_SF_SIZE,
161 .memory_type = ION_EBI_TYPE,
162 .extra_data = (void *) &co_ion_pdata,
163 },
164 {
Olav Hauganb800c8c2012-01-30 08:50:45 -0800165 .id = ION_IOMMU_HEAP_ID,
166 .type = ION_HEAP_TYPE_IOMMU,
167 .name = ION_IOMMU_HEAP_NAME,
168 },
169 {
170 .id = ION_QSECOM_HEAP_ID,
171 .type = ION_HEAP_TYPE_CARVEOUT,
172 .name = ION_QSECOM_HEAP_NAME,
173 .size = MSM_ION_QSECOM_SIZE,
174 .memory_type = ION_EBI_TYPE,
175 .extra_data = (void *) &co_ion_pdata,
176 },
177 {
178 .id = ION_AUDIO_HEAP_ID,
179 .type = ION_HEAP_TYPE_CARVEOUT,
180 .name = ION_AUDIO_HEAP_NAME,
181 .size = MSM_ION_AUDIO_SIZE,
182 .memory_type = ION_EBI_TYPE,
183 .extra_data = (void *) &co_ion_pdata,
184 },
185 }
186};
187
188static struct platform_device ion_dev = {
189 .name = "ion-msm",
190 .id = 1,
191 .dev = { .platform_data = &ion_pdata },
192};
193
Stephen Boyd668d7652012-04-25 11:31:01 -0700194static void __init reserve_ion_memory(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800195{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700196 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE;
197 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE;
198 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE;
199 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE;
200 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE;
201 msm_8974_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
Olav Hauganb800c8c2012-01-30 08:50:45 -0800202#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700203 msm_8974_reserve_table[MEMTYPE_EBI1].size += kernel_ebi1_mem_size;
Olav Hauganb800c8c2012-01-30 08:50:45 -0800204#endif
205}
206#endif
207
Jeff Hugo70946092012-02-10 11:30:43 -0700208static struct resource smd_resource[] = {
209 {
210 .name = "modem_smd_in",
Jeff Hugo3417d072012-07-06 15:45:59 -0600211 .start = 32 + 25, /* mss_sw_to_kpss_ipc_irq0 */
Jeff Hugo70946092012-02-10 11:30:43 -0700212 .flags = IORESOURCE_IRQ,
213 },
214 {
215 .name = "modem_smsm_in",
Jeff Hugo3417d072012-07-06 15:45:59 -0600216 .start = 32 + 26, /* mss_sw_to_kpss_ipc_irq1 */
Jeff Hugo70946092012-02-10 11:30:43 -0700217 .flags = IORESOURCE_IRQ,
218 },
219 {
220 .name = "adsp_smd_in",
221 .start = 32 + 156, /* lpass_to_kpss_ipc_irq0 */
222 .flags = IORESOURCE_IRQ,
223 },
224 {
225 .name = "adsp_smsm_in",
226 .start = 32 + 157, /* lpass_to_kpss_ipc_irq1 */
227 .flags = IORESOURCE_IRQ,
228 },
229 {
230 .name = "wcnss_smd_in",
231 .start = 32 + 142, /* WcnssAppsSmdMedIrq */
232 .flags = IORESOURCE_IRQ,
233 },
234 {
235 .name = "wcnss_smsm_in",
Jeff Hugo89046272012-03-29 14:45:37 -0600236 .start = 32 + 144, /* RivaAppsWlanSmsmIrq */
Jeff Hugo70946092012-02-10 11:30:43 -0700237 .flags = IORESOURCE_IRQ,
238 },
Jeff Hugo9a5dc6e2012-03-29 14:39:42 -0600239 {
240 .name = "rpm_smd_in",
241 .start = 32 + 168, /* rpm_to_kpss_ipc_irq4 */
242 .flags = IORESOURCE_IRQ,
243 },
Jeff Hugo70946092012-02-10 11:30:43 -0700244};
245
246static struct smd_subsystem_config smd_config_list[] = {
247 {
248 .irq_config_id = SMD_MODEM,
249 .subsys_name = "modem",
250 .edge = SMD_APPS_MODEM,
251
252 .smd_int.irq_name = "modem_smd_in",
253 .smd_int.flags = IRQF_TRIGGER_RISING,
254 .smd_int.irq_id = -1,
255 .smd_int.device_name = "smd_dev",
256 .smd_int.dev_id = 0,
257 .smd_int.out_bit_pos = 1 << 12,
258 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
259 .smd_int.out_offset = 0x8,
260
261 .smsm_int.irq_name = "modem_smsm_in",
262 .smsm_int.flags = IRQF_TRIGGER_RISING,
263 .smsm_int.irq_id = -1,
264 .smsm_int.device_name = "smsm_dev",
265 .smsm_int.dev_id = 0,
266 .smsm_int.out_bit_pos = 1 << 13,
267 .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
268 .smsm_int.out_offset = 0x8,
269 },
270 {
271 .irq_config_id = SMD_Q6,
Jeff Hugoa1e3b8c2012-05-29 14:01:41 -0600272 .subsys_name = "adsp",
Jeff Hugo70946092012-02-10 11:30:43 -0700273 .edge = SMD_APPS_QDSP,
274
275 .smd_int.irq_name = "adsp_smd_in",
276 .smd_int.flags = IRQF_TRIGGER_RISING,
277 .smd_int.irq_id = -1,
278 .smd_int.device_name = "smd_dev",
279 .smd_int.dev_id = 0,
280 .smd_int.out_bit_pos = 1 << 8,
281 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
282 .smd_int.out_offset = 0x8,
283
284 .smsm_int.irq_name = "adsp_smsm_in",
285 .smsm_int.flags = IRQF_TRIGGER_RISING,
286 .smsm_int.irq_id = -1,
287 .smsm_int.device_name = "smsm_dev",
288 .smsm_int.dev_id = 0,
289 .smsm_int.out_bit_pos = 1 << 9,
290 .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
291 .smsm_int.out_offset = 0x8,
292 },
293 {
294 .irq_config_id = SMD_WCNSS,
295 .subsys_name = "wcnss",
296 .edge = SMD_APPS_WCNSS,
297
298 .smd_int.irq_name = "wcnss_smd_in",
299 .smd_int.flags = IRQF_TRIGGER_RISING,
300 .smd_int.irq_id = -1,
301 .smd_int.device_name = "smd_dev",
302 .smd_int.dev_id = 0,
303 .smd_int.out_bit_pos = 1 << 17,
304 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
305 .smd_int.out_offset = 0x8,
306
307 .smsm_int.irq_name = "wcnss_smsm_in",
308 .smsm_int.flags = IRQF_TRIGGER_RISING,
309 .smsm_int.irq_id = -1,
310 .smsm_int.device_name = "smsm_dev",
311 .smsm_int.dev_id = 0,
312 .smsm_int.out_bit_pos = 1 << 19,
313 .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
314 .smsm_int.out_offset = 0x8,
315 },
Jeff Hugo9a5dc6e2012-03-29 14:39:42 -0600316 {
317 .irq_config_id = SMD_RPM,
318 .subsys_name = NULL, /* do not use PIL to load RPM */
319 .edge = SMD_APPS_RPM,
320
321 .smd_int.irq_name = "rpm_smd_in",
322 .smd_int.flags = IRQF_TRIGGER_RISING,
323 .smd_int.irq_id = -1,
324 .smd_int.device_name = "smd_dev",
325 .smd_int.dev_id = 0,
326 .smd_int.out_bit_pos = 1 << 0,
327 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
328 .smd_int.out_offset = 0x8,
329
330 .smsm_int.irq_name = NULL, /* RPM does not support SMSM */
331 .smsm_int.flags = 0,
332 .smsm_int.irq_id = 0,
333 .smsm_int.device_name = NULL,
334 .smsm_int.dev_id = 0,
335 .smsm_int.out_bit_pos = 0,
336 .smsm_int.out_base = NULL,
337 .smsm_int.out_offset = 0,
338 },
339};
340
341static struct smd_smem_regions aux_smem_areas[] = {
342 {
343 .phys_addr = (void *)(0xfc428000),
344 .size = 0x4000,
345 },
Jeff Hugo70946092012-02-10 11:30:43 -0700346};
347
Jeff Hugo3e366292012-03-29 15:19:14 -0600348static struct smd_subsystem_restart_config smd_ssr_cfg = {
349 .disable_smsm_reset_handshake = 1,
350};
351
Jeff Hugo70946092012-02-10 11:30:43 -0700352static struct smd_platform smd_platform_data = {
353 .num_ss_configs = ARRAY_SIZE(smd_config_list),
354 .smd_ss_configs = smd_config_list,
Jeff Hugo3e366292012-03-29 15:19:14 -0600355 .smd_ssr_config = &smd_ssr_cfg,
Jeff Hugo9a5dc6e2012-03-29 14:39:42 -0600356 .num_smem_areas = ARRAY_SIZE(aux_smem_areas),
357 .smd_smem_areas = aux_smem_areas,
Jeff Hugo70946092012-02-10 11:30:43 -0700358};
359
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700360struct platform_device msm_device_smd_8974 = {
Jeff Hugo70946092012-02-10 11:30:43 -0700361 .name = "msm_smd",
362 .id = -1,
363 .resource = smd_resource,
364 .num_resources = ARRAY_SIZE(smd_resource),
365 .dev = {
366 .platform_data = &smd_platform_data,
367 }
368};
369
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700370static void __init msm_8974_calculate_reserve_sizes(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800371{
372#ifdef CONFIG_ION_MSM
373 reserve_ion_memory();
374#endif
375}
376
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700377static struct reserve_info msm_8974_reserve_info __initdata = {
378 .memtype_reserve_table = msm_8974_reserve_table,
379 .calculate_reserve_sizes = msm_8974_calculate_reserve_sizes,
380 .paddr_to_memtype = msm_8974_paddr_to_memtype,
Olav Hauganb800c8c2012-01-30 08:50:45 -0800381};
382
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700383static void __init msm_8974_early_memory(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800384{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700385 reserve_info = &msm_8974_reserve_info;
Laura Abbottd8d0f772012-07-10 10:27:06 -0700386 of_scan_flat_dt(dt_scan_for_memory_reserve, msm_8974_reserve_table);
Olav Hauganb800c8c2012-01-30 08:50:45 -0800387}
388
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700389void __init msm_8974_reserve(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800390{
391 msm_reserve();
392}
393
Pavankumar Kondeti8c447382012-03-29 09:02:09 +0530394static struct platform_device android_usb_device = {
395 .name = "android_usb",
396 .id = -1,
397};
398
Gagan Macdd9bb792012-04-25 16:56:48 -0600399#define BIMC_BASE 0xfc380000
400#define BIMC_SIZE 0x0006A000
401#define SYS_NOC_BASE 0xfc460000
402#define PERIPH_NOC_BASE 0xFC468000
403#define OCMEM_NOC_BASE 0xfc470000
404#define MMSS_NOC_BASE 0xfc478000
405#define CONFIG_NOC_BASE 0xfc480000
406#define NOC_SIZE 0x00004000
407
408static struct resource bimc_res[] = {
409 {
410 .start = BIMC_BASE,
411 .end = BIMC_BASE + BIMC_SIZE,
412 .flags = IORESOURCE_MEM,
413 .name = "bimc_mem",
414 },
415};
416
417static struct resource ocmem_noc_res[] = {
418 {
419 .start = OCMEM_NOC_BASE,
420 .end = OCMEM_NOC_BASE + NOC_SIZE,
421 .flags = IORESOURCE_MEM,
422 .name = "ocmem_noc_mem",
423 },
424};
425
426static struct resource mmss_noc_res[] = {
427 {
428 .start = MMSS_NOC_BASE,
429 .end = MMSS_NOC_BASE + NOC_SIZE,
430 .flags = IORESOURCE_MEM,
431 .name = "mmss_noc_mem",
432 },
433};
434
435static struct resource sys_noc_res[] = {
436 {
437 .start = SYS_NOC_BASE,
438 .end = SYS_NOC_BASE + NOC_SIZE,
439 .flags = IORESOURCE_MEM,
440 .name = "sys_noc_mem",
441 },
442};
443
444static struct resource config_noc_res[] = {
445 {
446 .start = CONFIG_NOC_BASE,
447 .end = CONFIG_NOC_BASE + NOC_SIZE,
448 .flags = IORESOURCE_MEM,
449 .name = "config_noc_mem",
450 },
451};
452
453static struct resource periph_noc_res[] = {
454 {
455 .start = PERIPH_NOC_BASE,
456 .end = PERIPH_NOC_BASE + NOC_SIZE,
457 .flags = IORESOURCE_MEM,
458 .name = "periph_noc_mem",
459 },
460};
461
462static struct platform_device msm_bus_sys_noc = {
463 .name = "msm_bus_fabric",
464 .id = MSM_BUS_FAB_SYS_NOC,
465 .num_resources = ARRAY_SIZE(sys_noc_res),
466 .resource = sys_noc_res,
467};
468
469static struct platform_device msm_bus_bimc = {
470 .name = "msm_bus_fabric",
471 .id = MSM_BUS_FAB_BIMC,
472 .num_resources = ARRAY_SIZE(bimc_res),
473 .resource = bimc_res,
474};
475
476static struct platform_device msm_bus_mmss_noc = {
477 .name = "msm_bus_fabric",
478 .id = MSM_BUS_FAB_MMSS_NOC,
479 .num_resources = ARRAY_SIZE(mmss_noc_res),
480 .resource = mmss_noc_res,
481};
482
483static struct platform_device msm_bus_ocmem_noc = {
484 .name = "msm_bus_fabric",
485 .id = MSM_BUS_FAB_OCMEM_NOC,
486 .num_resources = ARRAY_SIZE(ocmem_noc_res),
487 .resource = ocmem_noc_res,
488};
489
490static struct platform_device msm_bus_periph_noc = {
491 .name = "msm_bus_fabric",
492 .id = MSM_BUS_FAB_PERIPH_NOC,
493 .num_resources = ARRAY_SIZE(periph_noc_res),
494 .resource = periph_noc_res,
495};
496
497static struct platform_device msm_bus_config_noc = {
498 .name = "msm_bus_fabric",
499 .id = MSM_BUS_FAB_CONFIG_NOC,
500 .num_resources = ARRAY_SIZE(config_noc_res),
501 .resource = config_noc_res,
502};
503
504static struct platform_device msm_bus_ocmem_vnoc = {
505 .name = "msm_bus_fabric",
506 .id = MSM_BUS_FAB_OCMEM_VNOC,
507};
508
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700509static struct platform_device *msm_bus_8974_devices[] = {
Gagan Macdd9bb792012-04-25 16:56:48 -0600510 &msm_bus_sys_noc,
511 &msm_bus_bimc,
512 &msm_bus_mmss_noc,
513 &msm_bus_ocmem_noc,
514 &msm_bus_periph_noc,
515 &msm_bus_config_noc,
516 &msm_bus_ocmem_vnoc,
517};
518
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700519static void __init msm8974_init_buses(void)
Gagan Macdd9bb792012-04-25 16:56:48 -0600520{
521#ifdef CONFIG_MSM_BUS_SCALING
522 msm_bus_sys_noc.dev.platform_data =
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700523 &msm_bus_8974_sys_noc_pdata;
524 msm_bus_bimc.dev.platform_data = &msm_bus_8974_bimc_pdata;
525 msm_bus_mmss_noc.dev.platform_data = &msm_bus_8974_mmss_noc_pdata;
526 msm_bus_ocmem_noc.dev.platform_data = &msm_bus_8974_ocmem_noc_pdata;
527 msm_bus_periph_noc.dev.platform_data = &msm_bus_8974_periph_noc_pdata;
528 msm_bus_config_noc.dev.platform_data = &msm_bus_8974_config_noc_pdata;
529 msm_bus_ocmem_vnoc.dev.platform_data = &msm_bus_8974_ocmem_vnoc_pdata;
Gagan Macdd9bb792012-04-25 16:56:48 -0600530#endif
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700531 platform_add_devices(msm_bus_8974_devices,
532 ARRAY_SIZE(msm_bus_8974_devices));
Gagan Macdd9bb792012-04-25 16:56:48 -0600533};
Hariprasad Dhalinarasimhaf42732a2012-05-21 18:00:49 -0700534
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700535void __init msm_8974_add_devices(void)
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700536{
Olav Hauganb800c8c2012-01-30 08:50:45 -0800537#ifdef CONFIG_ION_MSM
538 platform_device_register(&ion_dev);
539#endif
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700540 platform_device_register(&msm_device_smd_8974);
Pavankumar Kondeti8c447382012-03-29 09:02:09 +0530541 platform_device_register(&android_usb_device);
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700542 platform_add_devices(msm_8974_stub_regulator_devices,
543 msm_8974_stub_regulator_devices_len);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700544}
545
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700546static struct clk_lookup msm_clocks_dummy[] = {
Matt Wagantallb3fe8992011-12-07 19:26:55 -0800547 CLK_DUMMY("xo", XO_CLK, NULL, OFF),
Tianyi Gouc1e049f82011-11-23 14:20:16 -0800548 CLK_DUMMY("xo", XO_CLK, "pil_pronto", OFF),
Sathish Ambley3d50c762011-10-25 15:26:00 -0700549 CLK_DUMMY("core_clk", BLSP2_UART_CLK, "msm_serial_hsl.0", OFF),
550 CLK_DUMMY("iface_clk", BLSP2_UART_CLK, "msm_serial_hsl.0", OFF),
Sujit Reddy Thumma1a4a79e2011-11-04 09:44:32 +0530551 CLK_DUMMY("core_clk", SDC1_CLK, NULL, OFF),
552 CLK_DUMMY("iface_clk", SDC1_P_CLK, NULL, OFF),
553 CLK_DUMMY("core_clk", SDC3_CLK, NULL, OFF),
554 CLK_DUMMY("iface_clk", SDC3_P_CLK, NULL, OFF),
Pavankumar Kondeti0063b842012-01-16 12:19:58 +0530555 CLK_DUMMY("phy_clk", NULL, "msm_otg", OFF),
556 CLK_DUMMY("core_clk", NULL, "msm_otg", OFF),
Pavankumar Kondeti0063b842012-01-16 12:19:58 +0530557 CLK_DUMMY("iface_clk", NULL, "msm_otg", OFF),
Pavankumar Kondeti066bfbf2012-02-20 14:10:20 +0530558 CLK_DUMMY("xo", NULL, "msm_otg", OFF),
Yan He1466daa2011-11-30 17:25:38 -0800559 CLK_DUMMY("dfab_clk", DFAB_CLK, NULL, 0),
560 CLK_DUMMY("dma_bam_pclk", DMA_BAM_P_CLK, NULL, 0),
561 CLK_DUMMY("mem_clk", NULL, NULL, 0),
Harini Jayaraman5f98dbb2011-12-20 13:38:19 -0700562 CLK_DUMMY("core_clk", SPI_CLK, "spi_qsd.1", OFF),
563 CLK_DUMMY("iface_clk", SPI_P_CLK, "spi_qsd.1", OFF),
Sagar Dharia218edb92012-01-15 18:03:01 -0700564 CLK_DUMMY("core_clk", NULL, "f9966000.i2c", 0),
565 CLK_DUMMY("iface_clk", NULL, "f9966000.i2c", 0),
Sagar Dhariaa316a962012-03-21 16:13:22 -0600566 CLK_DUMMY("core_clk", NULL, "fe12f000.slim", OFF),
Adrian Salido-Moreno5ef3ac02012-05-14 18:40:47 -0700567 CLK_DUMMY("core_clk", "mdp.0", NULL, 0),
568 CLK_DUMMY("core_clk_src", "mdp.0", NULL, 0),
569 CLK_DUMMY("lut_clk", "mdp.0", NULL, 0),
570 CLK_DUMMY("vsync_clk", "mdp.0", NULL, 0),
571 CLK_DUMMY("iface_clk", "mdp.0", NULL, 0),
572 CLK_DUMMY("bus_clk", "mdp.0", NULL, 0),
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700573};
574
575struct clock_init_data msm_dummy_clock_init_data __initdata = {
576 .table = msm_clocks_dummy,
577 .size = ARRAY_SIZE(msm_clocks_dummy),
578};
579
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700580/*
581 * Used to satisfy dependencies for devices that need to be
582 * run early or in a particular order. Most likely your device doesn't fall
583 * into this category, and thus the driver should not be added here. The
584 * EPROBE_DEFER can satisfy most dependency problems.
585 */
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700586void __init msm_8974_add_drivers(void)
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700587{
Jeff Hugoa643ca12012-06-11 16:00:23 -0600588 msm_init_modem_notifier_list();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700589 msm_smd_init();
590 msm_rpm_driver_init();
Girish Mahadevan40abbe12012-04-25 14:58:13 -0600591 msm_lpmrs_module_init();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700592 rpm_regulator_smd_driver_init();
593 msm_spm_device_init();
594 regulator_stub_init();
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700595 if (machine_is_msm8974_rumi())
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700596 msm_clock_init(&msm_dummy_clock_init_data);
597 else
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700598 msm_clock_init(&msm8974_clock_init_data);
599 msm8974_init_buses();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700600}
601
602static struct of_device_id irq_match[] __initdata = {
603 { .compatible = "qcom,msm-qgic2", .data = gic_of_init, },
604 { .compatible = "qcom,msm-gpio", .data = msm_gpio_of_init, },
605 { .compatible = "qcom,spmi-pmic-arb", .data = qpnpint_of_init, },
606 {}
607};
608
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700609void __init msm_8974_init_irq(void)
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700610{
611 of_irq_init(irq_match);
612}
613
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700614static struct of_dev_auxdata msm_8974_auxdata_lookup[] __initdata = {
Sathish Ambleyab783ab2011-11-27 22:21:48 -0800615 OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \
Sathish Ambley3d50c762011-10-25 15:26:00 -0700616 "msm_serial_hsl.0", NULL),
Pavankumar Kondeti0063b842012-01-16 12:19:58 +0530617 OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \
618 "msm_otg", NULL),
Manu Gautam51be9712012-06-06 14:54:52 +0530619 OF_DEV_AUXDATA("qcom,dwc-usb3-msm", 0xF9200000, \
620 "msm_dwc3", NULL),
Harini Jayaraman5f98dbb2011-12-20 13:38:19 -0700621 OF_DEV_AUXDATA("qcom,spi-qup-v2", 0xF9924000, \
622 "spi_qsd.1", NULL),
Kenneth Heitkef3c829c2012-01-13 17:02:43 -0700623 OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \
624 "spmi-pmic-arb.0", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530625 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
David Ng665140f2012-04-12 16:03:45 -0700626 "msm_sdcc.1", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530627 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
628 "msm_sdcc.2", NULL),
629 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \
David Ng665140f2012-04-12 16:03:45 -0700630 "msm_sdcc.3", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530631 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98E4000, \
632 "msm_sdcc.4", NULL),
Matt Wagantallc2bbdc32012-03-21 19:44:50 -0700633 OF_DEV_AUXDATA("qcom,pil-q6v5-lpass", 0xFE200000, \
634 "pil-q6v5-lpass", NULL),
Matt Wagantall4e2599e2012-03-21 22:31:35 -0700635 OF_DEV_AUXDATA("qcom,pil-q6v5-mss", 0xFC880000, "pil-q6v5-mss", NULL),
Matt Wagantalle6e00d52012-03-08 17:39:07 -0800636 OF_DEV_AUXDATA("qcom,pil-mba", 0xFC820000, "pil-mba", NULL),
Tianyi Gouc1e049f82011-11-23 14:20:16 -0800637 OF_DEV_AUXDATA("qcom,pil-pronto", 0xFB21B000, \
638 "pil_pronto", NULL),
Hariprasad Dhalinarasimhade991f02012-05-31 13:15:51 -0700639 OF_DEV_AUXDATA("qcom,msm-rng", 0xF9BFF000, \
640 "msm_rng", NULL),
Ramesh Masavarapufb1f01e2012-06-14 09:40:40 -0700641 OF_DEV_AUXDATA("qcom,qseecom", 0xFE806000, \
642 "qseecom", NULL),
Adrian Salido-Moreno5ef3ac02012-05-14 18:40:47 -0700643 OF_DEV_AUXDATA("qcom,mdss_mdp", 0xFD900000, "mdp.0", NULL),
Siddartha Mohanadoss0a188882012-07-06 15:51:00 -0700644 OF_DEV_AUXDATA("qcom,msm-tsens", 0xFC4A8000, \
645 "msm-tsens", NULL),
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700646 {}
647};
648
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700649void __init msm_8974_init(struct of_dev_auxdata **adata)
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700650{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700651 msm_8974_init_gpiomux();
Vikram Mulukutlaaeadb5f2012-05-04 14:03:07 -0700652
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700653 *adata = msm_8974_auxdata_lookup;
Matt Wagantallecaa1172012-05-08 21:38:45 -0700654
655 regulator_has_full_constraints();
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700656}
Olav Hauganb800c8c2012-01-30 08:50:45 -0800657
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700658void __init msm_8974_very_early(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800659{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700660 msm_8974_early_memory();
Olav Hauganb800c8c2012-01-30 08:50:45 -0800661}