Skip to contentSkip to conversation

Enable SPARSE_IRQ for omap1

PATCH New Tony Lindgren 1 participant 5 messages May 4, 2015

Subsystems (3)
lore
Share & tools
lore

Tony Lindgren

author reviewer
#0 lore raw

cover Enable SPARSE_IRQ for omap1

Hi all,

Here are few patches to enable SPARSE_IRQ on omap1.

Note that after this set removing the users for irqs.h and making omap1 use the clock framework are needed to get close to multiarch booting on omap1.

These are against v4.1-rc1, and also require the MPUIO fix:

[PATCH] gpio: omap: Fix regression for MPUIO interrupts

Regards,

Tony

Tony Lindgren (4):
ARM: OMAP1: Move UART defines to prepare for sparse IRQ
ARM: OMAP1: Switch to use generic irqchip in preparation for sparse
IRQ
ARM: omap1: Switch to use MULTI_IRQ
ARM: OMAP1: Change interrupt numbering for sparse IRQ

 arch/arm/Kconfig                               |   2 +
 arch/arm/mach-omap1/ams-delta-fiq-handler.S    |   3 +-
 arch/arm/mach-omap1/board-ams-delta.c          |   1 +
 arch/arm/mach-omap1/board-fsample.c            |   1 +
 arch/arm/mach-omap1/board-generic.c            |   1 +
 arch/arm/mach-omap1/board-h2.c                 |   1 +
 arch/arm/mach-omap1/board-h3.c                 |   1 +
 arch/arm/mach-omap1/board-htcherald.c          |   1 +
 arch/arm/mach-omap1/board-innovator.c          |   1 +
 arch/arm/mach-omap1/board-nokia770.c           |   1 +
 arch/arm/mach-omap1/board-osk.c                |   1 +
 arch/arm/mach-omap1/board-palmte.c             |   1 +
 arch/arm/mach-omap1/board-palmtt.c             |   1 +
 arch/arm/mach-omap1/board-palmz71.c            |   1 +
 arch/arm/mach-omap1/board-perseus2.c           |   1 +
 arch/arm/mach-omap1/board-sx1.c                |   1 +
 arch/arm/mach-omap1/board-voiceblue.c          |   1 +
 arch/arm/mach-omap1/common.h                   |   5 +-
 arch/arm/mach-omap1/dma.c                      |   2 +-
 arch/arm/mach-omap1/i2c.c                      |   3 +-
 arch/arm/mach-omap1/include/mach/entry-macro.S |  39 ------
 arch/arm/mach-omap1/include/mach/irqs.h        | 124 ++++++++++---------
 arch/arm/mach-omap1/include/mach/serial.h      |   5 -
 arch/arm/mach-omap1/include/mach/soc.h         |   4 +
 arch/arm/mach-omap1/irq.c                      | 157 +++++++++++++++----------
 arch/arm/mach-omap1/timer.c                    |   4 +-
 arch/arm/plat-omap/dma.c                       |   4 +
 include/uapi/linux/serial_reg.h                |   3 +
 28 files changed, 190 insertions(+), 180 deletions(-)
 delete mode 100644 arch/arm/mach-omap1/include/mach/entry-macro.S
Signature · 1 line
2.1.4
author reviewer
#1 lore raw

PATCH 1/4 ARM: OMAP1: Move UART defines to prepare for sparse IRQ

These have been indirectly included via asm/irqs.h that has included mach/hardware.h unless SPARSE_IRQ is specified. Let's move them to where the other OMAP serial defines for 8250 are.

Cc Aaro Koskinen <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 arch/arm/mach-omap1/include/mach/serial.h | 5 -----
 include/uapi/linux/serial_reg.h           | 3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/mach-omap1/include/mach/serial.h +0 -5
index 2ce6a2d..4700e38 100644
@@ -27,11 +27,6 @@
  */
 #define OMAP_UART_INFO_OFS	0x3ffc
 
-/* OMAP1 serial ports */
-#define OMAP1_UART1_BASE	0xfffb0000
-#define OMAP1_UART2_BASE	0xfffb0800
-#define OMAP1_UART3_BASE	0xfffb9800
-
 #define OMAP_PORT_SHIFT		2
 #define OMAP7XX_PORT_SHIFT	0
 
