aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra/irq.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-05-01 17:10:10 -0400
committerWill Deacon <will.deacon@arm.com>2011-05-11 11:04:16 -0400
commit938fa349fbc16880feae4b65e56691ca12ede9ab (patch)
tree9e00699293398a1fce04330019d88e7f2697db64 /arch/arm/mach-tegra/irq.c
parent98022940c2431025be3c95e50035d762c40f539d (diff)
ARM: tegra: irq: convert to gic arch extensions
Replace the ugly hack that inserts legacy irq controller calls into the irq call paths by reading and replacing the gic irq chip with the new gic arch extensions. Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-tegra/irq.c')
-rw-r--r--arch/arm/mach-tegra/irq.c54
1 files changed, 16 insertions, 38 deletions
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index 4330d8995b27..567b75c4c67b 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * Copyright (C) 2010 Google, Inc. 2 * Copyright (C) 2011 Google, Inc.
3 * 3 *
4 * Author: 4 * Author:
5 * Colin Cross <ccross@google.com> 5 * Colin Cross <ccross@android.com>
6 * 6 *
7 * Copyright (C) 2010, NVIDIA Corporation 7 * Copyright (C) 2010, NVIDIA Corporation
8 * 8 *
@@ -46,10 +46,6 @@ static u32 tegra_lp0_wake_enb;
46static u32 tegra_lp0_wake_level; 46static u32 tegra_lp0_wake_level;
47static u32 tegra_lp0_wake_level_any; 47static u32 tegra_lp0_wake_level_any;
48 48
49static void (*tegra_gic_mask_irq)(struct irq_data *d);
50static void (*tegra_gic_unmask_irq)(struct irq_data *d);
51static void (*tegra_gic_ack_irq)(struct irq_data *d);
52
53/* ensures that sufficient time is passed for a register write to 49/* ensures that sufficient time is passed for a register write to
54 * serialize into the 32KHz domain */ 50 * serialize into the 32KHz domain */
55static void pmc_32kwritel(u32 val, unsigned long offs) 51static void pmc_32kwritel(u32 val, unsigned long offs)
@@ -103,58 +99,40 @@ void tegra_set_lp0_wake_pads(u32 wake_enb, u32 wake_level, u32 wake_any)
103 99
104static void tegra_mask(struct irq_data *d) 100static void tegra_mask(struct irq_data *d)
105{ 101{
106 tegra_gic_mask_irq(d); 102 if (d->irq >= 32)
107 tegra_legacy_mask_irq(d->irq); 103 tegra_legacy_mask_irq(d->irq);
108} 104}
109 105
110static void tegra_unmask(struct irq_data *d) 106static void tegra_unmask(struct irq_data *d)
111{ 107{
112 tegra_gic_unmask_irq(d); 108 if (d->irq >= 32)
113 tegra_legacy_unmask_irq(d->irq); 109 tegra_legacy_unmask_irq(d->irq);
114} 110}
115 111
116static void tegra_ack(struct irq_data *d) 112static void tegra_ack(struct irq_data *d)
117{ 113{
118 tegra_legacy_force_irq_clr(d->irq); 114 if (d->irq >= 32)
119 tegra_gic_ack_irq(d); 115 tegra_legacy_force_irq_clr(d->irq);
120} 116}
121 117
122static int tegra_retrigger(struct irq_data *d) 118static int tegra_retrigger(struct irq_data *d)
123{ 119{
120 if (d->irq < 32)
121 return 0;
122
124 tegra_legacy_force_irq_set(d->irq); 123 tegra_legacy_force_irq_set(d->irq);
125 return 1; 124 return 1;
126} 125}
127 126
128static struct irq_chip tegra_irq = {
129 .name = "PPI",
130 .irq_ack = tegra_ack,
131 .irq_mask = tegra_mask,
132 .irq_unmask = tegra_unmask,
133 .irq_retrigger = tegra_retrigger,
134};
135
136void __init tegra_init_irq(void) 127void __init tegra_init_irq(void)
137{ 128{
138 struct irq_chip *gic;
139 unsigned int i;
140 int irq;
141
142 tegra_init_legacy_irq(); 129 tegra_init_legacy_irq();
143 130
131 gic_arch_extn.irq_ack = tegra_ack;
132 gic_arch_extn.irq_mask = tegra_mask;
133 gic_arch_extn.irq_unmask = tegra_unmask;
134 gic_arch_extn.irq_retrigger = tegra_retrigger;
135
144 gic_init(0, 29, IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE), 136 gic_init(0, 29, IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE),
145 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100)); 137 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100));
146
147 gic = irq_get_chip(29);
148 tegra_gic_unmask_irq = gic->irq_unmask;
149 tegra_gic_mask_irq = gic->irq_mask;
150 tegra_gic_ack_irq = gic->irq_ack;
151#ifdef CONFIG_SMP
152 tegra_irq.irq_set_affinity = gic->irq_set_affinity;
153#endif
154
155 for (i = 0; i < INT_MAIN_NR; i++) {
156 irq = INT_PRI_BASE + i;
157 irq_set_chip_and_handler(irq, &tegra_irq, handle_level_irq);
158 set_irq_flags(irq, IRQF_VALID);
159 }
160} 138}