aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mmp
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 19:35:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 19:35:29 -0400
commit640414171818c6293c23e74a28d1c69b2a1a7fe5 (patch)
treecb3b10578f0ae39eac2930ce3b2c8a1616f5ba70 /arch/arm/mach-mmp
parentfa91515cbf2375a64c8bd0a033a05b0859dff591 (diff)
parenta2bdc32a527e817fdfa6c56eaa6c70f217da6c6c (diff)
Merge tag 'late-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC late changes from Kevin Hilman: "These are changes that arrived a little late before the merge window, or had dependencies on previous branches. Highlights: - ux500: misc. cleanup, fixup I2C devices - exynos: DT updates for RTC; PM updates - at91: DT updates for NAND; new platforms added to generic defconfig - sunxi: DT updates: cubieboard2, pinctrl driver, gated clocks - highbank: LPAE fixes, select necessary ARM errata - omap: PM fixes and improvements; OMAP5 mailbox support - omap: basic support for new DRA7xx SoCs" * tag 'late-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (60 commits) ARM: dts: vexpress: Add CCI node to TC2 device-tree ARM: EXYNOS: Skip C1 cpuidle state for exynos5440 ARM: EXYNOS: always enable PM domains support for EXYNOS4X12 ARM: highbank: clean-up some unused includes ARM: sun7i: Enable the A20 clocks in the DTSI ARM: sun6i: Enable clock support in the DTSI ARM: sun5i: dt: Use the A10s gates in the DTSI ARM: at91: at91_dt_defconfig: enable rm9200 support ARM: dts: add ADC device tree node for exynos5420/5250 ARM: dts: Add RTC DT node to Exynos5420 SoC ARM: dts: Update the "status" property of RTC DT node for Exynos5250 SoC ARM: dts: Fix the RTC DT node name for Exynos5250 irqchip: mmp: avoid to include irqs head file ARM: mmp: avoid to include head file in mach-mmp irqchip: mmp: support irqchip irqchip: move mmp irq driver ARM: OMAP: AM33xx: clock: Add RNG clock data ARM: OMAP: TI81XX: add always-on powerdomain for TI81XX ARM: OMAP4: clock: Lock PLLs in the right sequence ARM: OMAP: AM33XX: hwmod: Add hwmod data for debugSS ...
Diffstat (limited to 'arch/arm/mach-mmp')
-rw-r--r--arch/arm/mach-mmp/Makefile2
-rw-r--r--arch/arm/mach-mmp/common.h1
-rw-r--r--arch/arm/mach-mmp/include/mach/entry-macro.S26
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa168.h1
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa910.h1
-rw-r--r--arch/arm/mach-mmp/irq.c463
-rw-r--r--arch/arm/mach-mmp/mmp-dt.c8
-rw-r--r--arch/arm/mach-mmp/mmp2-dt.c8
-rw-r--r--arch/arm/mach-mmp/mmp2.c6
-rw-r--r--arch/arm/mach-mmp/pxa910.c7
10 files changed, 18 insertions, 505 deletions
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index 095c155d6fb8..9b702a1dc7b0 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -2,7 +2,7 @@
2# Makefile for Marvell's PXA168 processors line 2# Makefile for Marvell's PXA168 processors line
3# 3#
4 4
5obj-y += common.o devices.o time.o irq.o 5obj-y += common.o devices.o time.o
6 6
7# SoC support 7# SoC support
8obj-$(CONFIG_CPU_PXA168) += pxa168.o 8obj-$(CONFIG_CPU_PXA168) += pxa168.o
diff --git a/arch/arm/mach-mmp/common.h b/arch/arm/mach-mmp/common.h
index 991d7e9877de..cf445bae6d77 100644
--- a/arch/arm/mach-mmp/common.h
+++ b/arch/arm/mach-mmp/common.h
@@ -3,7 +3,6 @@
3 3
4extern void timer_init(int irq); 4extern void timer_init(int irq);
5 5
6extern void __init icu_init_irq(void);
7extern void __init mmp_map_io(void); 6extern void __init mmp_map_io(void);
8extern void mmp_restart(enum reboot_mode, const char *); 7extern void mmp_restart(enum reboot_mode, const char *);
9extern void __init pxa168_clk_init(void); 8extern void __init pxa168_clk_init(void);
diff --git a/arch/arm/mach-mmp/include/mach/entry-macro.S b/arch/arm/mach-mmp/include/mach/entry-macro.S
deleted file mode 100644
index bd152e24e6d7..000000000000
--- a/arch/arm/mach-mmp/include/mach/entry-macro.S
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/entry-macro.S
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <asm/irq.h>
10#include <mach/regs-icu.h>
11
12 .macro get_irqnr_preamble, base, tmp
13 mrc p15, 0, \tmp, c0, c0, 0 @ CPUID
14 and \tmp, \tmp, #0xff00
15 cmp \tmp, #0x5800
16 ldr \base, =mmp_icu_base
17 ldr \base, [\base, #0]
18 addne \base, \base, #0x10c @ PJ1 AP INT SEL register
19 addeq \base, \base, #0x104 @ PJ4 IRQ SEL register
20 .endm
21
22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
23 ldr \tmp, [\base, #0]
24 and \irqnr, \tmp, #0x3f
25 tst \tmp, #(1 << 6)
26 .endm
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index 459c2d03eb5c..a83ba7cb525d 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -4,6 +4,7 @@
4#include <linux/reboot.h> 4#include <linux/reboot.h>
5 5
6extern void pxa168_timer_init(void); 6extern void pxa168_timer_init(void);
7extern void __init icu_init_irq(void);
7extern void __init pxa168_init_irq(void); 8extern void __init pxa168_init_irq(void);
8extern void pxa168_restart(enum reboot_mode, const char *); 9extern void pxa168_restart(enum reboot_mode, const char *);
9extern void pxa168_clear_keypad_wakeup(void); 10extern void pxa168_clear_keypad_wakeup(void);
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index b914afa1fcdc..92253203f5b4 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -2,6 +2,7 @@
2#define __ASM_MACH_PXA910_H 2#define __ASM_MACH_PXA910_H
3 3
4extern void pxa910_timer_init(void); 4extern void pxa910_timer_init(void);
5extern void __init icu_init_irq(void);
5extern void __init pxa910_init_irq(void); 6extern void __init pxa910_init_irq(void);
6 7
7#include <linux/i2c.h> 8#include <linux/i2c.h>
diff --git a/arch/arm/mach-mmp/irq.c b/arch/arm/mach-mmp/irq.c
deleted file mode 100644
index 3c71246cd994..000000000000
--- a/arch/arm/mach-mmp/irq.c
+++ /dev/null
@@ -1,463 +0,0 @@
1/*
2 * linux/arch/arm/mach-mmp/irq.c
3 *
4 * Generic IRQ handling, GPIO IRQ demultiplexing, etc.
5 * Copyright (C) 2008 - 2012 Marvell Technology Group Ltd.
6 *
7 * Author: Bin Yang <bin.yang@marvell.com>
8 * Haojian Zhuang <haojian.zhuang@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/irq.h>
18#include <linux/irqdomain.h>
19#include <linux/io.h>
20#include <linux/ioport.h>
21#include <linux/of_address.h>
22#include <linux/of_irq.h>
23
24#include <mach/irqs.h>
25
26#ifdef CONFIG_CPU_MMP2
27#include <mach/pm-mmp2.h>
28#endif
29#ifdef CONFIG_CPU_PXA910
30#include <mach/pm-pxa910.h>
31#endif
32
33#include "common.h"
34
35#define MAX_ICU_NR 16
36
37struct icu_chip_data {
38 int nr_irqs;
39 unsigned int virq_base;
40 unsigned int cascade_irq;
41 void __iomem *reg_status;
42 void __iomem *reg_mask;
43 unsigned int conf_enable;
44 unsigned int conf_disable;
45 unsigned int conf_mask;
46 unsigned int clr_mfp_irq_base;
47 unsigned int clr_mfp_hwirq;
48 struct irq_domain *domain;
49};
50
51struct mmp_intc_conf {
52 unsigned int conf_enable;
53 unsigned int conf_disable;
54 unsigned int conf_mask;
55};
56
57void __iomem *mmp_icu_base;
58static struct icu_chip_data icu_data[MAX_ICU_NR];
59static int max_icu_nr;
60
61extern void mmp2_clear_pmic_int(void);
62
63static void icu_mask_ack_irq(struct irq_data *d)
64{
65 struct irq_domain *domain = d->domain;
66 struct icu_chip_data *data = (struct icu_chip_data *)domain->host_data;
67 int hwirq;
68 u32 r;
69
70 hwirq = d->irq - data->virq_base;
71 if (data == &icu_data[0]) {
72 r = readl_relaxed(mmp_icu_base + (hwirq << 2));
73 r &= ~data->conf_mask;
74 r |= data->conf_disable;
75 writel_relaxed(r, mmp_icu_base + (hwirq << 2));
76 } else {
77#ifdef CONFIG_CPU_MMP2
78 if ((data->virq_base == data->clr_mfp_irq_base)
79 && (hwirq == data->clr_mfp_hwirq))
80 mmp2_clear_pmic_int();
81#endif
82 r = readl_relaxed(data->reg_mask) | (1 << hwirq);
83 writel_relaxed(r, data->reg_mask);
84 }
85}
86
87static void icu_mask_irq(struct irq_data *d)
88{
89 struct irq_domain *domain = d->domain;
90 struct icu_chip_data *data = (struct icu_chip_data *)domain->host_data;
91 int hwirq;
92 u32 r;
93
94 hwirq = d->irq - data->virq_base;
95 if (data == &icu_data[0]) {
96 r = readl_relaxed(mmp_icu_base + (hwirq << 2));
97 r &= ~data->conf_mask;
98 r |= data->conf_disable;
99 writel_relaxed(r, mmp_icu_base + (hwirq << 2));
100 } else {
101 r = readl_relaxed(data->reg_mask) | (1 << hwirq);
102 writel_relaxed(r, data->reg_mask);
103 }
104}
105
106static void icu_unmask_irq(struct irq_data *d)
107{
108 struct irq_domain *domain = d->domain;
109 struct icu_chip_data *data = (struct icu_chip_data *)domain->host_data;
110 int hwirq;
111 u32 r;
112
113 hwirq = d->irq - data->virq_base;
114 if (data == &icu_data[0]) {
115 r = readl_relaxed(mmp_icu_base + (hwirq << 2));
116 r &= ~data->conf_mask;
117 r |= data->conf_enable;
118 writel_relaxed(r, mmp_icu_base + (hwirq << 2));
119 } else {
120 r = readl_relaxed(data->reg_mask) & ~(1 << hwirq);
121 writel_relaxed(r, data->reg_mask);
122 }
123}
124
125static struct irq_chip icu_irq_chip = {
126 .name = "icu_irq",
127 .irq_mask = icu_mask_irq,
128 .irq_mask_ack = icu_mask_ack_irq,
129 .irq_unmask = icu_unmask_irq,
130};
131
132static void icu_mux_irq_demux(unsigned int irq, struct irq_desc *desc)
133{
134 struct irq_domain *domain;
135 struct icu_chip_data *data;
136 int i;
137 unsigned long mask, status, n;
138
139 for (i = 1; i < max_icu_nr; i++) {
140 if (irq == icu_data[i].cascade_irq) {
141 domain = icu_data[i].domain;
142 data = (struct icu_chip_data *)domain->host_data;
143 break;
144 }
145 }
146 if (i >= max_icu_nr) {
147 pr_err("Spurious irq %d in MMP INTC\n", irq);
148 return;
149 }
150
151 mask = readl_relaxed(data->reg_mask);
152 while (1) {
153 status = readl_relaxed(data->reg_status) & ~mask;
154 if (status == 0)
155 break;
156 for_each_set_bit(n, &status, BITS_PER_LONG) {
157 generic_handle_irq(icu_data[i].virq_base + n);
158 }
159 }
160}
161
162static int mmp_irq_domain_map(struct irq_domain *d, unsigned int irq,
163 irq_hw_number_t hw)
164{
165 irq_set_chip_and_handler(irq, &icu_irq_chip, handle_level_irq);
166 set_irq_flags(irq, IRQF_VALID);
167 return 0;
168}
169
170static int mmp_irq_domain_xlate(struct irq_domain *d, struct device_node *node,
171 const u32 *intspec, unsigned int intsize,
172 unsigned long *out_hwirq,
173 unsigned int *out_type)
174{
175 *out_hwirq = intspec[0];
176 return 0;
177}
178
179const struct irq_domain_ops mmp_irq_domain_ops = {
180 .map = mmp_irq_domain_map,
181 .xlate = mmp_irq_domain_xlate,
182};
183
184static struct mmp_intc_conf mmp_conf = {
185 .conf_enable = 0x51,
186 .conf_disable = 0x0,
187 .conf_mask = 0x7f,
188};
189
190static struct mmp_intc_conf mmp2_conf = {
191 .conf_enable = 0x20,
192 .conf_disable = 0x0,
193 .conf_mask = 0x7f,
194};
195
196/* MMP (ARMv5) */
197void __init icu_init_irq(void)
198{
199 int irq;
200
201 max_icu_nr = 1;
202 mmp_icu_base = ioremap(0xd4282000, 0x1000);
203 icu_data[0].conf_enable = mmp_conf.conf_enable;
204 icu_data[0].conf_disable = mmp_conf.conf_disable;
205 icu_data[0].conf_mask = mmp_conf.conf_mask;
206 icu_data[0].nr_irqs = 64;
207 icu_data[0].virq_base = 0;
208 icu_data[0].domain = irq_domain_add_legacy(NULL, 64, 0, 0,
209 &irq_domain_simple_ops,
210 &icu_data[0]);
211 for (irq = 0; irq < 64; irq++) {
212 icu_mask_irq(irq_get_irq_data(irq));
213 irq_set_chip_and_handler(irq, &icu_irq_chip, handle_level_irq);
214 set_irq_flags(irq, IRQF_VALID);
215 }
216 irq_set_default_host(icu_data[0].domain);
217#ifdef CONFIG_CPU_PXA910
218 icu_irq_chip.irq_set_wake = pxa910_set_wake;
219#endif
220}
221
222/* MMP2 (ARMv7) */
223void __init mmp2_init_icu(void)
224{
225 int irq;
226
227 max_icu_nr = 8;
228 mmp_icu_base = ioremap(0xd4282000, 0x1000);
229 icu_data[0].conf_enable = mmp2_conf.conf_enable;
230 icu_data[0].conf_disable = mmp2_conf.conf_disable;
231 icu_data[0].conf_mask = mmp2_conf.conf_mask;
232 icu_data[0].nr_irqs = 64;
233 icu_data[0].virq_base = 0;
234 icu_data[0].domain = irq_domain_add_legacy(NULL, 64, 0, 0,
235 &irq_domain_simple_ops,
236 &icu_data[0]);
237 icu_data[1].reg_status = mmp_icu_base + 0x150;
238 icu_data[1].reg_mask = mmp_icu_base + 0x168;
239 icu_data[1].clr_mfp_irq_base = IRQ_MMP2_PMIC_BASE;
240 icu_data[1].clr_mfp_hwirq = IRQ_MMP2_PMIC - IRQ_MMP2_PMIC_BASE;
241 icu_data[1].nr_irqs = 2;
242 icu_data[1].cascade_irq = 4;
243 icu_data[1].virq_base = IRQ_MMP2_PMIC_BASE;
244 icu_data[1].domain = irq_domain_add_legacy(NULL, icu_data[1].nr_irqs,
245 icu_data[1].virq_base, 0,
246 &irq_domain_simple_ops,
247 &icu_data[1]);
248 icu_data[2].reg_status = mmp_icu_base + 0x154;
249 icu_data[2].reg_mask = mmp_icu_base + 0x16c;
250 icu_data[2].nr_irqs = 2;
251 icu_data[2].cascade_irq = 5;
252 icu_data[2].virq_base = IRQ_MMP2_RTC_BASE;
253 icu_data[2].domain = irq_domain_add_legacy(NULL, icu_data[2].nr_irqs,
254 icu_data[2].virq_base, 0,
255 &irq_domain_simple_ops,
256 &icu_data[2]);
257 icu_data[3].reg_status = mmp_icu_base + 0x180;
258 icu_data[3].reg_mask = mmp_icu_base + 0x17c;
259 icu_data[3].nr_irqs = 3;
260 icu_data[3].cascade_irq = 9;
261 icu_data[3].virq_base = IRQ_MMP2_KEYPAD_BASE;
262 icu_data[3].domain = irq_domain_add_legacy(NULL, icu_data[3].nr_irqs,
263 icu_data[3].virq_base, 0,
264 &irq_domain_simple_ops,
265 &icu_data[3]);
266 icu_data[4].reg_status = mmp_icu_base + 0x158;
267 icu_data[4].reg_mask = mmp_icu_base + 0x170;
268 icu_data[4].nr_irqs = 5;
269 icu_data[4].cascade_irq = 17;
270 icu_data[4].virq_base = IRQ_MMP2_TWSI_BASE;
271 icu_data[4].domain = irq_domain_add_legacy(NULL, icu_data[4].nr_irqs,
272 icu_data[4].virq_base, 0,
273 &irq_domain_simple_ops,
274 &icu_data[4]);
275 icu_data[5].reg_status = mmp_icu_base + 0x15c;
276 icu_data[5].reg_mask = mmp_icu_base + 0x174;
277 icu_data[5].nr_irqs = 15;
278 icu_data[5].cascade_irq = 35;
279 icu_data[5].virq_base = IRQ_MMP2_MISC_BASE;
280 icu_data[5].domain = irq_domain_add_legacy(NULL, icu_data[5].nr_irqs,
281 icu_data[5].virq_base, 0,
282 &irq_domain_simple_ops,
283 &icu_data[5]);
284 icu_data[6].reg_status = mmp_icu_base + 0x160;
285 icu_data[6].reg_mask = mmp_icu_base + 0x178;
286 icu_data[6].nr_irqs = 2;
287 icu_data[6].cascade_irq = 51;
288 icu_data[6].virq_base = IRQ_MMP2_MIPI_HSI1_BASE;
289 icu_data[6].domain = irq_domain_add_legacy(NULL, icu_data[6].nr_irqs,
290 icu_data[6].virq_base, 0,
291 &irq_domain_simple_ops,
292 &icu_data[6]);
293 icu_data[7].reg_status = mmp_icu_base + 0x188;
294 icu_data[7].reg_mask = mmp_icu_base + 0x184;
295 icu_data[7].nr_irqs = 2;
296 icu_data[7].cascade_irq = 55;
297 icu_data[7].virq_base = IRQ_MMP2_MIPI_HSI0_BASE;
298 icu_data[7].domain = irq_domain_add_legacy(NULL, icu_data[7].nr_irqs,
299 icu_data[7].virq_base, 0,
300 &irq_domain_simple_ops,
301 &icu_data[7]);
302 for (irq = 0; irq < IRQ_MMP2_MUX_END; irq++) {
303 icu_mask_irq(irq_get_irq_data(irq));
304 switch (irq) {
305 case IRQ_MMP2_PMIC_MUX:
306 case IRQ_MMP2_RTC_MUX:
307 case IRQ_MMP2_KEYPAD_MUX:
308 case IRQ_MMP2_TWSI_MUX:
309 case IRQ_MMP2_MISC_MUX:
310 case IRQ_MMP2_MIPI_HSI1_MUX:
311 case IRQ_MMP2_MIPI_HSI0_MUX:
312 irq_set_chip(irq, &icu_irq_chip);
313 irq_set_chained_handler(irq, icu_mux_irq_demux);
314 break;
315 default:
316 irq_set_chip_and_handler(irq, &icu_irq_chip,
317 handle_level_irq);
318 break;
319 }
320 set_irq_flags(irq, IRQF_VALID);
321 }
322 irq_set_default_host(icu_data[0].domain);
323#ifdef CONFIG_CPU_MMP2
324 icu_irq_chip.irq_set_wake = mmp2_set_wake;
325#endif
326}
327
328#ifdef CONFIG_OF
329static const struct of_device_id intc_ids[] __initconst = {
330 { .compatible = "mrvl,mmp-intc", .data = &mmp_conf },
331 { .compatible = "mrvl,mmp2-intc", .data = &mmp2_conf },
332 {}
333};
334
335static const struct of_device_id mmp_mux_irq_match[] __initconst = {
336 { .compatible = "mrvl,mmp2-mux-intc" },
337 {}
338};
339
340int __init mmp2_mux_init(struct device_node *parent)
341{
342 struct device_node *node;
343 const struct of_device_id *of_id;
344 struct resource res;
345 int i, irq_base, ret, irq;
346 u32 nr_irqs, mfp_irq;
347
348 node = parent;
349 max_icu_nr = 1;
350 for (i = 1; i < MAX_ICU_NR; i++) {
351 node = of_find_matching_node(node, mmp_mux_irq_match);
352 if (!node)
353 break;
354 of_id = of_match_node(&mmp_mux_irq_match[0], node);
355 ret = of_property_read_u32(node, "mrvl,intc-nr-irqs",
356 &nr_irqs);
357 if (ret) {
358 pr_err("Not found mrvl,intc-nr-irqs property\n");
359 ret = -EINVAL;
360 goto err;
361 }
362 ret = of_address_to_resource(node, 0, &res);
363 if (ret < 0) {
364 pr_err("Not found reg property\n");
365 ret = -EINVAL;
366 goto err;
367 }
368 icu_data[i].reg_status = mmp_icu_base + res.start;
369 ret = of_address_to_resource(node, 1, &res);
370 if (ret < 0) {
371 pr_err("Not found reg property\n");
372 ret = -EINVAL;
373 goto err;
374 }
375 icu_data[i].reg_mask = mmp_icu_base + res.start;
376 icu_data[i].cascade_irq = irq_of_parse_and_map(node, 0);
377 if (!icu_data[i].cascade_irq) {
378 ret = -EINVAL;
379 goto err;
380 }
381
382 irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
383 if (irq_base < 0) {
384 pr_err("Failed to allocate IRQ numbers for mux intc\n");
385 ret = irq_base;
386 goto err;
387 }
388 if (!of_property_read_u32(node, "mrvl,clr-mfp-irq",
389 &mfp_irq)) {
390 icu_data[i].clr_mfp_irq_base = irq_base;
391 icu_data[i].clr_mfp_hwirq = mfp_irq;
392 }
393 irq_set_chained_handler(icu_data[i].cascade_irq,
394 icu_mux_irq_demux);
395 icu_data[i].nr_irqs = nr_irqs;
396 icu_data[i].virq_base = irq_base;
397 icu_data[i].domain = irq_domain_add_legacy(node, nr_irqs,
398 irq_base, 0,
399 &mmp_irq_domain_ops,
400 &icu_data[i]);
401 for (irq = irq_base; irq < irq_base + nr_irqs; irq++)
402 icu_mask_irq(irq_get_irq_data(irq));
403 }
404 max_icu_nr = i;
405 return 0;
406err:
407 of_node_put(node);
408 max_icu_nr = i;
409 return ret;
410}
411
412void __init mmp_dt_irq_init(void)
413{
414 struct device_node *node;
415 const struct of_device_id *of_id;
416 struct mmp_intc_conf *conf;
417 int nr_irqs, irq_base, ret, irq;
418
419 node = of_find_matching_node(NULL, intc_ids);
420 if (!node) {
421 pr_err("Failed to find interrupt controller in arch-mmp\n");
422 return;
423 }
424 of_id = of_match_node(intc_ids, node);
425 conf = of_id->data;
426
427 ret = of_property_read_u32(node, "mrvl,intc-nr-irqs", &nr_irqs);
428 if (ret) {
429 pr_err("Not found mrvl,intc-nr-irqs property\n");
430 return;
431 }
432
433 mmp_icu_base = of_iomap(node, 0);
434 if (!mmp_icu_base) {
435 pr_err("Failed to get interrupt controller register\n");
436 return;
437 }
438
439 irq_base = irq_alloc_descs(-1, 0, nr_irqs - NR_IRQS_LEGACY, 0);
440 if (irq_base < 0) {
441 pr_err("Failed to allocate IRQ numbers\n");
442 goto err;
443 } else if (irq_base != NR_IRQS_LEGACY) {
444 pr_err("ICU's irqbase should be started from 0\n");
445 goto err;
446 }
447 icu_data[0].conf_enable = conf->conf_enable;
448 icu_data[0].conf_disable = conf->conf_disable;
449 icu_data[0].conf_mask = conf->conf_mask;
450 icu_data[0].nr_irqs = nr_irqs;
451 icu_data[0].virq_base = 0;
452 icu_data[0].domain = irq_domain_add_legacy(node, nr_irqs, 0, 0,
453 &mmp_irq_domain_ops,
454 &icu_data[0]);
455 irq_set_default_host(icu_data[0].domain);
456 for (irq = 0; irq < nr_irqs; irq++)
457 icu_mask_irq(irq_get_irq_data(irq));
458 mmp2_mux_init(node);
459 return;
460err:
461 iounmap(mmp_icu_base);
462}
463#endif
diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c
index b37915dc4470..cca529ceecb7 100644
--- a/arch/arm/mach-mmp/mmp-dt.c
+++ b/arch/arm/mach-mmp/mmp-dt.c
@@ -9,17 +9,13 @@
9 * publishhed by the Free Software Foundation. 9 * publishhed by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/irq.h> 12#include <linux/irqchip.h>
13#include <linux/irqdomain.h>
14#include <linux/of_irq.h>
15#include <linux/of_platform.h> 13#include <linux/of_platform.h>
16#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
17#include <asm/mach/time.h> 15#include <asm/mach/time.h>
18#include <mach/irqs.h>
19 16
20#include "common.h" 17#include "common.h"
21 18
22extern void __init mmp_dt_irq_init(void);
23extern void __init mmp_dt_init_timer(void); 19extern void __init mmp_dt_init_timer(void);
24 20
25static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = { 21static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = {
@@ -64,7 +60,6 @@ static const char *mmp_dt_board_compat[] __initdata = {
64 60
65DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)") 61DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)")
66 .map_io = mmp_map_io, 62 .map_io = mmp_map_io,
67 .init_irq = mmp_dt_irq_init,
68 .init_time = mmp_dt_init_timer, 63 .init_time = mmp_dt_init_timer,
69 .init_machine = pxa168_dt_init, 64 .init_machine = pxa168_dt_init,
70 .dt_compat = mmp_dt_board_compat, 65 .dt_compat = mmp_dt_board_compat,
@@ -72,7 +67,6 @@ MACHINE_END
72 67
73DT_MACHINE_START(PXA910_DT, "Marvell PXA910 (Device Tree Support)") 68DT_MACHINE_START(PXA910_DT, "Marvell PXA910 (Device Tree Support)")
74 .map_io = mmp_map_io, 69 .map_io = mmp_map_io,
75 .init_irq = mmp_dt_irq_init,
76 .init_time = mmp_dt_init_timer, 70 .init_time = mmp_dt_init_timer,
77 .init_machine = pxa910_dt_init, 71 .init_machine = pxa910_dt_init,
78 .dt_compat = mmp_dt_board_compat, 72 .dt_compat = mmp_dt_board_compat,
diff --git a/arch/arm/mach-mmp/mmp2-dt.c b/arch/arm/mach-mmp/mmp2-dt.c
index 4ac256720f7d..023cb453f157 100644
--- a/arch/arm/mach-mmp/mmp2-dt.c
+++ b/arch/arm/mach-mmp/mmp2-dt.c
@@ -10,18 +10,13 @@
10 */ 10 */
11 11
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/irq.h> 13#include <linux/irqchip.h>
14#include <linux/irqdomain.h>
15#include <linux/of_irq.h>
16#include <linux/of_platform.h> 14#include <linux/of_platform.h>
17#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
18#include <asm/mach/time.h> 16#include <asm/mach/time.h>
19#include <mach/irqs.h>
20#include <mach/regs-apbc.h>
21 17
22#include "common.h" 18#include "common.h"
23 19
24extern void __init mmp_dt_irq_init(void);
25extern void __init mmp_dt_init_timer(void); 20extern void __init mmp_dt_init_timer(void);
26 21
27static const struct of_dev_auxdata mmp2_auxdata_lookup[] __initconst = { 22static const struct of_dev_auxdata mmp2_auxdata_lookup[] __initconst = {
@@ -49,7 +44,6 @@ static const char *mmp2_dt_board_compat[] __initdata = {
49 44
50DT_MACHINE_START(MMP2_DT, "Marvell MMP2 (Device Tree Support)") 45DT_MACHINE_START(MMP2_DT, "Marvell MMP2 (Device Tree Support)")
51 .map_io = mmp_map_io, 46 .map_io = mmp_map_io,
52 .init_irq = mmp_dt_irq_init,
53 .init_time = mmp_dt_init_timer, 47 .init_time = mmp_dt_init_timer,
54 .init_machine = mmp2_dt_init, 48 .init_machine = mmp2_dt_init,
55 .dt_compat = mmp2_dt_board_compat, 49 .dt_compat = mmp2_dt_board_compat,
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index c7592f168bbd..a70b5530bd42 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -13,6 +13,8 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/irqchip/mmp.h>
16#include <linux/platform_device.h> 18#include <linux/platform_device.h>
17 19
18#include <asm/hardware/cache-tauros2.h> 20#include <asm/hardware/cache-tauros2.h>
@@ -26,6 +28,7 @@
26#include <mach/mfp.h> 28#include <mach/mfp.h>
27#include <mach/devices.h> 29#include <mach/devices.h>
28#include <mach/mmp2.h> 30#include <mach/mmp2.h>
31#include <mach/pm-mmp2.h>
29 32
30#include "common.h" 33#include "common.h"
31 34
@@ -94,6 +97,9 @@ void mmp2_clear_pmic_int(void)
94void __init mmp2_init_irq(void) 97void __init mmp2_init_irq(void)
95{ 98{
96 mmp2_init_icu(); 99 mmp2_init_icu();
100#ifdef CONFIG_PM
101 icu_irq_chip.irq_set_wake = mmp2_set_wake;
102#endif
97} 103}
98 104
99static int __init mmp2_init(void) 105static int __init mmp2_init(void)
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index ce6393acad86..eb57ee196842 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -12,6 +12,8 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/irq.h>
16#include <linux/irqchip/mmp.h>
15#include <linux/platform_device.h> 17#include <linux/platform_device.h>
16 18
17#include <asm/hardware/cache-tauros2.h> 19#include <asm/hardware/cache-tauros2.h>
@@ -23,6 +25,8 @@
23#include <mach/dma.h> 25#include <mach/dma.h>
24#include <mach/mfp.h> 26#include <mach/mfp.h>
25#include <mach/devices.h> 27#include <mach/devices.h>
28#include <mach/pm-pxa910.h>
29#include <mach/pxa910.h>
26 30
27#include "common.h" 31#include "common.h"
28 32
@@ -79,6 +83,9 @@ static struct mfp_addr_map pxa910_mfp_addr_map[] __initdata =
79void __init pxa910_init_irq(void) 83void __init pxa910_init_irq(void)
80{ 84{
81 icu_init_irq(); 85 icu_init_irq();
86#ifdef CONFIG_PM
87 icu_irq_chip.irq_set_wake = pxa910_set_wake;
88#endif
82} 89}
83 90
84static int __init pxa910_init(void) 91static int __init pxa910_init(void)