Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 1 | /* 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 Mohanadoss | 09a1c88 | 2013-06-12 17:01:44 -0700 | [diff] [blame] | 19 | #include <linux/msm_tsens.h> |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 20 | #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 Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 26 | #include <mach/msm_memtypes.h> |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 27 | #include <mach/msm_smd.h> |
| 28 | #include <mach/restart.h> |
| 29 | #include <mach/socinfo.h> |
| 30 | #include <mach/clk-provider.h> |
Jeff Hugo | 7cc06b1 | 2013-06-17 16:13:18 -0600 | [diff] [blame] | 31 | #include <mach/msm_smem.h> |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 32 | #include "board-dt.h" |
| 33 | #include "clock.h" |
| 34 | #include "devices.h" |
| 35 | #include "platsmp.h" |
Jeff Hugo | 69fe037 | 2013-05-17 12:29:47 -0600 | [diff] [blame] | 36 | #include "modem_notifier.h" |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 37 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 38 | static struct memtype_reserve apq8084_reserve_table[] __initdata = { |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 39 | [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 Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 49 | static int apq8084_paddr_to_memtype(phys_addr_t paddr) |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 50 | { |
| 51 | return MEMTYPE_EBI1; |
| 52 | } |
| 53 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 54 | static struct reserve_info apq8084_reserve_info __initdata = { |
| 55 | .memtype_reserve_table = apq8084_reserve_table, |
| 56 | .paddr_to_memtype = apq8084_paddr_to_memtype, |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 57 | }; |
| 58 | |
David Ng | 7b838c2 | 2013-04-11 17:38:37 -0700 | [diff] [blame] | 59 | static 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 Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 67 | void __init apq8084_reserve(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 68 | { |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 69 | reserve_info = &apq8084_reserve_info; |
| 70 | of_scan_flat_dt(dt_scan_for_memory_reserve, apq8084_reserve_table); |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 71 | msm_reserve(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 72 | } |
| 73 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 74 | static void __init apq8084_early_memory(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 75 | { |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 76 | reserve_info = &apq8084_reserve_info; |
| 77 | of_scan_flat_dt(dt_scan_for_memory_hole, apq8084_reserve_table); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 78 | } |
| 79 | |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 80 | /* |
| 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 Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 86 | void __init apq8084_add_drivers(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 87 | { |
Jeff Hugo | 7cc06b1 | 2013-06-17 16:13:18 -0600 | [diff] [blame] | 88 | msm_smem_init(); |
Jeff Hugo | 69fe037 | 2013-05-17 12:29:47 -0600 | [diff] [blame] | 89 | msm_init_modem_notifier_list(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 90 | msm_smd_init(); |
Tianyi Gou | 30e19b8 | 2013-05-06 20:53:24 -0700 | [diff] [blame] | 91 | msm_clock_init(&msm8084_clock_init_data); |
Siddartha Mohanadoss | 09a1c88 | 2013-06-12 17:01:44 -0700 | [diff] [blame] | 92 | tsens_tm_init_driver(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 93 | } |
| 94 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 95 | static void __init apq8084_map_io(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 96 | { |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 97 | msm_map_8084_io(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 98 | } |
| 99 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 100 | void __init apq8084_init(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 101 | { |
David Ng | 7b838c2 | 2013-04-11 17:38:37 -0700 | [diff] [blame] | 102 | struct of_dev_auxdata *adata = apq8084_auxdata_lookup; |
| 103 | |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 104 | if (socinfo_init() < 0) |
| 105 | pr_err("%s: socinfo_init() failed\n", __func__); |
| 106 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 107 | apq8084_init_gpiomux(); |
Stepan Moskovchenko | 7d8cdcaa | 2013-04-25 17:10:55 -0700 | [diff] [blame] | 108 | board_dt_populate(adata); |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 109 | apq8084_add_drivers(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 110 | } |
| 111 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 112 | void __init apq8084_init_very_early(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 113 | { |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 114 | apq8084_early_memory(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 115 | } |
| 116 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 117 | static const char *apq8084_dt_match[] __initconst = { |
| 118 | "qcom,apq8084", |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 119 | NULL |
| 120 | }; |
| 121 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 122 | DT_MACHINE_START(APQ8084_DT, "Qualcomm APQ 8084 (Flattened Device Tree)") |
| 123 | .map_io = apq8084_map_io, |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 124 | .init_irq = msm_dt_init_irq, |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 125 | .init_machine = apq8084_init, |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 126 | .handle_irq = gic_handle_irq, |
| 127 | .timer = &msm_dt_timer, |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 128 | .dt_compat = apq8084_dt_match, |
| 129 | .reserve = apq8084_reserve, |
| 130 | .init_very_early = apq8084_init_very_early, |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 131 | .restart = msm_restart, |
| 132 | .smp = &msm8974_smp_ops, |
| 133 | MACHINE_END |