include/uapi/linux/serial_reg.h +3 -0
index e9b4cb0..1e5ac4e7 100644
@@ -331,6 +331,9 @@
  * Extra serial register definitions for the internal UARTs
  * in TI OMAP processors.
  */
+#define OMAP1_UART1_BASE	0xfffb0000
+#define OMAP1_UART2_BASE	0xfffb0800
+#define OMAP1_UART3_BASE	0xfffb9800
 #define UART_OMAP_MDR1		0x08	/* Mode definition register */
 #define UART_OMAP_MDR2		0x09	/* Mode definition register 2 */
 #define UART_OMAP_SCR		0x10	/* Supplementary control register */
Signature · 1 line
2.1.4
author reviewer
#2 lore raw

PATCH 2/4 ARM: OMAP1: Switch to use generic irqchip in preparation for sparse IRQ

In reply to Tony Lindgren

Let's set up things ready for enabling sparse IRQ and remove the omap_read/write usage.

---
 arch/arm/mach-omap1/irq.c | 118 +++++++++++++++++++++++-----------------------
 1 file changed, 60 insertions(+), 58 deletions(-)
arch/arm/mach-omap1/irq.c +60 -58
index a8a533d..3651b17 100644
@@ -56,6 +56,7 @@
 
 struct omap_irq_bank {
 	unsigned long base_reg;
+	void __iomem *va;
 	unsigned long trigger_map;
 	unsigned long wake_enable;
 };
@@ -63,59 +64,33 @@ struct omap_irq_bank {
 u32 omap_irq_flags;
 static unsigned int irq_bank_count;
 static struct omap_irq_bank *irq_banks;
+static struct irq_domain *domain;
 
-static inline void irq_bank_writel(unsigned long value, int bank, int offset)
+static inline unsigned int irq_bank_readl(int bank, int offset)
 {
-	omap_writel(value, irq_banks[bank].base_reg + offset);
+	return readl_relaxed(irq_banks[bank].va + offset);
 }
-
-static void omap_ack_irq(struct irq_data *d)
-{
-	if (d->irq > 31)
-		omap_writel(0x1, OMAP_IH2_BASE + IRQ_CONTROL_REG_OFFSET);
-
-	omap_writel(0x1, OMAP_IH1_BASE + IRQ_CONTROL_REG_OFFSET);
-}
-
-static void omap_mask_irq(struct irq_data *d)
+static inline void irq_bank_writel(unsigned long value, int bank, int offset)
 {
-	int bank = IRQ_BANK(d->irq);
-	u32 l;
-
-	l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
-	l |= 1 << IRQ_BIT(d->irq);
-	omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
+	writel_relaxed(value, irq_banks[bank].va + offset);
 }
 
-static void omap_unmask_irq(struct irq_data *d)
+static void omap_ack_irq(int irq)
 {
-	int bank = IRQ_BANK(d->irq);
-	u32 l;
+	if (irq > 31)
+		writel_relaxed(0x1, irq_banks[1].va + IRQ_CONTROL_REG_OFFSET);
 
-	l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
-	l &= ~(1 << IRQ_BIT(d->irq));
-	omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
+	writel_relaxed(0x1, irq_banks[0].va + IRQ_CONTROL_REG_OFFSET);
 }
 
 static void omap_mask_ack_irq(struct irq_data *d)
 {
-	omap_mask_irq(d);
-	omap_ack_irq(d);
-}
-
-static int omap_wake_irq(struct irq_data *d, unsigned int enable)
-{
-	int bank = IRQ_BANK(d->irq);
+	struct irq_chip_type *ct = irq_data_get_chip_type(d);
 
-	if (enable)
-		irq_banks[bank].wake_enable |= IRQ_BIT(d->irq);
-	else
-		irq_banks[bank].wake_enable &= ~IRQ_BIT(d->irq);
-
-	return 0;
+	ct->chip.irq_mask(d);
+	omap_ack_irq(d->irq);
 }
 
-
 /*
  * Allows tuning the IRQ type and priority
  *
@@ -165,17 +140,30 @@ static struct omap_irq_bank omap1610_irq_banks[] = {
 };
 #endif
 
-static struct irq_chip omap_irq_chip = {
-	.name		= "MPU",
-	.irq_ack	= omap_mask_ack_irq,
-	.irq_mask	= omap_mask_irq,
-	.irq_unmask	= omap_unmask_irq,
-	.irq_set_wake	= omap_wake_irq,
-};
+static __init void
+omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
+{
+	struct irq_chip_generic *gc;
+	struct irq_chip_type *ct;
+
+	gc = irq_alloc_generic_chip("MPU", 1, irq_start, base,
+				    handle_level_irq);
+	ct = gc->chip_types;
+	ct->chip.irq_ack = omap_mask_ack_irq;
+	ct->chip.irq_mask = irq_gc_mask_set_bit;
+	ct->chip.irq_unmask = irq_gc_mask_clr_bit;
+	ct->chip.irq_set_wake = irq_gc_set_wake;
+	ct->regs.mask = IRQ_MIR_REG_OFFSET;
+	irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
+			       IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+}
 
 void __init omap1_init_irq(void)
 {
-	int i, j;
+	struct irq_chip_type *ct;
+	struct irq_data *d = NULL;
+	int i, j, irq_base;
+	unsigned long nr_irqs;
 
 #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
 	if (cpu_is_omap7xx()) {
@@ -203,8 +191,26 @@ void __init omap1_init_irq(void)
 		irq_bank_count = ARRAY_SIZE(omap1610_irq_banks);
 	}
 #endif
-	printk("Total of %i interrupts in %i interrupt banks\n",
-	       irq_bank_count * 32, irq_bank_count);
+
+	for (i = 0; i < irq_bank_count; i++) {
+		irq_banks[i].va = ioremap(irq_banks[i].base_reg, 0xff);
+		if (WARN_ON(!irq_banks[i].va))
+			return;
+	}
+
+	nr_irqs = irq_bank_count * 32;
+
+	irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
+	if (irq_base < 0) {
+		pr_warn("Couldn't allocate IRQ numbers\n");
+		irq_base = 0;
+	}
+
+	domain = irq_domain_add_legacy(NULL, nr_irqs, irq_base, 0,
+				       &irq_domain_simple_ops, NULL);
+
+	pr_info("Total of %lu interrupts in %i interrupt banks\n",
+		nr_irqs, irq_bank_count);
 
 	/* Mask and clear all interrupts */
 	for (i = 0; i < irq_bank_count; i++) {
@@ -227,19 +233,15 @@ void __init omap1_init_irq(void)
 
 			irq_trigger = irq_banks[i].trigger_map >> IRQ_BIT(j);
 			omap_irq_set_cfg(j, 0, 0, irq_trigger);
-
-			irq_set_chip_and_handler(j, &omap_irq_chip,
-						 handle_level_irq);
 			set_irq_flags(j, IRQF_VALID);
 		}
+		omap_alloc_gc(irq_banks[i].va, irq_base + i * 32, 32);
 	}
 
 	/* Unmask level 2 handler */
