blob: cbd257f71c33a29f14a8087e1a2f590d7be80e37 [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>
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053021#include <asm/mach/arch.h>
22#include <asm/mach/time.h>
23#include <mach/socinfo.h>
24#include <mach/board.h>
Utsab Bose4bb94652012-09-28 15:07:35 +053025#include <mach/msm_memtypes.h>
Ravi Kumar Vcb4dd002012-09-28 15:08:41 +053026#include <mach/qpnp-int.h>
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053027#include <linux/io.h>
28#include <linux/gpio.h>
29#include <linux/irq.h>
30#include <linux/irqdomain.h>
31
Rohit Vaswani149f5752012-09-20 16:20:48 -070032#include "board-dt.h"
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053033#include "clock.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -080034#include "platsmp.h"
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053035
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053036static struct clk_lookup msm_clocks_dummy[] = {
37 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF),
38 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF),
39};
40
41struct clock_init_data mpq8092_clock_init_data __initdata = {
42 .table = msm_clocks_dummy,
43 .size = ARRAY_SIZE(msm_clocks_dummy),
44};
45
Utsab Bose4bb94652012-09-28 15:07:35 +053046static struct memtype_reserve mpq8092_reserve_table[] __initdata = {
47 [MEMTYPE_SMI] = {
48 },
49 [MEMTYPE_EBI0] = {
50 .flags = MEMTYPE_FLAGS_1M_ALIGN,
51 },
52 [MEMTYPE_EBI1] = {
53 .flags = MEMTYPE_FLAGS_1M_ALIGN,
54 },
55};
56
57static int mpq8092_paddr_to_memtype(unsigned int paddr)
58{
59 return MEMTYPE_EBI1;
60}
61
62static struct reserve_info mpq8092_reserve_info __initdata = {
63 .memtype_reserve_table = mpq8092_reserve_table,
64 .paddr_to_memtype = mpq8092_paddr_to_memtype,
65};
66
67static void __init mpq8092_early_memory(void)
68{
69 reserve_info = &mpq8092_reserve_info;
70 of_scan_flat_dt(dt_scan_for_memory_reserve, mpq8092_reserve_table);
71}
72
73static void __init mpq8092_dt_reserve(void)
74{
75 msm_reserve();
76}
77
Rohit Vaswani149f5752012-09-20 16:20:48 -070078static void __init mpq8092_map_io(void)
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053079{
80 msm_map_mpq8092_io();
81 if (socinfo_init() < 0)
82 pr_err("%s: socinfo_init() failed\n", __func__);
83
84}
85
86static struct of_dev_auxdata mpq8092_auxdata_lookup[] __initdata = {
87 OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \
88 "msm_serial_hsl.0", NULL),
Ravi Kumar Vce0f2ba2012-09-20 19:08:24 +053089 OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \
90 "spmi-pmic-arb.0", NULL),
Sujit Reddy Thumma2330f3a372012-10-18 10:28:51 +053091 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
92 "msm_sdcc.1", NULL),
93 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
94 "msm_sdcc.2", NULL),
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053095 {}
96};
97
Rohit Vaswani149f5752012-09-20 16:20:48 -070098static void __init mpq8092_init(void)
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053099{
Rohit Vaswani149f5752012-09-20 16:20:48 -0700100 struct of_dev_auxdata *adata = mpq8092_auxdata_lookup;
101
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530102 mpq8092_init_gpiomux();
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530103 msm_clock_init(&mpq8092_clock_init_data);
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530104 of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
105}
106
107static const char *mpq8092_dt_match[] __initconst = {
108 "qcom,mpq8092-sim",
109 NULL
110};
111
Rohit Vaswani149f5752012-09-20 16:20:48 -0700112DT_MACHINE_START(MSM8092_DT, "Qualcomm MSM 8092 (Flattened Device Tree)")
113 .map_io = mpq8092_map_io,
114 .init_irq = msm_dt_init_irq_nompm,
115 .init_machine = mpq8092_init,
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530116 .handle_irq = gic_handle_irq,
Rohit Vaswani149f5752012-09-20 16:20:48 -0700117 .timer = &msm_dt_timer,
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530118 .dt_compat = mpq8092_dt_match,
Utsab Bose4bb94652012-09-28 15:07:35 +0530119 .reserve = mpq8092_dt_reserve,
120 .init_very_early = mpq8092_early_memory,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800121 .smp = &msm8974_smp_ops,
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530122MACHINE_END