blob: 61339833ea5d0100dddd595f61e5ca36df94d541 [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>
19#include <asm/hardware/gic.h>
20#include <asm/mach/map.h>
21#include <asm/mach/arch.h>
22#include <mach/board.h>
23#include <mach/gpiomux.h>
24#include <mach/msm_iomap.h>
25#include <mach/msm_memtypes.h>
26#include <mach/restart.h>
27#include <mach/socinfo.h>
28#include <mach/clk-provider.h>
Jeff Hugo7cc06b12013-06-17 16:13:18 -060029#include <mach/msm_smem.h>
Jeff Hugof616c3f2013-06-13 15:14:40 -060030#include <mach/msm_smd.h>
Jay Chokshiffeabaf2013-05-10 17:49:25 -070031#include "board-dt.h"
32#include "clock.h"
33#include "devices.h"
34#include "platsmp.h"
Jeff Hugof616c3f2013-06-13 15:14:40 -060035#include "modem_notifier.h"
Jay Chokshiffeabaf2013-05-10 17:49:25 -070036
37static struct clk_lookup msm_clocks_dummy[] = {
38 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
39 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
Venkat Gopalakrishnanc1f54de2013-05-20 18:07:50 -070040 CLK_DUMMY("core_clk", SDC1_CLK, "msm_sdcc.1", OFF),
41 CLK_DUMMY("iface_clk", SDC1_P_CLK, "msm_sdcc.1", OFF),
42 CLK_DUMMY("core_clk", SDC2_CLK, "msm_sdcc.2", OFF),
43 CLK_DUMMY("iface_clk", SDC2_P_CLK, "msm_sdcc.2", OFF),
Manu Gautamcc651b32013-06-21 16:58:52 +053044 CLK_DUMMY("core_clk", USB_HS_SYSTEM_CLK, "msm_otg", OFF),
45 CLK_DUMMY("iface_clk", USB_HS_AHB_CLK, "msm_otg", OFF),
46 CLK_DUMMY("xo", CXO_OTG_CLK, "msm_otg", OFF),
Yan Hedc90e2e2013-07-18 12:25:28 -070047 CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF),
48 CLK_DUMMY("dma_bam_pclk", DMA_BAM_P_CLK, "msm_sps", OFF),
Jay Chokshiffeabaf2013-05-10 17:49:25 -070049};
50
51static struct clock_init_data msm_dummy_clock_init_data __initdata = {
52 .table = msm_clocks_dummy,
53 .size = ARRAY_SIZE(msm_clocks_dummy),
54};
55
56static struct of_dev_auxdata msmsamarium_auxdata_lookup[] __initdata = {
Venkat Gopalakrishnan4f1264b2013-05-20 18:03:12 -070057 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
58 "msm_sdcc.1", NULL),
59 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
60 "msm_sdcc.2", NULL),
Manu Gautamcc651b32013-06-21 16:58:52 +053061 OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \
62 "msm_otg", NULL),
Jay Chokshiffeabaf2013-05-10 17:49:25 -070063 {},
64};
65
Neeti Desaie181bab2013-06-13 17:46:53 -070066static struct memtype_reserve msmsamarium_reserve_table[] __initdata = {
67 [MEMTYPE_SMI] = {
68 },
69 [MEMTYPE_EBI0] = {
70 .flags = MEMTYPE_FLAGS_1M_ALIGN,
71 },
72 [MEMTYPE_EBI1] = {
73 .flags = MEMTYPE_FLAGS_1M_ALIGN,
74 },
75};
76
77static int msmsamarium_paddr_to_memtype(phys_addr_t paddr)
78{
79 return MEMTYPE_EBI1;
80}
81
82static struct reserve_info msmsamarium_reserve_info __initdata = {
83 .memtype_reserve_table = msmsamarium_reserve_table,
84 .paddr_to_memtype = msmsamarium_paddr_to_memtype,
85};
86
87void __init msmsamarium_reserve(void)
88{
89 reserve_info = &msmsamarium_reserve_info;
90 of_scan_flat_dt(dt_scan_for_memory_reserve, msmsamarium_reserve_table);
91 msm_reserve();
92}
93
94static void __init msmsamarium_early_memory(void)
95{
96 reserve_info = &msmsamarium_reserve_info;
97 of_scan_flat_dt(dt_scan_for_memory_hole, msmsamarium_reserve_table);
98}
99
Jay Chokshiffeabaf2013-05-10 17:49:25 -0700100/*
101 * Used to satisfy dependencies for devices that need to be
102 * run early or in a particular order. Most likely your device doesn't fall
103 * into this category, and thus the driver should not be added here. The
104 * EPROBE_DEFER can satisfy most dependency problems.
105 */
106void __init msmsamarium_add_drivers(void)
107{
Jeff Hugo7cc06b12013-06-17 16:13:18 -0600108 msm_smem_init();
Jeff Hugof616c3f2013-06-13 15:14:40 -0600109 msm_init_modem_notifier_list();
110 msm_smd_init();
Jay Chokshiffeabaf2013-05-10 17:49:25 -0700111 msm_clock_init(&msm_dummy_clock_init_data);
112}
113
114static void __init msmsamarium_map_io(void)
115{
116 msm_map_msmsamarium_io();
117}
118
119void __init msmsamarium_init(void)
120{
121 struct of_dev_auxdata *adata = msmsamarium_auxdata_lookup;
122
123 if (socinfo_init() < 0)
124 pr_err("%s: socinfo_init() failed\n", __func__);
125
126 msmsamarium_init_gpiomux();
127 board_dt_populate(adata);
128 msmsamarium_add_drivers();
129}
130
Neeti Desaie181bab2013-06-13 17:46:53 -0700131void __init msmsamarium_init_very_early(void)
132{
133 msmsamarium_early_memory();
134}
135
Jay Chokshiffeabaf2013-05-10 17:49:25 -0700136static const char *msmsamarium_dt_match[] __initconst = {
137 "qcom,msmsamarium",
138 NULL
139};
140
141DT_MACHINE_START(MSMSAMARIUM_DT, "Qualcomm MSM Samarium(Flattened Device Tree)")
142 .map_io = msmsamarium_map_io,
143 .init_irq = msm_dt_init_irq,
144 .init_machine = msmsamarium_init,
145 .handle_irq = gic_handle_irq,
146 .timer = &msm_dt_timer,
147 .dt_compat = msmsamarium_dt_match,
Neeti Desaie181bab2013-06-13 17:46:53 -0700148 .reserve = msmsamarium_reserve,
149 .init_very_early = msmsamarium_init_very_early,
Jay Chokshiffeabaf2013-05-10 17:49:25 -0700150 .restart = msm_restart,
151 .smp = &msm8974_smp_ops,
152MACHINE_END