blob: 1ede17bc9f43cc0b4a6961a891642c00b915b2a1 [file] [log] [blame]
Sathish Ambleyc58afc22011-10-09 21:55:39 -07001/* Copyright (c) 2011, Code Aurora Forum. 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/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>
19#include <asm/mach/arch.h>
20#include <mach/socinfo.h>
21#include <mach/board.h>
22#include "timer.h"
23
24#define early_machine_is_copper() \
25 of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msmcopper")
26#define machine_is_copper() \
27 of_machine_is_compatible("qcom,msmcopper")
28
29static void __init msm_dt_init_irq(void)
30{
31 if (machine_is_copper())
32 msm_copper_init_irq();
33}
34
35static void __init msm_dt_map_io(void)
36{
37 if (early_machine_is_copper())
38 msm_map_copper_io();
39 if (socinfo_init() < 0)
40 pr_err("%s: socinfo_init() failed\n", __func__);
41}
42
43static void __init msm_dt_init(void)
44{
45 struct of_dev_auxdata *adata = NULL;
46
47 if (machine_is_copper())
48 msm_copper_init(&adata);
49
50 of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
51 if (machine_is_copper())
52 msm_copper_add_devices();
53}
54
55static const char *msm_dt_match[] __initdata = {
56 "qcom,msmcopper",
57 NULL
58};
59
60DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
61 .map_io = msm_dt_map_io,
62 .init_irq = msm_dt_init_irq,
63 .init_machine = msm_dt_init,
64 .timer = &msm_timer,
65 .dt_compat = msm_dt_match,
66MACHINE_END