blob: 527de41402ea33cffcad3ada2b4d62fcf6c2bae6 [file] [log] [blame]
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +05301/* Copyright (c) 2012, 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 <linux/of_irq.h>
20#include <asm/hardware/gic.h>
21#include <asm/arch_timer.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/time.h>
24#include <mach/socinfo.h>
25#include <mach/board.h>
Utsab Bose4bb94652012-09-28 15:07:35 +053026#include <mach/msm_memtypes.h>
Ravi Kumar Vcb4dd002012-09-28 15:08:41 +053027#include <mach/qpnp-int.h>
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053028#include <linux/io.h>
29#include <linux/gpio.h>
30#include <linux/irq.h>
31#include <linux/irqdomain.h>
32
33#include "clock.h"
34
35static struct of_device_id irq_match[] __initdata = {
36 { .compatible = "qcom,msm-qgic2", .data = gic_of_init, },
37 { .compatible = "qcom,msm-gpio", .data = msm_gpio_of_init, },
Ravi Kumar Vcb4dd002012-09-28 15:08:41 +053038 { .compatible = "qcom,spmi-pmic-arb", .data = qpnpint_of_init, },
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053039 {}
40};
41
42static struct clk_lookup msm_clocks_dummy[] = {
43 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF),
44 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF),
45};
46
47struct clock_init_data mpq8092_clock_init_data __initdata = {
48 .table = msm_clocks_dummy,
49 .size = ARRAY_SIZE(msm_clocks_dummy),
50};
51
Utsab Bose4bb94652012-09-28 15:07:35 +053052static struct memtype_reserve mpq8092_reserve_table[] __initdata = {
53 [MEMTYPE_SMI] = {
54 },
55 [MEMTYPE_EBI0] = {
56 .flags = MEMTYPE_FLAGS_1M_ALIGN,
57 },
58 [MEMTYPE_EBI1] = {
59 .flags = MEMTYPE_FLAGS_1M_ALIGN,
60 },
61};
62
63static int mpq8092_paddr_to_memtype(unsigned int paddr)
64{
65 return MEMTYPE_EBI1;
66}
67
68static struct reserve_info mpq8092_reserve_info __initdata = {
69 .memtype_reserve_table = mpq8092_reserve_table,
70 .paddr_to_memtype = mpq8092_paddr_to_memtype,
71};
72
73static void __init mpq8092_early_memory(void)
74{
75 reserve_info = &mpq8092_reserve_info;
76 of_scan_flat_dt(dt_scan_for_memory_reserve, mpq8092_reserve_table);
77}
78
79static void __init mpq8092_dt_reserve(void)
80{
81 msm_reserve();
82}
83
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053084void __init mpq8092_init_irq(void)
85{
86 of_irq_init(irq_match);
87}
88
89static void __init mpq8092_dt_timer_init(void)
90{
91 arch_timer_of_register();
92}
93
94static struct sys_timer mpq8092_dt_timer = {
95 .init = mpq8092_dt_timer_init
96};
97
98static void __init mpq8092_dt_init_irq(void)
99{
100 mpq8092_init_irq();
101}
102
103static void __init mpq8092_dt_map_io(void)
104{
105 msm_map_mpq8092_io();
106 if (socinfo_init() < 0)
107 pr_err("%s: socinfo_init() failed\n", __func__);
108
109}
110
111static struct of_dev_auxdata mpq8092_auxdata_lookup[] __initdata = {
112 OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \
113 "msm_serial_hsl.0", NULL),
Ravi Kumar Vce0f2ba2012-09-20 19:08:24 +0530114 OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \
115 "spmi-pmic-arb.0", NULL),
Sujit Reddy Thumma2330f3a372012-10-18 10:28:51 +0530116 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
117 "msm_sdcc.1", NULL),
118 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
119 "msm_sdcc.2", NULL),
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530120 {}
121};
122
123static void __init mpq8092_init(struct of_dev_auxdata **adata)
124{
125 mpq8092_init_gpiomux();
126 *adata = mpq8092_auxdata_lookup;
127 msm_clock_init(&mpq8092_clock_init_data);
128}
129
130static void __init mpq8092_dt_init(void)
131{
132 struct of_dev_auxdata *adata = NULL;
133
134 mpq8092_init(&adata);
135 of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
136}
137
138static const char *mpq8092_dt_match[] __initconst = {
139 "qcom,mpq8092-sim",
140 NULL
141};
142
143DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
144 .map_io = mpq8092_dt_map_io,
145 .init_irq = mpq8092_dt_init_irq,
146 .init_machine = mpq8092_dt_init,
147 .handle_irq = gic_handle_irq,
148 .timer = &mpq8092_dt_timer,
149 .dt_compat = mpq8092_dt_match,
Utsab Bose4bb94652012-09-28 15:07:35 +0530150 .reserve = mpq8092_dt_reserve,
151 .init_very_early = mpq8092_early_memory,
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530152MACHINE_END