-
-	if (cpu_is_omap7xx())
-		omap_unmask_irq(irq_get_irq_data(INT_7XX_IH2_IRQ));
-	else if (cpu_is_omap15xx())
-		omap_unmask_irq(irq_get_irq_data(INT_1510_IH2_IRQ));
-	else if (cpu_is_omap16xx())
-		omap_unmask_irq(irq_get_irq_data(INT_1610_IH2_IRQ));
+	d = irq_get_irq_data(omap_irq_flags);
+	if (d) {
+		ct = irq_data_get_chip_type(d);
+		ct->chip.irq_unmask(d);
+	}
 }
Signature · 1 line
2.1.4
author reviewer
#3 lore raw

PATCH 3/4 ARM: omap1: Switch to use MULTI_IRQ

In reply to Tony Lindgren

This allows us to get a bit further with SPARSE_IRQ and MULTIARCH support.

Note that we now also rename omap_irq_flags to omap_l2_irq as that's the omap_irq_flags naming is confusing. It just contains the interrupt number for the l2 irq.

---
 arch/arm/Kconfig                               |  1 +
 arch/arm/mach-omap1/board-ams-delta.c          |  1 +
 arch/arm/mach-omap1/board-fsample.c            |  1 +
 arch/arm/mach-omap1/board-generic.c            |  1 +
 arch/arm/mach-omap1/board-h2.c                 |  1 +
 arch/arm/mach-omap1/board-h3.c                 |  1 +
 arch/arm/mach-omap1/board-htcherald.c          |  1 +
 arch/arm/mach-omap1/board-innovator.c          |  1 +
 arch/arm/mach-omap1/board-nokia770.c           |  1 +
 arch/arm/mach-omap1/board-osk.c                |  1 +
 arch/arm/mach-omap1/board-palmte.c             |  1 +
 arch/arm/mach-omap1/board-palmtt.c             |  1 +
 arch/arm/mach-omap1/board-palmz71.c            |  1 +
 arch/arm/mach-omap1/board-perseus2.c           |  1 +
 arch/arm/mach-omap1/board-sx1.c                |  1 +
 arch/arm/mach-omap1/board-voiceblue.c          |  1 +
 arch/arm/mach-omap1/common.h                   |  5 ++--
 arch/arm/mach-omap1/include/mach/entry-macro.S | 39 -------------------------
 arch/arm/mach-omap1/irq.c                      | 40 ++++++++++++++++++++++----
 19 files changed, 53 insertions(+), 47 deletions(-)
 delete mode 100644 arch/arm/mach-omap1/include/mach/entry-macro.S
