blob: 828ae9c255a601b03bbe7adfc092613764ee7ca9 [file] [log] [blame]
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -08001/* Copyright (c) 2013, The Linux Foundation. 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/err.h>
14#include <linux/kernel.h>
15#include <linux/of.h>
16#include <linux/of_address.h>
17#include <linux/of_platform.h>
18#include <linux/memory.h>
19#include <asm/hardware/gic.h>
20#include <asm/mach/map.h>
21#include <asm/mach/arch.h>
22#include <mach/board.h>
23#include <mach/gpiomux.h>
24#include <mach/msm_iomap.h>
Laura Abbotte17c5332013-03-05 14:21:43 -080025#include <mach/msm_memtypes.h>
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080026#include <mach/msm_smd.h>
27#include <mach/restart.h>
28#include <mach/socinfo.h>
29#include <mach/clk-provider.h>
30#include "board-dt.h"
31#include "clock.h"
32#include "devices.h"
33#include "platsmp.h"
34
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070035static struct memtype_reserve apq8084_reserve_table[] __initdata = {
Laura Abbotte17c5332013-03-05 14:21:43 -080036 [MEMTYPE_SMI] = {
37 },
38 [MEMTYPE_EBI0] = {
39 .flags = MEMTYPE_FLAGS_1M_ALIGN,
40 },
41 [MEMTYPE_EBI1] = {
42 .flags = MEMTYPE_FLAGS_1M_ALIGN,
43 },
44};
45
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070046static int apq8084_paddr_to_memtype(phys_addr_t paddr)
Laura Abbotte17c5332013-03-05 14:21:43 -080047{
48 return MEMTYPE_EBI1;
49}
50
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070051static struct reserve_info apq8084_reserve_info __initdata = {
52 .memtype_reserve_table = apq8084_reserve_table,
53 .paddr_to_memtype = apq8084_paddr_to_memtype,
Laura Abbotte17c5332013-03-05 14:21:43 -080054};
55
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070056void __init apq8084_reserve(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080057{
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070058 reserve_info = &apq8084_reserve_info;
59 of_scan_flat_dt(dt_scan_for_memory_reserve, apq8084_reserve_table);
Laura Abbotte17c5332013-03-05 14:21:43 -080060 msm_reserve();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080061}
62
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070063static void __init apq8084_early_memory(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080064{
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070065 reserve_info = &apq8084_reserve_info;
66 of_scan_flat_dt(dt_scan_for_memory_hole, apq8084_reserve_table);
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080067}
68
69static struct clk_lookup msm_clocks_dummy[] = {
70 CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
71 CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
72};
73
74static struct clock_init_data msm_dummy_clock_init_data __initdata = {
75 .table = msm_clocks_dummy,
76 .size = ARRAY_SIZE(msm_clocks_dummy),
77};
78
79/*
80 * Used to satisfy dependencies for devices that need to be
81 * run early or in a particular order. Most likely your device doesn't fall
82 * into this category, and thus the driver should not be added here. The
83 * EPROBE_DEFER can satisfy most dependency problems.
84 */
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070085void __init apq8084_add_drivers(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080086{
87 msm_smd_init();
88 msm_clock_init(&msm_dummy_clock_init_data);
89}
90
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070091static void __init apq8084_map_io(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080092{
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070093 msm_map_8084_io();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080094}
95
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070096void __init apq8084_init(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080097{
98 if (socinfo_init() < 0)
99 pr_err("%s: socinfo_init() failed\n", __func__);
100
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700101 apq8084_init_gpiomux();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800102 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700103 apq8084_add_drivers();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800104}
105
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700106void __init apq8084_init_very_early(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800107{
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700108 apq8084_early_memory();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800109}
110
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700111static const char *apq8084_dt_match[] __initconst = {
112 "qcom,apq8084",
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800113 NULL
114};
115
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700116DT_MACHINE_START(APQ8084_DT, "Qualcomm APQ 8084 (Flattened Device Tree)")
117 .map_io = apq8084_map_io,
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800118 .init_irq = msm_dt_init_irq,
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700119 .init_machine = apq8084_init,
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800120 .handle_irq = gic_handle_irq,
121 .timer = &msm_dt_timer,
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700122 .dt_compat = apq8084_dt_match,
123 .reserve = apq8084_reserve,
124 .init_very_early = apq8084_init_very_early,
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800125 .restart = msm_restart,
126 .smp = &msm8974_smp_ops,
127MACHINE_END