Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [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> |
| 25 | #include <mach/msm_memtypes.h> |
| 26 | #include <mach/msm_smd.h> |
Patrick Daly | bdb97db | 2013-06-12 12:10:38 -0700 | [diff] [blame] | 27 | #include <mach/rpm-smd.h> |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 28 | #include <mach/restart.h> |
| 29 | #include <mach/socinfo.h> |
| 30 | #include <mach/clk-provider.h> |
Jeff Hugo | 55b4afe | 2013-07-12 14:27:51 -0600 | [diff] [blame] | 31 | #include <mach/msm_smem.h> |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 32 | #include "board-dt.h" |
| 33 | #include "clock.h" |
| 34 | #include "devices.h" |
Jeff Hugo | 55b4afe | 2013-07-12 14:27:51 -0600 | [diff] [blame] | 35 | #include "modem_notifier.h" |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 36 | |
mengmeng | 6cf6369 | 2013-07-06 08:16:51 +0800 | [diff] [blame] | 37 | static struct memtype_reserve msmkrypton_reserve_table[] __initdata = { |
| 38 | [MEMTYPE_EBI1] = { |
| 39 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | static int msmkrypton_paddr_to_memtype(unsigned int paddr) |
| 44 | { |
| 45 | return MEMTYPE_EBI1; |
| 46 | } |
| 47 | |
| 48 | static struct reserve_info msmkrypton_reserve_info __initdata = { |
| 49 | .memtype_reserve_table = msmkrypton_reserve_table, |
| 50 | .paddr_to_memtype = msmkrypton_paddr_to_memtype, |
| 51 | }; |
| 52 | |
Abhimanyu Kapur | 57fc2ed | 2013-06-03 18:17:52 -0700 | [diff] [blame] | 53 | static struct of_dev_auxdata msmkrypton_auxdata_lookup[] __initdata = { |
| 54 | {} |
| 55 | }; |
| 56 | |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 57 | /* |
| 58 | * Used to satisfy dependencies for devices that need to be |
| 59 | * run early or in a particular order. Most likely your device doesn't fall |
| 60 | * into this category, and thus the driver should not be added here. The |
| 61 | * EPROBE_DEFER can satisfy most dependency problems. |
| 62 | */ |
| 63 | void __init msmkrypton_add_drivers(void) |
| 64 | { |
Jeff Hugo | 55b4afe | 2013-07-12 14:27:51 -0600 | [diff] [blame] | 65 | msm_smem_init(); |
| 66 | msm_init_modem_notifier_list(); |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 67 | msm_smd_init(); |
Patrick Daly | bdb97db | 2013-06-12 12:10:38 -0700 | [diff] [blame] | 68 | msm_rpm_driver_init(); |
Patrick Daly | 565b65a | 2013-06-07 16:09:12 -0700 | [diff] [blame] | 69 | msm_clock_init(&msmkrypton_clock_init_data); |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 70 | } |
| 71 | |
mengmeng | 6cf6369 | 2013-07-06 08:16:51 +0800 | [diff] [blame] | 72 | static void __init msmkrypton_early_memory(void) |
| 73 | { |
| 74 | reserve_info = &msmkrypton_reserve_info; |
| 75 | of_scan_flat_dt(dt_scan_for_memory_hole, msmkrypton_reserve_table); |
| 76 | } |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 77 | static void __init msmkrypton_map_io(void) |
| 78 | { |
| 79 | msm_map_msmkrypton_io(); |
| 80 | } |
| 81 | |
| 82 | void __init msmkrypton_init(void) |
| 83 | { |
| 84 | if (socinfo_init() < 0) |
| 85 | pr_err("%s: socinfo_init() failed\n", __func__); |
| 86 | |
| 87 | msmkrypton_init_gpiomux(); |
Abhimanyu Kapur | 57fc2ed | 2013-06-03 18:17:52 -0700 | [diff] [blame] | 88 | board_dt_populate(msmkrypton_auxdata_lookup); |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 89 | msmkrypton_add_drivers(); |
| 90 | } |
| 91 | |
| 92 | static const char *msmkrypton_dt_match[] __initconst = { |
| 93 | "qcom,msmkrypton", |
| 94 | NULL |
| 95 | }; |
| 96 | |
| 97 | DT_MACHINE_START(MSMKRYPTON_DT, "Qualcomm MSM Krypton (Flattened Device Tree)") |
| 98 | .map_io = msmkrypton_map_io, |
| 99 | .init_irq = msm_dt_init_irq, |
| 100 | .init_machine = msmkrypton_init, |
| 101 | .handle_irq = gic_handle_irq, |
| 102 | .timer = &msm_dt_timer, |
| 103 | .dt_compat = msmkrypton_dt_match, |
mengmeng | 6cf6369 | 2013-07-06 08:16:51 +0800 | [diff] [blame] | 104 | .init_very_early = msmkrypton_early_memory, |
Abhimanyu Kapur | a6e2774 | 2013-03-18 16:39:31 -0700 | [diff] [blame] | 105 | .restart = msm_restart, |
| 106 | MACHINE_END |