diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-12 23:23:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-12 23:23:11 -0500 |
commit | f082f02c4731900a5065de69eb0d8cb5aab66196 (patch) | |
tree | b7d3c90cb087d1ebcc0ab945bdb618c78b38051d /arch/microblaze | |
parent | 9465d9cc31fa732089cd8bec9f1bdfcdc174a5ce (diff) | |
parent | 2cae3a1ed36ded9b4c8859feeea73827f1c2130d (diff) |
Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq updates from Thomas Gleixner:
"The irq department provides:
- a major update to the auto affinity management code, which is used
by multi-queue devices
- move of the microblaze irq chip driver into the common driver code
so it can be shared between microblaze, powerpc and MIPS
- a series of updates to the ARM GICV3 interrupt controller
- the usual pile of fixes and small improvements all over the place"
* 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (25 commits)
powerpc/virtex: Use generic xilinx irqchip driver
irqchip/xilinx: Try to fall back if xlnx,kind-of-intr not provided
irqchip/xilinx: Add support for parent intc
irqchip/xilinx: Rename get_irq to xintc_get_irq
irqchip/xilinx: Restructure and use jump label api
irqchip/xilinx: Clean up print messages
microblaze/irqchip: Move intc driver to irqchip
ARM: virt: Select ARM_GIC_V3_ITS
ARM: gic-v3-its: Add 32bit support to GICv3 ITS
irqchip/gic-v3-its: Specialise readq and writeq accesses
irqchip/gic-v3-its: Specialise flush_dcache operation
irqchip/gic-v3-its: Narrow down Entry Size when used as a divider
irqchip/gic-v3-its: Change unsigned types for AArch32 compatibility
irqchip/gic-v3: Use nops macro for Cavium ThunderX erratum 23154
irqchip/gic-v3: Convert arm64 GIC accessors to {read,write}_sysreg_s
genirq/msi: Drop artificial PCI dependency
irqchip/bcm7038-l1: Implement irq_cpu_offline() callback
genirq/affinity: Use default affinity mask for reserved vectors
genirq/affinity: Take reserved vectors into account when spreading irqs
PCI: Remove the irq_affinity mask from struct pci_dev
...
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/Kconfig | 1 | ||||
-rw-r--r-- | arch/microblaze/include/asm/irq.h | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/intc.c | 196 | ||||
-rw-r--r-- | arch/microblaze/kernel/irq.c | 4 |
5 files changed, 5 insertions, 200 deletions
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 86f65721e629..85885a501dce 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -27,6 +27,7 @@ config MICROBLAZE | |||
27 | select HAVE_MEMBLOCK_NODE_MAP | 27 | select HAVE_MEMBLOCK_NODE_MAP |
28 | select HAVE_OPROFILE | 28 | select HAVE_OPROFILE |
29 | select IRQ_DOMAIN | 29 | select IRQ_DOMAIN |
30 | select XILINX_INTC | ||
30 | select MODULES_USE_ELF_RELA | 31 | select MODULES_USE_ELF_RELA |
31 | select OF | 32 | select OF |
32 | select OF_EARLY_FLATTREE | 33 | select OF_EARLY_FLATTREE |
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index bab3b1393ad4..d785defeeed5 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h | |||
@@ -16,6 +16,6 @@ struct pt_regs; | |||
16 | extern void do_IRQ(struct pt_regs *regs); | 16 | extern void do_IRQ(struct pt_regs *regs); |
17 | 17 | ||
18 | /* should be defined in each interrupt controller driver */ | 18 | /* should be defined in each interrupt controller driver */ |
19 | extern unsigned int get_irq(void); | 19 | extern unsigned int xintc_get_irq(void); |
20 | 20 | ||
21 | #endif /* _ASM_MICROBLAZE_IRQ_H */ | 21 | #endif /* _ASM_MICROBLAZE_IRQ_H */ |
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile index f08bacaf8a95..e098381af928 100644 --- a/arch/microblaze/kernel/Makefile +++ b/arch/microblaze/kernel/Makefile | |||
@@ -15,7 +15,7 @@ endif | |||
15 | extra-y := head.o vmlinux.lds | 15 | extra-y := head.o vmlinux.lds |
16 | 16 | ||
17 | obj-y += dma.o exceptions.o \ | 17 | obj-y += dma.o exceptions.o \ |
18 | hw_exception_handler.o intc.o irq.o \ | 18 | hw_exception_handler.o irq.o \ |
19 | platform.o process.o prom.o ptrace.o \ | 19 | platform.o process.o prom.o ptrace.o \ |
20 | reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o | 20 | reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o |
21 | 21 | ||
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c deleted file mode 100644 index 90bec7d71f85..000000000000 --- a/arch/microblaze/kernel/intc.c +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2013 Michal Simek <monstr@monstr.eu> | ||
3 | * Copyright (C) 2012-2013 Xilinx, Inc. | ||
4 | * Copyright (C) 2007-2009 PetaLogix | ||
5 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/irqdomain.h> | ||
13 | #include <linux/irq.h> | ||
14 | #include <linux/irqchip.h> | ||
15 | #include <linux/of_address.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/bug.h> | ||
18 | |||
19 | static void __iomem *intc_baseaddr; | ||
20 | |||
21 | /* No one else should require these constants, so define them locally here. */ | ||
22 | #define ISR 0x00 /* Interrupt Status Register */ | ||
23 | #define IPR 0x04 /* Interrupt Pending Register */ | ||
24 | #define IER 0x08 /* Interrupt Enable Register */ | ||
25 | #define IAR 0x0c /* Interrupt Acknowledge Register */ | ||
26 | #define SIE 0x10 /* Set Interrupt Enable bits */ | ||
27 | #define CIE 0x14 /* Clear Interrupt Enable bits */ | ||
28 | #define IVR 0x18 /* Interrupt Vector Register */ | ||
29 | #define MER 0x1c /* Master Enable Register */ | ||
30 | |||
31 | #define MER_ME (1<<0) | ||
32 | #define MER_HIE (1<<1) | ||
33 | |||
34 | static unsigned int (*read_fn)(void __iomem *); | ||
35 | static void (*write_fn)(u32, void __iomem *); | ||
36 | |||
37 | static void intc_write32(u32 val, void __iomem *addr) | ||
38 | { | ||
39 | iowrite32(val, addr); | ||
40 | } | ||
41 | |||
42 | static unsigned int intc_read32(void __iomem *addr) | ||
43 | { | ||
44 | return ioread32(addr); | ||
45 | } | ||
46 | |||
47 | static void intc_write32_be(u32 val, void __iomem *addr) | ||
48 | { | ||
49 | iowrite32be(val, addr); | ||
50 | } | ||
51 | |||
52 | static unsigned int intc_read32_be(void __iomem *addr) | ||
53 | { | ||
54 | return ioread32be(addr); | ||
55 | } | ||
56 | |||
57 | static void intc_enable_or_unmask(struct irq_data *d) | ||
58 | { | ||
59 | unsigned long mask = 1 << d->hwirq; | ||
60 | |||
61 | pr_debug("enable_or_unmask: %ld\n", d->hwirq); | ||
62 | |||
63 | /* ack level irqs because they can't be acked during | ||
64 | * ack function since the handle_level_irq function | ||
65 | * acks the irq before calling the interrupt handler | ||
66 | */ | ||
67 | if (irqd_is_level_type(d)) | ||
68 | write_fn(mask, intc_baseaddr + IAR); | ||
69 | |||
70 | write_fn(mask, intc_baseaddr + SIE); | ||
71 | } | ||
72 | |||
73 | static void intc_disable_or_mask(struct irq_data *d) | ||
74 | { | ||
75 | pr_debug("disable: %ld\n", d->hwirq); | ||
76 | write_fn(1 << d->hwirq, intc_baseaddr + CIE); | ||
77 | } | ||
78 | |||
79 | static void intc_ack(struct irq_data *d) | ||
80 | { | ||
81 | pr_debug("ack: %ld\n", d->hwirq); | ||
82 | write_fn(1 << d->hwirq, intc_baseaddr + IAR); | ||
83 | } | ||
84 | |||
85 | static void intc_mask_ack(struct irq_data *d) | ||
86 | { | ||
87 | unsigned long mask = 1 << d->hwirq; | ||
88 | |||
89 | pr_debug("disable_and_ack: %ld\n", d->hwirq); | ||
90 | write_fn(mask, intc_baseaddr + CIE); | ||
91 | write_fn(mask, intc_baseaddr + IAR); | ||
92 | } | ||
93 | |||
94 | static struct irq_chip intc_dev = { | ||
95 | .name = "Xilinx INTC", | ||
96 | .irq_unmask = intc_enable_or_unmask, | ||
97 | .irq_mask = intc_disable_or_mask, | ||
98 | .irq_ack = intc_ack, | ||
99 | .irq_mask_ack = intc_mask_ack, | ||
100 | }; | ||
101 | |||
102 | static struct irq_domain *root_domain; | ||
103 | |||
104 | unsigned int get_irq(void) | ||
105 | { | ||
106 | unsigned int hwirq, irq = -1; | ||
107 | |||
108 | hwirq = read_fn(intc_baseaddr + IVR); | ||
109 | if (hwirq != -1U) | ||
110 | irq = irq_find_mapping(root_domain, hwirq); | ||
111 | |||
112 | pr_debug("get_irq: hwirq=%d, irq=%d\n", hwirq, irq); | ||
113 | |||
114 | return irq; | ||
115 | } | ||
116 | |||
117 | static int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) | ||
118 | { | ||
119 | u32 intr_mask = (u32)d->host_data; | ||
120 | |||
121 | if (intr_mask & (1 << hw)) { | ||
122 | irq_set_chip_and_handler_name(irq, &intc_dev, | ||
123 | handle_edge_irq, "edge"); | ||
124 | irq_clear_status_flags(irq, IRQ_LEVEL); | ||
125 | } else { | ||
126 | irq_set_chip_and_handler_name(irq, &intc_dev, | ||
127 | handle_level_irq, "level"); | ||
128 | irq_set_status_flags(irq, IRQ_LEVEL); | ||
129 | } | ||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | static const struct irq_domain_ops xintc_irq_domain_ops = { | ||
134 | .xlate = irq_domain_xlate_onetwocell, | ||
135 | .map = xintc_map, | ||
136 | }; | ||
137 | |||
138 | static int __init xilinx_intc_of_init(struct device_node *intc, | ||
139 | struct device_node *parent) | ||
140 | { | ||
141 | u32 nr_irq, intr_mask; | ||
142 | int ret; | ||
143 | |||
144 | intc_baseaddr = of_iomap(intc, 0); | ||
145 | BUG_ON(!intc_baseaddr); | ||
146 | |||
147 | ret = of_property_read_u32(intc, "xlnx,num-intr-inputs", &nr_irq); | ||
148 | if (ret < 0) { | ||
149 | pr_err("%s: unable to read xlnx,num-intr-inputs\n", __func__); | ||
150 | return ret; | ||
151 | } | ||
152 | |||
153 | ret = of_property_read_u32(intc, "xlnx,kind-of-intr", &intr_mask); | ||
154 | if (ret < 0) { | ||
155 | pr_err("%s: unable to read xlnx,kind-of-intr\n", __func__); | ||
156 | return ret; | ||
157 | } | ||
158 | |||
159 | if (intr_mask >> nr_irq) | ||
160 | pr_warn("%s: mismatch in kind-of-intr param\n", __func__); | ||
161 | |||
162 | pr_info("%s: num_irq=%d, edge=0x%x\n", | ||
163 | intc->full_name, nr_irq, intr_mask); | ||
164 | |||
165 | write_fn = intc_write32; | ||
166 | read_fn = intc_read32; | ||
167 | |||
168 | /* | ||
169 | * Disable all external interrupts until they are | ||
170 | * explicity requested. | ||
171 | */ | ||
172 | write_fn(0, intc_baseaddr + IER); | ||
173 | |||
174 | /* Acknowledge any pending interrupts just in case. */ | ||
175 | write_fn(0xffffffff, intc_baseaddr + IAR); | ||
176 | |||
177 | /* Turn on the Master Enable. */ | ||
178 | write_fn(MER_HIE | MER_ME, intc_baseaddr + MER); | ||
179 | if (!(read_fn(intc_baseaddr + MER) & (MER_HIE | MER_ME))) { | ||
180 | write_fn = intc_write32_be; | ||
181 | read_fn = intc_read32_be; | ||
182 | write_fn(MER_HIE | MER_ME, intc_baseaddr + MER); | ||
183 | } | ||
184 | |||
185 | /* Yeah, okay, casting the intr_mask to a void* is butt-ugly, but I'm | ||
186 | * lazy and Michal can clean it up to something nicer when he tests | ||
187 | * and commits this patch. ~~gcl */ | ||
188 | root_domain = irq_domain_add_linear(intc, nr_irq, &xintc_irq_domain_ops, | ||
189 | (void *)intr_mask); | ||
190 | |||
191 | irq_set_default_host(root_domain); | ||
192 | |||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | IRQCHIP_DECLARE(xilinx_intc, "xlnx,xps-intc-1.00.a", xilinx_intc_of_init); | ||
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c index 11e24de91aa4..903dad822fad 100644 --- a/arch/microblaze/kernel/irq.c +++ b/arch/microblaze/kernel/irq.c | |||
@@ -29,12 +29,12 @@ void __irq_entry do_IRQ(struct pt_regs *regs) | |||
29 | trace_hardirqs_off(); | 29 | trace_hardirqs_off(); |
30 | 30 | ||
31 | irq_enter(); | 31 | irq_enter(); |
32 | irq = get_irq(); | 32 | irq = xintc_get_irq(); |
33 | next_irq: | 33 | next_irq: |
34 | BUG_ON(!irq); | 34 | BUG_ON(!irq); |
35 | generic_handle_irq(irq); | 35 | generic_handle_irq(irq); |
36 | 36 | ||
37 | irq = get_irq(); | 37 | irq = xintc_get_irq(); |
38 | if (irq != -1U) { | 38 | if (irq != -1U) { |
39 | pr_debug("next irq: %d\n", irq); | 39 | pr_debug("next irq: %d\n", irq); |
40 | ++concurrent_irq; | 40 | ++concurrent_irq; |