arch/arm/Kconfig +1 -0
index 45df48b..881a76c 100644
@@ -752,6 +752,7 @@ config ARCH_OMAP1
 	select GENERIC_IRQ_CHIP
 	select HAVE_IDE
 	select IRQ_DOMAIN
+	select MULTI_IRQ_HANDLER
 	select NEED_MACH_IO_H if PCCARD
 	select NEED_MACH_MEMORY_H
 	help
arch/arm/mach-omap1/board-ams-delta.c +1 -0
index 2aab761..a95499e 100644
@@ -626,6 +626,7 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
 	.map_io		= ams_delta_map_io,
 	.init_early	= omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= ams_delta_init,
 	.init_late	= ams_delta_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-fsample.c +1 -0
index 702d580..0fb51d2 100644
@@ -362,6 +362,7 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
 	.map_io		= omap_fsample_map_io,
 	.init_early	= omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= omap_fsample_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-generic.c +1 -0
index e1d9171..9708629 100644
@@ -82,6 +82,7 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
 	.map_io		= omap16xx_map_io,
 	.init_early	= omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= omap_generic_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-h2.c +1 -0
index 5b45d26..8340d68 100644
@@ -426,6 +426,7 @@ MACHINE_START(OMAP_H2, "TI-H2")
 	.map_io		= omap16xx_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= h2_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-h3.c +1 -0
index bfed4f9..086ff34 100644
@@ -452,6 +452,7 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
 	.map_io		= omap16xx_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= h3_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-htcherald.c +1 -0
index 35a2379..9525ef9 100644
@@ -601,6 +601,7 @@ MACHINE_START(HERALD, "HTC Herald")
 	.map_io         = htcherald_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq       = omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine   = htcherald_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-innovator.c +1 -0
index c49ce83..ed4e045 100644
@@ -456,6 +456,7 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
 	.map_io		= innovator_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= innovator_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-nokia770.c +1 -0
index 85089d8..9f6c7af 100644
@@ -294,6 +294,7 @@ MACHINE_START(NOKIA770, "Nokia 770")
 	.map_io		= omap16xx_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= omap_nokia770_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-osk.c +1 -0
index 7436d4c..0efd165 100644
@@ -610,6 +610,7 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
 	.map_io		= omap16xx_map_io,
 	.init_early	= omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= osk_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-palmte.c +1 -0
index 3b8e98f..1142ae4 100644
@@ -235,6 +235,7 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
 	.map_io		= omap15xx_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= omap_palmte_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-palmtt.c +1 -0
index ca50120..54a547a 100644
@@ -282,6 +282,7 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
 	.map_io		= omap15xx_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= omap_palmtt_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-palmz71.c +1 -0
index 470e12d..87ec04a 100644
@@ -297,6 +297,7 @@ MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
 	.map_io		= omap15xx_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= omap_palmz71_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-perseus2.c +1 -0
index 8b2f712..3d76f05 100644
@@ -324,6 +324,7 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
 	.map_io		= omap_perseus2_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= omap_perseus2_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-sx1.c +1 -0
