Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 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 | |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 13 | #include <linux/err.h> |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/errno.h> |
| 16 | #include <linux/of.h> |
| 17 | #include <linux/of_address.h> |
| 18 | #include <linux/of_platform.h> |
| 19 | #include <linux/of_fdt.h> |
| 20 | #include <linux/of_irq.h> |
| 21 | #include <asm/hardware/gic.h> |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 22 | #include <asm/mach/arch.h> |
| 23 | #include <asm/mach/time.h> |
| 24 | #include <mach/socinfo.h> |
| 25 | #include <mach/board.h> |
Utsab Bose | 4bb9465 | 2012-09-28 15:07:35 +0530 | [diff] [blame] | 26 | #include <mach/msm_memtypes.h> |
Ravi Kumar V | cb4dd00 | 2012-09-28 15:08:41 +0530 | [diff] [blame] | 27 | #include <mach/qpnp-int.h> |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 28 | #include <linux/io.h> |
| 29 | #include <linux/gpio.h> |
| 30 | #include <linux/irq.h> |
| 31 | #include <linux/irqdomain.h> |
| 32 | |
Rohit Vaswani | 149f575 | 2012-09-20 16:20:48 -0700 | [diff] [blame] | 33 | #include "board-dt.h" |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 34 | #include "clock.h" |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 35 | #include "platsmp.h" |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 36 | |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 37 | static struct clk_lookup msm_clocks_dummy[] = { |
| 38 | CLK_DUMMY("core_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF), |
| 39 | CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF), |
| 40 | }; |
| 41 | |
| 42 | struct clock_init_data mpq8092_clock_init_data __initdata = { |
| 43 | .table = msm_clocks_dummy, |
| 44 | .size = ARRAY_SIZE(msm_clocks_dummy), |
| 45 | }; |
| 46 | |
Utsab Bose | 4bb9465 | 2012-09-28 15:07:35 +0530 | [diff] [blame] | 47 | static struct memtype_reserve mpq8092_reserve_table[] __initdata = { |
| 48 | [MEMTYPE_SMI] = { |
| 49 | }, |
| 50 | [MEMTYPE_EBI0] = { |
| 51 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 52 | }, |
| 53 | [MEMTYPE_EBI1] = { |
| 54 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 55 | }, |
| 56 | }; |
| 57 | |
| 58 | static int mpq8092_paddr_to_memtype(unsigned int paddr) |
| 59 | { |
| 60 | return MEMTYPE_EBI1; |
| 61 | } |
| 62 | |
| 63 | static struct reserve_info mpq8092_reserve_info __initdata = { |
| 64 | .memtype_reserve_table = mpq8092_reserve_table, |
| 65 | .paddr_to_memtype = mpq8092_paddr_to_memtype, |
| 66 | }; |
| 67 | |
| 68 | static void __init mpq8092_early_memory(void) |
| 69 | { |
| 70 | reserve_info = &mpq8092_reserve_info; |
| 71 | of_scan_flat_dt(dt_scan_for_memory_reserve, mpq8092_reserve_table); |
| 72 | } |
| 73 | |
| 74 | static void __init mpq8092_dt_reserve(void) |
| 75 | { |
| 76 | msm_reserve(); |
| 77 | } |
| 78 | |
Rohit Vaswani | 149f575 | 2012-09-20 16:20:48 -0700 | [diff] [blame] | 79 | static void __init mpq8092_map_io(void) |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 80 | { |
| 81 | msm_map_mpq8092_io(); |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | static struct of_dev_auxdata mpq8092_auxdata_lookup[] __initdata = { |
| 85 | OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \ |
| 86 | "msm_serial_hsl.0", NULL), |
Ravi Kumar V | ce0f2ba | 2012-09-20 19:08:24 +0530 | [diff] [blame] | 87 | OF_DEV_AUXDATA("qcom,spmi-pmic-arb", 0xFC4C0000, \ |
| 88 | "spmi-pmic-arb.0", NULL), |
Sujit Reddy Thumma | 2330f3a37 | 2012-10-18 10:28:51 +0530 | [diff] [blame] | 89 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \ |
| 90 | "msm_sdcc.1", NULL), |
| 91 | OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \ |
| 92 | "msm_sdcc.2", NULL), |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 93 | {} |
| 94 | }; |
| 95 | |
Rohit Vaswani | 149f575 | 2012-09-20 16:20:48 -0700 | [diff] [blame] | 96 | static void __init mpq8092_init(void) |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 97 | { |
Rohit Vaswani | 149f575 | 2012-09-20 16:20:48 -0700 | [diff] [blame] | 98 | struct of_dev_auxdata *adata = mpq8092_auxdata_lookup; |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 99 | |
Abhimanyu Kapur | 91a0a50 | 2013-01-11 19:24:59 -0800 | [diff] [blame] | 100 | if (socinfo_init() < 0) |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 101 | pr_err("%s: socinfo_init() failed\n", __func__); |
Rohit Vaswani | 149f575 | 2012-09-20 16:20:48 -0700 | [diff] [blame] | 102 | |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 103 | mpq8092_init_gpiomux(); |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 104 | msm_clock_init(&mpq8092_clock_init_data); |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 105 | of_platform_populate(NULL, of_default_bus_match_table, adata, NULL); |
| 106 | } |
| 107 | |
| 108 | static const char *mpq8092_dt_match[] __initconst = { |
| 109 | "qcom,mpq8092-sim", |
| 110 | NULL |
| 111 | }; |
| 112 | |
Rohit Vaswani | 149f575 | 2012-09-20 16:20:48 -0700 | [diff] [blame] | 113 | DT_MACHINE_START(MSM8092_DT, "Qualcomm MSM 8092 (Flattened Device Tree)") |
| 114 | .map_io = mpq8092_map_io, |
| 115 | .init_irq = msm_dt_init_irq_nompm, |
| 116 | .init_machine = mpq8092_init, |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 117 | .handle_irq = gic_handle_irq, |
Rohit Vaswani | 149f575 | 2012-09-20 16:20:48 -0700 | [diff] [blame] | 118 | .timer = &msm_dt_timer, |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 119 | .dt_compat = mpq8092_dt_match, |
Utsab Bose | 4bb9465 | 2012-09-28 15:07:35 +0530 | [diff] [blame] | 120 | .reserve = mpq8092_dt_reserve, |
| 121 | .init_very_early = mpq8092_early_memory, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 122 | .smp = &msm8974_smp_ops, |
Ravi Kumar V | af9cdcf | 2012-09-01 00:12:21 +0530 | [diff] [blame] | 123 | MACHINE_END |