blob: b4c63f9e0d0b634686a6fb6091f8220821b5e62c [file] [log] [blame]
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +05302 *
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
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -080013#include <linux/err.h>
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053014#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/of.h>
17#include <linux/of_address.h>
18#include <linux/of_platform.h>
19#include <linux/of_fdt.h>
20#include <linux/of_irq.h>
21#include <asm/hardware/gic.h>
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053022#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
Rohit Vaswani149f5752012-09-20 16:20:48 -070033#include "board-dt.h"
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053034#include "clock.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -080035#include "platsmp.h"
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053036
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053037static struct clk_lookup msm_clocks_dummy[] = {
38 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF),
39 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF),
40};
41
42struct clock_init_data mpq8092_clock_init_data __initdata = {
43 .table = msm_clocks_dummy,
44 .size = ARRAY_SIZE(msm_clocks_dummy),
45};
46
Utsab Bose4bb94652012-09-28 15:07:35 +053047static struct memtype_reserve mpq8092_reserve_table[] __initdata = {
48 [MEMTYPE_SMI] = {
49 },
50 [MEMTYPE_EBI0] = {
51 .flags = MEMTYPE_FLAGS_1M_ALIGN,
52 },
53 [MEMTYPE_EBI1] = {
54 .flags = MEMTYPE_FLAGS_1M_ALIGN,
55 },
56};
57
58static int mpq8092_paddr_to_memtype(unsigned int paddr)
59{
60 return MEMTYPE_EBI1;
61}
62
63static struct reserve_info mpq8092_reserve_info __initdata = {
64 .memtype_reserve_table = mpq8092_reserve_table,
65 .paddr_to_memtype = mpq8092_paddr_to_memtype,
66};
67
68static void __init mpq8092_early_memory(void)
69{
70 reserve_info = &mpq8092_reserve_info;
71 of_scan_flat_dt(dt_scan_for_memory_reserve, mpq8092_reserve_table);
72}
73
74static void __init mpq8092_dt_reserve(void)
75{
76 msm_reserve();
77}
78
Rohit Vaswani149f5752012-09-20 16:20:48 -070079static void __init mpq8092_map_io(void)
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053080{
81 msm_map_mpq8092_io();
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053082}
83
84static struct of_dev_auxdata mpq8092_auxdata_lookup[] __initdata = {
85 OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \
86 "msm_serial_hsl.0", NULL),
Ravi Kumar Vce0f2ba2012-09-20 19:08:24 +053087 OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \
88 "spmi-pmic-arb.0", NULL),
Sujit Reddy Thumma2330f3a372012-10-18 10:28:51 +053089 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
90 "msm_sdcc.1", NULL),
91 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
92 "msm_sdcc.2", NULL),
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053093 {}
94};
95
Rohit Vaswani149f5752012-09-20 16:20:48 -070096static void __init mpq8092_init(void)
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +053097{
Rohit Vaswani149f5752012-09-20 16:20:48 -070098 struct of_dev_auxdata *adata = mpq8092_auxdata_lookup;
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -080099
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -0800100 if (socinfo_init() < 0)
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -0800101 pr_err("%s: socinfo_init() failed\n", __func__);
Rohit Vaswani149f5752012-09-20 16:20:48 -0700102
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530103 mpq8092_init_gpiomux();
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530104 msm_clock_init(&mpq8092_clock_init_data);
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530105 of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
106}
107
108static const char *mpq8092_dt_match[] __initconst = {
109 "qcom,mpq8092-sim",
110 NULL
111};
112
Rohit Vaswani149f5752012-09-20 16:20:48 -0700113DT_MACHINE_START(MSM8092_DT, "Qualcomm MSM 8092 (Flattened Device Tree)")
114 .map_io = mpq8092_map_io,
115 .init_irq = msm_dt_init_irq_nompm,
116 .init_machine = mpq8092_init,
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530117 .handle_irq = gic_handle_irq,
Rohit Vaswani149f5752012-09-20 16:20:48 -0700118 .timer = &msm_dt_timer,
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530119 .dt_compat = mpq8092_dt_match,
Utsab Bose4bb94652012-09-28 15:07:35 +0530120 .reserve = mpq8092_dt_reserve,
121 .init_very_early = mpq8092_early_memory,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -0800122 .smp = &msm8974_smp_ops,
Ravi Kumar Vaf9cdcf2012-09-01 00:12:21 +0530123MACHINE_END