blob: 52a947baab9aae5b262f710d864cc45a1625b05d [file] [log] [blame]
Jay Chokshiffeabaf2013-05-10 17:49:25 -07001/* 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 Mohanadossc6801b12013-07-22 15:33:10 -070019#include <linux/msm_tsens.h>
Jay Chokshiffeabaf2013-05-10 17:49:25 -070020#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 Hugo7cc06b12013-06-17 16:13:18 -060030#include <mach/msm_smem.h>
Jeff Hugof616c3f2013-06-13 15:14:40 -060031#include <mach/msm_smd.h>
Jay Chokshiffeabaf2013-05-10 17:49:25 -070032#include "board-dt.h"
33#include "clock.h"
34#include "devices.h"
35#include "platsmp.h"
Jeff Hugof616c3f2013-06-13 15:14:40 -060036#include "modem_notifier.h"
Jay Chokshiffeabaf2013-05-10 17:49:25 -070037
38static struct clk_lookup msm_clocks_dummy[] = {
Vikram Mulukutla8010a182013-07-18 12:37:58 -070039 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 Chokshiffeabaf2013-05-10 17:49:25 -070043 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
44 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
Venkat Gopalakrishnanc1f54de2013-05-20 18:07:50 -070045 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 Gautamcc651b32013-06-21 16:58:52 +053049 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 Hedc90e2e2013-07-18 12:25:28 -070052 CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF),
53 CLK_DUMMY("dma_bam_pclk", DMA_BAM_P_CLK, "msm_sps", OFF),
Jay Chokshiffeabaf2013-05-10 17:49:25 -070054};
55
56static struct clock_init_data msm_dummy_clock_init_data __initdata = {
57 .table = msm_clocks_dummy,
58 .size = ARRAY_SIZE(msm_clocks_dummy),
59};
60
61static struct of_dev_auxdata msmsamarium_auxdata_lookup[] __initdata = {
Venkat Gopalakrishnan4f1264b2013-05-20 18:03:12 -070062 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 Gautamcc651b32013-06-21 16:58:52 +053066 OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \
67 "msm_otg", NULL),
Jay Chokshiffeabaf2013-05-10 17:49:25 -070068 {},
69};
70
Neeti Desaie181bab2013-06-13 17:46:53 -070071static 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
82static int msmsamarium_paddr_to_memtype(phys_addr_t paddr)
83{
84 return MEMTYPE_EBI1;
85}
86
87static struct reserve_info msmsamarium_reserve_info __initdata = {
88 .memtype_reserve_table = msmsamarium_reserve_table,
89 .paddr_to_memtype = msmsamarium_paddr_to_memtype,
90};
91
92void __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
99static 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 Chokshiffeabaf2013-05-10 17:49:25 -0700105/*
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 */
111void __init msmsamarium_add_drivers(void)
112{
Jeff Hugo7cc06b12013-06-17 16:13:18 -0600113 msm_smem_init();
Jeff Hugof616c3f2013-06-13 15:14:40 -0600114 msm_init_modem_notifier_list();
115 msm_smd_init();
Jay Chokshiffeabaf2013-05-10 17:49:25 -0700116 msm_clock_init(&msm_dummy_clock_init_data);
Siddartha Mohanadossc6801b12013-07-22 15:33:10 -0700117 tsens_tm_init_driver();
Jay Chokshiffeabaf2013-05-10 17:49:25 -0700118}
119
120static void __init msmsamarium_map_io(void)
121{
122 msm_map_msmsamarium_io();
123}
124
125void __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 Desaie181bab2013-06-13 17:46:53 -0700137void __init msmsamarium_init_very_early(void)
138{
139 msmsamarium_early_memory();
140}
141
Jay Chokshiffeabaf2013-05-10 17:49:25 -0700142static const char *msmsamarium_dt_match[] __initconst = {
143 "qcom,msmsamarium",
144 NULL
145};
146
147DT_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 Desaie181bab2013-06-13 17:46:53 -0700154 .reserve = msmsamarium_reserve,
155 .init_very_early = msmsamarium_init_very_early,
Jay Chokshiffeabaf2013-05-10 17:49:25 -0700156 .restart = msm_restart,
157 .smp = &msm8974_smp_ops,
158MACHINE_END