blob: 872fabebf8dd9f874b0612efc5f06f8d3b4aa34f [file] [log] [blame]
Mitchel Humpherysa35ec182012-11-19 11:04:35 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -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 Mustafa878892c2012-08-23 17:30:32 -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>
David Keitelab876512013-02-19 12:01:07 -080027#include <linux/regulator/qpnp-regulator.h>
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070028#include <asm/mach/map.h>
29#include <asm/hardware/gic.h>
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070030#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>
Syed Rameez Mustafaf1bdd712012-11-20 14:56:44 -080035#include <mach/restart.h>
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070036#ifdef CONFIG_ION_MSM
37#include <mach/ion.h>
38#endif
39#include <mach/msm_memtypes.h>
40#include <mach/socinfo.h>
41#include <mach/board.h>
Matt Wagantall33d01f52012-02-23 23:27:44 -080042#include <mach/clk-provider.h>
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -070043#include <mach/msm_smd.h>
44#include <mach/rpm-smd.h>
David Keitel27664142013-03-07 12:02:05 -080045#include <mach/rpm-regulator-smd.h>
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -070046#include <linux/msm_thermal.h>
Rohit Vaswani835707b2012-09-20 16:21:39 -070047#include "board-dt.h"
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070048#include "clock.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -080049#include "platsmp.h"
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -070050#include "spm.h"
51#include "lpm_resources.h"
Jeff Hugof7580b72013-02-15 17:05:17 -070052#include "modem_notifier.h"
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070053
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -080054static struct memtype_reserve msm8226_reserve_table[] __initdata = {
55 [MEMTYPE_SMI] = {
56 },
57 [MEMTYPE_EBI0] = {
58 .flags = MEMTYPE_FLAGS_1M_ALIGN,
59 },
60 [MEMTYPE_EBI1] = {
61 .flags = MEMTYPE_FLAGS_1M_ALIGN,
62 },
63};
64
65static int msm8226_paddr_to_memtype(unsigned int paddr)
66{
67 return MEMTYPE_EBI1;
68}
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070069
Syed Rameez Mustafa51d4d182012-11-20 14:36:43 -080070static struct of_dev_auxdata msm8226_auxdata_lookup[] __initdata = {
71 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
72 "msm_sdcc.1", NULL),
73 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
74 "msm_sdcc.2", NULL),
75 {}
76};
77
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -080078static struct reserve_info msm8226_reserve_info __initdata = {
79 .memtype_reserve_table = msm8226_reserve_table,
80 .paddr_to_memtype = msm8226_paddr_to_memtype,
81};
82
83static void __init msm8226_early_memory(void)
84{
85 reserve_info = &msm8226_reserve_info;
Neeti Desaibfedbd32012-11-21 13:19:36 -080086 of_scan_flat_dt(dt_scan_for_memory_hole, msm8226_reserve_table);
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -080087}
88
89static void __init msm8226_reserve(void)
90{
Neeti Desaibfedbd32012-11-21 13:19:36 -080091 reserve_info = &msm8226_reserve_info;
92 of_scan_flat_dt(dt_scan_for_memory_reserve, msm8226_reserve_table);
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -080093 msm_reserve();
94}
95
Patrick Dalye682ac72013-01-22 15:21:37 -080096/*
97 * Used to satisfy dependencies for devices that need to be
98 * run early or in a particular order. Most likely your device doesn't fall
99 * into this category, and thus the driver should not be added here. The
100 * EPROBE_DEFER can satisfy most dependency problems.
101 */
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700102void __init msm8226_add_drivers(void)
103{
Jeff Hugof7580b72013-02-15 17:05:17 -0700104 msm_init_modem_notifier_list();
105 msm_smd_init();
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700106 msm_rpm_driver_init();
107 msm_lpmrs_module_init();
108 msm_spm_device_init();
David Keitel27664142013-03-07 12:02:05 -0800109 rpm_regulator_smd_driver_init();
David Keitelab876512013-02-19 12:01:07 -0800110 qpnp_regulator_init();
Patrick Dalyeb370ea2012-10-23 11:57:50 -0700111 if (machine_is_msm8226_rumi())
112 msm_clock_init(&msm8226_rumi_clock_init_data);
113 else
114 msm_clock_init(&msm8226_clock_init_data);
115
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700116 msm_thermal_device_init();
117}
118
Syed Rameez Mustafae8156b42012-10-11 18:05:08 -0700119void __init msm8226_init(void)
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700120{
Syed Rameez Mustafa51d4d182012-11-20 14:36:43 -0800121 struct of_dev_auxdata *adata = msm8226_auxdata_lookup;
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800122
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -0800123 if (socinfo_init() < 0)
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800124 pr_err("%s: socinfo_init() failed\n", __func__);
Syed Rameez Mustafa51d4d182012-11-20 14:36:43 -0800125
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -0700126 msm8226_init_gpiomux();
Syed Rameez Mustafa51d4d182012-11-20 14:36:43 -0800127 of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
Patrick Dalye682ac72013-01-22 15:21:37 -0800128 msm8226_add_drivers();
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700129}
130
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700131static const char *msm8226_dt_match[] __initconst = {
132 "qcom,msm8226",
133 NULL
134};
135
136DT_MACHINE_START(MSM8226_DT, "Qualcomm MSM 8226 (Flattened Device Tree)")
137 .map_io = msm_map_msm8226_io,
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700138 .init_irq = msm_dt_init_irq,
Rohit Vaswani835707b2012-09-20 16:21:39 -0700139 .init_machine = msm8226_init,
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700140 .handle_irq = gic_handle_irq,
Rohit Vaswani835707b2012-09-20 16:21:39 -0700141 .timer = &msm_dt_timer,
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700142 .dt_compat = msm8226_dt_match,
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -0800143 .reserve = msm8226_reserve,
Syed Rameez Mustafaf1bdd712012-11-20 14:56:44 -0800144 .init_very_early = msm8226_early_memory,
145 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800146 .smp = &arm_smp_ops,
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700147MACHINE_END