index 29e5262..939991e 100644
@@ -343,6 +343,7 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
 	.map_io		= omap15xx_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= omap_sx1_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/board-voiceblue.c +1 -0
index 4677a9c..e960687 100644
@@ -288,6 +288,7 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
 	.map_io		= omap15xx_map_io,
 	.init_early     = omap1_init_early,
 	.init_irq	= omap1_init_irq,
+	.handle_irq	= omap1_handle_irq,
 	.init_machine	= voiceblue_init,
 	.init_late	= omap1_init_late,
 	.init_time	= omap1_timer_init,
arch/arm/mach-omap1/common.h +3 -2
index 732f8ee..6363e0c 100644
@@ -30,6 +30,8 @@
 #include <linux/i2c-omap.h>
 #include <linux/reboot.h>
 
+#include <asm/exception.h>
+
 #include <plat/i2c.h>
 
 #include <mach/irqs.h>
@@ -73,6 +75,7 @@ static inline int omap_serial_wakeup_init(void)
 
 void omap1_init_early(void);
 void omap1_init_irq(void);
+void __exception_irq_entry omap1_handle_irq(struct pt_regs *regs);
 void omap1_init_late(void);
 void omap1_restart(enum reboot_mode, const char *);
 
@@ -91,8 +94,6 @@ static inline int __init omap_32k_timer_init(void)
 }
 #endif
 
-extern u32 omap_irq_flags;
-
 #ifdef CONFIG_ARCH_OMAP16XX
 extern int ocpi_enable(void);
 #else
arch/arm/mach-omap1/include/mach/entry-macro.S deleted +0 -39
deleted file mode 100644
index 78a8c6c..0000000
@@ -1,39 +0,0 @@
-/*
- * arch/arm/mach-omap1/include/mach/entry-macro.S
- *
- * Low-level IRQ helper macros for OMAP-based platforms
- *
- * Copyright (C) 2009 Texas Instruments
- *
- * This file is licensed under  the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <mach/hardware.h>
-#include <mach/irqs.h>
-
-		.macro  get_irqnr_preamble, base, tmp
-		.endm
-
-		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
-		ldr	\base, =OMAP1_IO_ADDRESS(OMAP_IH1_BASE)
-		ldr	\irqnr, [\base, #IRQ_ITR_REG_OFFSET]
-		ldr	\tmp, [\base, #IRQ_MIR_REG_OFFSET]
-		mov	\irqstat, #0xffffffff
-		bic	\tmp, \irqstat, \tmp
-		tst	\irqnr, \tmp
-		beq	1510f
-
-		ldr	\irqnr, [\base, #IRQ_SIR_FIQ_REG_OFFSET]
-		ldr	\tmp, =omap_irq_flags	@ irq flags address
-		ldr	\tmp, [\tmp, #0]	@ irq flags value
-		cmp	\irqnr, #0
-		ldreq	\irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
-		cmpeq	\irqnr, \tmp
-		ldreq	\base, =OMAP1_IO_ADDRESS(OMAP_IH2_BASE)
-		ldreq	\irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
-		addeqs	\irqnr, \irqnr, #32
-1510:
-		.endm
-
arch/arm/mach-omap1/irq.c +34 -6
index 3651b17..567fba3 100644
@@ -43,6 +43,7 @@
 #include <linux/io.h>
 
 #include <asm/irq.h>
+#include <asm/exception.h>
 #include <asm/mach/irq.h>
 
 #include "soc.h"
@@ -61,7 +62,7 @@ struct omap_irq_bank {
 	unsigned long wake_enable;
 };
 
-u32 omap_irq_flags;
+static u32 omap_l2_irq;
 static unsigned int irq_bank_count;
 static struct omap_irq_bank *irq_banks;
 static struct irq_domain *domain;
@@ -140,6 +141,36 @@ static struct omap_irq_bank omap1610_irq_banks[] = {
 };
 #endif
 
+asmlinkage void __exception_irq_entry omap1_handle_irq(struct pt_regs *regs)
+{
+	void __iomem *l1 = irq_banks[0].va;
+	void __iomem *l2 = irq_banks[1].va;
+	u32 irqnr;
+
+	do {
+		irqnr = readl_relaxed(l1 + IRQ_ITR_REG_OFFSET);
+		irqnr &= ~(readl_relaxed(l1 + IRQ_MIR_REG_OFFSET) & 0xffffffff);
+		if (!irqnr)
+			break;
+
+		irqnr = readl_relaxed(l1 + IRQ_SIR_FIQ_REG_OFFSET);
+		if (irqnr)
+			goto irq;
+
+		irqnr = readl_relaxed(l1 + IRQ_SIR_IRQ_REG_OFFSET);
+		if (irqnr == omap_l2_irq) {
+			irqnr = readl_relaxed(l2 + IRQ_SIR_IRQ_REG_OFFSET);
+			if (irqnr)
+				irqnr += 32;
+		}
+irq:
+		if (irqnr)
+			handle_domain_irq(domain, irqnr, regs);
+		else
+			break;
+	} while (irqnr);
+}
+
 static __init void
 omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
 {
@@ -167,26 +198,22 @@ void __init omap1_init_irq(void)
 
 #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
 	if (cpu_is_omap7xx()) {
-		omap_irq_flags = INT_7XX_IH2_IRQ;
 		irq_banks = omap7xx_irq_banks;
 		irq_bank_count = ARRAY_SIZE(omap7xx_irq_banks);
 	}
 #endif
 #ifdef CONFIG_ARCH_OMAP15XX
 	if (cpu_is_omap1510()) {
-		omap_irq_flags = INT_1510_IH2_IRQ;
 		irq_banks = omap1510_irq_banks;
 		irq_bank_count = ARRAY_SIZE(omap1510_irq_banks);
 	}
 	if (cpu_is_omap310()) {
-		omap_irq_flags = INT_1510_IH2_IRQ;
 		irq_banks = omap310_irq_banks;
 		irq_bank_count = ARRAY_SIZE(omap310_irq_banks);
 	}
 #endif
 #if defined(CONFIG_ARCH_OMAP16XX)
 	if (cpu_is_omap16xx()) {
-		omap_irq_flags = INT_1510_IH2_IRQ;
 		irq_banks = omap1610_irq_banks;
 		irq_bank_count = ARRAY_SIZE(omap1610_irq_banks);
 	}
@@ -205,6 +232,7 @@ void __init omap1_init_irq(void)
 		pr_warn("Couldn't allocate IRQ numbers\n");
 		irq_base = 0;
 	}
+	omap_l2_irq = cpu_is_omap7xx() ? irq_base + 1 : irq_base;
 
 	domain = irq_domain_add_legacy(NULL, nr_irqs, irq_base, 0,
 				       &irq_domain_simple_ops, NULL);
@@ -239,7 +267,7 @@ void __init omap1_init_irq(void)
 	}
 
 	/* Unmask level 2 handler */
