Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -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 | fd0f9b4 | 2012-09-21 18:33:36 -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> |
Siddartha Mohanadoss | 4cef5f4 | 2013-04-11 13:59:41 -0700 | [diff] [blame] | 27 | #include <linux/msm_tsens.h> |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 28 | #include <asm/mach/map.h> |
| 29 | #include <asm/arch_timer.h> |
| 30 | #include <asm/hardware/gic.h> |
| 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> |
Hanumant Singh | e427131 | 2012-10-24 13:27:57 -0700 | [diff] [blame] | 36 | #include <mach/restart.h> |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 37 | #ifdef CONFIG_ION_MSM |
| 38 | #include <mach/ion.h> |
| 39 | #endif |
Xiaozhe Shi | e428453 | 2013-03-13 16:03:09 -0700 | [diff] [blame] | 40 | #include <linux/regulator/qpnp-regulator.h> |
Neeti Desai | 1c63810 | 2012-11-09 16:08:11 -0800 | [diff] [blame] | 41 | #include <mach/msm_memtypes.h> |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 42 | #include <mach/socinfo.h> |
| 43 | #include <mach/board.h> |
| 44 | #include <mach/clk-provider.h> |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 45 | #include <mach/msm_smd.h> |
| 46 | #include <mach/rpm-smd.h> |
Xiaozhe Shi | f33ce3b | 2013-04-09 17:13:42 -0700 | [diff] [blame] | 47 | #include <mach/rpm-regulator-smd.h> |
Jeff Hugo | 7cc06b1 | 2013-06-17 16:13:18 -0600 | [diff] [blame] | 48 | #include <mach/msm_smem.h> |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 49 | #include <linux/msm_thermal.h> |
Rohit Vaswani | 90e3023 | 2012-10-10 16:52:37 -0700 | [diff] [blame] | 50 | #include "board-dt.h" |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 51 | #include "clock.h" |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 52 | #include "platsmp.h" |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 53 | #include "spm.h" |
Mahesh Sivasubramanian | 59ffcb0 | 2013-05-31 15:08:15 -0600 | [diff] [blame] | 54 | #include "pm.h" |
Jeff Hugo | a50514f | 2013-03-14 14:40:35 -0600 | [diff] [blame] | 55 | #include "modem_notifier.h" |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 56 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 57 | static struct memtype_reserve msm8610_reserve_table[] __initdata = { |
Neeti Desai | 1c63810 | 2012-11-09 16:08:11 -0800 | [diff] [blame] | 58 | [MEMTYPE_SMI] = { |
| 59 | }, |
| 60 | [MEMTYPE_EBI0] = { |
| 61 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 62 | }, |
| 63 | [MEMTYPE_EBI1] = { |
| 64 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 65 | }, |
| 66 | }; |
| 67 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 68 | static int msm8610_paddr_to_memtype(unsigned int paddr) |
Neeti Desai | 1c63810 | 2012-11-09 16:08:11 -0800 | [diff] [blame] | 69 | { |
| 70 | return MEMTYPE_EBI1; |
| 71 | } |
| 72 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 73 | static struct of_dev_auxdata msm8610_auxdata_lookup[] __initdata = { |
David Ng | b5bac06 | 2012-11-02 00:00:12 -0700 | [diff] [blame] | 74 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \ |
| 75 | "msm_sdcc.1", NULL), |
| 76 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \ |
| 77 | "msm_sdcc.2", NULL), |
Venkat Gopalakrishnan | 44395b9 | 2013-04-05 12:31:13 -0700 | [diff] [blame] | 78 | OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF9824900, \ |
| 79 | "msm_sdcc.1", NULL), |
| 80 | OF_DEV_AUXDATA("qcom,sdhci-msm", 0xF98A4900, \ |
| 81 | "msm_sdcc.2", NULL), |
David Ng | b5bac06 | 2012-11-02 00:00:12 -0700 | [diff] [blame] | 82 | {} |
| 83 | }; |
| 84 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 85 | static struct reserve_info msm8610_reserve_info __initdata = { |
| 86 | .memtype_reserve_table = msm8610_reserve_table, |
| 87 | .paddr_to_memtype = msm8610_paddr_to_memtype, |
Neeti Desai | 1c63810 | 2012-11-09 16:08:11 -0800 | [diff] [blame] | 88 | }; |
| 89 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 90 | static void __init msm8610_early_memory(void) |
Neeti Desai | 1c63810 | 2012-11-09 16:08:11 -0800 | [diff] [blame] | 91 | { |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 92 | reserve_info = &msm8610_reserve_info; |
Neeti Desai | 2a575be | 2012-11-26 12:53:10 -0800 | [diff] [blame] | 93 | of_scan_flat_dt(dt_scan_for_memory_hole, msm8610_reserve_table); |
Neeti Desai | 1c63810 | 2012-11-09 16:08:11 -0800 | [diff] [blame] | 94 | } |
| 95 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 96 | static void __init msm8610_reserve(void) |
Neeti Desai | 1c63810 | 2012-11-09 16:08:11 -0800 | [diff] [blame] | 97 | { |
Neeti Desai | 2a575be | 2012-11-26 12:53:10 -0800 | [diff] [blame] | 98 | reserve_info = &msm8610_reserve_info; |
| 99 | of_scan_flat_dt(dt_scan_for_memory_reserve, msm8610_reserve_table); |
Neeti Desai | 1c63810 | 2012-11-09 16:08:11 -0800 | [diff] [blame] | 100 | msm_reserve(); |
| 101 | } |
| 102 | |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 103 | void __init msm8610_add_drivers(void) |
| 104 | { |
Jeff Hugo | 7cc06b1 | 2013-06-17 16:13:18 -0600 | [diff] [blame] | 105 | msm_smem_init(); |
Jeff Hugo | a50514f | 2013-03-14 14:40:35 -0600 | [diff] [blame] | 106 | msm_init_modem_notifier_list(); |
| 107 | msm_smd_init(); |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 108 | msm_rpm_driver_init(); |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 109 | msm_spm_device_init(); |
Mahesh Sivasubramanian | 59ffcb0 | 2013-05-31 15:08:15 -0600 | [diff] [blame] | 110 | msm_pm_sleep_status_init(); |
Xiaozhe Shi | f33ce3b | 2013-04-09 17:13:42 -0700 | [diff] [blame] | 111 | rpm_regulator_smd_driver_init(); |
Xiaozhe Shi | e428453 | 2013-03-13 16:03:09 -0700 | [diff] [blame] | 112 | qpnp_regulator_init(); |
Siddartha Mohanadoss | 4cef5f4 | 2013-04-11 13:59:41 -0700 | [diff] [blame] | 113 | tsens_tm_init_driver(); |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 114 | msm_thermal_device_init(); |
Vikram Mulukutla | d682cd8 | 2013-01-24 12:32:36 -0800 | [diff] [blame] | 115 | |
Stepan Moskovchenko | 82f0eab | 2013-04-02 19:52:28 -0700 | [diff] [blame] | 116 | if (of_board_is_rumi()) |
Vikram Mulukutla | d682cd8 | 2013-01-24 12:32:36 -0800 | [diff] [blame] | 117 | msm_clock_init(&msm8610_rumi_clock_init_data); |
| 118 | else |
| 119 | msm_clock_init(&msm8610_clock_init_data); |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 120 | } |
| 121 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 122 | void __init msm8610_init(void) |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 123 | { |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 124 | struct of_dev_auxdata *adata = msm8610_auxdata_lookup; |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 125 | |
Abhimanyu Kapur | 91a0a50 | 2013-01-11 19:24:59 -0800 | [diff] [blame] | 126 | if (socinfo_init() < 0) |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 127 | pr_err("%s: socinfo_init() failed\n", __func__); |
David Ng | b5bac06 | 2012-11-02 00:00:12 -0700 | [diff] [blame] | 128 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 129 | msm8610_init_gpiomux(); |
Stepan Moskovchenko | 7d8cdcaa | 2013-04-25 17:10:55 -0700 | [diff] [blame] | 130 | board_dt_populate(adata); |
Vikram Mulukutla | d682cd8 | 2013-01-24 12:32:36 -0800 | [diff] [blame] | 131 | msm8610_add_drivers(); |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 132 | } |
| 133 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 134 | static const char *msm8610_dt_match[] __initconst = { |
| 135 | "qcom,msm8610", |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 136 | NULL |
| 137 | }; |
| 138 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 139 | DT_MACHINE_START(MSM8610_DT, "Qualcomm MSM 8610 (Flattened Device Tree)") |
| 140 | .map_io = msm_map_msm8610_io, |
Praveen Chidambaram | 5238071 | 2012-12-20 16:51:11 -0700 | [diff] [blame] | 141 | .init_irq = msm_dt_init_irq, |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 142 | .init_machine = msm8610_init, |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 143 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | 90e3023 | 2012-10-10 16:52:37 -0700 | [diff] [blame] | 144 | .timer = &msm_dt_timer, |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 145 | .dt_compat = msm8610_dt_match, |
Hanumant Singh | e427131 | 2012-10-24 13:27:57 -0700 | [diff] [blame] | 146 | .restart = msm_restart, |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 147 | .reserve = msm8610_reserve, |
| 148 | .init_very_early = msm8610_early_memory, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 149 | .smp = &arm_smp_ops, |
Syed Rameez Mustafa | fd0f9b4 | 2012-09-21 18:33:36 -0700 | [diff] [blame] | 150 | MACHINE_END |