Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2013, The Linux Foundation. All rights reserved. |
| 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 | |
| 13 | #include <linux/err.h> |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/of.h> |
| 16 | #include <linux/of_address.h> |
| 17 | #include <linux/of_platform.h> |
| 18 | #include <linux/memory.h> |
Siddartha Mohanadoss | c6801b1 | 2013-07-22 15:33:10 -0700 | [diff] [blame] | 19 | #include <linux/msm_tsens.h> |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 20 | #include <asm/hardware/gic.h> |
| 21 | #include <asm/mach/map.h> |
| 22 | #include <asm/mach/arch.h> |
| 23 | #include <mach/board.h> |
| 24 | #include <mach/gpiomux.h> |
| 25 | #include <mach/msm_iomap.h> |
| 26 | #include <mach/msm_memtypes.h> |
| 27 | #include <mach/restart.h> |
| 28 | #include <mach/socinfo.h> |
| 29 | #include <mach/clk-provider.h> |
Jeff Hugo | 7cc06b1 | 2013-06-17 16:13:18 -0600 | [diff] [blame] | 30 | #include <mach/msm_smem.h> |
Jeff Hugo | f616c3f | 2013-06-13 15:14:40 -0600 | [diff] [blame] | 31 | #include <mach/msm_smd.h> |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 32 | #include "board-dt.h" |
| 33 | #include "clock.h" |
| 34 | #include "devices.h" |
| 35 | #include "platsmp.h" |
Jeff Hugo | f616c3f | 2013-06-13 15:14:40 -0600 | [diff] [blame] | 36 | #include "modem_notifier.h" |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 37 | |
| 38 | static struct clk_lookup msm_clocks_dummy[] = { |
Vikram Mulukutla | 8010a18 | 2013-07-18 12:37:58 -0700 | [diff] [blame] | 39 | CLK_DUMMY("xo", CXO_CLK, "fc880000.qcom,mss", OFF), |
| 40 | CLK_DUMMY("bus_clk", MSS_BIMC_Q6_CLK, "fc880000.qcom,mss", OFF), |
| 41 | CLK_DUMMY("iface_clk", MSS_CFG_AHB_CLK, "fc880000.qcom,mss", OFF), |
| 42 | CLK_DUMMY("mem_clk", BOOT_ROM_AHB_CLK, "fc880000.qcom,mss", OFF), |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 43 | CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF), |
| 44 | CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF), |
Venkat Gopalakrishnan | c1f54de | 2013-05-20 18:07:50 -0700 | [diff] [blame] | 45 | CLK_DUMMY("core_clk", SDC1_CLK, "msm_sdcc.1", OFF), |
| 46 | CLK_DUMMY("iface_clk", SDC1_P_CLK, "msm_sdcc.1", OFF), |
| 47 | CLK_DUMMY("core_clk", SDC2_CLK, "msm_sdcc.2", OFF), |
| 48 | CLK_DUMMY("iface_clk", SDC2_P_CLK, "msm_sdcc.2", OFF), |
Manu Gautam | cc651b3 | 2013-06-21 16:58:52 +0530 | [diff] [blame] | 49 | CLK_DUMMY("core_clk", USB_HS_SYSTEM_CLK, "msm_otg", OFF), |
| 50 | CLK_DUMMY("iface_clk", USB_HS_AHB_CLK, "msm_otg", OFF), |
| 51 | CLK_DUMMY("xo", CXO_OTG_CLK, "msm_otg", OFF), |
Yan He | dc90e2e | 2013-07-18 12:25:28 -0700 | [diff] [blame] | 52 | CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF), |
| 53 | CLK_DUMMY("dma_bam_pclk", DMA_BAM_P_CLK, "msm_sps", OFF), |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | static struct clock_init_data msm_dummy_clock_init_data __initdata = { |
| 57 | .table = msm_clocks_dummy, |
| 58 | .size = ARRAY_SIZE(msm_clocks_dummy), |
| 59 | }; |
| 60 | |
| 61 | static struct of_dev_auxdata msmsamarium_auxdata_lookup[] __initdata = { |
Venkat Gopalakrishnan | 4f1264b | 2013-05-20 18:03:12 -0700 | [diff] [blame] | 62 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \ |
| 63 | "msm_sdcc.1", NULL), |
| 64 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \ |
| 65 | "msm_sdcc.2", NULL), |
Manu Gautam | cc651b3 | 2013-06-21 16:58:52 +0530 | [diff] [blame] | 66 | OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \ |
| 67 | "msm_otg", NULL), |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 68 | {}, |
| 69 | }; |
| 70 | |
Neeti Desai | e181bab | 2013-06-13 17:46:53 -0700 | [diff] [blame] | 71 | static struct memtype_reserve msmsamarium_reserve_table[] __initdata = { |
| 72 | [MEMTYPE_SMI] = { |
| 73 | }, |
| 74 | [MEMTYPE_EBI0] = { |
| 75 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 76 | }, |
| 77 | [MEMTYPE_EBI1] = { |
| 78 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 79 | }, |
| 80 | }; |
| 81 | |
| 82 | static int msmsamarium_paddr_to_memtype(phys_addr_t paddr) |
| 83 | { |
| 84 | return MEMTYPE_EBI1; |
| 85 | } |
| 86 | |
| 87 | static struct reserve_info msmsamarium_reserve_info __initdata = { |
| 88 | .memtype_reserve_table = msmsamarium_reserve_table, |
| 89 | .paddr_to_memtype = msmsamarium_paddr_to_memtype, |
| 90 | }; |
| 91 | |
| 92 | void __init msmsamarium_reserve(void) |
| 93 | { |
| 94 | reserve_info = &msmsamarium_reserve_info; |
| 95 | of_scan_flat_dt(dt_scan_for_memory_reserve, msmsamarium_reserve_table); |
| 96 | msm_reserve(); |
| 97 | } |
| 98 | |
| 99 | static void __init msmsamarium_early_memory(void) |
| 100 | { |
| 101 | reserve_info = &msmsamarium_reserve_info; |
| 102 | of_scan_flat_dt(dt_scan_for_memory_hole, msmsamarium_reserve_table); |
| 103 | } |
| 104 | |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 105 | /* |
| 106 | * Used to satisfy dependencies for devices that need to be |
| 107 | * run early or in a particular order. Most likely your device doesn't fall |
| 108 | * into this category, and thus the driver should not be added here. The |
| 109 | * EPROBE_DEFER can satisfy most dependency problems. |
| 110 | */ |
| 111 | void __init msmsamarium_add_drivers(void) |
| 112 | { |
Jeff Hugo | 7cc06b1 | 2013-06-17 16:13:18 -0600 | [diff] [blame] | 113 | msm_smem_init(); |
Jeff Hugo | f616c3f | 2013-06-13 15:14:40 -0600 | [diff] [blame] | 114 | msm_init_modem_notifier_list(); |
| 115 | msm_smd_init(); |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 116 | msm_clock_init(&msm_dummy_clock_init_data); |
Siddartha Mohanadoss | c6801b1 | 2013-07-22 15:33:10 -0700 | [diff] [blame] | 117 | tsens_tm_init_driver(); |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | static void __init msmsamarium_map_io(void) |
| 121 | { |
| 122 | msm_map_msmsamarium_io(); |
| 123 | } |
| 124 | |
| 125 | void __init msmsamarium_init(void) |
| 126 | { |
| 127 | struct of_dev_auxdata *adata = msmsamarium_auxdata_lookup; |
| 128 | |
| 129 | if (socinfo_init() < 0) |
| 130 | pr_err("%s: socinfo_init() failed\n", __func__); |
| 131 | |
| 132 | msmsamarium_init_gpiomux(); |
| 133 | board_dt_populate(adata); |
| 134 | msmsamarium_add_drivers(); |
| 135 | } |
| 136 | |
Neeti Desai | e181bab | 2013-06-13 17:46:53 -0700 | [diff] [blame] | 137 | void __init msmsamarium_init_very_early(void) |
| 138 | { |
| 139 | msmsamarium_early_memory(); |
| 140 | } |
| 141 | |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 142 | static const char *msmsamarium_dt_match[] __initconst = { |
| 143 | "qcom,msmsamarium", |
| 144 | NULL |
| 145 | }; |
| 146 | |
| 147 | DT_MACHINE_START(MSMSAMARIUM_DT, "Qualcomm MSM Samarium(Flattened Device Tree)") |
| 148 | .map_io = msmsamarium_map_io, |
| 149 | .init_irq = msm_dt_init_irq, |
| 150 | .init_machine = msmsamarium_init, |
| 151 | .handle_irq = gic_handle_irq, |
| 152 | .timer = &msm_dt_timer, |
| 153 | .dt_compat = msmsamarium_dt_match, |
Neeti Desai | e181bab | 2013-06-13 17:46:53 -0700 | [diff] [blame] | 154 | .reserve = msmsamarium_reserve, |
| 155 | .init_very_early = msmsamarium_init_very_early, |
Jay Chokshi | ffeabaf | 2013-05-10 17:49:25 -0700 | [diff] [blame] | 156 | .restart = msm_restart, |
| 157 | .smp = &msm8974_smp_ops, |
| 158 | MACHINE_END |