blob: 8ceccf4ed4f9a142c93922d99cc1c109c19e54d0 [file] [log] [blame]
Abhimanyu Kapura6e27742013-03-18 16:39:31 -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/msm_smd.h>
Patrick Dalybdb97db2013-06-12 12:10:38 -070027#include <mach/rpm-smd.h>
Abhimanyu Kapura6e27742013-03-18 16:39:31 -070028#include <mach/restart.h>
29#include <mach/socinfo.h>
30#include <mach/clk-provider.h>
Jeff Hugo55b4afe2013-07-12 14:27:51 -060031#include <mach/msm_smem.h>
Abhimanyu Kapura6e27742013-03-18 16:39:31 -070032#include "board-dt.h"
33#include "clock.h"
34#include "devices.h"
Jeff Hugo55b4afe2013-07-12 14:27:51 -060035#include "modem_notifier.h"
Abhimanyu Kapura6e27742013-03-18 16:39:31 -070036
mengmeng6cf63692013-07-06 08:16:51 +080037static struct memtype_reserve msmkrypton_reserve_table[] __initdata = {
38 [MEMTYPE_EBI1] = {
39 .flags = MEMTYPE_FLAGS_1M_ALIGN,
40 },
41};
42
43static int msmkrypton_paddr_to_memtype(unsigned int paddr)
44{
45 return MEMTYPE_EBI1;
46}
47
48static struct reserve_info msmkrypton_reserve_info __initdata = {
49 .memtype_reserve_table = msmkrypton_reserve_table,
50 .paddr_to_memtype = msmkrypton_paddr_to_memtype,
51};
52
Abhimanyu Kapur57fc2ed2013-06-03 18:17:52 -070053static struct of_dev_auxdata msmkrypton_auxdata_lookup[] __initdata = {
54 {}
55};
56
Abhimanyu Kapura6e27742013-03-18 16:39:31 -070057/*
58 * Used to satisfy dependencies for devices that need to be
59 * run early or in a particular order. Most likely your device doesn't fall
60 * into this category, and thus the driver should not be added here. The
61 * EPROBE_DEFER can satisfy most dependency problems.
62 */
63void __init msmkrypton_add_drivers(void)
64{
Jeff Hugo55b4afe2013-07-12 14:27:51 -060065 msm_smem_init();
66 msm_init_modem_notifier_list();
Abhimanyu Kapura6e27742013-03-18 16:39:31 -070067 msm_smd_init();
Patrick Dalybdb97db2013-06-12 12:10:38 -070068 msm_rpm_driver_init();
Patrick Daly565b65a2013-06-07 16:09:12 -070069 msm_clock_init(&msmkrypton_clock_init_data);
Abhimanyu Kapura6e27742013-03-18 16:39:31 -070070}
71
mengmeng6cf63692013-07-06 08:16:51 +080072static void __init msmkrypton_early_memory(void)
73{
74 reserve_info = &msmkrypton_reserve_info;
75 of_scan_flat_dt(dt_scan_for_memory_hole, msmkrypton_reserve_table);
76}
Abhimanyu Kapura6e27742013-03-18 16:39:31 -070077static void __init msmkrypton_map_io(void)
78{
79 msm_map_msmkrypton_io();
80}
81
82void __init msmkrypton_init(void)
83{
84 if (socinfo_init() < 0)
85 pr_err("%s: socinfo_init() failed\n", __func__);
86
87 msmkrypton_init_gpiomux();
Abhimanyu Kapur57fc2ed2013-06-03 18:17:52 -070088 board_dt_populate(msmkrypton_auxdata_lookup);
Abhimanyu Kapura6e27742013-03-18 16:39:31 -070089 msmkrypton_add_drivers();
90}
91
92static const char *msmkrypton_dt_match[] __initconst = {
93 "qcom,msmkrypton",
94 NULL
95};
96
97DT_MACHINE_START(MSMKRYPTON_DT, "Qualcomm MSM Krypton (Flattened Device Tree)")
98 .map_io = msmkrypton_map_io,
99 .init_irq = msm_dt_init_irq,
100 .init_machine = msmkrypton_init,
101 .handle_irq = gic_handle_irq,
102 .timer = &msm_dt_timer,
103 .dt_compat = msmkrypton_dt_match,
mengmeng6cf63692013-07-06 08:16:51 +0800104 .init_very_early = msmkrypton_early_memory,
Abhimanyu Kapura6e27742013-03-18 16:39:31 -0700105 .restart = msm_restart,
106MACHINE_END