blob: 2a6bbb711b370f4b3db1ab42d397e3de21608c47 [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>
Siddartha Mohanadoss09a1c882013-06-12 17:01:44 -070019#include <linux/msm_tsens.h>
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080020#include <asm/hardware/gic.h>
21#include <asm/mach/map.h>
22#include <asm/mach/arch.h>
23#include <mach/board.h>
24#include <mach/gpiomux.h>
25#include <mach/msm_iomap.h>
Laura Abbotte17c5332013-03-05 14:21:43 -080026#include <mach/msm_memtypes.h>
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080027#include <mach/msm_smd.h>
28#include <mach/restart.h>
29#include <mach/socinfo.h>
30#include <mach/clk-provider.h>
Jeff Hugo7cc06b12013-06-17 16:13:18 -060031#include <mach/msm_smem.h>
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080032#include "board-dt.h"
33#include "clock.h"
34#include "devices.h"
35#include "platsmp.h"
Jeff Hugo69fe0372013-05-17 12:29:47 -060036#include "modem_notifier.h"
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080037
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070038static struct memtype_reserve apq8084_reserve_table[] __initdata = {
Laura Abbotte17c5332013-03-05 14:21:43 -080039 [MEMTYPE_SMI] = {
40 },
41 [MEMTYPE_EBI0] = {
42 .flags = MEMTYPE_FLAGS_1M_ALIGN,
43 },
44 [MEMTYPE_EBI1] = {
45 .flags = MEMTYPE_FLAGS_1M_ALIGN,
46 },
47};
48
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070049static int apq8084_paddr_to_memtype(phys_addr_t paddr)
Laura Abbotte17c5332013-03-05 14:21:43 -080050{
51 return MEMTYPE_EBI1;
52}
53
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070054static struct reserve_info apq8084_reserve_info __initdata = {
55 .memtype_reserve_table = apq8084_reserve_table,
56 .paddr_to_memtype = apq8084_paddr_to_memtype,
Laura Abbotte17c5332013-03-05 14:21:43 -080057};
58
David Ng7b838c22013-04-11 17:38:37 -070059static struct of_dev_auxdata apq8084_auxdata_lookup[] __initdata = {
60 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
61 "msm_sdcc.1", NULL),
62 OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
63 "msm_sdcc.2", NULL),
64 {}
65};
66
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070067void __init apq8084_reserve(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080068{
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070069 reserve_info = &apq8084_reserve_info;
70 of_scan_flat_dt(dt_scan_for_memory_reserve, apq8084_reserve_table);
Laura Abbotte17c5332013-03-05 14:21:43 -080071 msm_reserve();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080072}
73
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070074static void __init apq8084_early_memory(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080075{
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070076 reserve_info = &apq8084_reserve_info;
77 of_scan_flat_dt(dt_scan_for_memory_hole, apq8084_reserve_table);
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080078}
79
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080080/*
81 * Used to satisfy dependencies for devices that need to be
82 * run early or in a particular order. Most likely your device doesn't fall
83 * into this category, and thus the driver should not be added here. The
84 * EPROBE_DEFER can satisfy most dependency problems.
85 */
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070086void __init apq8084_add_drivers(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080087{
Jeff Hugo7cc06b12013-06-17 16:13:18 -060088 msm_smem_init();
Jeff Hugo69fe0372013-05-17 12:29:47 -060089 msm_init_modem_notifier_list();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080090 msm_smd_init();
Tianyi Gou30e19b82013-05-06 20:53:24 -070091 msm_clock_init(&msm8084_clock_init_data);
Siddartha Mohanadoss09a1c882013-06-12 17:01:44 -070092 tsens_tm_init_driver();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080093}
94
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070095static void __init apq8084_map_io(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080096{
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -070097 msm_map_8084_io();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -080098}
99
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700100void __init apq8084_init(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800101{
David Ng7b838c22013-04-11 17:38:37 -0700102 struct of_dev_auxdata *adata = apq8084_auxdata_lookup;
103
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800104 if (socinfo_init() < 0)
105 pr_err("%s: socinfo_init() failed\n", __func__);
106
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700107 apq8084_init_gpiomux();
Stepan Moskovchenko7d8cdcaa2013-04-25 17:10:55 -0700108 board_dt_populate(adata);
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700109 apq8084_add_drivers();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800110}
111
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700112void __init apq8084_init_very_early(void)
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800113{
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700114 apq8084_early_memory();
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800115}
116
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700117static const char *apq8084_dt_match[] __initconst = {
118 "qcom,apq8084",
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800119 NULL
120};
121
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700122DT_MACHINE_START(APQ8084_DT, "Qualcomm APQ 8084 (Flattened Device Tree)")
123 .map_io = apq8084_map_io,
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800124 .init_irq = msm_dt_init_irq,
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700125 .init_machine = apq8084_init,
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800126 .handle_irq = gic_handle_irq,
127 .timer = &msm_dt_timer,
Stepan Moskovchenkoe90cd652013-04-18 12:54:47 -0700128 .dt_compat = apq8084_dt_match,
129 .reserve = apq8084_reserve,
130 .init_very_early = apq8084_init_very_early,
Stepan Moskovchenkofb941ac2013-01-24 15:59:24 -0800131 .restart = msm_restart,
132 .smp = &msm8974_smp_ops,
133MACHINE_END