Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 2 | * |
| 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 Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 13 | #include <linux/err.h> |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 14 | #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 Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 22 | #include <linux/memory.h> |
| 23 | #ifdef CONFIG_ANDROID_PMEM |
| 24 | #include <linux/android_pmem.h> |
| 25 | #endif |
Matt Wagantall | ecaa117 | 2012-05-08 21:38:45 -0700 | [diff] [blame] | 26 | #include <linux/regulator/machine.h> |
Michael Bohan | 2a46832 | 2012-08-14 17:06:34 -0700 | [diff] [blame] | 27 | #include <linux/regulator/krait-regulator.h> |
Eugene Seah | ce52ef2 | 2012-07-12 12:40:38 -0600 | [diff] [blame] | 28 | #include <linux/msm_thermal.h> |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/hardware/gic.h> |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 31 | #include <asm/mach/map.h> |
| 32 | #include <asm/mach/arch.h> |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 33 | #include <mach/board.h> |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 34 | #include <mach/gpiomux.h> |
| 35 | #include <mach/msm_iomap.h> |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 36 | #ifdef CONFIG_ION_MSM |
| 37 | #include <mach/ion.h> |
| 38 | #endif |
| 39 | #include <mach/msm_memtypes.h> |
Jeff Hugo | 7094609 | 2012-02-10 11:30:43 -0700 | [diff] [blame] | 40 | #include <mach/msm_smd.h> |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 41 | #include <mach/restart.h> |
Mahesh Sivasubramanian | a8ff992 | 2012-03-27 17:50:42 -0600 | [diff] [blame] | 42 | #include <mach/rpm-smd.h> |
David Collins | 8f4cebc | 2012-05-08 16:54:50 -0700 | [diff] [blame] | 43 | #include <mach/rpm-regulator-smd.h> |
Vikram Mulukutla | aeadb5f | 2012-05-04 14:03:07 -0700 | [diff] [blame] | 44 | #include <mach/socinfo.h> |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 45 | #include "board-dt.h" |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 46 | #include "clock.h" |
Michael Bohan | 037a0f5 | 2012-02-29 19:13:09 -0800 | [diff] [blame] | 47 | #include "devices.h" |
Praveen Chidambaram | da9501d | 2012-04-26 19:48:29 -0600 | [diff] [blame] | 48 | #include "spm.h" |
Jeff Hugo | a643ca1 | 2012-06-11 16:00:23 -0600 | [diff] [blame] | 49 | #include "modem_notifier.h" |
Girish Mahadevan | 40abbe1 | 2012-04-25 14:58:13 -0600 | [diff] [blame] | 50 | #include "lpm_resources.h" |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 51 | #include "platsmp.h" |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 52 | |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 53 | |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 54 | static struct memtype_reserve msm8974_reserve_table[] __initdata = { |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 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 | |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 65 | static int msm8974_paddr_to_memtype(unsigned int paddr) |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 66 | { |
| 67 | return MEMTYPE_EBI1; |
| 68 | } |
| 69 | |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 70 | static struct reserve_info msm8974_reserve_info __initdata = { |
| 71 | .memtype_reserve_table = msm8974_reserve_table, |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 72 | .paddr_to_memtype = msm8974_paddr_to_memtype, |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 73 | }; |
| 74 | |
Neeti Desai | 1b2cb55 | 2012-11-01 21:57:36 -0700 | [diff] [blame] | 75 | void __init msm_8974_reserve(void) |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 76 | { |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 77 | reserve_info = &msm8974_reserve_info; |
| 78 | of_scan_flat_dt(dt_scan_for_memory_reserve, msm8974_reserve_table); |
Neeti Desai | 1b2cb55 | 2012-11-01 21:57:36 -0700 | [diff] [blame] | 79 | msm_reserve(); |
| 80 | } |
| 81 | |
| 82 | static void __init msm8974_early_memory(void) |
| 83 | { |
| 84 | reserve_info = &msm8974_reserve_info; |
| 85 | of_scan_flat_dt(dt_scan_for_memory_hole, msm8974_reserve_table); |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 86 | } |
| 87 | |
Bhakthavatsala Raghavendra | b976654 | 2012-08-17 16:25:48 -0700 | [diff] [blame] | 88 | static struct platform_device msm_fm_platform_init = { |
| 89 | .name = "iris_fm", |
| 90 | .id = -1, |
| 91 | }; |
| 92 | |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 93 | static struct platform_device *msm_bus_8974_devices[] = { |
Bhakthavatsala Raghavendra | b976654 | 2012-08-17 16:25:48 -0700 | [diff] [blame] | 94 | &msm_fm_platform_init, |
Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 95 | }; |
| 96 | |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 97 | static void __init msm8974_init_buses(void) |
Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 98 | { |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 99 | platform_add_devices(msm_bus_8974_devices, |
| 100 | ARRAY_SIZE(msm_bus_8974_devices)); |
Gagan Mac | dd9bb79 | 2012-04-25 16:56:48 -0600 | [diff] [blame] | 101 | }; |
Hariprasad Dhalinarasimha | f42732a | 2012-05-21 18:00:49 -0700 | [diff] [blame] | 102 | |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 103 | /* |
| 104 | * Used to satisfy dependencies for devices that need to be |
| 105 | * run early or in a particular order. Most likely your device doesn't fall |
| 106 | * into this category, and thus the driver should not be added here. The |
| 107 | * EPROBE_DEFER can satisfy most dependency problems. |
| 108 | */ |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 109 | void __init msm8974_add_drivers(void) |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 110 | { |
Jeff Hugo | a643ca1 | 2012-06-11 16:00:23 -0600 | [diff] [blame] | 111 | msm_init_modem_notifier_list(); |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 112 | msm_smd_init(); |
| 113 | msm_rpm_driver_init(); |
Girish Mahadevan | 40abbe1 | 2012-04-25 14:58:13 -0600 | [diff] [blame] | 114 | msm_lpmrs_module_init(); |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 115 | rpm_regulator_smd_driver_init(); |
| 116 | msm_spm_device_init(); |
Michael Bohan | 2a46832 | 2012-08-14 17:06:34 -0700 | [diff] [blame] | 117 | krait_power_init(); |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 118 | if (machine_is_msm8974_rumi()) |
Vikram Mulukutla | 19245e0 | 2012-07-23 15:58:04 -0700 | [diff] [blame] | 119 | msm_clock_init(&msm8974_rumi_clock_init_data); |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 120 | else |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 121 | msm_clock_init(&msm8974_clock_init_data); |
| 122 | msm8974_init_buses(); |
Eugene Seah | ce52ef2 | 2012-07-12 12:40:38 -0600 | [diff] [blame] | 123 | msm_thermal_device_init(); |
Vikram Mulukutla | aa6f36c | 2012-06-12 18:16:29 -0700 | [diff] [blame] | 124 | } |
| 125 | |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 126 | static struct of_dev_auxdata msm8974_auxdata_lookup[] __initdata = { |
Pavankumar Kondeti | 0063b84 | 2012-01-16 12:19:58 +0530 | [diff] [blame] | 127 | OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \ |
| 128 | "msm_otg", NULL), |
Vijayavardhan Vennapusa | 1f5da0b | 2013-01-08 20:03:57 +0530 | [diff] [blame] | 129 | OF_DEV_AUXDATA("qcom,ehci-host", 0xF9A55000, \ |
| 130 | "msm_ehci_host", NULL), |
Manu Gautam | 51be971 | 2012-06-06 14:54:52 +0530 | [diff] [blame] | 131 | OF_DEV_AUXDATA("qcom,dwc-usb3-msm", 0xF9200000, \ |
| 132 | "msm_dwc3", NULL), |
Shimrit Malichi | 57ae149 | 2012-08-06 14:03:45 +0300 | [diff] [blame] | 133 | OF_DEV_AUXDATA("qcom,usb-bam-msm", 0xF9304000, \ |
| 134 | "usb_bam", NULL), |
Harini Jayaraman | 5f98dbb | 2011-12-20 13:38:19 -0700 | [diff] [blame] | 135 | OF_DEV_AUXDATA("qcom,spi-qup-v2", 0xF9924000, \ |
| 136 | "spi_qsd.1", NULL), |
Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 137 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \ |
David Ng | 665140f | 2012-04-12 16:03:45 -0700 | [diff] [blame] | 138 | "msm_sdcc.1", NULL), |
Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 139 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \ |
| 140 | "msm_sdcc.2", NULL), |
| 141 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \ |
David Ng | 665140f | 2012-04-12 16:03:45 -0700 | [diff] [blame] | 142 | "msm_sdcc.3", NULL), |
Sujit Reddy Thumma | 85fc52c | 2012-05-02 12:53:45 +0530 | [diff] [blame] | 143 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98E4000, \ |
| 144 | "msm_sdcc.4", NULL), |
Pratik Patel | 80515b5 | 2012-06-17 17:57:24 -0700 | [diff] [blame] | 145 | OF_DEV_AUXDATA("arm,coresight-tmc", 0xFC322000, \ |
| 146 | "coresight-tmc-etr", NULL), |
| 147 | OF_DEV_AUXDATA("arm,coresight-tpiu", 0xFC318000, \ |
| 148 | "coresight-tpiu", NULL), |
| 149 | OF_DEV_AUXDATA("qcom,coresight-replicator", 0xFC31C000, \ |
| 150 | "coresight-replicator", NULL), |
| 151 | OF_DEV_AUXDATA("arm,coresight-tmc", 0xFC307000, \ |
| 152 | "coresight-tmc-etf", NULL), |
| 153 | OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC31B000, \ |
| 154 | "coresight-funnel-merg", NULL), |
| 155 | OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC319000, \ |
| 156 | "coresight-funnel-in0", NULL), |
| 157 | OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC31A000, \ |
| 158 | "coresight-funnel-in1", NULL), |
| 159 | OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC345000, \ |
| 160 | "coresight-funnel-kpss", NULL), |
| 161 | OF_DEV_AUXDATA("arm,coresight-funnel", 0xFC364000, \ |
| 162 | "coresight-funnel-mmss", NULL), |
| 163 | OF_DEV_AUXDATA("arm,coresight-stm", 0xFC321000, \ |
| 164 | "coresight-stm", NULL), |
| 165 | OF_DEV_AUXDATA("arm,coresight-etm", 0xFC33C000, \ |
| 166 | "coresight-etm0", NULL), |
| 167 | OF_DEV_AUXDATA("arm,coresight-etm", 0xFC33D000, \ |
| 168 | "coresight-etm1", NULL), |
| 169 | OF_DEV_AUXDATA("arm,coresight-etm", 0xFC33E000, \ |
| 170 | "coresight-etm2", NULL), |
| 171 | OF_DEV_AUXDATA("arm,coresight-etm", 0xFC33F000, \ |
| 172 | "coresight-etm3", NULL), |
Hariprasad Dhalinarasimha | de991f0 | 2012-05-31 13:15:51 -0700 | [diff] [blame] | 173 | OF_DEV_AUXDATA("qcom,msm-rng", 0xF9BFF000, \ |
| 174 | "msm_rng", NULL), |
Ramesh Masavarapu | fb1f01e | 2012-06-14 09:40:40 -0700 | [diff] [blame] | 175 | OF_DEV_AUXDATA("qcom,qseecom", 0xFE806000, \ |
| 176 | "qseecom", NULL), |
Adrian Salido-Moreno | 5ef3ac0 | 2012-05-14 18:40:47 -0700 | [diff] [blame] | 177 | OF_DEV_AUXDATA("qcom,mdss_mdp", 0xFD900000, "mdp.0", NULL), |
Siddartha Mohanadoss | 0a18888 | 2012-07-06 15:51:00 -0700 | [diff] [blame] | 178 | OF_DEV_AUXDATA("qcom,msm-tsens", 0xFC4A8000, \ |
| 179 | "msm-tsens", NULL), |
Mona Hossain | b43e94b | 2012-05-07 08:52:06 -0700 | [diff] [blame] | 180 | OF_DEV_AUXDATA("qcom,qcedev", 0xFD440000, \ |
| 181 | "qcedev.0", NULL), |
| 182 | OF_DEV_AUXDATA("qcom,qcrypto", 0xFD440000, \ |
| 183 | "qcrypto.0", NULL), |
Ming-yi Lin | b6ade10 | 2013-02-04 14:05:08 +0800 | [diff] [blame] | 184 | OF_DEV_AUXDATA("qcom,hsic-host", 0xF9A00000, \ |
| 185 | "msm_hsic_host", NULL), |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 186 | {} |
| 187 | }; |
| 188 | |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 189 | static void __init msm8974_map_io(void) |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 190 | { |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 191 | msm_map_8974_io(); |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | void __init msm8974_init(void) |
| 195 | { |
| 196 | struct of_dev_auxdata *adata = msm8974_auxdata_lookup; |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 197 | |
Abhimanyu Kapur | 91a0a50 | 2013-01-11 19:24:59 -0800 | [diff] [blame] | 198 | if (socinfo_init() < 0) |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 199 | pr_err("%s: socinfo_init() failed\n", __func__); |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 200 | |
Abhimanyu Kapur | 90ced6e | 2012-06-26 17:41:25 -0700 | [diff] [blame] | 201 | msm_8974_init_gpiomux(); |
Matt Wagantall | ecaa117 | 2012-05-08 21:38:45 -0700 | [diff] [blame] | 202 | regulator_has_full_constraints(); |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 203 | of_platform_populate(NULL, of_default_bus_match_table, adata, NULL); |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 204 | msm8974_add_drivers(); |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 205 | } |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 206 | |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 207 | void __init msm8974_init_very_early(void) |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 208 | { |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 209 | msm8974_early_memory(); |
Olav Haugan | b800c8c | 2012-01-30 08:50:45 -0800 | [diff] [blame] | 210 | } |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 211 | |
| 212 | static const char *msm8974_dt_match[] __initconst = { |
| 213 | "qcom,msm8974", |
| 214 | NULL |
| 215 | }; |
| 216 | |
| 217 | DT_MACHINE_START(MSM8974_DT, "Qualcomm MSM 8974 (Flattened Device Tree)") |
| 218 | .map_io = msm8974_map_io, |
| 219 | .init_irq = msm_dt_init_irq, |
| 220 | .init_machine = msm8974_init, |
| 221 | .handle_irq = gic_handle_irq, |
| 222 | .timer = &msm_dt_timer, |
| 223 | .dt_compat = msm8974_dt_match, |
Neeti Desai | 1b2cb55 | 2012-11-01 21:57:36 -0700 | [diff] [blame] | 224 | .reserve = msm_8974_reserve, |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 225 | .init_very_early = msm8974_init_very_early, |
| 226 | .restart = msm_restart, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 227 | .smp = &msm8974_smp_ops, |
Rohit Vaswani | 750bee1 | 2012-09-20 16:18:10 -0700 | [diff] [blame] | 228 | MACHINE_END |