blob: 4e881df054c865111ea3686d4e2ee512c887f76d [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",
211 .start = 32 + 17, /* mss_sw_to_kpss_ipc_irq0 */
212 .flags = IORESOURCE_IRQ,
213 },
214 {
215 .name = "modem_smsm_in",
216 .start = 32 + 18, /* mss_sw_to_kpss_ipc_irq1 */
217 .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;
Olav Hauganb800c8c2012-01-30 08:50:45 -0800386}
387
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700388void __init msm_8974_reserve(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800389{
390 msm_reserve();
391}
392
Pavankumar Kondeti8c447382012-03-29 09:02:09 +0530393static struct platform_device android_usb_device = {
394 .name = "android_usb",
395 .id = -1,
396};
397
Hariprasad Dhalinarasimhaf42732a2012-05-21 18:00:49 -0700398#define SHARED_IMEM_TZ_BASE 0xFE805720
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700399static struct resource msm8974_tzlog_resources[] = {
Hariprasad Dhalinarasimhaf42732a2012-05-21 18:00:49 -0700400 {
401 .start = SHARED_IMEM_TZ_BASE,
402 .end = SHARED_IMEM_TZ_BASE + SZ_4K - 1,
403 .flags = IORESOURCE_MEM,
404 },
405};
406
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700407struct platform_device msm8974_device_tz_log = {
Hariprasad Dhalinarasimhaf42732a2012-05-21 18:00:49 -0700408 .name = "tz_log",
409 .id = 0,
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700410 .num_resources = ARRAY_SIZE(msm8974_tzlog_resources),
411 .resource = msm8974_tzlog_resources,
Hariprasad Dhalinarasimhaf42732a2012-05-21 18:00:49 -0700412};
413
Gagan Macdd9bb792012-04-25 16:56:48 -0600414#define BIMC_BASE 0xfc380000
415#define BIMC_SIZE 0x0006A000
416#define SYS_NOC_BASE 0xfc460000
417#define PERIPH_NOC_BASE 0xFC468000
418#define OCMEM_NOC_BASE 0xfc470000
419#define MMSS_NOC_BASE 0xfc478000
420#define CONFIG_NOC_BASE 0xfc480000
421#define NOC_SIZE 0x00004000
422
423static struct resource bimc_res[] = {
424 {
425 .start = BIMC_BASE,
426 .end = BIMC_BASE + BIMC_SIZE,
427 .flags = IORESOURCE_MEM,
428 .name = "bimc_mem",
429 },
430};
431
432static struct resource ocmem_noc_res[] = {
433 {
434 .start = OCMEM_NOC_BASE,
435 .end = OCMEM_NOC_BASE + NOC_SIZE,
436 .flags = IORESOURCE_MEM,
437 .name = "ocmem_noc_mem",
438 },
439};
440
441static struct resource mmss_noc_res[] = {
442 {
443 .start = MMSS_NOC_BASE,
444 .end = MMSS_NOC_BASE + NOC_SIZE,
445 .flags = IORESOURCE_MEM,
446 .name = "mmss_noc_mem",
447 },
448};
449
450static struct resource sys_noc_res[] = {
451 {
452 .start = SYS_NOC_BASE,
453 .end = SYS_NOC_BASE + NOC_SIZE,
454 .flags = IORESOURCE_MEM,
455 .name = "sys_noc_mem",
456 },
457};
458
459static struct resource config_noc_res[] = {
460 {
461 .start = CONFIG_NOC_BASE,
462 .end = CONFIG_NOC_BASE + NOC_SIZE,
463 .flags = IORESOURCE_MEM,
464 .name = "config_noc_mem",
465 },
466};
467
468static struct resource periph_noc_res[] = {
469 {
470 .start = PERIPH_NOC_BASE,
471 .end = PERIPH_NOC_BASE + NOC_SIZE,
472 .flags = IORESOURCE_MEM,
473 .name = "periph_noc_mem",
474 },
475};
476
477static struct platform_device msm_bus_sys_noc = {
478 .name = "msm_bus_fabric",
479 .id = MSM_BUS_FAB_SYS_NOC,
480 .num_resources = ARRAY_SIZE(sys_noc_res),
481 .resource = sys_noc_res,
482};
483
484static struct platform_device msm_bus_bimc = {
485 .name = "msm_bus_fabric",
486 .id = MSM_BUS_FAB_BIMC,
487 .num_resources = ARRAY_SIZE(bimc_res),
488 .resource = bimc_res,
489};
490
491static struct platform_device msm_bus_mmss_noc = {
492 .name = "msm_bus_fabric",
493 .id = MSM_BUS_FAB_MMSS_NOC,
494 .num_resources = ARRAY_SIZE(mmss_noc_res),
495 .resource = mmss_noc_res,
496};
497
498static struct platform_device msm_bus_ocmem_noc = {
499 .name = "msm_bus_fabric",
500 .id = MSM_BUS_FAB_OCMEM_NOC,
501 .num_resources = ARRAY_SIZE(ocmem_noc_res),
502 .resource = ocmem_noc_res,
503};
504
505static struct platform_device msm_bus_periph_noc = {
506 .name = "msm_bus_fabric",
507 .id = MSM_BUS_FAB_PERIPH_NOC,
508 .num_resources = ARRAY_SIZE(periph_noc_res),
509 .resource = periph_noc_res,
510};
511
512static struct platform_device msm_bus_config_noc = {
513 .name = "msm_bus_fabric",
514 .id = MSM_BUS_FAB_CONFIG_NOC,
515 .num_resources = ARRAY_SIZE(config_noc_res),
516 .resource = config_noc_res,
517};
518
519static struct platform_device msm_bus_ocmem_vnoc = {
520 .name = "msm_bus_fabric",
521 .id = MSM_BUS_FAB_OCMEM_VNOC,
522};
523
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700524static struct platform_device *msm_bus_8974_devices[] = {
Gagan Macdd9bb792012-04-25 16:56:48 -0600525 &msm_bus_sys_noc,
526 &msm_bus_bimc,
527 &msm_bus_mmss_noc,
528 &msm_bus_ocmem_noc,
529 &msm_bus_periph_noc,
530 &msm_bus_config_noc,
531 &msm_bus_ocmem_vnoc,
532};
533
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700534static void __init msm8974_init_buses(void)
Gagan Macdd9bb792012-04-25 16:56:48 -0600535{
536#ifdef CONFIG_MSM_BUS_SCALING
537 msm_bus_sys_noc.dev.platform_data =
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700538 &msm_bus_8974_sys_noc_pdata;
539 msm_bus_bimc.dev.platform_data = &msm_bus_8974_bimc_pdata;
540 msm_bus_mmss_noc.dev.platform_data = &msm_bus_8974_mmss_noc_pdata;
541 msm_bus_ocmem_noc.dev.platform_data = &msm_bus_8974_ocmem_noc_pdata;
542 msm_bus_periph_noc.dev.platform_data = &msm_bus_8974_periph_noc_pdata;
543 msm_bus_config_noc.dev.platform_data = &msm_bus_8974_config_noc_pdata;
544 msm_bus_ocmem_vnoc.dev.platform_data = &msm_bus_8974_ocmem_vnoc_pdata;
Gagan Macdd9bb792012-04-25 16:56:48 -0600545#endif
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700546 platform_add_devices(msm_bus_8974_devices,
547 ARRAY_SIZE(msm_bus_8974_devices));
Gagan Macdd9bb792012-04-25 16:56:48 -0600548};
Hariprasad Dhalinarasimhaf42732a2012-05-21 18:00:49 -0700549
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700550void __init msm_8974_add_devices(void)
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700551{
Olav Hauganb800c8c2012-01-30 08:50:45 -0800552#ifdef CONFIG_ION_MSM
553 platform_device_register(&ion_dev);
554#endif
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700555 platform_device_register(&msm_device_smd_8974);
Pavankumar Kondeti8c447382012-03-29 09:02:09 +0530556 platform_device_register(&android_usb_device);
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700557 platform_add_devices(msm_8974_stub_regulator_devices,
558 msm_8974_stub_regulator_devices_len);
559 platform_device_register(&msm8974_device_tz_log);
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700560}
561
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700562static struct clk_lookup msm_clocks_dummy[] = {
Matt Wagantallb3fe8992011-12-07 19:26:55 -0800563 CLK_DUMMY("xo", XO_CLK, NULL, OFF),
Tianyi Gouc1e049f82011-11-23 14:20:16 -0800564 CLK_DUMMY("xo", XO_CLK, "pil_pronto", OFF),
Sathish Ambley3d50c762011-10-25 15:26:00 -0700565 CLK_DUMMY("core_clk", BLSP2_UART_CLK, "msm_serial_hsl.0", OFF),
566 CLK_DUMMY("iface_clk", BLSP2_UART_CLK, "msm_serial_hsl.0", OFF),
Sujit Reddy Thumma1a4a79e2011-11-04 09:44:32 +0530567 CLK_DUMMY("core_clk", SDC1_CLK, NULL, OFF),
568 CLK_DUMMY("iface_clk", SDC1_P_CLK, NULL, OFF),
569 CLK_DUMMY("core_clk", SDC3_CLK, NULL, OFF),
570 CLK_DUMMY("iface_clk", SDC3_P_CLK, NULL, OFF),
Pavankumar Kondeti0063b842012-01-16 12:19:58 +0530571 CLK_DUMMY("phy_clk", NULL, "msm_otg", OFF),
572 CLK_DUMMY("core_clk", NULL, "msm_otg", OFF),
Pavankumar Kondeti0063b842012-01-16 12:19:58 +0530573 CLK_DUMMY("iface_clk", NULL, "msm_otg", OFF),
Pavankumar Kondeti066bfbf2012-02-20 14:10:20 +0530574 CLK_DUMMY("xo", NULL, "msm_otg", OFF),
Yan He1466daa2011-11-30 17:25:38 -0800575 CLK_DUMMY("dfab_clk", DFAB_CLK, NULL, 0),
576 CLK_DUMMY("dma_bam_pclk", DMA_BAM_P_CLK, NULL, 0),
577 CLK_DUMMY("mem_clk", NULL, NULL, 0),
Harini Jayaraman5f98dbb2011-12-20 13:38:19 -0700578 CLK_DUMMY("core_clk", SPI_CLK, "spi_qsd.1", OFF),
579 CLK_DUMMY("iface_clk", SPI_P_CLK, "spi_qsd.1", OFF),
Sagar Dharia218edb92012-01-15 18:03:01 -0700580 CLK_DUMMY("core_clk", NULL, "f9966000.i2c", 0),
581 CLK_DUMMY("iface_clk", NULL, "f9966000.i2c", 0),
Sagar Dhariaa316a962012-03-21 16:13:22 -0600582 CLK_DUMMY("core_clk", NULL, "fe12f000.slim", OFF),
Adrian Salido-Moreno5ef3ac02012-05-14 18:40:47 -0700583 CLK_DUMMY("core_clk", "mdp.0", NULL, 0),
584 CLK_DUMMY("core_clk_src", "mdp.0", NULL, 0),
585 CLK_DUMMY("lut_clk", "mdp.0", NULL, 0),
586 CLK_DUMMY("vsync_clk", "mdp.0", NULL, 0),
587 CLK_DUMMY("iface_clk", "mdp.0", NULL, 0),
588 CLK_DUMMY("bus_clk", "mdp.0", NULL, 0),
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700589};
590
591struct clock_init_data msm_dummy_clock_init_data __initdata = {
592 .table = msm_clocks_dummy,
593 .size = ARRAY_SIZE(msm_clocks_dummy),
594};
595
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700596/*
597 * Used to satisfy dependencies for devices that need to be
598 * run early or in a particular order. Most likely your device doesn't fall
599 * into this category, and thus the driver should not be added here. The
600 * EPROBE_DEFER can satisfy most dependency problems.
601 */
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700602void __init msm_8974_add_drivers(void)
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700603{
Jeff Hugoa643ca12012-06-11 16:00:23 -0600604 msm_init_modem_notifier_list();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700605 msm_smd_init();
606 msm_rpm_driver_init();
Girish Mahadevan40abbe12012-04-25 14:58:13 -0600607 msm_lpmrs_module_init();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700608 rpm_regulator_smd_driver_init();
609 msm_spm_device_init();
610 regulator_stub_init();
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700611 if (machine_is_msm8974_rumi())
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700612 msm_clock_init(&msm_dummy_clock_init_data);
613 else
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700614 msm_clock_init(&msm8974_clock_init_data);
615 msm8974_init_buses();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700616}
617
618static struct of_device_id irq_match[] __initdata = {
619 { .compatible = "qcom,msm-qgic2", .data = gic_of_init, },
620 { .compatible = "qcom,msm-gpio", .data = msm_gpio_of_init, },
621 { .compatible = "qcom,spmi-pmic-arb", .data = qpnpint_of_init, },
622 {}
623};
624
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700625void __init msm_8974_init_irq(void)
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700626{
627 of_irq_init(irq_match);
628}
629
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700630static struct of_dev_auxdata msm_8974_auxdata_lookup[] __initdata = {
Sathish Ambleyab783ab2011-11-27 22:21:48 -0800631 OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \
Sathish Ambley3d50c762011-10-25 15:26:00 -0700632 "msm_serial_hsl.0", NULL),
Pavankumar Kondeti0063b842012-01-16 12:19:58 +0530633 OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \
634 "msm_otg", NULL),
Manu Gautam51be9712012-06-06 14:54:52 +0530635 OF_DEV_AUXDATA("qcom,dwc-usb3-msm", 0xF9200000, \
636 "msm_dwc3", NULL),
Harini Jayaraman5f98dbb2011-12-20 13:38:19 -0700637 OF_DEV_AUXDATA("qcom,spi-qup-v2", 0xF9924000, \
638 "spi_qsd.1", NULL),
Kenneth Heitkef3c829c2012-01-13 17:02:43 -0700639 OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \
640 "spmi-pmic-arb.0", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530641 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
David Ng665140f2012-04-12 16:03:45 -0700642 "msm_sdcc.1", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530643 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
644 "msm_sdcc.2", NULL),
645 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \
David Ng665140f2012-04-12 16:03:45 -0700646 "msm_sdcc.3", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530647 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98E4000, \
648 "msm_sdcc.4", NULL),
Matt Wagantallc2bbdc32012-03-21 19:44:50 -0700649 OF_DEV_AUXDATA("qcom,pil-q6v5-lpass", 0xFE200000, \
650 "pil-q6v5-lpass", NULL),
Matt Wagantall4e2599e2012-03-21 22:31:35 -0700651 OF_DEV_AUXDATA("qcom,pil-q6v5-mss", 0xFC880000, "pil-q6v5-mss", NULL),
Matt Wagantalle6e00d52012-03-08 17:39:07 -0800652 OF_DEV_AUXDATA("qcom,pil-mba", 0xFC820000, "pil-mba", NULL),
Tianyi Gouc1e049f82011-11-23 14:20:16 -0800653 OF_DEV_AUXDATA("qcom,pil-pronto", 0xFB21B000, \
654 "pil_pronto", NULL),
Hariprasad Dhalinarasimhade991f02012-05-31 13:15:51 -0700655 OF_DEV_AUXDATA("qcom,msm-rng", 0xF9BFF000, \
656 "msm_rng", NULL),
Ramesh Masavarapufb1f01e2012-06-14 09:40:40 -0700657 OF_DEV_AUXDATA("qcom,qseecom", 0xFE806000, \
658 "qseecom", NULL),
Adrian Salido-Moreno5ef3ac02012-05-14 18:40:47 -0700659 OF_DEV_AUXDATA("qcom,mdss_mdp", 0xFD900000, "mdp.0", NULL),
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700660 {}
661};
662
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700663void __init msm_8974_init(struct of_dev_auxdata **adata)
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700664{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700665 msm_8974_init_gpiomux();
Vikram Mulukutlaaeadb5f2012-05-04 14:03:07 -0700666
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700667 *adata = msm_8974_auxdata_lookup;
Matt Wagantallecaa1172012-05-08 21:38:45 -0700668
669 regulator_has_full_constraints();
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700670}
Olav Hauganb800c8c2012-01-30 08:50:45 -0800671
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700672void __init msm_8974_very_early(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800673{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700674 msm_8974_early_memory();
Olav Hauganb800c8c2012-01-30 08:50:45 -0800675}