Mitchel Humpherys | a35ec18 | 2012-11-19 11:04:35 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -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> |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 14 | #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 Keitel | ab87651 | 2013-02-19 12:01:07 -0800 | [diff] [blame] | 27 | #include <linux/regulator/qpnp-regulator.h> |
Siddartha Mohanadoss | 4cef5f4 | 2013-04-11 13:59:41 -0700 | [diff] [blame] | 28 | #include <linux/msm_tsens.h> |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/hardware/gic.h> |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 31 | #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 Mustafa | f1bdd71 | 2012-11-20 14:56:44 -0800 | [diff] [blame] | 36 | #include <mach/restart.h> |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 37 | #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 Wagantall | 33d01f5 | 2012-02-23 23:27:44 -0800 | [diff] [blame] | 43 | #include <mach/clk-provider.h> |
Praveen Chidambaram | de2a87b | 2012-12-20 16:13:53 -0700 | [diff] [blame] | 44 | #include <mach/msm_smd.h> |
| 45 | #include <mach/rpm-smd.h> |
David Keitel | 2766414 | 2013-03-07 12:02:05 -0800 | [diff] [blame] | 46 | #include <mach/rpm-regulator-smd.h> |
Jeff Hugo | 7cc06b1 | 2013-06-17 16:13:18 -0600 | [diff] [blame] | 47 | #include <mach/msm_smem.h> |
Praveen Chidambaram | de2a87b | 2012-12-20 16:13:53 -0700 | [diff] [blame] | 48 | #include <linux/msm_thermal.h> |
Rohit Vaswani | 835707b | 2012-09-20 16:21:39 -0700 | [diff] [blame] | 49 | #include "board-dt.h" |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 50 | #include "clock.h" |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 51 | #include "platsmp.h" |
Praveen Chidambaram | de2a87b | 2012-12-20 16:13:53 -0700 | [diff] [blame] | 52 | #include "spm.h" |
Mahesh Sivasubramanian | 59ffcb0 | 2013-05-31 15:08:15 -0600 | [diff] [blame] | 53 | #include "pm.h" |
Jeff Hugo | f7580b7 | 2013-02-15 17:05:17 -0700 | [diff] [blame] | 54 | #include "modem_notifier.h" |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 55 | |
Mitchel Humpherys | 3c7c712 | 2012-11-08 19:24:39 -0800 | [diff] [blame] | 56 | static 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 | |
| 67 | static int msm8226_paddr_to_memtype(unsigned int paddr) |
| 68 | { |
| 69 | return MEMTYPE_EBI1; |
| 70 | } |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 71 | |
Syed Rameez Mustafa | 51d4d18 | 2012-11-20 14:36:43 -0800 | [diff] [blame] | 72 | static 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 Konda | 4162f8f | 2013-07-08 16:23:41 -0700 | [diff] [blame] | 77 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9864000, \ |
| 78 | "msm_sdcc.3", NULL), |
Sahitya Tummala | e90afc2 | 2013-04-04 10:07:31 +0530 | [diff] [blame] | 79 | 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 Konda | 4162f8f | 2013-07-08 16:23:41 -0700 | [diff] [blame] | 83 | OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9864900, \ |
| 84 | "msm_sdcc.3", NULL), |
Pavankumar Kondeti | f3b5371 | 2013-10-29 16:35:52 +0530 | [diff] [blame] | 85 | OF_DEV_AUXDATA("qcom,hsic-host", 0xF9A00000, "msm_hsic_host", NULL), |
| 86 | |
Syed Rameez Mustafa | 51d4d18 | 2012-11-20 14:36:43 -0800 | [diff] [blame] | 87 | {} |
| 88 | }; |
| 89 | |
Mitchel Humpherys | 3c7c712 | 2012-11-08 19:24:39 -0800 | [diff] [blame] | 90 | static struct reserve_info msm8226_reserve_info __initdata = { |
| 91 | .memtype_reserve_table = msm8226_reserve_table, |
| 92 | .paddr_to_memtype = msm8226_paddr_to_memtype, |
| 93 | }; |
| 94 | |
| 95 | static void __init msm8226_early_memory(void) |
| 96 | { |
| 97 | reserve_info = &msm8226_reserve_info; |
Neeti Desai | bfedbd3 | 2012-11-21 13:19:36 -0800 | [diff] [blame] | 98 | of_scan_flat_dt(dt_scan_for_memory_hole, msm8226_reserve_table); |
Mitchel Humpherys | 3c7c712 | 2012-11-08 19:24:39 -0800 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | static void __init msm8226_reserve(void) |
| 102 | { |
Neeti Desai | bfedbd3 | 2012-11-21 13:19:36 -0800 | [diff] [blame] | 103 | reserve_info = &msm8226_reserve_info; |
| 104 | of_scan_flat_dt(dt_scan_for_memory_reserve, msm8226_reserve_table); |
Mitchel Humpherys | 3c7c712 | 2012-11-08 19:24:39 -0800 | [diff] [blame] | 105 | msm_reserve(); |
| 106 | } |
| 107 | |
Patrick Daly | e682ac7 | 2013-01-22 15:21:37 -0800 | [diff] [blame] | 108 | /* |
| 109 | * Used to satisfy dependencies for devices that need to be |
| 110 | * run early or in a particular order. Most likely your device doesn't fall |
| 111 | * into this category, and thus the driver should not be added here. The |
| 112 | * EPROBE_DEFER can satisfy most dependency problems. |
| 113 | */ |
Praveen Chidambaram | de2a87b | 2012-12-20 16:13:53 -0700 | [diff] [blame] | 114 | void __init msm8226_add_drivers(void) |
| 115 | { |
Jeff Hugo | 7cc06b1 | 2013-06-17 16:13:18 -0600 | [diff] [blame] | 116 | msm_smem_init(); |
Jeff Hugo | f7580b7 | 2013-02-15 17:05:17 -0700 | [diff] [blame] | 117 | msm_init_modem_notifier_list(); |
| 118 | msm_smd_init(); |
Praveen Chidambaram | de2a87b | 2012-12-20 16:13:53 -0700 | [diff] [blame] | 119 | msm_rpm_driver_init(); |
Praveen Chidambaram | de2a87b | 2012-12-20 16:13:53 -0700 | [diff] [blame] | 120 | msm_spm_device_init(); |
Mahesh Sivasubramanian | 59ffcb0 | 2013-05-31 15:08:15 -0600 | [diff] [blame] | 121 | msm_pm_sleep_status_init(); |
David Keitel | 2766414 | 2013-03-07 12:02:05 -0800 | [diff] [blame] | 122 | rpm_regulator_smd_driver_init(); |
David Keitel | ab87651 | 2013-02-19 12:01:07 -0800 | [diff] [blame] | 123 | qpnp_regulator_init(); |
Stepan Moskovchenko | 82f0eab | 2013-04-02 19:52:28 -0700 | [diff] [blame] | 124 | if (of_board_is_rumi()) |
Patrick Daly | eb370ea | 2012-10-23 11:57:50 -0700 | [diff] [blame] | 125 | msm_clock_init(&msm8226_rumi_clock_init_data); |
| 126 | else |
| 127 | msm_clock_init(&msm8226_clock_init_data); |
Siddartha Mohanadoss | 4cef5f4 | 2013-04-11 13:59:41 -0700 | [diff] [blame] | 128 | tsens_tm_init_driver(); |
Praveen Chidambaram | de2a87b | 2012-12-20 16:13:53 -0700 | [diff] [blame] | 129 | msm_thermal_device_init(); |
| 130 | } |
| 131 | |
Syed Rameez Mustafa | e8156b4 | 2012-10-11 18:05:08 -0700 | [diff] [blame] | 132 | void __init msm8226_init(void) |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 133 | { |
Syed Rameez Mustafa | 51d4d18 | 2012-11-20 14:36:43 -0800 | [diff] [blame] | 134 | struct of_dev_auxdata *adata = msm8226_auxdata_lookup; |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 135 | |
Abhimanyu Kapur | 91a0a50 | 2013-01-11 19:24:59 -0800 | [diff] [blame] | 136 | if (socinfo_init() < 0) |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 137 | pr_err("%s: socinfo_init() failed\n", __func__); |
Syed Rameez Mustafa | 51d4d18 | 2012-11-20 14:36:43 -0800 | [diff] [blame] | 138 | |
Syed Rameez Mustafa | 9d16c4f | 2012-09-10 14:16:55 -0700 | [diff] [blame] | 139 | msm8226_init_gpiomux(); |
Stepan Moskovchenko | 7d8cdcaa | 2013-04-25 17:10:55 -0700 | [diff] [blame] | 140 | board_dt_populate(adata); |
Patrick Daly | e682ac7 | 2013-01-22 15:21:37 -0800 | [diff] [blame] | 141 | msm8226_add_drivers(); |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 142 | } |
| 143 | |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 144 | static const char *msm8226_dt_match[] __initconst = { |
| 145 | "qcom,msm8226", |
Syed Rameez Mustafa | 52a979b | 2013-05-20 18:05:50 -0700 | [diff] [blame] | 146 | "qcom,msm8926", |
Syed Rameez Mustafa | b41bf33 | 2013-06-05 12:09:22 -0700 | [diff] [blame] | 147 | "qcom,apq8026", |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 148 | NULL |
| 149 | }; |
| 150 | |
| 151 | DT_MACHINE_START(MSM8226_DT, "Qualcomm MSM 8226 (Flattened Device Tree)") |
| 152 | .map_io = msm_map_msm8226_io, |
Praveen Chidambaram | de2a87b | 2012-12-20 16:13:53 -0700 | [diff] [blame] | 153 | .init_irq = msm_dt_init_irq, |
Rohit Vaswani | 835707b | 2012-09-20 16:21:39 -0700 | [diff] [blame] | 154 | .init_machine = msm8226_init, |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 155 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | 835707b | 2012-09-20 16:21:39 -0700 | [diff] [blame] | 156 | .timer = &msm_dt_timer, |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 157 | .dt_compat = msm8226_dt_match, |
Mitchel Humpherys | 3c7c712 | 2012-11-08 19:24:39 -0800 | [diff] [blame] | 158 | .reserve = msm8226_reserve, |
Syed Rameez Mustafa | f1bdd71 | 2012-11-20 14:56:44 -0800 | [diff] [blame] | 159 | .init_very_early = msm8226_early_memory, |
| 160 | .restart = msm_restart, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 161 | .smp = &arm_smp_ops, |
Syed Rameez Mustafa | 878892c | 2012-08-23 17:30:32 -0700 | [diff] [blame] | 162 | MACHINE_END |