diff options
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/include/asm/irq.h | 11 | ||||
-rw-r--r-- | arch/microblaze/kernel/intc.c | 28 | ||||
-rw-r--r-- | arch/microblaze/kernel/irq.c | 11 |
3 files changed, 30 insertions, 20 deletions
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index cc54187f3d38..b116a825de77 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h | |||
@@ -9,7 +9,14 @@ | |||
9 | #ifndef _ASM_MICROBLAZE_IRQ_H | 9 | #ifndef _ASM_MICROBLAZE_IRQ_H |
10 | #define _ASM_MICROBLAZE_IRQ_H | 10 | #define _ASM_MICROBLAZE_IRQ_H |
11 | 11 | ||
12 | #define NR_IRQS 32 | 12 | |
13 | /* | ||
14 | * Linux IRQ# is currently offset by one to map to the hardware | ||
15 | * irq number. So hardware IRQ0 maps to Linux irq 1. | ||
16 | */ | ||
17 | #define NO_IRQ_OFFSET 1 | ||
18 | #define IRQ_OFFSET NO_IRQ_OFFSET | ||
19 | #define NR_IRQS (32 + IRQ_OFFSET) | ||
13 | #include <asm-generic/irq.h> | 20 | #include <asm-generic/irq.h> |
14 | 21 | ||
15 | /* This type is the placeholder for a hardware interrupt number. It has to | 22 | /* This type is the placeholder for a hardware interrupt number. It has to |
@@ -20,7 +27,7 @@ typedef unsigned long irq_hw_number_t; | |||
20 | 27 | ||
21 | extern unsigned int nr_irq; | 28 | extern unsigned int nr_irq; |
22 | 29 | ||
23 | #define NO_IRQ (-1) | 30 | #define NO_IRQ 0 |
24 | 31 | ||
25 | struct pt_regs; | 32 | struct pt_regs; |
26 | extern void do_IRQ(struct pt_regs *regs); | 33 | extern void do_IRQ(struct pt_regs *regs); |
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c index 1293098ff70d..44b177e2ab12 100644 --- a/arch/microblaze/kernel/intc.c +++ b/arch/microblaze/kernel/intc.c | |||
@@ -42,8 +42,9 @@ unsigned int nr_irq; | |||
42 | 42 | ||
43 | static void intc_enable_or_unmask(struct irq_data *d) | 43 | static void intc_enable_or_unmask(struct irq_data *d) |
44 | { | 44 | { |
45 | unsigned long mask = 1 << d->irq; | 45 | unsigned long mask = 1 << d->hwirq; |
46 | pr_debug("enable_or_unmask: %d\n", d->irq); | 46 | |
47 | pr_debug("enable_or_unmask: %ld\n", d->hwirq); | ||
47 | out_be32(INTC_BASE + SIE, mask); | 48 | out_be32(INTC_BASE + SIE, mask); |
48 | 49 | ||
49 | /* ack level irqs because they can't be acked during | 50 | /* ack level irqs because they can't be acked during |
@@ -56,20 +57,21 @@ static void intc_enable_or_unmask(struct irq_data *d) | |||
56 | 57 | ||
57 | static void intc_disable_or_mask(struct irq_data *d) | 58 | static void intc_disable_or_mask(struct irq_data *d) |
58 | { | 59 | { |
59 | pr_debug("disable: %d\n", d->irq); | 60 | pr_debug("disable: %ld\n", d->hwirq); |
60 | out_be32(INTC_BASE + CIE, 1 << d->irq); | 61 | out_be32(INTC_BASE + CIE, 1 << d->hwirq); |
61 | } | 62 | } |
62 | 63 | ||
63 | static void intc_ack(struct irq_data *d) | 64 | static void intc_ack(struct irq_data *d) |
64 | { | 65 | { |
65 | pr_debug("ack: %d\n", d->irq); | 66 | pr_debug("ack: %ld\n", d->hwirq); |
66 | out_be32(INTC_BASE + IAR, 1 << d->irq); | 67 | out_be32(INTC_BASE + IAR, 1 << d->hwirq); |
67 | } | 68 | } |
68 | 69 | ||
69 | static void intc_mask_ack(struct irq_data *d) | 70 | static void intc_mask_ack(struct irq_data *d) |
70 | { | 71 | { |
71 | unsigned long mask = 1 << d->irq; | 72 | unsigned long mask = 1 << d->hwirq; |
72 | pr_debug("disable_and_ack: %d\n", d->irq); | 73 | |
74 | pr_debug("disable_and_ack: %ld\n", d->hwirq); | ||
73 | out_be32(INTC_BASE + CIE, mask); | 75 | out_be32(INTC_BASE + CIE, mask); |
74 | out_be32(INTC_BASE + IAR, mask); | 76 | out_be32(INTC_BASE + IAR, mask); |
75 | } | 77 | } |
@@ -91,7 +93,7 @@ unsigned int get_irq(struct pt_regs *regs) | |||
91 | * order to handle multiple interrupt controllers. It currently | 93 | * order to handle multiple interrupt controllers. It currently |
92 | * is hardcoded to check for interrupts only on the first INTC. | 94 | * is hardcoded to check for interrupts only on the first INTC. |
93 | */ | 95 | */ |
94 | irq = in_be32(INTC_BASE + IVR); | 96 | irq = in_be32(INTC_BASE + IVR) + NO_IRQ_OFFSET; |
95 | pr_debug("get_irq: %d\n", irq); | 97 | pr_debug("get_irq: %d\n", irq); |
96 | 98 | ||
97 | return irq; | 99 | return irq; |
@@ -116,8 +118,7 @@ void __init init_IRQ(void) | |||
116 | intc = of_find_compatible_node(NULL, NULL, "xlnx,xps-intc-1.00.a"); | 118 | intc = of_find_compatible_node(NULL, NULL, "xlnx,xps-intc-1.00.a"); |
117 | BUG_ON(!intc); | 119 | BUG_ON(!intc); |
118 | 120 | ||
119 | intc_baseaddr = be32_to_cpup(of_get_property(intc, | 121 | intc_baseaddr = be32_to_cpup(of_get_property(intc, "reg", NULL)); |
120 | "reg", NULL)); | ||
121 | intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE); | 122 | intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE); |
122 | nr_irq = be32_to_cpup(of_get_property(intc, | 123 | nr_irq = be32_to_cpup(of_get_property(intc, |
123 | "xlnx,num-intr-inputs", NULL)); | 124 | "xlnx,num-intr-inputs", NULL)); |
@@ -145,8 +146,8 @@ void __init init_IRQ(void) | |||
145 | /* Turn on the Master Enable. */ | 146 | /* Turn on the Master Enable. */ |
146 | out_be32(intc_baseaddr + MER, MER_HIE | MER_ME); | 147 | out_be32(intc_baseaddr + MER, MER_HIE | MER_ME); |
147 | 148 | ||
148 | for (i = 0; i < nr_irq; ++i) { | 149 | for (i = IRQ_OFFSET; i < (nr_irq + IRQ_OFFSET); ++i) { |
149 | if (intr_mask & (0x00000001 << i)) { | 150 | if (intr_mask & (0x00000001 << (i - IRQ_OFFSET))) { |
150 | irq_set_chip_and_handler_name(i, &intc_dev, | 151 | irq_set_chip_and_handler_name(i, &intc_dev, |
151 | handle_edge_irq, "edge"); | 152 | handle_edge_irq, "edge"); |
152 | irq_clear_status_flags(i, IRQ_LEVEL); | 153 | irq_clear_status_flags(i, IRQ_LEVEL); |
@@ -155,5 +156,6 @@ void __init init_IRQ(void) | |||
155 | handle_level_irq, "level"); | 156 | handle_level_irq, "level"); |
156 | irq_set_status_flags(i, IRQ_LEVEL); | 157 | irq_set_status_flags(i, IRQ_LEVEL); |
157 | } | 158 | } |
159 | irq_get_irq_data(i)->hwirq = i - IRQ_OFFSET; | ||
158 | } | 160 | } |
159 | } | 161 | } |
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c index e5d63a89b9b2..bbebcae72c02 100644 --- a/arch/microblaze/kernel/irq.c +++ b/arch/microblaze/kernel/irq.c | |||
@@ -33,11 +33,12 @@ void __irq_entry do_IRQ(struct pt_regs *regs) | |||
33 | irq_enter(); | 33 | irq_enter(); |
34 | irq = get_irq(regs); | 34 | irq = get_irq(regs); |
35 | next_irq: | 35 | next_irq: |
36 | BUG_ON(irq == -1U); | 36 | BUG_ON(!irq); |
37 | generic_handle_irq(irq); | 37 | /* Substract 1 because of get_irq */ |
38 | generic_handle_irq(irq + IRQ_OFFSET - NO_IRQ_OFFSET); | ||
38 | 39 | ||
39 | irq = get_irq(regs); | 40 | irq = get_irq(regs); |
40 | if (irq != -1U) { | 41 | if (irq) { |
41 | pr_debug("next irq: %d\n", irq); | 42 | pr_debug("next irq: %d\n", irq); |
42 | ++concurrent_irq; | 43 | ++concurrent_irq; |
43 | goto next_irq; | 44 | goto next_irq; |
@@ -52,13 +53,13 @@ next_irq: | |||
52 | intc without any cascades or any connection that's why mapping is 1:1 */ | 53 | intc without any cascades or any connection that's why mapping is 1:1 */ |
53 | unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq) | 54 | unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq) |
54 | { | 55 | { |
55 | return hwirq; | 56 | return hwirq + IRQ_OFFSET; |
56 | } | 57 | } |
57 | EXPORT_SYMBOL_GPL(irq_create_mapping); | 58 | EXPORT_SYMBOL_GPL(irq_create_mapping); |
58 | 59 | ||
59 | unsigned int irq_create_of_mapping(struct device_node *controller, | 60 | unsigned int irq_create_of_mapping(struct device_node *controller, |
60 | const u32 *intspec, unsigned int intsize) | 61 | const u32 *intspec, unsigned int intsize) |
61 | { | 62 | { |
62 | return intspec[0]; | 63 | return intspec[0] + IRQ_OFFSET; |
63 | } | 64 | } |
64 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | 65 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); |