blob: 496e1f47730d4ed2abad227b65400ae47afd46ad [file] [log] [blame]
Sathish Ambleyc58afc22011-10-09 21:55:39 -07001/* Copyright (c) 2011, 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/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/irqdomain.h>
18#include <linux/of.h>
19#include <linux/of_address.h>
20#include <linux/of_platform.h>
21#include <asm/mach/map.h>
22#include <asm/hardware/gic.h>
23#include <mach/board.h>
24#include <mach/gpio.h>
25#include <mach/gpiomux.h>
26#include <mach/msm_iomap.h>
27#include "clock.h"
28
29static int __init gpiomux_init(void)
30{
31 int rc;
32
33 rc = msm_gpiomux_init(NR_GPIO_IRQS);
34 if (rc) {
35 pr_err("%s: msm_gpiomux_init failed %d\n", __func__, rc);
36 return rc;
37 }
38
39 return 0;
40}
41
42void __init msm_copper_add_devices(void)
43{
44}
45
46static struct of_device_id msm_copper_gic_match[] __initdata = {
47 { .compatible = "qcom,msm-qgic2", },
48 {}
49};
50
51void __init msm_copper_init_irq(void)
52{
53 unsigned int i;
54
55 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
56 (void *)MSM_QGIC_CPU_BASE);
57
58 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
59 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
60
61 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
62 mb();
63
64 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
65 * as they are configured as level, which does not play nice with
66 * handle_percpu_irq.
67 */
68 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
69 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
70 irq_set_handler(i, handle_percpu_irq);
71 }
72 irq_domain_generate_simple(msm_copper_gic_match,
73 COPPER_QGIC_DIST_PHYS, GIC_SPI_START);
74}
75
76static struct clk_lookup msm_clocks_dummy[] = {
77};
78
79struct clock_init_data msm_dummy_clock_init_data __initdata = {
80 .table = msm_clocks_dummy,
81 .size = ARRAY_SIZE(msm_clocks_dummy),
82};
83
84static struct of_dev_auxdata msm_copper_auxdata_lookup[] __initdata = {
85 {}
86};
87
88void __init msm_copper_init(struct of_dev_auxdata **adata)
89{
90 if (gpiomux_init())
91 pr_err("%s: gpiomux_init() failed\n", __func__);
92 msm_clock_init(&msm_dummy_clock_init_data);
93
94 *adata = msm_copper_auxdata_lookup;
95}