blob: 2723e20cbe0cec920b606edc36feee5590031398 [file] [log] [blame]
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -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
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -080013#include <linux/err.h>
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -070014#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/platform_device.h>
17#include <linux/io.h>
18#include <linux/gpio.h>
19#include <linux/irq.h>
20#include <linux/irqdomain.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/of_platform.h>
24#include <linux/of_fdt.h>
25#include <linux/of_irq.h>
26#include <linux/memory.h>
27#include <asm/mach/map.h>
28#include <asm/arch_timer.h>
29#include <asm/hardware/gic.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/time.h>
32#include <mach/board.h>
33#include <mach/gpiomux.h>
34#include <mach/msm_iomap.h>
Hanumant Singhe4271312012-10-24 13:27:57 -070035#include <mach/restart.h>
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -070036#ifdef CONFIG_ION_MSM
37#include <mach/ion.h>
38#endif
Xiaozhe Shie4284532013-03-13 16:03:09 -070039#include <linux/regulator/qpnp-regulator.h>
Neeti Desai1c638102012-11-09 16:08:11 -080040#include <mach/msm_memtypes.h>
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -070041#include <mach/socinfo.h>
42#include <mach/board.h>
43#include <mach/clk-provider.h>
Praveen Chidambaram52380712012-12-20 16:51:11 -070044#include <mach/msm_smd.h>
45#include <mach/rpm-smd.h>
46#include <linux/msm_thermal.h>
Rohit Vaswani90e30232012-10-10 16:52:37 -070047#include "board-dt.h"
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -070048#include "clock.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -080049#include "platsmp.h"
Praveen Chidambaram52380712012-12-20 16:51:11 -070050#include "spm.h"
51#include "lpm_resources.h"
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -070052
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -080053static struct memtype_reserve msm8610_reserve_table[] __initdata = {
Neeti Desai1c638102012-11-09 16:08:11 -080054 [MEMTYPE_SMI] = {
55 },
56 [MEMTYPE_EBI0] = {
57 .flags = MEMTYPE_FLAGS_1M_ALIGN,
58 },
59 [MEMTYPE_EBI1] = {
60 .flags = MEMTYPE_FLAGS_1M_ALIGN,
61 },
62};
63
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -080064static int msm8610_paddr_to_memtype(unsigned int paddr)
Neeti Desai1c638102012-11-09 16:08:11 -080065{
66 return MEMTYPE_EBI1;
67}
68
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -080069static struct of_dev_auxdata msm8610_auxdata_lookup[] __initdata = {
David Ngb5bac062012-11-02 00:00:12 -070070 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
71 "msm_sdcc.1", NULL),
72 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
73 "msm_sdcc.2", NULL),
74 {}
75};
76
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -080077static struct reserve_info msm8610_reserve_info __initdata = {
78 .memtype_reserve_table = msm8610_reserve_table,
79 .paddr_to_memtype = msm8610_paddr_to_memtype,
Neeti Desai1c638102012-11-09 16:08:11 -080080};
81
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -080082static void __init msm8610_early_memory(void)
Neeti Desai1c638102012-11-09 16:08:11 -080083{
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -080084 reserve_info = &msm8610_reserve_info;
Neeti Desai2a575be2012-11-26 12:53:10 -080085 of_scan_flat_dt(dt_scan_for_memory_hole, msm8610_reserve_table);
Neeti Desai1c638102012-11-09 16:08:11 -080086}
87
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -080088static void __init msm8610_reserve(void)
Neeti Desai1c638102012-11-09 16:08:11 -080089{
Neeti Desai2a575be2012-11-26 12:53:10 -080090 reserve_info = &msm8610_reserve_info;
91 of_scan_flat_dt(dt_scan_for_memory_reserve, msm8610_reserve_table);
Neeti Desai1c638102012-11-09 16:08:11 -080092 msm_reserve();
93}
94
Praveen Chidambaram52380712012-12-20 16:51:11 -070095void __init msm8610_add_drivers(void)
96{
97 msm_rpm_driver_init();
98 msm_lpmrs_module_init();
99 msm_spm_device_init();
Xiaozhe Shie4284532013-03-13 16:03:09 -0700100 qpnp_regulator_init();
Praveen Chidambaram52380712012-12-20 16:51:11 -0700101 msm_thermal_device_init();
Vikram Mulukutlad682cd82013-01-24 12:32:36 -0800102
103 if (machine_is_msm8610_rumi())
104 msm_clock_init(&msm8610_rumi_clock_init_data);
105 else
106 msm_clock_init(&msm8610_clock_init_data);
Praveen Chidambaram52380712012-12-20 16:51:11 -0700107}
108
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800109void __init msm8610_init(void)
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -0700110{
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800111 struct of_dev_auxdata *adata = msm8610_auxdata_lookup;
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800112
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -0800113 if (socinfo_init() < 0)
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800114 pr_err("%s: socinfo_init() failed\n", __func__);
David Ngb5bac062012-11-02 00:00:12 -0700115
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800116 msm8610_init_gpiomux();
David Ngb5bac062012-11-02 00:00:12 -0700117 of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
Vikram Mulukutlad682cd82013-01-24 12:32:36 -0800118 msm8610_add_drivers();
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -0700119}
120
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800121static const char *msm8610_dt_match[] __initconst = {
122 "qcom,msm8610",
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -0700123 NULL
124};
125
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800126DT_MACHINE_START(MSM8610_DT, "Qualcomm MSM 8610 (Flattened Device Tree)")
127 .map_io = msm_map_msm8610_io,
Praveen Chidambaram52380712012-12-20 16:51:11 -0700128 .init_irq = msm_dt_init_irq,
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800129 .init_machine = msm8610_init,
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -0700130 .handle_irq = gic_handle_irq,
Rohit Vaswani90e30232012-10-10 16:52:37 -0700131 .timer = &msm_dt_timer,
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800132 .dt_compat = msm8610_dt_match,
Hanumant Singhe4271312012-10-24 13:27:57 -0700133 .restart = msm_restart,
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800134 .reserve = msm8610_reserve,
135 .init_very_early = msm8610_early_memory,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800136 .smp = &arm_smp_ops,
Syed Rameez Mustafafd0f9b42012-09-21 18:33:36 -0700137MACHINE_END