diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-13 18:37:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-13 18:37:30 -0400 |
commit | 505608d2b9f3ab9e3ea0fd1b89b1cc560b91a7b5 (patch) | |
tree | 1f7ff920409e0e510c4b36286b8f5bcba1e88086 | |
parent | 0da273668657a70155f3d4ae121dc19277a05778 (diff) | |
parent | 4de563ae821b1935b3c467a4606e5738b0b0df87 (diff) |
Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq updates from Thomas Gleixner:
- core fix for missing round up in the generic irq chip implementation
- new irq chip for MOXA SoCs
- a few fixes and cleanups in the irqchip drivers
* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
irqchip: Add support for MOXA ART SoCs
genirq: generic chip: Use DIV_ROUND_UP to calculate numchips
irqchip: nvic: Fix wrong num_ct argument for irq_alloc_domain_generic_chips()
irqchip: sun4i: Staticize sun4i_irq_ack()
irqchip: vt8500: Staticize local symbols
-rw-r--r-- | drivers/irqchip/Makefile | 1 | ||||
-rw-r--r-- | drivers/irqchip/irq-moxart.c | 117 | ||||
-rw-r--r-- | drivers/irqchip/irq-nvic.c | 2 | ||||
-rw-r--r-- | drivers/irqchip/irq-sun4i.c | 2 | ||||
-rw-r--r-- | drivers/irqchip/irq-vt8500.c | 6 | ||||
-rw-r--r-- | kernel/irq/generic-chip.c | 2 |
6 files changed, 125 insertions, 5 deletions
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 2065ef6a949c..e65c41a7366b 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_ARCH_MXS) += irq-mxs.o | |||
7 | obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o | 7 | obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o |
8 | obj-$(CONFIG_METAG) += irq-metag-ext.o | 8 | obj-$(CONFIG_METAG) += irq-metag-ext.o |
9 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o | 9 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o |
10 | obj-$(CONFIG_ARCH_MOXART) += irq-moxart.o | ||
10 | obj-$(CONFIG_ORION_IRQCHIP) += irq-orion.o | 11 | obj-$(CONFIG_ORION_IRQCHIP) += irq-orion.o |
11 | obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o | 12 | obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o |
12 | obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o | 13 | obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o |
diff --git a/drivers/irqchip/irq-moxart.c b/drivers/irqchip/irq-moxart.c new file mode 100644 index 000000000000..5552fc2bf28a --- /dev/null +++ b/drivers/irqchip/irq-moxart.c | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | * MOXA ART SoCs IRQ chip driver. | ||
3 | * | ||
4 | * Copyright (C) 2013 Jonas Jensen | ||
5 | * | ||
6 | * Jonas Jensen <jonas.jensen@gmail.com> | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public | ||
9 | * License version 2. This program is licensed "as is" without any | ||
10 | * warranty of any kind, whether express or implied. | ||
11 | */ | ||
12 | |||
13 | #include <linux/io.h> | ||
14 | #include <linux/irq.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/of_address.h> | ||
17 | #include <linux/of_irq.h> | ||
18 | #include <linux/irqdomain.h> | ||
19 | |||
20 | #include <asm/exception.h> | ||
21 | |||
22 | #include "irqchip.h" | ||
23 | |||
24 | #define IRQ_SOURCE_REG 0 | ||
25 | #define IRQ_MASK_REG 0x04 | ||
26 | #define IRQ_CLEAR_REG 0x08 | ||
27 | #define IRQ_MODE_REG 0x0c | ||
28 | #define IRQ_LEVEL_REG 0x10 | ||
29 | #define IRQ_STATUS_REG 0x14 | ||
30 | |||
31 | #define FIQ_SOURCE_REG 0x20 | ||
32 | #define FIQ_MASK_REG 0x24 | ||
33 | #define FIQ_CLEAR_REG 0x28 | ||
34 | #define FIQ_MODE_REG 0x2c | ||
35 | #define FIQ_LEVEL_REG 0x30 | ||
36 | #define FIQ_STATUS_REG 0x34 | ||
37 | |||
38 | |||
39 | struct moxart_irq_data { | ||
40 | void __iomem *base; | ||
41 | struct irq_domain *domain; | ||
42 | unsigned int interrupt_mask; | ||
43 | }; | ||
44 | |||
45 | static struct moxart_irq_data intc; | ||
46 | |||
47 | static asmlinkage void __exception_irq_entry handle_irq(struct pt_regs *regs) | ||
48 | { | ||
49 | u32 irqstat; | ||
50 | int hwirq; | ||
51 | |||
52 | irqstat = readl(intc.base + IRQ_STATUS_REG); | ||
53 | |||
54 | while (irqstat) { | ||
55 | hwirq = ffs(irqstat) - 1; | ||
56 | handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs); | ||
57 | irqstat &= ~(1 << hwirq); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | static int __init moxart_of_intc_init(struct device_node *node, | ||
62 | struct device_node *parent) | ||
63 | { | ||
64 | unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; | ||
65 | int ret; | ||
66 | struct irq_chip_generic *gc; | ||
67 | |||
68 | intc.base = of_iomap(node, 0); | ||
69 | if (!intc.base) { | ||
70 | pr_err("%s: unable to map IC registers\n", | ||
71 | node->full_name); | ||
72 | return -EINVAL; | ||
73 | } | ||
74 | |||
75 | intc.domain = irq_domain_add_linear(node, 32, &irq_generic_chip_ops, | ||
76 | intc.base); | ||
77 | if (!intc.domain) { | ||
78 | pr_err("%s: unable to create IRQ domain\n", node->full_name); | ||
79 | return -EINVAL; | ||
80 | } | ||
81 | |||
82 | ret = irq_alloc_domain_generic_chips(intc.domain, 32, 1, | ||
83 | "MOXARTINTC", handle_edge_irq, | ||
84 | clr, 0, IRQ_GC_INIT_MASK_CACHE); | ||
85 | if (ret) { | ||
86 | pr_err("%s: could not allocate generic chip\n", | ||
87 | node->full_name); | ||
88 | irq_domain_remove(intc.domain); | ||
89 | return -EINVAL; | ||
90 | } | ||
91 | |||
92 | ret = of_property_read_u32(node, "interrupt-mask", | ||
93 | &intc.interrupt_mask); | ||
94 | if (ret) | ||
95 | pr_err("%s: could not read interrupt-mask DT property\n", | ||
96 | node->full_name); | ||
97 | |||
98 | gc = irq_get_domain_generic_chip(intc.domain, 0); | ||
99 | |||
100 | gc->reg_base = intc.base; | ||
101 | gc->chip_types[0].regs.mask = IRQ_MASK_REG; | ||
102 | gc->chip_types[0].regs.ack = IRQ_CLEAR_REG; | ||
103 | gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit; | ||
104 | gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; | ||
105 | gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit; | ||
106 | |||
107 | writel(0, intc.base + IRQ_MASK_REG); | ||
108 | writel(0xffffffff, intc.base + IRQ_CLEAR_REG); | ||
109 | |||
110 | writel(intc.interrupt_mask, intc.base + IRQ_MODE_REG); | ||
111 | writel(intc.interrupt_mask, intc.base + IRQ_LEVEL_REG); | ||
112 | |||
113 | set_handle_irq(handle_irq); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | IRQCHIP_DECLARE(moxa_moxart_ic, "moxa,moxart-ic", moxart_of_intc_init); | ||
diff --git a/drivers/irqchip/irq-nvic.c b/drivers/irqchip/irq-nvic.c index 8d0c8b3181c5..70bdf6edb7bb 100644 --- a/drivers/irqchip/irq-nvic.c +++ b/drivers/irqchip/irq-nvic.c | |||
@@ -84,7 +84,7 @@ static int __init nvic_of_init(struct device_node *node, | |||
84 | return -ENOMEM; | 84 | return -ENOMEM; |
85 | } | 85 | } |
86 | 86 | ||
87 | ret = irq_alloc_domain_generic_chips(nvic_irq_domain, 32, numbanks, | 87 | ret = irq_alloc_domain_generic_chips(nvic_irq_domain, 32, 1, |
88 | "nvic_irq", handle_fasteoi_irq, | 88 | "nvic_irq", handle_fasteoi_irq, |
89 | clr, 0, IRQ_GC_INIT_MASK_CACHE); | 89 | clr, 0, IRQ_GC_INIT_MASK_CACHE); |
90 | if (ret) { | 90 | if (ret) { |
diff --git a/drivers/irqchip/irq-sun4i.c b/drivers/irqchip/irq-sun4i.c index b66d4ae06898..a5438d889245 100644 --- a/drivers/irqchip/irq-sun4i.c +++ b/drivers/irqchip/irq-sun4i.c | |||
@@ -38,7 +38,7 @@ static struct irq_domain *sun4i_irq_domain; | |||
38 | 38 | ||
39 | static asmlinkage void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs); | 39 | static asmlinkage void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs); |
40 | 40 | ||
41 | void sun4i_irq_ack(struct irq_data *irqd) | 41 | static void sun4i_irq_ack(struct irq_data *irqd) |
42 | { | 42 | { |
43 | unsigned int irq = irqd_to_hwirq(irqd); | 43 | unsigned int irq = irqd_to_hwirq(irqd); |
44 | unsigned int irq_off = irq % 32; | 44 | unsigned int irq_off = irq % 32; |
diff --git a/drivers/irqchip/irq-vt8500.c b/drivers/irqchip/irq-vt8500.c index d97059550a2c..1846e7d66681 100644 --- a/drivers/irqchip/irq-vt8500.c +++ b/drivers/irqchip/irq-vt8500.c | |||
@@ -178,7 +178,8 @@ static struct irq_domain_ops vt8500_irq_domain_ops = { | |||
178 | .xlate = irq_domain_xlate_onecell, | 178 | .xlate = irq_domain_xlate_onecell, |
179 | }; | 179 | }; |
180 | 180 | ||
181 | asmlinkage void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs) | 181 | static asmlinkage |
182 | void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs) | ||
182 | { | 183 | { |
183 | u32 stat, i; | 184 | u32 stat, i; |
184 | int irqnr, virq; | 185 | int irqnr, virq; |
@@ -203,7 +204,8 @@ asmlinkage void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs) | |||
203 | } | 204 | } |
204 | } | 205 | } |
205 | 206 | ||
206 | int __init vt8500_irq_init(struct device_node *node, struct device_node *parent) | 207 | static int __init vt8500_irq_init(struct device_node *node, |
208 | struct device_node *parent) | ||
207 | { | 209 | { |
208 | int irq, i; | 210 | int irq, i; |
209 | struct device_node *np = node; | 211 | struct device_node *np = node; |
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 10e663ab1f4a..452d6f2ba21d 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c | |||
@@ -275,7 +275,7 @@ int irq_alloc_domain_generic_chips(struct irq_domain *d, int irqs_per_chip, | |||
275 | if (d->gc) | 275 | if (d->gc) |
276 | return -EBUSY; | 276 | return -EBUSY; |
277 | 277 | ||
278 | numchips = d->revmap_size / irqs_per_chip; | 278 | numchips = DIV_ROUND_UP(d->revmap_size, irqs_per_chip); |
279 | if (!numchips) | 279 | if (!numchips) |
280 | return -EINVAL; | 280 | return -EINVAL; |
281 | 281 | ||