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 | |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 35 | static struct memtype_reserve msmzinc_reserve_table[] __initdata = { |
| 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 | |
| 46 | static int msmzinc_paddr_to_memtype(unsigned int paddr) |
| 47 | { |
| 48 | return MEMTYPE_EBI1; |
| 49 | } |
| 50 | |
| 51 | static struct reserve_info msmzinc_reserve_info __initdata = { |
| 52 | .memtype_reserve_table = msmzinc_reserve_table, |
| 53 | .paddr_to_memtype = msmzinc_paddr_to_memtype, |
| 54 | }; |
| 55 | |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 56 | void __init msmzinc_reserve(void) |
| 57 | { |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 58 | reserve_info = &msmzinc_reserve_info; |
| 59 | of_scan_flat_dt(dt_scan_for_memory_reserve, msmzinc_reserve_table); |
| 60 | msm_reserve(); |
Stepan Moskovchenko | fb941ac | 2013-01-24 15:59:24 -0800 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | static void __init msmzinc_early_memory(void) |
| 64 | { |
Laura Abbott | e17c533 | 2013-03-05 14:21:43 -0800 | [diff] [blame] | 65 | reserve_info = &msmzinc_reserve_info; |
| 66 | of_scan_flat_dt(dt_scan_for_memory_hole, msmzinc_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 | */ |
| 85 | void __init msmzinc_add_drivers(void) |
| 86 | { |
| 87 | msm_smd_init(); |
| 88 | msm_clock_init(&msm_dummy_clock_init_data); |
| 89 | } |
| 90 | |
| 91 | static void __init msmzinc_map_io(void) |
| 92 | { |
| 93 | msm_map_zinc_io(); |
| 94 | } |
| 95 | |
| 96 | void __init msmzinc_init(void) |
| 97 | { |
| 98 | if (socinfo_init() < 0) |
| 99 | pr_err("%s: socinfo_init() failed\n", __func__); |
| 100 | |
| 101 | msmzinc_init_gpiomux(); |
| 102 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 103 | msmzinc_add_drivers(); |
| 104 | } |
| 105 | |
| 106 | void __init msmzinc_init_very_early(void) |
| 107 | { |
| 108 | msmzinc_early_memory(); |
| 109 | } |
| 110 | |
| 111 | static const char *msmzinc_dt_match[] __initconst = { |
| 112 | "qcom,msmzinc", |
| 113 | NULL |
| 114 | }; |
| 115 | |
| 116 | DT_MACHINE_START(MSMZINC_DT, "Qualcomm MSM ZINC (Flattened Device Tree)") |
| 117 | .map_io = msmzinc_map_io, |
| 118 | .init_irq = msm_dt_init_irq, |
| 119 | .init_machine = msmzinc_init, |
| 120 | .handle_irq = gic_handle_irq, |
| 121 | .timer = &msm_dt_timer, |
| 122 | .dt_compat = msmzinc_dt_match, |
| 123 | .reserve = msmzinc_reserve, |
| 124 | .init_very_early = msmzinc_init_very_early, |
| 125 | .restart = msm_restart, |
| 126 | .smp = &msm8974_smp_ops, |
| 127 | MACHINE_END |