ARM: sa1100: Use MULTI_IRQ_HANDLER and IRQ domains
Subsystems (2)
cover ARM: sa1100: Use MULTI_IRQ_HANDLER and IRQ domains
This patch serie updates SA1100 to use MULTI_IRQ_HANDLER and IRQ domains to handle IRQs. These patches introduce no changes in the way IRQs are handled with respect to hardware, registers or IRQ numbers.
Dmitry Eremin-Solenikov (6):
ARM: sa1100: switch to MULTI_IRQ_HANDLER
ARM: sa1100: drop entry-macro.S
ARM: sa1100: enable IRQ domains
ARM: sa1100: introduce irqdomains support
ARM: sa1100: merge IRQ 11 to "normal" irq domain
ARM: sa1100: switch to hwirq usage
arch/arm/Kconfig | 2 + arch/arm/mach-sa1100/include/mach/entry-macro.S | 41 ------- arch/arm/mach-sa1100/irq.c | 136 +++++++++++++++++------- 3 files changed, 97 insertions(+), 82 deletions(-) delete mode 100644 arch/arm/mach-sa1100/include/mach/entry-macro.S
PATCH 1/6 ARM: sa1100: switch to MULTI_IRQ_HANDLER
Add sa1100_handle_irq implementating handle_irq for sa1100 platform. It is more or less a translation of old assembly code from assembler to plain C. Also install this irq handler from sa1100_init_irq().
--- arch/arm/Kconfig | 1 + arch/arm/mach-sa1100/irq.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+)
arch/arm/Kconfig +1 -0
@@ -703,6 +703,7 @@ config ARCH_SA1100 select GENERIC_CLOCKEVENTS select HAVE_IDE select ISA + select MULTI_IRQ_HANDLER select NEED_MACH_MEMORY_H select SPARSE_IRQ help
arch/arm/mach-sa1100/irq.c +20 -0
@@ -20,6 +20,7 @@#include <mach/hardware.h> #include <mach/irqs.h> #include <asm/mach/irq.h> +#include <asm/exception.h> #include "generic.h"
@@ -291,6 +292,23 @@ static int __init sa1100irq_init_devicefs(void)device_initcall (sa1100irq_init_devicefs); +static asmlinkage void __exception_irq_entry +sa1100_handle_irq (struct pt_regs *regs) +{ +uint32_t icip, icmr, mask; + +do { + icip = (ICIP ); + icmr = (ICMR ); + mask = icip & icmr; + +if (mask ==0 ) +break ; + +handle_IRQ (ffs (mask) -1 , regs); + }while (1 ); +} +void __init sa1100_init_irq (void ) {unsigned int irq;
@@ -338,5 +356,7 @@ void __init sa1100_init_irq(void)irq_set_chip (IRQ_GPIO11_27 , &sa1100_normal_chip);irq_set_chained_handler (IRQ_GPIO11_27 , sa1100_high_gpio_handler); +set_handle_irq (sa1100_handle_irq); +sa1100_init_gpio (); }
Signature · 1 line
2.1.1
PATCH 2/6 ARM: sa1100: drop entry-macro.S
In reply to Dmitry Eremin-SolenikovFrom: Dmitry Eremin-Solenikov <[email protected]>
As mach-sa1100 was converted to MULTI_IRQ_HANDLER, drop now-unused entry-macro.S file.
--- arch/arm/mach-sa1100/include/mach/entry-macro.S | 41 ------------------------- 1 file changed, 41 deletions(-) delete mode 100644 arch/arm/mach-sa1100/include/mach/entry-macro.S
arch/arm/mach-sa1100/include/mach/entry-macro.S deleted +0 -41
@@ -1,41 +0,0 @@ -/* - * arch/arm/mach-sa1100/include/mach/entry-macro.S - * - * Low-level IRQ helper macros for SA1100-based platforms - * - * 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. - */ - - .macro get_irqnr_preamble, base, tmp - mov \base, #0xfa000000 @ ICIP = 0xfa050000 - add \base, \base, #0x00050000 - .endm - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \irqstat, [\base] @ get irqs - ldr \irqnr, [\base, #4] @ ICMR = 0xfa050004 - ands \irqstat, \irqstat, \irqnr - mov \irqnr, #0 - beq 1001f - tst \irqstat, #0xff - moveq \irqstat, \irqstat, lsr #8 - addeq \irqnr, \irqnr, #8 - tsteq \irqstat, #0xff - moveq \irqstat, \irqstat, lsr #8 - addeq \irqnr, \irqnr, #8 - tsteq \irqstat, #0xff - moveq \irqstat, \irqstat, lsr #8 - addeq \irqnr, \irqnr, #8 - tst \irqstat, #0x0f - moveq \irqstat, \irqstat, lsr #4 - addeq \irqnr, \irqnr, #4 - tst \irqstat, #0x03 - moveq \irqstat, \irqstat, lsr #2 - addeq \irqnr, \irqnr, #2 - tst \irqstat, #0x01 - addeqs \irqnr, \irqnr, #1 -1001: - .endm -
Signature · 1 line
2.1.1
PATCH 3/6 ARM: sa1100: enable IRQ domains
In reply to Dmitry Eremin-Solenikov--- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/Kconfig +1 -0
@@ -702,6 +702,7 @@ config ARCH_SA1100 select CPU_SA1100 select GENERIC_CLOCKEVENTS select HAVE_IDE + select IRQ_DOMAIN select ISA select MULTI_IRQ_HANDLER select NEED_MACH_MEMORY_H
Signature · 1 line
2.1.1
PATCH 4/6 ARM: sa1100: introduce irqdomains support
In reply to Dmitry Eremin-SolenikovUse irqdomains to manage both system and GPIO interrupts on SA1100 SoC family. This opens path to further cleanup and unification in sa1100 IRQ drivers.
--- arch/arm/mach-sa1100/irq.c | 78 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 17 deletions(-)
arch/arm/mach-sa1100/irq.c +61 -17
@@ -14,6 +14,7 @@#include <linux/interrupt.h> #include <linux/io.h> #include <linux/irq.h> +#include <linux/irqdomain.h> #include <linux/ioport.h> #include <linux/syscore_ops.h>
@@ -106,6 +107,23 @@ static struct irq_chip sa1100_low_gpio_chip = { .irq_set_wake = sa1100_low_gpio_wake, }; +static int sa1100_low_gpio_irqdomain_map (struct irq_domain *d, +unsigned int irq,irq_hw_number_t hwirq) +{ +irq_set_chip_and_handler (irq, &sa1100_low_gpio_chip, + handle_edge_irq); +set_irq_flags (irq,IRQF_VALID |IRQF_PROBE ); + +return 0 ; +} + +static struct irq_domain_ops sa1100_low_gpio_irqdomain_ops = { + .map = sa1100_low_gpio_irqdomain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + +static struct irq_domain *sa1100_low_gpio_irqdomain; +/* * IRQ11 (GPIO11 through 27) handler. We enter here with the * irq_controller_lock held, and IRQs disabled. Decode the IRQ
@@ -187,6 +205,23 @@ static struct irq_chip sa1100_high_gpio_chip = { .irq_set_wake = sa1100_high_gpio_wake, }; +static int sa1100_high_gpio_irqdomain_map (struct irq_domain *d, +unsigned int irq,irq_hw_number_t hwirq) +{ +irq_set_chip_and_handler (irq, &sa1100_high_gpio_chip, + handle_edge_irq); +set_irq_flags (irq,IRQF_VALID |IRQF_PROBE ); + +return 0 ; +} + +static struct irq_domain_ops sa1100_high_gpio_irqdomain_ops = { + .map = sa1100_high_gpio_irqdomain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + +static struct irq_domain *sa1100_high_gpio_irqdomain; +/* * We don't need to ACK IRQs on the SA1100 unless they're GPIOs * this is for internal IRQs i.e. from 11 to 31.
@@ -224,6 +259,23 @@ static struct irq_chip sa1100_normal_chip = { .irq_set_wake = sa1100_set_wake, }; +static int sa1100_normal_irqdomain_map (struct irq_domain *d, +unsigned int irq,irq_hw_number_t hwirq) +{ +irq_set_chip_and_handler (irq, &sa1100_normal_chip, + handle_level_irq); +set_irq_flags (irq,IRQF_VALID ); + +return 0 ; +} + +static struct irq_domain_ops sa1100_normal_irqdomain_ops = { + .map = sa1100_normal_irqdomain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + +static struct irq_domain *sa1100_normal_irqdomain; +static struct resource irq_resource =DEFINE_RES_MEM_NAMED (0x90050000 ,SZ_64K ,"irqs" );
@@ -311,8 +363,6 @@ sa1100_handle_irq(struct pt_regs *regs)void __init sa1100_init_irq (void ) { -unsigned int irq; -request_resource (&iomem_resource, &irq_resource);/* disable all IRQs */
@@ -332,23 +382,17 @@ void __init sa1100_init_irq(void)*/ ICCR =1 ; -for (irq =0 ; irq <=10 ; irq++) { -irq_set_chip_and_handler (irq, &sa1100_low_gpio_chip, - handle_edge_irq); -set_irq_flags (irq,IRQF_VALID |IRQF_PROBE ); - } + sa1100_low_gpio_irqdomain =irq_domain_add_legacy (NULL , +11 ,0 ,0 , + &sa1100_low_gpio_irqdomain_ops,NULL ); -for (irq =12 ; irq <=31 ; irq++) { -irq_set_chip_and_handler (irq, &sa1100_normal_chip, - handle_level_irq); -set_irq_flags (irq,IRQF_VALID ); - } + sa1100_normal_irqdomain =irq_domain_add_legacy (NULL , +20 ,12 ,12 , + &sa1100_normal_irqdomain_ops,NULL ); -for (irq =32 ; irq <=48 ; irq++) { -irq_set_chip_and_handler (irq, &sa1100_high_gpio_chip, - handle_edge_irq); -set_irq_flags (irq,IRQF_VALID |IRQF_PROBE ); - } + sa1100_high_gpio_irqdomain =irq_domain_add_legacy (NULL , +17 ,32 ,11 , + &sa1100_high_gpio_irqdomain_ops,NULL );/* * Install handler for GPIO 11-27 edge detect interrupts
Signature · 1 line
2.1.1
PATCH 5/6 ARM: sa1100: merge IRQ 11 to "normal" irq domain
In reply to Dmitry Eremin-SolenikovIRQ 11 is a shared IRQ receiving IRQs from "high" GPIOs. It is still handled by sa1100_normal_chip, so there is no point to exclude it from "normal" irq domain. The IRQF_VALID flag set by domain map function will be cleared by irq_set_chained_handler() internally.
--- arch/arm/mach-sa1100/irq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-sa1100/irq.c +1 -2
@@ -387,7 +387,7 @@ void __init sa1100_init_irq(void) &sa1100_low_gpio_irqdomain_ops, NULL); sa1100_normal_irqdomain =irq_domain_add_legacy (NULL , -20 ,12 ,12 , +21 ,11 ,11 , &sa1100_normal_irqdomain_ops,NULL ); sa1100_high_gpio_irqdomain = irq_domain_add_legacy(NULL,
@@ -397,7 +397,6 @@ void __init sa1100_init_irq(void)/* * Install handler for GPIO 11-27 edge detect interrupts */ -irq_set_chip (IRQ_GPIO11_27 , &sa1100_normal_chip);irq_set_chained_handler (IRQ_GPIO11_27 , sa1100_high_gpio_handler);set_handle_irq (sa1100_handle_irq);
Signature · 1 line
2.1.1
PATCH 6/6 ARM: sa1100: switch to hwirq usage
In reply to Dmitry Eremin-SolenikovSwitch internally to using hardware irq numbers (hwirq). In case of GPIO interrupts, hwirq is equal to GPIO number. In case of system interrupts, hwirq is equal to interrupt number in the interrupt controller.
--- arch/arm/mach-sa1100/irq.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
arch/arm/mach-sa1100/irq.c +14 -23
@@ -35,20 +35,11 @@ static int GPIO_IRQ_rising_edge;static int GPIO_IRQ_falling_edge;static int GPIO_IRQ_mask = (1 <<11 ) -1 ; -/* -* To get the GPIO number from an IRQ number -*/ -#define GPIO_11_27_IRQ (i) ((i) - 21) -#define GPIO11_27_MASK (irq) (1 << GPIO_11_27_IRQ(irq)) -static int sa1100_gpio_type (struct irq_data *d,unsigned int type) {unsigned int mask; -if (d->irq <=10 ) - mask =1 << d->irq; -else - mask =GPIO11_27_MASK (d->irq); + mask =BIT (d->hwirq);if (type ==IRQ_TYPE_PROBE ) {if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask)
@@ -76,25 +67,25 @@ static int sa1100_gpio_type(struct irq_data *d, unsigned int type)*/ static void sa1100_low_gpio_ack (struct irq_data *d) { -GEDR = (1 << d->irq); +GEDR =BIT (d->hwirq); }static void sa1100_low_gpio_mask (struct irq_data *d) { -ICMR &= ~(1 << d->irq); +ICMR &= ~BIT (d->hwirq); }static void sa1100_low_gpio_unmask (struct irq_data *d) { -ICMR |=1 << d->irq; +ICMR |=BIT (d->hwirq); }static int sa1100_low_gpio_wake (struct irq_data *d,unsigned int on) {if (on) -PWER |=1 << d->irq; +PWER |=BIT (d->hwirq);else -PWER &= ~(1 << d->irq); +PWER &= ~BIT (d->hwirq);return 0 ; }
@@ -162,14 +153,14 @@ sa1100_high_gpio_handler(unsigned int irq, struct irq_desc *desc)*/ static void sa1100_high_gpio_ack (struct irq_data *d) { -unsigned int mask =GPIO11_27_MASK (d->irq); +unsigned int mask =BIT (d->hwirq);GEDR = mask; }static void sa1100_high_gpio_mask (struct irq_data *d) { -unsigned int mask =GPIO11_27_MASK (d->irq); +unsigned int mask =BIT (d->hwirq); GPIO_IRQ_mask &= ~mask;
@@ -179,7 +170,7 @@ static void sa1100_high_gpio_mask(struct irq_data *d)static void sa1100_high_gpio_unmask (struct irq_data *d) { -unsigned int mask =GPIO11_27_MASK (d->irq); +unsigned int mask =BIT (d->hwirq); GPIO_IRQ_mask |= mask;
@@ -190,9 +181,9 @@ static void sa1100_high_gpio_unmask(struct irq_data *d)static int sa1100_high_gpio_wake (struct irq_data *d,unsigned int on) {if (on) -PWER |=GPIO11_27_MASK (d->irq); +PWER |=BIT (d->hwirq);else -PWER &= ~GPIO11_27_MASK (d->irq); +PWER &= ~BIT (d->hwirq);return 0 ; }
@@ -228,12 +219,12 @@ static struct irq_domain *sa1100_high_gpio_irqdomain;*/ static void sa1100_mask_irq (struct irq_data *d) { -ICMR &= ~(1 << d->irq); +ICMR &= ~BIT (d->hwirq); }static void sa1100_unmask_irq (struct irq_data *d) { -ICMR |= (1 << d->irq); +ICMR |=BIT (d->hwirq); }/*
@@ -241,7 +232,7 @@ static void sa1100_unmask_irq(struct irq_data *d)*/ static int sa1100_set_wake (struct irq_data *d,unsigned int on) { -if (d->irq == IRQ_RTCAlrm) { +if (d->hwirq == IRQ_RTCAlrm) {if (on)PWER |=PWER_RTC ;else
Signature · 1 line
2.1.1