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> |
| 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 Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 25 | #include <mach/msm_memtypes.h> |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 26 | #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 Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 35 | static struct memtype_reserve apq8084_reserve_table[] __initdata = { |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 36 | [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 Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 46 | static int apq8084_paddr_to_memtype(phys_addr_t paddr) |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 47 | { |
| 48 | return MEMTYPE_EBI1; |
| 49 | } |
| 50 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 51 | static struct reserve_info apq8084_reserve_info __initdata = { |
| 52 | .memtype_reserve_table = apq8084_reserve_table, |
| 53 | .paddr_to_memtype = apq8084_paddr_to_memtype, |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 54 | }; |
| 55 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 56 | void __init apq8084_reserve(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 57 | { |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 58 | reserve_info = &apq8084_reserve_info; |
| 59 | of_scan_flat_dt(dt_scan_for_memory_reserve, apq8084_reserve_table); |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 60 | msm_reserve(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 61 | } |
| 62 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 63 | static void __init apq8084_early_memory(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 64 | { |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 65 | reserve_info = &apq8084_reserve_info; |
| 66 | of_scan_flat_dt(dt_scan_for_memory_hole, apq8084_reserve_table); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | static 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 | |
| 74 | static 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 Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 85 | void __init apq8084_add_drivers(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 86 | { |
| 87 | msm_smd_init(); |
| 88 | msm_clock_init(&msm_dummy_clock_init_data); |
| 89 | } |
| 90 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 91 | static void __init apq8084_map_io(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 92 | { |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 93 | msm_map_8084_io(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 94 | } |
| 95 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 96 | void __init apq8084_init(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 97 | { |
| 98 | if (socinfo_init() < 0) |
| 99 | pr_err("%s: socinfo_init() failed\n", __func__); |
| 100 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 101 | apq8084_init_gpiomux(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 102 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 103 | apq8084_add_drivers(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 104 | } |
| 105 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 106 | void __init apq8084_init_very_early(void) |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 107 | { |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 108 | apq8084_early_memory(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 109 | } |
| 110 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 111 | static const char *apq8084_dt_match[] __initconst = { |
| 112 | "qcom,apq8084", |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 113 | NULL |
| 114 | }; |
| 115 | |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 116 | DT_MACHINE_START(APQ8084_DT, "Qualcomm APQ 8084 (Flattened Device Tree)") |
| 117 | .map_io = apq8084_map_io, |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 118 | .init_irq = msm_dt_init_irq, |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 119 | .init_machine = apq8084_init, |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 120 | .handle_irq = gic_handle_irq, |
| 121 | .timer = &msm_dt_timer, |
Stepan Moskovchenko | e90cd65 | 2013-04-18 12:54:47 -0700 | [diff] [blame] | 122 | .dt_compat = apq8084_dt_match, |
| 123 | .reserve = apq8084_reserve, |
| 124 | .init_very_early = apq8084_init_very_early, |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 125 | .restart = msm_restart, |
| 126 | .smp = &msm8974_smp_ops, |
| 127 | MACHINE_END |