-	d = irq_get_irq_data(omap_irq_flags);
+	d = irq_get_irq_data(irq_find_mapping(domain, omap_l2_irq));
 	if (d) {
 		ct = irq_data_get_chip_type(d);
 		ct->chip.irq_unmask(d);
Signature · 1 line
2.1.4
author reviewer
#4 lore raw

PATCH 4/4 ARM: OMAP1: Change interrupt numbering for sparse IRQ

In reply to Tony Lindgren

Change interrupt numbering for sparse IRQ. We do this using a fixed offset until we can drop irqs.h once all it's users have been updated.

Note that this depends on the GPIO fix for the MPUIO IRQs "gpio: omap: Fix regression for MPUIO interrupts".

Also note that this patch adds some extra irq alloc warnings that will go away when we stop calling irq_alloc_descs in gpio-omap.c with a follow-up patch.

---
 arch/arm/Kconfig                            |   1 +
 arch/arm/mach-omap1/ams-delta-fiq-handler.S |   3 +-
 arch/arm/mach-omap1/dma.c                   |   2 +-
 arch/arm/mach-omap1/i2c.c                   |   3 +-
 arch/arm/mach-omap1/include/mach/irqs.h     | 124 ++++++++++++++--------------
 arch/arm/mach-omap1/include/mach/soc.h      |   4 +
 arch/arm/mach-omap1/irq.c                   |   1 +
 arch/arm/mach-omap1/timer.c                 |   4 +-
 arch/arm/plat-omap/dma.c                    |   4 +
 9 files changed, 75 insertions(+), 71 deletions(-)
arch/arm/Kconfig +1 -0
index 881a76c..6a23dac 100644
@@ -755,6 +755,7 @@ config ARCH_OMAP1
 	select MULTI_IRQ_HANDLER
 	select NEED_MACH_IO_H if PCCARD
 	select NEED_MACH_MEMORY_H
+	select SPARSE_IRQ
 	help
 	  Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx)
 
