diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2012-06-12 22:20:58 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2012-07-01 09:57:29 -0400 |
commit | f3eac29da1f6a477722b56ff00228e8a13f8f6c6 (patch) | |
tree | 8b50b39a755008a9f890d7b31600940584140dc1 /arch/arm | |
parent | 1ab7ef158dfbaf6314b6660a3e3fb037cba2a1ca (diff) |
ARM: imx: move irq_domain_add_legacy call into tzic driver
Move irq_domain_add_legacy call from imx5*-dt.c into tzic init function
and have the tzic driver adopt irqdomain support for both DT and non-DT
boot.
Now tzic init function calls irq_alloc_descs to get irq_base and adds
a lenacy irqdomain with the irq_base, so that the mapping between tzic
irq and Linux irq number can be handled by irqdomain.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-imx/imx51-dt.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx53-dt.c | 15 | ||||
-rw-r--r-- | arch/arm/plat-mxc/tzic.c | 28 |
3 files changed, 20 insertions, 38 deletions
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c index 3bdabbc64f43..d4067fe36357 100644 --- a/arch/arm/mach-imx/imx51-dt.c +++ b/arch/arm/mach-imx/imx51-dt.c | |||
@@ -11,7 +11,6 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | #include <linux/irqdomain.h> | ||
15 | #include <linux/of_irq.h> | 14 | #include <linux/of_irq.h> |
16 | #include <linux/of_platform.h> | 15 | #include <linux/of_platform.h> |
17 | #include <linux/pinctrl/machine.h> | 16 | #include <linux/pinctrl/machine.h> |
@@ -45,18 +44,6 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = { | |||
45 | { /* sentinel */ } | 44 | { /* sentinel */ } |
46 | }; | 45 | }; |
47 | 46 | ||
48 | static int __init imx51_tzic_add_irq_domain(struct device_node *np, | ||
49 | struct device_node *interrupt_parent) | ||
50 | { | ||
51 | irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL); | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static const struct of_device_id imx51_irq_match[] __initconst = { | ||
56 | { .compatible = "fsl,imx51-tzic", .data = imx51_tzic_add_irq_domain, }, | ||
57 | { /* sentinel */ } | ||
58 | }; | ||
59 | |||
60 | static const struct of_device_id imx51_iomuxc_of_match[] __initconst = { | 47 | static const struct of_device_id imx51_iomuxc_of_match[] __initconst = { |
61 | { .compatible = "fsl,imx51-iomuxc-babbage", .data = imx51_babbage_common_init, }, | 48 | { .compatible = "fsl,imx51-iomuxc-babbage", .data = imx51_babbage_common_init, }, |
62 | { /* sentinel */ } | 49 | { /* sentinel */ } |
@@ -68,8 +55,6 @@ static void __init imx51_dt_init(void) | |||
68 | const struct of_device_id *of_id; | 55 | const struct of_device_id *of_id; |
69 | void (*func)(void); | 56 | void (*func)(void); |
70 | 57 | ||
71 | of_irq_init(imx51_irq_match); | ||
72 | |||
73 | pinctrl_provide_dummies(); | 58 | pinctrl_provide_dummies(); |
74 | 59 | ||
75 | node = of_find_matching_node(NULL, imx51_iomuxc_of_match); | 60 | node = of_find_matching_node(NULL, imx51_iomuxc_of_match); |
diff --git a/arch/arm/mach-imx/imx53-dt.c b/arch/arm/mach-imx/imx53-dt.c index 17fca3cac268..fdd90805d98e 100644 --- a/arch/arm/mach-imx/imx53-dt.c +++ b/arch/arm/mach-imx/imx53-dt.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <linux/irqdomain.h> | ||
19 | #include <linux/of_irq.h> | 18 | #include <linux/of_irq.h> |
20 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
21 | #include <linux/pinctrl/machine.h> | 20 | #include <linux/pinctrl/machine.h> |
@@ -52,18 +51,6 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = { | |||
52 | { /* sentinel */ } | 51 | { /* sentinel */ } |
53 | }; | 52 | }; |
54 | 53 | ||
55 | static int __init imx53_tzic_add_irq_domain(struct device_node *np, | ||
56 | struct device_node *interrupt_parent) | ||
57 | { | ||
58 | irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL); | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | static const struct of_device_id imx53_irq_match[] __initconst = { | ||
63 | { .compatible = "fsl,imx53-tzic", .data = imx53_tzic_add_irq_domain, }, | ||
64 | { /* sentinel */ } | ||
65 | }; | ||
66 | |||
67 | static const struct of_device_id imx53_iomuxc_of_match[] __initconst = { | 54 | static const struct of_device_id imx53_iomuxc_of_match[] __initconst = { |
68 | { .compatible = "fsl,imx53-iomuxc-ard", .data = imx53_ard_common_init, }, | 55 | { .compatible = "fsl,imx53-iomuxc-ard", .data = imx53_ard_common_init, }, |
69 | { .compatible = "fsl,imx53-iomuxc-evk", .data = imx53_evk_common_init, }, | 56 | { .compatible = "fsl,imx53-iomuxc-evk", .data = imx53_evk_common_init, }, |
@@ -91,8 +78,6 @@ static void __init imx53_dt_init(void) | |||
91 | const struct of_device_id *of_id; | 78 | const struct of_device_id *of_id; |
92 | void (*func)(void); | 79 | void (*func)(void); |
93 | 80 | ||
94 | of_irq_init(imx53_irq_match); | ||
95 | |||
96 | pinctrl_provide_dummies(); | 81 | pinctrl_provide_dummies(); |
97 | 82 | ||
98 | node = of_find_matching_node(NULL, imx53_iomuxc_of_match); | 83 | node = of_find_matching_node(NULL, imx53_iomuxc_of_match); |
diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c index 98308ec1f321..abc90e4116f5 100644 --- a/arch/arm/plat-mxc/tzic.c +++ b/arch/arm/plat-mxc/tzic.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/irqdomain.h> | ||
19 | #include <linux/of.h> | ||
18 | 20 | ||
19 | #include <asm/mach/irq.h> | 21 | #include <asm/mach/irq.h> |
20 | #include <asm/exception.h> | 22 | #include <asm/exception.h> |
@@ -49,6 +51,7 @@ | |||
49 | #define TZIC_ID0 0x0FD0 /* Indentification Register 0 */ | 51 | #define TZIC_ID0 0x0FD0 /* Indentification Register 0 */ |
50 | 52 | ||
51 | void __iomem *tzic_base; /* Used as irq controller base in entry-macro.S */ | 53 | void __iomem *tzic_base; /* Used as irq controller base in entry-macro.S */ |
54 | static struct irq_domain *domain; | ||
52 | 55 | ||
53 | #define TZIC_NUM_IRQS 128 | 56 | #define TZIC_NUM_IRQS 128 |
54 | 57 | ||
@@ -77,15 +80,14 @@ static int tzic_set_irq_fiq(unsigned int irq, unsigned int type) | |||
77 | static void tzic_irq_suspend(struct irq_data *d) | 80 | static void tzic_irq_suspend(struct irq_data *d) |
78 | { | 81 | { |
79 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 82 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
80 | int idx = gc->irq_base >> 5; | 83 | int idx = d->hwirq >> 5; |
81 | 84 | ||
82 | __raw_writel(gc->wake_active, tzic_base + TZIC_WAKEUP0(idx)); | 85 | __raw_writel(gc->wake_active, tzic_base + TZIC_WAKEUP0(idx)); |
83 | } | 86 | } |
84 | 87 | ||
85 | static void tzic_irq_resume(struct irq_data *d) | 88 | static void tzic_irq_resume(struct irq_data *d) |
86 | { | 89 | { |
87 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 90 | int idx = d->hwirq >> 5; |
88 | int idx = gc->irq_base >> 5; | ||
89 | 91 | ||
90 | __raw_writel(__raw_readl(tzic_base + TZIC_ENSET0(idx)), | 92 | __raw_writel(__raw_readl(tzic_base + TZIC_ENSET0(idx)), |
91 | tzic_base + TZIC_WAKEUP0(idx)); | 93 | tzic_base + TZIC_WAKEUP0(idx)); |
@@ -102,11 +104,10 @@ static struct mxc_extra_irq tzic_extra_irq = { | |||
102 | #endif | 104 | #endif |
103 | }; | 105 | }; |
104 | 106 | ||
105 | static __init void tzic_init_gc(unsigned int irq_start) | 107 | static __init void tzic_init_gc(int idx, unsigned int irq_start) |
106 | { | 108 | { |
107 | struct irq_chip_generic *gc; | 109 | struct irq_chip_generic *gc; |
108 | struct irq_chip_type *ct; | 110 | struct irq_chip_type *ct; |
109 | int idx = irq_start >> 5; | ||
110 | 111 | ||
111 | gc = irq_alloc_generic_chip("tzic", 1, irq_start, tzic_base, | 112 | gc = irq_alloc_generic_chip("tzic", 1, irq_start, tzic_base, |
112 | handle_level_irq); | 113 | handle_level_irq); |
@@ -140,7 +141,8 @@ asmlinkage void __exception_irq_entry tzic_handle_irq(struct pt_regs *regs) | |||
140 | while (stat) { | 141 | while (stat) { |
141 | handled = 1; | 142 | handled = 1; |
142 | irqofs = fls(stat) - 1; | 143 | irqofs = fls(stat) - 1; |
143 | handle_IRQ(irqofs + i * 32, regs); | 144 | handle_IRQ(irq_find_mapping(domain, |
145 | irqofs + i * 32), regs); | ||
144 | stat &= ~(1 << irqofs); | 146 | stat &= ~(1 << irqofs); |
145 | } | 147 | } |
146 | } | 148 | } |
@@ -154,6 +156,8 @@ asmlinkage void __exception_irq_entry tzic_handle_irq(struct pt_regs *regs) | |||
154 | */ | 156 | */ |
155 | void __init tzic_init_irq(void __iomem *irqbase) | 157 | void __init tzic_init_irq(void __iomem *irqbase) |
156 | { | 158 | { |
159 | struct device_node *np; | ||
160 | int irq_base; | ||
157 | int i; | 161 | int i; |
158 | 162 | ||
159 | tzic_base = irqbase; | 163 | tzic_base = irqbase; |
@@ -175,8 +179,16 @@ void __init tzic_init_irq(void __iomem *irqbase) | |||
175 | 179 | ||
176 | /* all IRQ no FIQ Warning :: No selection */ | 180 | /* all IRQ no FIQ Warning :: No selection */ |
177 | 181 | ||
178 | for (i = 0; i < TZIC_NUM_IRQS; i += 32) | 182 | irq_base = irq_alloc_descs(-1, 0, TZIC_NUM_IRQS, numa_node_id()); |
179 | tzic_init_gc(i); | 183 | WARN_ON(irq_base < 0); |
184 | |||
185 | np = of_find_compatible_node(NULL, NULL, "fsl,tzic"); | ||
186 | domain = irq_domain_add_legacy(np, TZIC_NUM_IRQS, irq_base, 0, | ||
187 | &irq_domain_simple_ops, NULL); | ||
188 | WARN_ON(!domain); | ||
189 | |||
190 | for (i = 0; i < 4; i++, irq_base += 32) | ||
191 | tzic_init_gc(i, irq_base); | ||
180 | 192 | ||
181 | #ifdef CONFIG_FIQ | 193 | #ifdef CONFIG_FIQ |
182 | /* Initialize FIQ */ | 194 | /* Initialize FIQ */ |