blob: 19f54cfead0606f982fe0805c207fdf1768cf867 [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{
29 struct device_node *node;
30 struct resource res;
31 struct of_irq oirq;
32
33 node = of_find_compatible_node(NULL, NULL, "qcom,msm-qtimer");
34 if (!node) {
35 pr_err("no matching timer node found\n");
36 return;
37 }
38
39 if (of_irq_map_one(node, 0, &oirq)) {
40 pr_err("interrupt not specified in timer node\n");
41 } else {
42 res.start = res.end = oirq.specifier[0];
43 res.flags = IORESOURCE_IRQ;
44 arch_timer_register(&res, 1);
45 }
46 of_node_put(node);
47}
48
49static struct sys_timer msm_dt_timer = {
50 .init = msm_dt_timer_init
51};
52
53int __cpuinit local_timer_setup(struct clock_event_device *evt)
54{
55 return 0;
56}
57
Trilok Sonieecb28c2011-07-20 16:24:14 +010058void local_timer_stop(void)
Sathish Ambley098f9bd2011-11-09 16:32:53 -080059{
Trilok Sonieecb28c2011-07-20 16:24:14 +010060 return;
Sathish Ambley098f9bd2011-11-09 16:32:53 -080061}
Sathish Ambleyc58afc22011-10-09 21:55:39 -070062
Sathish Ambleyc58afc22011-10-09 21:55:39 -070063static void __init msm_dt_init_irq(void)
64{
65 if (machine_is_copper())
66 msm_copper_init_irq();
67}
68
69static void __init msm_dt_map_io(void)
70{
71 if (early_machine_is_copper())
72 msm_map_copper_io();
73 if (socinfo_init() < 0)
74 pr_err("%s: socinfo_init() failed\n", __func__);
75}
76
77static void __init msm_dt_init(void)
78{
79 struct of_dev_auxdata *adata = NULL;
80
81 if (machine_is_copper())
82 msm_copper_init(&adata);
83
84 of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
85 if (machine_is_copper())
86 msm_copper_add_devices();
87}
88
89static const char *msm_dt_match[] __initdata = {
90 "qcom,msmcopper",
91 NULL
92};
93
94DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
95 .map_io = msm_dt_map_io,
96 .init_irq = msm_dt_init_irq,
97 .init_machine = msm_dt_init,
Sathish Ambley9b40e7d2012-01-03 16:50:44 -080098 .handle_irq = gic_handle_irq,
Sathish Ambley098f9bd2011-11-09 16:32:53 -080099 .timer = &msm_dt_timer,
Sathish Ambleyc58afc22011-10-09 21:55:39 -0700100 .dt_compat = msm_dt_match,
101MACHINE_END