| Duy Truong | e833aca | 2013-02-12 13:35:08 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012, The Linux Foundation. All rights reserved. |
| Ravi Kumar V | 1c0b8f6 | 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 | |
| 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> |
| 21 | #include <asm/arch_timer.h> |
| 22 | #include <asm/mach/arch.h> |
| 23 | #include <asm/mach/time.h> |
| 24 | #include <mach/socinfo.h> |
| 25 | #include <mach/board.h> |
| 26 | |
| 27 | #include <linux/io.h> |
| 28 | #include <linux/gpio.h> |
| 29 | #include <linux/irq.h> |
| 30 | #include <linux/irqdomain.h> |
| 31 | |
| 32 | #include "clock.h" |
| 33 | |
| 34 | static struct of_device_id irq_match[] __initdata = { |
| 35 | { .compatible = "qcom,msm-qgic2", .data = gic_of_init, }, |
| 36 | { .compatible = "qcom,msm-gpio", .data = msm_gpio_of_init, }, |
| 37 | {} |
| 38 | }; |
| 39 | |
| 40 | static struct clk_lookup msm_clocks_dummy[] = { |
| 41 | CLK_DUMMY("core_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF), |
| 42 | CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "msm_serial_hsl.0", OFF), |
| 43 | }; |
| 44 | |
| 45 | struct clock_init_data mpq8092_clock_init_data __initdata = { |
| 46 | .table = msm_clocks_dummy, |
| 47 | .size = ARRAY_SIZE(msm_clocks_dummy), |
| 48 | }; |
| 49 | |
| 50 | void __init mpq8092_init_irq(void) |
| 51 | { |
| 52 | of_irq_init(irq_match); |
| 53 | } |
| 54 | |
| 55 | static void __init mpq8092_dt_timer_init(void) |
| 56 | { |
| 57 | arch_timer_of_register(); |
| 58 | } |
| 59 | |
| 60 | static struct sys_timer mpq8092_dt_timer = { |
| 61 | .init = mpq8092_dt_timer_init |
| 62 | }; |
| 63 | |
| 64 | static void __init mpq8092_dt_init_irq(void) |
| 65 | { |
| 66 | mpq8092_init_irq(); |
| 67 | } |
| 68 | |
| 69 | static void __init mpq8092_dt_map_io(void) |
| 70 | { |
| 71 | msm_map_mpq8092_io(); |
| 72 | if (socinfo_init() < 0) |
| 73 | pr_err("%s: socinfo_init() failed\n", __func__); |
| 74 | |
| 75 | } |
| 76 | |
| 77 | static struct of_dev_auxdata mpq8092_auxdata_lookup[] __initdata = { |
| 78 | OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF991F000, \ |
| 79 | "msm_serial_hsl.0", NULL), |
| 80 | {} |
| 81 | }; |
| 82 | |
| 83 | static void __init mpq8092_init(struct of_dev_auxdata **adata) |
| 84 | { |
| 85 | mpq8092_init_gpiomux(); |
| 86 | *adata = mpq8092_auxdata_lookup; |
| 87 | msm_clock_init(&mpq8092_clock_init_data); |
| 88 | } |
| 89 | |
| 90 | static void __init mpq8092_dt_init(void) |
| 91 | { |
| 92 | struct of_dev_auxdata *adata = NULL; |
| 93 | |
| 94 | mpq8092_init(&adata); |
| 95 | of_platform_populate(NULL, of_default_bus_match_table, adata, NULL); |
| 96 | } |
| 97 | |
| 98 | static const char *mpq8092_dt_match[] __initconst = { |
| 99 | "qcom,mpq8092-sim", |
| 100 | NULL |
| 101 | }; |
| 102 | |
| 103 | DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)") |
| 104 | .map_io = mpq8092_dt_map_io, |
| 105 | .init_irq = mpq8092_dt_init_irq, |
| 106 | .init_machine = mpq8092_dt_init, |
| 107 | .handle_irq = gic_handle_irq, |
| 108 | .timer = &mpq8092_dt_timer, |
| 109 | .dt_compat = mpq8092_dt_match, |
| 110 | MACHINE_END |