Commit 37ebbcff authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarGrant 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.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 67bb90fd
...@@ -480,6 +480,7 @@ config ARCH_IOP13XX ...@@ -480,6 +480,7 @@ config ARCH_IOP13XX
select PCI select PCI
select PLAT_IOP select PLAT_IOP
select VMSPLIT_1G select VMSPLIT_1G
select SPARSE_IRQ
help help
Support for Intel's IOP13XX (XScale) family of processors. Support for Intel's IOP13XX (XScale) family of processors.
......
...@@ -191,6 +191,4 @@ static inline u32 read_intpnd_3(void) ...@@ -191,6 +191,4 @@ static inline u32 read_intpnd_3(void)
#define NR_IOP13XX_IRQS (IRQ_IOP13XX_HPI + 1) #define NR_IOP13XX_IRQS (IRQ_IOP13XX_HPI + 1)
#endif #endif
#define NR_IRQS NR_IOP13XX_IRQS
#endif /* _IOP13XX_IRQ_H_ */ #endif /* _IOP13XX_IRQ_H_ */
#ifndef _IOP13XX_TIME_H_ #ifndef _IOP13XX_TIME_H_
#define _IOP13XX_TIME_H_ #define _IOP13XX_TIME_H_
#include <mach/irqs.h>
#define IRQ_IOP_TIMER0 IRQ_IOP13XX_TIMER0 #define IRQ_IOP_TIMER0 IRQ_IOP13XX_TIMER0
#define IOP_TMR_EN 0x02 #define IOP_TMR_EN 0x02
......
...@@ -93,4 +93,5 @@ MACHINE_START(IQ81340MC, "Intel IQ81340MC") ...@@ -93,4 +93,5 @@ MACHINE_START(IQ81340MC, "Intel IQ81340MC")
.init_time = iq81340mc_timer_init, .init_time = iq81340mc_timer_init,
.init_machine = iq81340mc_init, .init_machine = iq81340mc_init,
.restart = iop13xx_restart, .restart = iop13xx_restart,
.nr_irqs = NR_IOP13XX_IRQS,
MACHINE_END MACHINE_END
...@@ -95,4 +95,5 @@ MACHINE_START(IQ81340SC, "Intel IQ81340SC") ...@@ -95,4 +95,5 @@ MACHINE_START(IQ81340SC, "Intel IQ81340SC")
.init_time = iq81340sc_timer_init, .init_time = iq81340sc_timer_init,
.init_machine = iq81340sc_init, .init_machine = iq81340sc_init,
.restart = iop13xx_restart, .restart = iop13xx_restart,
.nr_irqs = NR_IOP13XX_IRQS,
MACHINE_END MACHINE_END
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/irq.h> #include <asm/irq.h>
#define IOP13XX_NUM_MSI_IRQS 128
static DECLARE_BITMAP(msi_irq_in_use, IOP13XX_NUM_MSI_IRQS);
/* IMIPR0 CP6 R8 Page 1 /* IMIPR0 CP6 R8 Page 1
*/ */
static u32 read_imipr_0(void) static u32 read_imipr_0(void)
...@@ -121,41 +117,6 @@ void __init iop13xx_msi_init(void) ...@@ -121,41 +117,6 @@ void __init iop13xx_msi_init(void)
irq_set_chained_handler(IRQ_IOP13XX_INBD_MSI, iop13xx_msi_handler); irq_set_chained_handler(IRQ_IOP13XX_INBD_MSI, iop13xx_msi_handler);
} }
/*
* Dynamic irq allocate and deallocation
*/
int create_irq(void)
{
int irq, pos;
again:
pos = find_first_zero_bit(msi_irq_in_use, IOP13XX_NUM_MSI_IRQS);
irq = IRQ_IOP13XX_MSI_0 + pos;
if (irq > NR_IRQS)
return -ENOSPC;
/* test_and_set_bit operates on 32-bits at a time */
if (test_and_set_bit(pos, msi_irq_in_use))
goto again;
dynamic_irq_init(irq);
return irq;
}
void destroy_irq(unsigned int irq)
{
int pos = irq - IRQ_IOP13XX_MSI_0;
dynamic_irq_cleanup(irq);
clear_bit(pos, msi_irq_in_use);
}
void arch_teardown_msi_irq(unsigned int irq)
{
destroy_irq(irq);
}
static void iop13xx_msi_nop(struct irq_data *d) static void iop13xx_msi_nop(struct irq_data *d)
{ {
return; return;
...@@ -172,12 +133,17 @@ static struct irq_chip iop13xx_msi_chip = { ...@@ -172,12 +133,17 @@ static struct irq_chip iop13xx_msi_chip = {
int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
{ {
int id, irq = create_irq(); int id, irq = irq_alloc_desc_from(IRQ_IOP13XX_MSI_0, -1);
struct msi_msg msg; struct msi_msg msg;
if (irq < 0) if (irq < 0)
return irq; return irq;
if (irq >= NR_IOP13XX_IRQS) {
irq_free_desc(irq);
return -ENOSPC;
}
irq_set_msi_desc(irq, desc); irq_set_msi_desc(irq, desc);
msg.address_hi = 0x0; msg.address_hi = 0x0;
...@@ -191,3 +157,8 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) ...@@ -191,3 +157,8 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
return 0; return 0;
} }
void arch_teardown_msi_irq(unsigned int irq)
{
irq_free_desc(irq);
}
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/hardware/iop_adma.h> #include <asm/hardware/iop_adma.h>
#include <mach/irqs.h>
#define IOP13XX_UART_XTAL 33334000 #define IOP13XX_UART_XTAL 33334000
#define IOP13XX_SETUP_DEBUG 0 #define IOP13XX_SETUP_DEBUG 0
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/sizes.h> #include <asm/sizes.h>
#include <mach/irqs.h>
/* assumes CONTROLLER_ONLY# is never asserted in the ESSR register */ /* assumes CONTROLLER_ONLY# is never asserted in the ESSR register */
#define IOP13XX_TPMI_MMR(dev) IOP13XX_REG_ADDR32_PHYS(0x48000 + (dev << 12)) #define IOP13XX_TPMI_MMR(dev) IOP13XX_REG_ADDR32_PHYS(0x48000 + (dev << 12))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment