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