blob: 7b13bbc1345fe767ff18dc8196b9b0f03b9b7de8 [file] [log] [blame]
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001/* Copyright (c) 2011-2013, The Linux Foundation. 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
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -080013#include <linux/err.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070014#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#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>
Olav Hauganb800c8c2012-01-30 08:50:45 -080022#include <linux/memory.h>
Matt Wagantallecaa1172012-05-08 21:38:45 -070023#include <linux/regulator/machine.h>
Michael Bohan2a468322012-08-14 17:06:34 -070024#include <linux/regulator/krait-regulator.h>
Siddartha Mohanadoss4cef5f42013-04-11 13:59:41 -070025#include <linux/msm_tsens.h>
Eugene Seahce52ef22012-07-12 12:40:38 -060026#include <linux/msm_thermal.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070027#include <asm/mach/map.h>
28#include <asm/hardware/gic.h>
Rohit Vaswani750bee12012-09-20 16:18:10 -070029#include <asm/mach/map.h>
30#include <asm/mach/arch.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070031#include <mach/board.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070032#include <mach/gpiomux.h>
33#include <mach/msm_iomap.h>
Olav Hauganb800c8c2012-01-30 08:50:45 -080034#ifdef CONFIG_ION_MSM
35#include <mach/ion.h>
36#endif
37#include <mach/msm_memtypes.h>
Jeff Hugo70946092012-02-10 11:30:43 -070038#include <mach/msm_smd.h>
Rohit Vaswani750bee12012-09-20 16:18:10 -070039#include <mach/restart.h>
Mahesh Sivasubramaniana8ff9922012-03-27 17:50:42 -060040#include <mach/rpm-smd.h>
David Collins8f4cebc2012-05-08 16:54:50 -070041#include <mach/rpm-regulator-smd.h>
Vikram Mulukutlaaeadb5f2012-05-04 14:03:07 -070042#include <mach/socinfo.h>
Jeff Hugo7cc06b12013-06-17 16:13:18 -060043#include <mach/msm_smem.h>
Rohit Vaswani750bee12012-09-20 16:18:10 -070044#include "board-dt.h"
Sathish Ambleyc58afc22011-10-09 21:55:39 -070045#include "clock.h"
Michael Bohan037a0f52012-02-29 19:13:09 -080046#include "devices.h"
Praveen Chidambaramda9501d2012-04-26 19:48:29 -060047#include "spm.h"
Girish Mahadevanc45b4c72013-04-24 14:07:11 -060048#include "pm.h"
Jeff Hugoa643ca12012-06-11 16:00:23 -060049#include "modem_notifier.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -080050#include "platsmp.h"
Sathish Ambleyc58afc22011-10-09 21:55:39 -070051
Olav Hauganb800c8c2012-01-30 08:50:45 -080052
Rohit Vaswani750bee12012-09-20 16:18:10 -070053static struct memtype_reserve msm8974_reserve_table[] __initdata = {
Olav Hauganb800c8c2012-01-30 08:50:45 -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
Laura Abbott938d7502013-04-09 10:44:16 -070064static int msm8974_paddr_to_memtype(phys_addr_t paddr)
Olav Hauganb800c8c2012-01-30 08:50:45 -080065{
66 return MEMTYPE_EBI1;
67}
68
Rohit Vaswani750bee12012-09-20 16:18:10 -070069static struct reserve_info msm8974_reserve_info __initdata = {
70 .memtype_reserve_table = msm8974_reserve_table,
Rohit Vaswani750bee12012-09-20 16:18:10 -070071 .paddr_to_memtype = msm8974_paddr_to_memtype,
Olav Hauganb800c8c2012-01-30 08:50:45 -080072};
73
Neeti Desai1b2cb552012-11-01 21:57:36 -070074void __init msm_8974_reserve(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -080075{
Rohit Vaswani750bee12012-09-20 16:18:10 -070076 reserve_info = &msm8974_reserve_info;
77 of_scan_flat_dt(dt_scan_for_memory_reserve, msm8974_reserve_table);
Neeti Desai1b2cb552012-11-01 21:57:36 -070078 msm_reserve();
79}
80
81static void __init msm8974_early_memory(void)
82{
83 reserve_info = &msm8974_reserve_info;
84 of_scan_flat_dt(dt_scan_for_memory_hole, msm8974_reserve_table);
Olav Hauganb800c8c2012-01-30 08:50:45 -080085}
86
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -070087/*
88 * Used to satisfy dependencies for devices that need to be
89 * run early or in a particular order. Most likely your device doesn't fall
90 * into this category, and thus the driver should not be added here. The
91 * EPROBE_DEFER can satisfy most dependency problems.
92 */
Rohit Vaswani750bee12012-09-20 16:18:10 -070093void __init msm8974_add_drivers(void)
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -070094{
Jeff Hugo7cc06b12013-06-17 16:13:18 -060095 msm_smem_init();
Jeff Hugoa643ca12012-06-11 16:00:23 -060096 msm_init_modem_notifier_list();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -070097 msm_smd_init();
98 msm_rpm_driver_init();
Mahesh Sivasubramanian59ffcb02013-05-31 15:08:15 -060099 msm_pm_sleep_status_init();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700100 rpm_regulator_smd_driver_init();
101 msm_spm_device_init();
Michael Bohan2a468322012-08-14 17:06:34 -0700102 krait_power_init();
Stepan Moskovchenko82f0eab2013-04-02 19:52:28 -0700103 if (of_board_is_rumi())
Vikram Mulukutla19245e02012-07-23 15:58:04 -0700104 msm_clock_init(&msm8974_rumi_clock_init_data);
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700105 else
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700106 msm_clock_init(&msm8974_clock_init_data);
Siddartha Mohanadoss4cef5f42013-04-11 13:59:41 -0700107 tsens_tm_init_driver();
Eugene Seahce52ef22012-07-12 12:40:38 -0600108 msm_thermal_device_init();
Vikram Mulukutlaaa6f36c2012-06-12 18:16:29 -0700109}
110
Manu Gautam605c1622013-11-18 17:46:41 +0530111static struct of_dev_auxdata msm_hsic_host_adata[] = {
112 OF_DEV_AUXDATA("qcom,hsic-host", 0xF9A00000, "msm_hsic_host", NULL),
113 {}
114};
115
Rohit Vaswani750bee12012-09-20 16:18:10 -0700116static struct of_dev_auxdata msm8974_auxdata_lookup[] __initdata = {
Pavankumar Kondeti0063b842012-01-16 12:19:58 +0530117 OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \
118 "msm_otg", NULL),
Vijayavardhan Vennapusa1f5da0b2013-01-08 20:03:57 +0530119 OF_DEV_AUXDATA("qcom,ehci-host", 0xF9A55000, \
120 "msm_ehci_host", NULL),
Manu Gautam51be9712012-06-06 14:54:52 +0530121 OF_DEV_AUXDATA("qcom,dwc-usb3-msm", 0xF9200000, \
122 "msm_dwc3", NULL),
Shimrit Malichi57ae1492012-08-06 14:03:45 +0300123 OF_DEV_AUXDATA("qcom,usb-bam-msm", 0xF9304000, \
124 "usb_bam", NULL),
Harini Jayaraman5f98dbb2011-12-20 13:38:19 -0700125 OF_DEV_AUXDATA("qcom,spi-qup-v2", 0xF9924000, \
126 "spi_qsd.1", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530127 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
David Ng665140f2012-04-12 16:03:45 -0700128 "msm_sdcc.1", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530129 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
130 "msm_sdcc.2", NULL),
131 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \
David Ng665140f2012-04-12 16:03:45 -0700132 "msm_sdcc.3", NULL),
Sujit Reddy Thumma85fc52c2012-05-02 12:53:45 +0530133 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98E4000, \
134 "msm_sdcc.4", NULL),
Venkat Gopalakrishnan13268f92012-09-17 15:15:07 -0700135 OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9824900, \
136 "msm_sdcc.1", NULL),
137 OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF98A4900, \
138 "msm_sdcc.2", NULL),
139 OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9864900, \
140 "msm_sdcc.3", NULL),
141 OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF98E4900, \
142 "msm_sdcc.4", NULL),
Hariprasad Dhalinarasimhade991f02012-05-31 13:15:51 -0700143 OF_DEV_AUXDATA("qcom,msm-rng", 0xF9BFF000, \
144 "msm_rng", NULL),
Ramesh Masavarapufb1f01e2012-06-14 09:40:40 -0700145 OF_DEV_AUXDATA("qcom,qseecom", 0xFE806000, \
146 "qseecom", NULL),
Adrian Salido-Moreno5ef3ac02012-05-14 18:40:47 -0700147 OF_DEV_AUXDATA("qcom,mdss_mdp", 0xFD900000, "mdp.0", NULL),
Siddartha Mohanadoss0a188882012-07-06 15:51:00 -0700148 OF_DEV_AUXDATA("qcom,msm-tsens", 0xFC4A8000, \
149 "msm-tsens", NULL),
Mona Hossainb43e94b2012-05-07 08:52:06 -0700150 OF_DEV_AUXDATA("qcom,qcedev", 0xFD440000, \
151 "qcedev.0", NULL),
152 OF_DEV_AUXDATA("qcom,qcrypto", 0xFD440000, \
153 "qcrypto.0", NULL),
Ming-yi Linb6ade102013-02-04 14:05:08 +0800154 OF_DEV_AUXDATA("qcom,hsic-host", 0xF9A00000, \
155 "msm_hsic_host", NULL),
Manu Gautam605c1622013-11-18 17:46:41 +0530156 OF_DEV_AUXDATA("qcom,hsic-smsc-hub", 0, "msm_smsc_hub",
157 msm_hsic_host_adata),
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700158 {}
159};
160
Rohit Vaswani750bee12012-09-20 16:18:10 -0700161static void __init msm8974_map_io(void)
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700162{
Rohit Vaswani750bee12012-09-20 16:18:10 -0700163 msm_map_8974_io();
Rohit Vaswani750bee12012-09-20 16:18:10 -0700164}
165
166void __init msm8974_init(void)
167{
168 struct of_dev_auxdata *adata = msm8974_auxdata_lookup;
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800169
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -0800170 if (socinfo_init() < 0)
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800171 pr_err("%s: socinfo_init() failed\n", __func__);
Rohit Vaswani750bee12012-09-20 16:18:10 -0700172
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700173 msm_8974_init_gpiomux();
Matt Wagantallecaa1172012-05-08 21:38:45 -0700174 regulator_has_full_constraints();
Stepan Moskovchenko7d8cdcaa2013-04-25 17:10:55 -0700175 board_dt_populate(adata);
Rohit Vaswani750bee12012-09-20 16:18:10 -0700176 msm8974_add_drivers();
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700177}
Olav Hauganb800c8c2012-01-30 08:50:45 -0800178
Rohit Vaswani750bee12012-09-20 16:18:10 -0700179void __init msm8974_init_very_early(void)
Olav Hauganb800c8c2012-01-30 08:50:45 -0800180{
Rohit Vaswani750bee12012-09-20 16:18:10 -0700181 msm8974_early_memory();
Olav Hauganb800c8c2012-01-30 08:50:45 -0800182}
Rohit Vaswani750bee12012-09-20 16:18:10 -0700183
184static const char *msm8974_dt_match[] __initconst = {
185 "qcom,msm8974",
Stepan Moskovchenko076ab702013-03-27 18:54:33 -0700186 "qcom,apq8074",
Rohit Vaswani750bee12012-09-20 16:18:10 -0700187 NULL
188};
189
190DT_MACHINE_START(MSM8974_DT, "Qualcomm MSM 8974 (Flattened Device Tree)")
191 .map_io = msm8974_map_io,
192 .init_irq = msm_dt_init_irq,
193 .init_machine = msm8974_init,
194 .handle_irq = gic_handle_irq,
195 .timer = &msm_dt_timer,
196 .dt_compat = msm8974_dt_match,
Neeti Desai1b2cb552012-11-01 21:57:36 -0700197 .reserve = msm_8974_reserve,
Rohit Vaswani750bee12012-09-20 16:18:10 -0700198 .init_very_early = msm8974_init_very_early,
199 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800200 .smp = &msm8974_smp_ops,
Rohit Vaswani750bee12012-09-20 16:18:10 -0700201MACHINE_END