blob: aff2d757ca1a9ea8b69682731070270d32516468 [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>
Siddartha Mohanadoss4cef5f42013-04-11 13:59:41 -070028#include <linux/msm_tsens.h>
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070029#include <asm/mach/map.h>
30#include <asm/hardware/gic.h>
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070031#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33#include <mach/board.h>
34#include <mach/gpiomux.h>
35#include <mach/msm_iomap.h>
Syed Rameez Mustafaf1bdd712012-11-20 14:56:44 -080036#include <mach/restart.h>
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070037#ifdef CONFIG_ION_MSM
38#include <mach/ion.h>
39#endif
40#include <mach/msm_memtypes.h>
41#include <mach/socinfo.h>
42#include <mach/board.h>
Matt Wagantall33d01f52012-02-23 23:27:44 -080043#include <mach/clk-provider.h>
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -070044#include <mach/msm_smd.h>
45#include <mach/rpm-smd.h>
David Keitel27664142013-03-07 12:02:05 -080046#include <mach/rpm-regulator-smd.h>
Jeff Hugo7cc06b12013-06-17 16:13:18 -060047#include <mach/msm_smem.h>
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -070048#include <linux/msm_thermal.h>
Rohit Vaswani835707b2012-09-20 16:21:39 -070049#include "board-dt.h"
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070050#include "clock.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -080051#include "platsmp.h"
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -070052#include "spm.h"
Mahesh Sivasubramanian59ffcb02013-05-31 15:08:15 -060053#include "pm.h"
Jeff Hugof7580b72013-02-15 17:05:17 -070054#include "modem_notifier.h"
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070055
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -080056static struct memtype_reserve msm8226_reserve_table[] __initdata = {
57 [MEMTYPE_SMI] = {
58 },
59 [MEMTYPE_EBI0] = {
60 .flags = MEMTYPE_FLAGS_1M_ALIGN,
61 },
62 [MEMTYPE_EBI1] = {
63 .flags = MEMTYPE_FLAGS_1M_ALIGN,
64 },
65};
66
67static int msm8226_paddr_to_memtype(unsigned int paddr)
68{
69 return MEMTYPE_EBI1;
70}
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -070071
Syed Rameez Mustafa51d4d182012-11-20 14:36:43 -080072static struct of_dev_auxdata msm8226_auxdata_lookup[] __initdata = {
73 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
74 "msm_sdcc.1", NULL),
75 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
76 "msm_sdcc.2", NULL),
Krishna Konda4162f8f2013-07-08 16:23:41 -070077 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \
78 "msm_sdcc.3", NULL),
Sahitya Tummalae90afc22013-04-04 10:07:31 +053079 OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9824900, \
80 "msm_sdcc.1", NULL),
81 OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF98A4900, \
82 "msm_sdcc.2", NULL),
Krishna Konda4162f8f2013-07-08 16:23:41 -070083 OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9864900, \
84 "msm_sdcc.3", NULL),
Syed Rameez Mustafa51d4d182012-11-20 14:36:43 -080085 {}
86};
87
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -080088static struct reserve_info msm8226_reserve_info __initdata = {
89 .memtype_reserve_table = msm8226_reserve_table,
90 .paddr_to_memtype = msm8226_paddr_to_memtype,
91};
92
93static void __init msm8226_early_memory(void)
94{
95 reserve_info = &msm8226_reserve_info;
Neeti Desaibfedbd32012-11-21 13:19:36 -080096 of_scan_flat_dt(dt_scan_for_memory_hole, msm8226_reserve_table);
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -080097}
98
99static void __init msm8226_reserve(void)
100{
Neeti Desaibfedbd32012-11-21 13:19:36 -0800101 reserve_info = &msm8226_reserve_info;
102 of_scan_flat_dt(dt_scan_for_memory_reserve, msm8226_reserve_table);
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -0800103 msm_reserve();
104}
105
Patrick Dalye682ac72013-01-22 15:21:37 -0800106/*
107 * Used to satisfy dependencies for devices that need to be
108 * run early or in a particular order. Most likely your device doesn't fall
109 * into this category, and thus the driver should not be added here. The
110 * EPROBE_DEFER can satisfy most dependency problems.
111 */
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700112void __init msm8226_add_drivers(void)
113{
Jeff Hugo7cc06b12013-06-17 16:13:18 -0600114 msm_smem_init();
Jeff Hugof7580b72013-02-15 17:05:17 -0700115 msm_init_modem_notifier_list();
116 msm_smd_init();
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700117 msm_rpm_driver_init();
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700118 msm_spm_device_init();
Mahesh Sivasubramanian59ffcb02013-05-31 15:08:15 -0600119 msm_pm_sleep_status_init();
David Keitel27664142013-03-07 12:02:05 -0800120 rpm_regulator_smd_driver_init();
David Keitelab876512013-02-19 12:01:07 -0800121 qpnp_regulator_init();
Stepan Moskovchenko82f0eab2013-04-02 19:52:28 -0700122 if (of_board_is_rumi())
Patrick Dalyeb370ea2012-10-23 11:57:50 -0700123 msm_clock_init(&msm8226_rumi_clock_init_data);
124 else
125 msm_clock_init(&msm8226_clock_init_data);
Siddartha Mohanadoss4cef5f42013-04-11 13:59:41 -0700126 tsens_tm_init_driver();
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700127 msm_thermal_device_init();
128}
129
Syed Rameez Mustafae8156b42012-10-11 18:05:08 -0700130void __init msm8226_init(void)
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700131{
Syed Rameez Mustafa51d4d182012-11-20 14:36:43 -0800132 struct of_dev_auxdata *adata = msm8226_auxdata_lookup;
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800133
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -0800134 if (socinfo_init() < 0)
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800135 pr_err("%s: socinfo_init() failed\n", __func__);
Syed Rameez Mustafa51d4d182012-11-20 14:36:43 -0800136
Syed Rameez Mustafa9d16c4f2012-09-10 14:16:55 -0700137 msm8226_init_gpiomux();
Stepan Moskovchenko7d8cdcaa2013-04-25 17:10:55 -0700138 board_dt_populate(adata);
Patrick Dalye682ac72013-01-22 15:21:37 -0800139 msm8226_add_drivers();
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700140}
141
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700142static const char *msm8226_dt_match[] __initconst = {
143 "qcom,msm8226",
Syed Rameez Mustafa52a979b2013-05-20 18:05:50 -0700144 "qcom,msm8926",
Syed Rameez Mustafab41bf332013-06-05 12:09:22 -0700145 "qcom,apq8026",
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700146 NULL
147};
148
149DT_MACHINE_START(MSM8226_DT, "Qualcomm MSM 8226 (Flattened Device Tree)")
150 .map_io = msm_map_msm8226_io,
Praveen Chidambaramde2a87b2012-12-20 16:13:53 -0700151 .init_irq = msm_dt_init_irq,
Rohit Vaswani835707b2012-09-20 16:21:39 -0700152 .init_machine = msm8226_init,
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700153 .handle_irq = gic_handle_irq,
Rohit Vaswani835707b2012-09-20 16:21:39 -0700154 .timer = &msm_dt_timer,
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700155 .dt_compat = msm8226_dt_match,
Mitchel Humpherys3c7c7122012-11-08 19:24:39 -0800156 .reserve = msm8226_reserve,
Syed Rameez Mustafaf1bdd712012-11-20 14:56:44 -0800157 .init_very_early = msm8226_early_memory,
158 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800159 .smp = &arm_smp_ops,
Syed Rameez Mustafa878892c2012-08-23 17:30:32 -0700160MACHINE_END