arch/arm/mach-omap1/ams-delta-fiq-handler.S +1 -2
index 3d1e1c2..5d7fb59 100644
@@ -17,11 +17,10 @@
 #include <asm/assembler.h>
 
 #include <mach/board-ams-delta.h>
-
-#include <mach/irqs.h>
 #include <mach/ams-delta-fiq.h>
 
 #include "iomap.h"
+#include "soc.h"
 
 /*
  * GPIO related definitions, copied from arch/arm/plat-omap/gpio.c.
arch/arm/mach-omap1/dma.c +1 -1
index 4be601b6..7b02ed2 100644
@@ -28,7 +28,7 @@
 #include <linux/omap-dma.h>
 #include <mach/tc.h>
 
-#include <mach/irqs.h>
+#include "soc.h"
 
 #define OMAP1_DMA_BASE			(0xfffed800)
 #define OMAP1_LOGICAL_DMA_CH_COUNT	17
arch/arm/mach-omap1/i2c.c +1 -2
index 7f5761c..82887d6 100644
@@ -27,7 +27,6 @@
 
 #define OMAP_I2C_SIZE		0x3f
 #define OMAP1_I2C_BASE		0xfffb3800
-#define OMAP1_INT_I2C		(32 + 4)
 
 static const char name[] = "omap_i2c";
 
@@ -67,7 +66,7 @@ int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *pdata,
 	res[0].start = OMAP1_I2C_BASE;
 	res[0].end = res[0].start + OMAP_I2C_SIZE;
 	res[0].flags = IORESOURCE_MEM;
-	res[1].start = OMAP1_INT_I2C;
+	res[1].start = INT_I2C;
 	res[1].flags = IORESOURCE_IRQ;
 	pdev->resource = res;
 
arch/arm/mach-omap1/include/mach/irqs.h +60 -64

155 lines not on this page · raw message

arch/arm/mach-omap1/include/mach/soc.h +4 -0
index 612bd1cc..3d93557 100644
@@ -28,6 +28,10 @@
 #ifndef __ASM_ARCH_OMAP_CPU_H
 #define __ASM_ARCH_OMAP_CPU_H
 
+#include <asm/irq.h>
+#include <mach/hardware.h>
+#include <mach/irqs.h>
+
 #ifndef __ASSEMBLY__
 
 #include <linux/bitops.h>
arch/arm/mach-omap1/irq.c +1 -0
index 567fba3..f4d346f 100644
@@ -233,6 +233,7 @@ void __init omap1_init_irq(void)
 		irq_base = 0;
 	}
 	omap_l2_irq = cpu_is_omap7xx() ? irq_base + 1 : irq_base;
+	omap_l2_irq -= NR_IRQS_LEGACY;
 
 	domain = irq_domain_add_legacy(NULL, nr_irqs, irq_base, 0,
 				       &irq_domain_simple_ops, NULL);
arch/arm/mach-omap1/timer.c +2 -2
index bde7a35..06c5ba7 100644
@@ -27,10 +27,10 @@
 #include <linux/platform_device.h>
 #include <linux/platform_data/dmtimer-omap.h>
 
-#include <mach/irqs.h>
-
 #include <plat/dmtimer.h>
 
+#include "soc.h"
+
 #define OMAP1610_GPTIMER1_BASE		0xfffb1400
 #define OMAP1610_GPTIMER2_BASE		0xfffb1c00
 #define OMAP1610_GPTIMER3_BASE		0xfffb2400
arch/arm/plat-omap/dma.c +4 -0
index 6416e03..1e460b4 100644
@@ -38,6 +38,10 @@
 
 #include <linux/omap-dma.h>
 
+#ifdef CONFIG_ARCH_OMAP1
+#include <mach/soc.h>
+#endif
+
 /*
  * MAX_LOGICAL_DMA_CH_COUNT: the maximum number of logical DMA
  * channels that an instance of the SDMA IP block can support.  Used
Signature · 1 line
2.1.4