aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-iop13xx
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-05-07 11:44:04 -0400
committerThomas Gleixner <tglx@linutronix.de>2014-05-16 08:05:18 -0400
commit37ebbcff78375bfa69eb69748ef00f577b7c1c6c (patch)
tree6881b33163a27f0cd233178af737590edaf76378 /arch/arm/mach-iop13xx
parent67bb90fd743ecf637f2e36eb9a39afcad08ef523 (diff)
arm: iop13xx: Use sparse irqs for MSI
No need for a private allocator. The core code handles it already. Allocate the non MSI irqs right at boot time via machine_desc->nr_irqs and let the sparse core handle the MSI space. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Grant Likely <grant.likely@linaro.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20140507154333.809210026@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/arm/mach-iop13xx')
-rw-r--r--arch/arm/mach-iop13xx/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-iop13xx/include/mach/time.h3
-rw-r--r--arch/arm/mach-iop13xx/iq81340mc.c1
-rw-r--r--arch/arm/mach-iop13xx/iq81340sc.c1
-rw-r--r--arch/arm/mach-iop13xx/msi.c51
-rw-r--r--arch/arm/mach-iop13xx/setup.c1
-rw-r--r--arch/arm/mach-iop13xx/tpmi.c1
7 files changed, 18 insertions, 42 deletions
diff --git a/arch/arm/mach-iop13xx/include/mach/irqs.h b/arch/arm/mach-iop13xx/include/mach/irqs.h
index 054e7acb5bfa..e8d24d32121a 100644
--- a/arch/arm/mach-iop13xx/include/mach/irqs.h
+++ b/arch/arm/mach-iop13xx/include/mach/irqs.h
@@ -191,6 +191,4 @@ static inline u32 read_intpnd_3(void)
191#define NR_IOP13XX_IRQS (IRQ_IOP13XX_HPI + 1) 191#define NR_IOP13XX_IRQS (IRQ_IOP13XX_HPI + 1)
192#endif 192#endif
193 193
194#define NR_IRQS NR_IOP13XX_IRQS
195
196#endif /* _IOP13XX_IRQ_H_ */ 194#endif /* _IOP13XX_IRQ_H_ */
diff --git a/arch/arm/mach-iop13xx/include/mach/time.h b/arch/arm/mach-iop13xx/include/mach/time.h
index f1c00d6d560b..15bc9bb78a6b 100644
--- a/arch/arm/mach-iop13xx/include/mach/time.h
+++ b/arch/arm/mach-iop13xx/include/mach/time.h
@@ -1,5 +1,8 @@
1#ifndef _IOP13XX_TIME_H_ 1#ifndef _IOP13XX_TIME_H_
2#define _IOP13XX_TIME_H_ 2#define _IOP13XX_TIME_H_
3
4#include <mach/irqs.h>
5
3#define IRQ_IOP_TIMER0 IRQ_IOP13XX_TIMER0 6#define IRQ_IOP_TIMER0 IRQ_IOP13XX_TIMER0
4 7
5#define IOP_TMR_EN 0x02 8#define IOP_TMR_EN 0x02
diff --git a/arch/arm/mach-iop13xx/iq81340mc.c b/arch/arm/mach-iop13xx/iq81340mc.c
index 02a8228ac2d3..9cd07d396093 100644
--- a/arch/arm/mach-iop13xx/iq81340mc.c
+++ b/arch/arm/mach-iop13xx/iq81340mc.c
@@ -93,4 +93,5 @@ MACHINE_START(IQ81340MC, "Intel IQ81340MC")
93 .init_time = iq81340mc_timer_init, 93 .init_time = iq81340mc_timer_init,
94 .init_machine = iq81340mc_init, 94 .init_machine = iq81340mc_init,
95 .restart = iop13xx_restart, 95 .restart = iop13xx_restart,
96 .nr_irqs = NR_IOP13XX_IRQS,
96MACHINE_END 97MACHINE_END
diff --git a/arch/arm/mach-iop13xx/iq81340sc.c b/arch/arm/mach-iop13xx/iq81340sc.c
index 1b80f10722b3..b3ec11cb707e 100644
--- a/arch/arm/mach-iop13xx/iq81340sc.c
+++ b/arch/arm/mach-iop13xx/iq81340sc.c
@@ -95,4 +95,5 @@ MACHINE_START(IQ81340SC, "Intel IQ81340SC")
95 .init_time = iq81340sc_timer_init, 95 .init_time = iq81340sc_timer_init,
96 .init_machine = iq81340sc_init, 96 .init_machine = iq81340sc_init,
97 .restart = iop13xx_restart, 97 .restart = iop13xx_restart,
98 .nr_irqs = NR_IOP13XX_IRQS,
98MACHINE_END 99MACHINE_END
diff --git a/arch/arm/mach-iop13xx/msi.c b/arch/arm/mach-iop13xx/msi.c
index 560d5b2dec22..655072dd9fe8 100644
--- a/arch/arm/mach-iop13xx/msi.c
+++ b/arch/arm/mach-iop13xx/msi.c
@@ -24,10 +24,6 @@
24#include <asm/mach/irq.h> 24#include <asm/mach/irq.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26 26
27
28#define IOP13XX_NUM_MSI_IRQS 128
29static DECLARE_BITMAP(msi_irq_in_use, IOP13XX_NUM_MSI_IRQS);
30
31/* IMIPR0 CP6 R8 Page 1 27/* IMIPR0 CP6 R8 Page 1
32 */ 28 */
33static u32 read_imipr_0(void) 29static u32 read_imipr_0(void)
@@ -121,41 +117,6 @@ void __init iop13xx_msi_init(void)
121 irq_set_chained_handler(IRQ_IOP13XX_INBD_MSI, iop13xx_msi_handler); 117 irq_set_chained_handler(IRQ_IOP13XX_INBD_MSI, iop13xx_msi_handler);
122} 118}
123 119
124/*
125 * Dynamic irq allocate and deallocation
126 */
127int create_irq(void)
128{
129 int irq, pos;
130
131again:
132 pos = find_first_zero_bit(msi_irq_in_use, IOP13XX_NUM_MSI_IRQS);
133 irq = IRQ_IOP13XX_MSI_0 + pos;
134 if (irq > NR_IRQS)
135 return -ENOSPC;
136 /* test_and_set_bit operates on 32-bits at a time */
137 if (test_and_set_bit(pos, msi_irq_in_use))
138 goto again;
139
140 dynamic_irq_init(irq);
141
142 return irq;
143}
144
145void destroy_irq(unsigned int irq)
146{
147 int pos = irq - IRQ_IOP13XX_MSI_0;
148
149 dynamic_irq_cleanup(irq);
150
151 clear_bit(pos, msi_irq_in_use);
152}
153
154void arch_teardown_msi_irq(unsigned int irq)
155{
156 destroy_irq(irq);
157}
158
159static void iop13xx_msi_nop(struct irq_data *d) 120static void iop13xx_msi_nop(struct irq_data *d)
160{ 121{
161 return; 122 return;
@@ -172,12 +133,17 @@ static struct irq_chip iop13xx_msi_chip = {
172 133
173int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) 134int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
174{ 135{
175 int id, irq = create_irq(); 136 int id, irq = irq_alloc_desc_from(IRQ_IOP13XX_MSI_0, -1);
176 struct msi_msg msg; 137 struct msi_msg msg;
177 138
178 if (irq < 0) 139 if (irq < 0)
179 return irq; 140 return irq;
180 141
142 if (irq >= NR_IOP13XX_IRQS) {
143 irq_free_desc(irq);
144 return -ENOSPC;
145 }
146
181 irq_set_msi_desc(irq, desc); 147 irq_set_msi_desc(irq, desc);
182 148
183 msg.address_hi = 0x0; 149 msg.address_hi = 0x0;
@@ -191,3 +157,8 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
191 157
192 return 0; 158 return 0;
193} 159}
160
161void arch_teardown_msi_irq(unsigned int irq)
162{
163 irq_free_desc(irq);
164}
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c
index 96e6c7a6793b..bca96f433495 100644
--- a/arch/arm/mach-iop13xx/setup.c
+++ b/arch/arm/mach-iop13xx/setup.c
@@ -27,6 +27,7 @@
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/hardware/iop_adma.h> 29#include <asm/hardware/iop_adma.h>
30#include <mach/irqs.h>
30 31
31#define IOP13XX_UART_XTAL 33334000 32#define IOP13XX_UART_XTAL 33334000
32#define IOP13XX_SETUP_DEBUG 0 33#define IOP13XX_SETUP_DEBUG 0
diff --git a/arch/arm/mach-iop13xx/tpmi.c b/arch/arm/mach-iop13xx/tpmi.c
index 6fdad7a0425a..db511ec2b1df 100644
--- a/arch/arm/mach-iop13xx/tpmi.c
+++ b/arch/arm/mach-iop13xx/tpmi.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/sizes.h> 26#include <asm/sizes.h>
27#include <mach/irqs.h>
27 28
28/* assumes CONTROLLER_ONLY# is never asserted in the ESSR register */ 29/* assumes CONTROLLER_ONLY# is never asserted in the ESSR register */
29#define IOP13XX_TPMI_MMR(dev) IOP13XX_REG_ADDR32_PHYS(0x48000 + (dev << 12)) 30#define IOP13XX_TPMI_MMR(dev) IOP13XX_REG_ADDR32_PHYS(0x48000 + (dev << 12))