diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2013-03-25 09:34:51 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2013-04-01 04:30:04 -0400 |
commit | 6a8e95b071ecf7357d294782b6ef4e707ce0fbbd (patch) | |
tree | 8ab18cce9c20e78a0964fe995e68d034038301c5 /arch/arm | |
parent | cec6bae8ca0417002fa8e3376ab03198dcaaa82a (diff) |
ARM: mxs: move icoll driver into drivers/irqchip
Move icoll.c into drivers/irqchip as irq-mxs.c, and along with the
renaming, change the driver to use IRQCHIP_DECLARE.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-mxs/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-mxs/icoll.c | 128 | ||||
-rw-r--r-- | arch/arm/mach-mxs/include/mach/common.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-mxs/mach-mxs.c | 6 |
4 files changed, 5 insertions, 134 deletions
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile index 76c336e6f5b5..b934603e2765 100644 --- a/arch/arm/mach-mxs/Makefile +++ b/arch/arm/mach-mxs/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | # Common support | 1 | # Common support |
2 | obj-y := icoll.o ocotp.o system.o mm.o | 2 | obj-y := ocotp.o system.o mm.o |
3 | 3 | ||
4 | obj-$(CONFIG_PM) += pm.o | 4 | obj-$(CONFIG_PM) += pm.o |
5 | 5 | ||
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c deleted file mode 100644 index b4d620765cf1..000000000000 --- a/arch/arm/mach-mxs/icoll.c +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
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 as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | */ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/irq.h> | ||
22 | #include <linux/irqdomain.h> | ||
23 | #include <linux/io.h> | ||
24 | #include <linux/of.h> | ||
25 | #include <linux/of_address.h> | ||
26 | #include <linux/of_irq.h> | ||
27 | #include <linux/stmp_device.h> | ||
28 | #include <asm/exception.h> | ||
29 | |||
30 | #define HW_ICOLL_VECTOR 0x0000 | ||
31 | #define HW_ICOLL_LEVELACK 0x0010 | ||
32 | #define HW_ICOLL_CTRL 0x0020 | ||
33 | #define HW_ICOLL_STAT_OFFSET 0x0070 | ||
34 | #define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10) | ||
35 | #define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10) | ||
36 | #define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004 | ||
37 | #define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1 | ||
38 | |||
39 | #define ICOLL_NUM_IRQS 128 | ||
40 | |||
41 | static void __iomem *icoll_base; | ||
42 | static struct irq_domain *icoll_domain; | ||
43 | |||
44 | static void icoll_ack_irq(struct irq_data *d) | ||
45 | { | ||
46 | /* | ||
47 | * The Interrupt Collector is able to prioritize irqs. | ||
48 | * Currently only level 0 is used. So acking can use | ||
49 | * BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 unconditionally. | ||
50 | */ | ||
51 | __raw_writel(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0, | ||
52 | icoll_base + HW_ICOLL_LEVELACK); | ||
53 | } | ||
54 | |||
55 | static void icoll_mask_irq(struct irq_data *d) | ||
56 | { | ||
57 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, | ||
58 | icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->hwirq)); | ||
59 | } | ||
60 | |||
61 | static void icoll_unmask_irq(struct irq_data *d) | ||
62 | { | ||
63 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, | ||
64 | icoll_base + HW_ICOLL_INTERRUPTn_SET(d->hwirq)); | ||
65 | } | ||
66 | |||
67 | static struct irq_chip mxs_icoll_chip = { | ||
68 | .irq_ack = icoll_ack_irq, | ||
69 | .irq_mask = icoll_mask_irq, | ||
70 | .irq_unmask = icoll_unmask_irq, | ||
71 | }; | ||
72 | |||
73 | asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs) | ||
74 | { | ||
75 | u32 irqnr; | ||
76 | |||
77 | do { | ||
78 | irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET); | ||
79 | if (irqnr != 0x7f) { | ||
80 | __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR); | ||
81 | irqnr = irq_find_mapping(icoll_domain, irqnr); | ||
82 | handle_IRQ(irqnr, regs); | ||
83 | continue; | ||
84 | } | ||
85 | break; | ||
86 | } while (1); | ||
87 | } | ||
88 | |||
89 | static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq, | ||
90 | irq_hw_number_t hw) | ||
91 | { | ||
92 | irq_set_chip_and_handler(virq, &mxs_icoll_chip, handle_level_irq); | ||
93 | set_irq_flags(virq, IRQF_VALID); | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | static struct irq_domain_ops icoll_irq_domain_ops = { | ||
99 | .map = icoll_irq_domain_map, | ||
100 | .xlate = irq_domain_xlate_onecell, | ||
101 | }; | ||
102 | |||
103 | static void __init icoll_of_init(struct device_node *np, | ||
104 | struct device_node *interrupt_parent) | ||
105 | { | ||
106 | icoll_base = of_iomap(np, 0); | ||
107 | WARN_ON(!icoll_base); | ||
108 | |||
109 | /* | ||
110 | * Interrupt Collector reset, which initializes the priority | ||
111 | * for each irq to level 0. | ||
112 | */ | ||
113 | stmp_reset_block(icoll_base + HW_ICOLL_CTRL); | ||
114 | |||
115 | icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, | ||
116 | &icoll_irq_domain_ops, NULL); | ||
117 | WARN_ON(!icoll_domain); | ||
118 | } | ||
119 | |||
120 | static const struct of_device_id icoll_of_match[] __initconst = { | ||
121 | {.compatible = "fsl,icoll", .data = icoll_of_init}, | ||
122 | { /* sentinel */ } | ||
123 | }; | ||
124 | |||
125 | void __init icoll_init_irq(void) | ||
126 | { | ||
127 | of_irq_init(icoll_of_match); | ||
128 | } | ||
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h index e043c4735b5a..df2a4ef14dae 100644 --- a/arch/arm/mach-mxs/include/mach/common.h +++ b/arch/arm/mach-mxs/include/mach/common.h | |||
@@ -22,7 +22,4 @@ extern void mx23_map_io(void); | |||
22 | extern int mx28_clocks_init(void); | 22 | extern int mx28_clocks_init(void); |
23 | extern void mx28_map_io(void); | 23 | extern void mx28_map_io(void); |
24 | 24 | ||
25 | extern void icoll_init_irq(void); | ||
26 | extern void icoll_handle_irq(struct pt_regs *); | ||
27 | |||
28 | #endif /* __MACH_MXS_COMMON_H__ */ | 25 | #endif /* __MACH_MXS_COMMON_H__ */ |
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index c1c0fb414c28..10506381b446 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/irqchip.h> | ||
22 | #include <linux/irqchip/mxs.h> | ||
21 | #include <linux/micrel_phy.h> | 23 | #include <linux/micrel_phy.h> |
22 | #include <linux/mxsfb.h> | 24 | #include <linux/mxsfb.h> |
23 | #include <linux/of_platform.h> | 25 | #include <linux/of_platform.h> |
@@ -469,7 +471,7 @@ static const char *imx28_dt_compat[] __initdata = { | |||
469 | 471 | ||
470 | DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)") | 472 | DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)") |
471 | .map_io = mx23_map_io, | 473 | .map_io = mx23_map_io, |
472 | .init_irq = icoll_init_irq, | 474 | .init_irq = irqchip_init, |
473 | .handle_irq = icoll_handle_irq, | 475 | .handle_irq = icoll_handle_irq, |
474 | .init_time = imx23_timer_init, | 476 | .init_time = imx23_timer_init, |
475 | .init_machine = mxs_machine_init, | 477 | .init_machine = mxs_machine_init, |
@@ -479,7 +481,7 @@ MACHINE_END | |||
479 | 481 | ||
480 | DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)") | 482 | DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)") |
481 | .map_io = mx28_map_io, | 483 | .map_io = mx28_map_io, |
482 | .init_irq = icoll_init_irq, | 484 | .init_irq = irqchip_init, |
483 | .handle_irq = icoll_handle_irq, | 485 | .handle_irq = icoll_handle_irq, |
484 | .init_time = imx28_timer_init, | 486 | .init_time = imx28_timer_init, |
485 | .init_machine = mxs_machine_init, | 487 | .init_machine = mxs_machine_init, |