blob: b2a4ce2f4ad663623a4ff39ed4946cf3fea1d2b8 [file] [log] [blame]
Sathish Ambley9b40e7d2012-01-03 16:50:44 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Sathish Ambleyc58afc22011-10-09 21:55:39 -07002 *
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/kernel.h>
14#include <linux/errno.h>
15#include <linux/of.h>
16#include <linux/of_address.h>
17#include <linux/of_platform.h>
18#include <linux/of_fdt.h>
Sathish Ambley098f9bd2011-11-09 16:32:53 -080019#include <linux/of_irq.h>
Sathish Ambley9b40e7d2012-01-03 16:50:44 -080020#include <asm/hardware/gic.h>
Sathish Ambley098f9bd2011-11-09 16:32:53 -080021#include <asm/arch_timer.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070022#include <asm/mach/arch.h>
Sathish Ambley098f9bd2011-11-09 16:32:53 -080023#include <asm/mach/time.h>
Sathish Ambleyc58afc22011-10-09 21:55:39 -070024#include <mach/socinfo.h>
25#include <mach/board.h>
Sathish Ambley098f9bd2011-11-09 16:32:53 -080026
27static void __init msm_dt_timer_init(void)
28{
Sathish Ambley2f27a172012-03-16 10:46:28 -070029 arch_timer_of_register();
Sathish Ambley098f9bd2011-11-09 16:32:53 -080030}
31
32static struct sys_timer msm_dt_timer = {
33 .init = msm_dt_timer_init
34};
35
Sathish Ambleyc58afc22011-10-09 21:55:39 -070036static void __init msm_dt_init_irq(void)
37{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070038 if (machine_is_msm8974())
39 msm_8974_init_irq();
Sathish Ambleyc58afc22011-10-09 21:55:39 -070040}
41
42static void __init msm_dt_map_io(void)
43{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070044 if (early_machine_is_msm8974())
45 msm_map_8974_io();
Sathish Ambleyc58afc22011-10-09 21:55:39 -070046 if (socinfo_init() < 0)
47 pr_err("%s: socinfo_init() failed\n", __func__);
48}
49
50static void __init msm_dt_init(void)
51{
52 struct of_dev_auxdata *adata = NULL;
53
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070054 if (machine_is_msm8974())
55 msm_8974_init(&adata);
Sathish Ambleyc58afc22011-10-09 21:55:39 -070056
57 of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070058 if (machine_is_msm8974()) {
59 msm_8974_add_devices();
60 msm_8974_add_drivers();
Michael Bohane7c2b472012-03-30 14:27:18 -070061 }
Sathish Ambleyc58afc22011-10-09 21:55:39 -070062}
63
David Brown25454262012-03-29 15:28:43 -070064static const char *msm_dt_match[] __initconst = {
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070065 "qcom,msm8974",
Sathish Ambleyc58afc22011-10-09 21:55:39 -070066 NULL
67};
68
Olav Hauganb800c8c2012-01-30 08:50:45 -080069static void __init msm_dt_reserve(void)
70{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070071 if (early_machine_is_msm8974())
72 msm_8974_reserve();
Olav Hauganb800c8c2012-01-30 08:50:45 -080073}
74
75static void __init msm_dt_init_very_early(void)
76{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -070077 if (early_machine_is_msm8974())
78 msm_8974_very_early();
Olav Hauganb800c8c2012-01-30 08:50:45 -080079}
80
Sathish Ambleyc58afc22011-10-09 21:55:39 -070081DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
82 .map_io = msm_dt_map_io,
83 .init_irq = msm_dt_init_irq,
84 .init_machine = msm_dt_init,
Sathish Ambley9b40e7d2012-01-03 16:50:44 -080085 .handle_irq = gic_handle_irq,
Sathish Ambley098f9bd2011-11-09 16:32:53 -080086 .timer = &msm_dt_timer,
Sathish Ambleyc58afc22011-10-09 21:55:39 -070087 .dt_compat = msm_dt_match,
Olav Hauganb800c8c2012-01-30 08:50:45 -080088 .reserve = msm_dt_reserve,
89 .init_very_early = msm_dt_init_very_early,
Sathish Ambleyc58afc22011-10-09 21:55:39 -070090MACHINE_END