ARM: tegra: consolidate GIC extension usage
Subsystems (3)
PATCH 1/1 ARM: tegra: consolidate GIC extension usage
Tegra uses its own GIC extension mechanism to drive another interrupt controller, used as a wake-up source.
Move this functionality to the recently introduced gic_arch_extn. Adding an eoi method also ensures that the knowledge of the interrupt flow control is removed from the Tegra code.
--- arch/arm/mach-tegra/irq.c | 44 +++++++++++--------------------------------- 1 files changed, 11 insertions(+), 33 deletions(-)
arch/arm/mach-tegra/irq.c +11 -33
@@ -46,10 +46,6 @@ static u32 tegra_lp0_wake_enb;static u32 tegra_lp0_wake_level;static u32 tegra_lp0_wake_level_any; -static void (*tegra_gic_mask_irq)(struct irq_data *d); -static void (*tegra_gic_unmask_irq)(struct irq_data *d); -static void (*tegra_gic_ack_irq)(struct irq_data *d); -/* ensures that sufficient time is passed for a register write to * serialize into the 32KHz domain */ static void pmc_32kwritel (u32 val,unsigned long offs)
@@ -103,20 +99,22 @@ void tegra_set_lp0_wake_pads(u32 wake_enb, u32 wake_level, u32 wake_any)static void tegra_mask (struct irq_data *d) { -tegra_gic_mask_irq (d);tegra_legacy_mask_irq (d->irq); }static void tegra_unmask (struct irq_data *d) { -tegra_gic_unmask_irq (d);tegra_legacy_unmask_irq (d->irq); }static void tegra_ack (struct irq_data *d) {tegra_legacy_force_irq_clr (d->irq); -tegra_gic_ack_irq (d); +} + +static void tegra_eoi (struct irq_data *d) +{ +tegra_legacy_force_irq_clr (d->irq); }static int tegra_retrigger (struct irq_data *d)
@@ -125,36 +123,16 @@ static int tegra_retrigger(struct irq_data *d)return 1 ; } -static struct irq_chip tegra_irq = { - .name ="PPI" , - .irq_ack = tegra_ack, - .irq_mask = tegra_mask, - .irq_unmask = tegra_unmask, - .irq_retrigger = tegra_retrigger, -}; -void __init tegra_init_irq (void ) { -struct irq_chip *gic; -unsigned int i; -int irq; -tegra_init_legacy_irq (); + gic_arch_extn.irq_eoi = tegra_eoi; + gic_arch_extn.irq_ack = tegra_ack; + gic_arch_extn.irq_mask = tegra_mask; + gic_arch_extn.irq_unmask = tegra_unmask; + gic_arch_extn.irq_retrigger = tegra_retrigger; +gic_init (0 ,29 ,IO_ADDRESS (TEGRA_ARM_INT_DIST_BASE ),IO_ADDRESS (TEGRA_ARM_PERIF_BASE +0x100 )); - - gic =irq_get_chip (29 ); - tegra_gic_unmask_irq = gic->irq_unmask; - tegra_gic_mask_irq = gic->irq_mask; - tegra_gic_ack_irq = gic->irq_ack; -#ifdef CONFIG_SMP - tegra_irq.irq_set_affinity = gic->irq_set_affinity; -#endif - -for (i =0 ; i <INT_MAIN_NR ; i++) { - irq =INT_PRI_BASE + i; -irq_set_chip_and_handler (irq, &tegra_irq, handle_level_irq); -set_irq_flags (irq,IRQF_VALID ); - } }
Signature · 1 line
1.7.0.4
PATCH 1/1 ARM: tegra: consolidate GIC extension usage
Quoted 6 lines · Marc Zyngier
Tegra uses its own GIC extension mechanism to drive another interrupt controller, used as a wake-up source.
Move this functionality to the recently introduced
gic_arch_extn. Adding an eoi method also ensures that the knowledge of the interrupt flow control is removed from the Tegra code.
A good follow-on step would be...
arch/arm/mach-tegra/irq.c void tegra_set_lp0_wake_pads(u32 wake_enb, u32 wake_level, u32 wake_any) · line 103
Quoted 5 lines
static void
tegra_mask(struct irq_data *d)
{arch/arm/mach-tegra/irq.c +0
-1-tegra_gic_mask_irq (d);tegra_legacy_mask_irq (d->irq); }
... arranging tegra_legacy_mask_irq() etc to take struct irq_data directly. These functions could then be removed entirely as they serve no useful purpose other than transforming the new API back to the old API.
Quoted 34 lines
static void
tegra_unmask(struct irq_data *d)
{arch/arm/mach-tegra/irq.c +5
-11-tegra_gic_unmask_irq (d);tegra_legacy_unmask_irq (d->irq); }static void tegra_ack (struct irq_data *d) {tegra_legacy_force_irq_clr (d->irq); -tegra_gic_ack_irq (d); +} + +static void tegra_eoi (struct irq_data *d) +{ +tegra_legacy_force_irq_clr (d->irq); }static int tegra_retrigger (struct irq_data *d)@@ -125,36 +123,16 @@ static int tegra_retrigger(struct irq_data *d)return 1 ; } -static struct irq_chip tegra_irq = { - .name ="PPI" , - .irq_ack = tegra_ack, - .irq_mask = tegra_mask, - .irq_unmask = tegra_unmask, - .irq_retrigger = tegra_retrigger, -}; -void __init tegra_init_irq (void ) { -struct irq_chip *gic;
arch/arm/mach-tegra/irq.c static int tegra_retrigger(struct irq_data *d) · line 134
Quoted 10 lines
arch/arm/mach-tegra/irq.c +5
-3-unsigned int i; -int irq; -tegra_init_legacy_irq (); + gic_arch_extn.irq_eoi = tegra_eoi; + gic_arch_extn.irq_ack = tegra_ack; + gic_arch_extn.irq_mask = tegra_mask; + gic_arch_extn.irq_unmask = tegra_unmask; + gic_arch_extn.irq_retrigger = tegra_retrigger;
Hmm, gic_arch_extn should've been a pointer rather than a structure to avoid architectures repeatedly doing this kind of initialization...
PATCH 1/1 ARM: tegra: consolidate GIC extension usage
Quoted 4 lines · On Wed, 27 Apr 2011 09:36:57 +0100 Russell King - ARM Linux…
On Wed, Apr 20, 2011 at 11:58:24AM +0100, Marc Zyngier wrote:
A good follow-on step would be...
Quoted 9 lines
Review
Quoted 5 lines
static void
tegra_mask(struct irq_data *d)
{(quoted diff) +0
-1- tegra_gic_mask_irq(d); tegra_legacy_mask_irq(d->irq); }... arranging
tegra_legacy_mask_irq()etc to take structirq_datadirectly. These functions could then be removed entirely as they serve no useful purpose other than transforming the new API back to the old API.
How about the following patch? I haven't touched the gic_arch_extn part as it would break Will's fastEOI patch set (which depends on this one), but will prepare another patch cleaning up that part.
Quoted 1 line
From
e11dc836ed12dd952b8152101e8417eb1de2ddc3Mon Sep 17 00:00:00 2001
From: Marc Zyngier <[email protected]>
Date: Wed, 20 Apr 2011 11:58:24 +0100
Subject: [PATCH] ARM: tegra: consolidate GIC extension usage
Tegra uses its own GIC extension mechanism to drive another interrupt controller, used as a wake-up source.
Move this functionality to the recently introduced gic_arch_extn. Adding an eoi method also ensures that the knowledge of the interrupt flow control is removed from the Tegra code.
--- arch/arm/mach-tegra/include/mach/legacy_irq.h | 16 ++++---- arch/arm/mach-tegra/irq.c | 56 +++--------------------- arch/arm/mach-tegra/legacy_irq.c | 22 +++++++--- 3 files changed, 30 insertions(+), 64 deletions(-)
arch/arm/mach-tegra/include/mach/legacy_irq.h +8 -8
@@ -18,16 +18,16 @@#ifndef _ARCH_ARM_MACH_TEGRA_LEGARY_IRQ_H#define _ARCH_ARM_MACH_TEGRA_LEGARY_IRQ_H -void tegra_legacy_mask_irq (unsigned int irq); -void tegra_legacy_unmask_irq (unsigned int irq); -void tegra_legacy_select_fiq (unsigned int irq,bool fiq); -void tegra_legacy_force_irq_set (unsigned int irq); -void tegra_legacy_force_irq_clr (unsigned int irq); -int tegra_legacy_force_irq_status (unsigned int irq); -void tegra_legacy_select_fiq (unsigned int irq,bool fiq); +void tegra_legacy_mask_irq (struct irq_data *d); +void tegra_legacy_unmask_irq (struct irq_data *d); +void tegra_legacy_select_fiq (struct irq_data *d,bool fiq); +void tegra_legacy_force_irq_set (struct irq_data *d); +void tegra_legacy_force_irq_clr (struct irq_data *d); +int tegra_legacy_force_irq_status (struct irq_data *d); +void tegra_legacy_select_fiq (struct irq_data *d,bool fiq);unsigned long tegra_legacy_vfiq (int nr);unsigned long tegra_legacy_class (int nr); -int tegra_legacy_irq_set_wake (int irq,int enable); +int tegra_legacy_irq_set_wake (struct irq_data *d,int enable);void tegra_legacy_irq_set_lp1_wake_mask (void );void tegra_legacy_irq_restore_mask (void );void tegra_init_legacy_irq (void );
arch/arm/mach-tegra/irq.c +7 -49
77 lines not on this page · raw message
arch/arm/mach-tegra/legacy_irq.c +15 -7
@@ -17,6 +17,7 @@#include <linux/io.h> #include <linux/kernel.h> +#include <linux/irq.h> #include <mach/iomap.h> #include <mach/irqs.h> #include <mach/legacy_irq.h>
@@ -55,8 +56,9 @@ static u32 tegra_legacy_saved_mask[4];/* When going into deep sleep, the CPU is powered down, taking the GIC with it In order to wake, the wake interrupts need to be enabled in the legacy interrupt controller. */ -void tegra_legacy_unmask_irq (unsigned int irq) +void tegra_legacy_unmask_irq (struct irq_data *d) { +unsigned int irq = d->irq;void __iomem *base;pr_debug ("%s: %d\n" , __func__, irq);
@@ -65,8 +67,9 @@ void tegra_legacy_unmask_irq(unsigned int irq)writel (1 << (irq &31 ), base +ICTLR_CPU_IER_SET ); } -void tegra_legacy_mask_irq (unsigned int irq) +void tegra_legacy_mask_irq (struct irq_data *d) { +unsigned int irq = d->irq;void __iomem *base;pr_debug ("%s: %d\n" , __func__, irq);
@@ -75,8 +78,9 @@ void tegra_legacy_mask_irq(unsigned int irq)writel (1 << (irq &31 ), base +ICTLR_CPU_IER_CLR ); } -void tegra_legacy_force_irq_set (unsigned int irq) +void tegra_legacy_force_irq_set (struct irq_data *d) { +unsigned int irq = d->irq;void __iomem *base;pr_debug ("%s: %d\n" , __func__, irq);
@@ -85,8 +89,9 @@ void tegra_legacy_force_irq_set(unsigned int irq)writel (1 << (irq &31 ), base +ICTLR_CPU_IEP_FIR_SET ); } -void tegra_legacy_force_irq_clr (unsigned int irq) +void tegra_legacy_force_irq_clr (struct irq_data *d) { +unsigned int irq = d->irq;void __iomem *base;pr_debug ("%s: %d\n" , __func__, irq);
@@ -95,8 +100,9 @@ void tegra_legacy_force_irq_clr(unsigned int irq)writel (1 << (irq &31 ), base +ICTLR_CPU_IEP_FIR_CLR ); } -int tegra_legacy_force_irq_status (unsigned int irq) +int tegra_legacy_force_irq_status (struct irq_data *d) { +unsigned int irq = d->irq;void __iomem *base;pr_debug ("%s: %d\n" , __func__, irq);
@@ -105,8 +111,9 @@ int tegra_legacy_force_irq_status(unsigned int irq)return !!(readl (base +ICTLR_CPU_IEP_FIR ) & (1 << (irq &31 ))); } -void tegra_legacy_select_fiq (unsigned int irq,bool fiq) +void tegra_legacy_select_fiq (struct irq_data *d,bool fiq) { +unsigned int irq = d->irq;void __iomem *base;pr_debug ("%s: %d\n" , __func__, irq);
@@ -129,8 +136,9 @@ unsigned long tegra_legacy_class(int nr)return readl (base +ICTLR_CPU_IEP_CLASS ); } -int tegra_legacy_irq_set_wake (int irq,int enable) +int tegra_legacy_irq_set_wake (struct irq_data *d,int enable) { +unsigned int irq = d->irq; irq -=32 ;if (enable) tegra_legacy_wake_mask[irq >>5 ] |=1 << (irq &31 );
Signature · 5 lines
1.7.4.5 -- I'm the slime oozin' out from your TV set...
PATCH 1/1 ARM: tegra: consolidate GIC extension usage
Quoted 13 lines · Marc Zyngier
Quoted 10 lines · On Wed, 27 Apr 2011 09:36:57 +0100 Russell King - ARM Linux…
On Wed, Apr 20, 2011 at 11:58:24AM +0100, Marc Zyngier wrote:
A good follow-on step would be...
Quoted 5 lines
?static void
tegra_mask(struct irq_data *d)
?{
- ?tegra_gic_mask_irq(d);
? ?tegra_legacy_mask_irq(d->irq);
?}
Quoted 7 lines
Quoted 3 lines
... arranging
tegra_legacy_mask_irq()etc to take structirq_datadirectly. These functions could then be removed entirely as they serve no useful purpose other than transforming the new API back to the old API.How about the following patch? I haven't touched the
gic_arch_extnpart as it would break Will's fastEOI patch set (which depends on this one), but will prepare another patch cleaning up that part.
I have a patch that fixes all of this and more as part of the Tegra PM series, but I was sitting on it assuming Tegra PM would not go into 2.6.40. Let me sort out the cleanups from the PM stuff, and I'll post a patch that drops legacy_irq.c entirely.
PATCH 1/1 ARM: tegra: consolidate GIC extension usage
Hi Colin,
Quoted 18 lines · Colin Cross
Quoted 17 lines · Marc Zyngier
Quoted 13 lines · On Wed, 27 Apr 2011 09:36:57 +0100 Russell King - ARM Linux…
On Wed, Apr 20, 2011 at 11:58:24AM +0100, Marc Zyngier wrote:
A good follow-on step would be...
Quoted 5 lines
static void
tegra_mask(struct irq_data *d)
{- tegra_gic_mask_irq(d); tegra_legacy_mask_irq(d->irq);}
... arranging
tegra_legacy_mask_irq()etc to take structirq_datadirectly. These functions could then be removed entirely as they serve no useful purpose other than transforming the new API back to the old API.
Quoted 8 lines
Quoted 3 lines
How about the following patch? I haven't touched the
gic_arch_extnpart as it would break Will's fastEOI patch set (which depends on this one), but will prepare another patch cleaning up that part.I have a patch that fixes all of this and more as part of the Tegra PM series, but I was sitting on it assuming Tegra PM would not go into 2.6.40. Let me sort out the cleanups from the PM stuff, and I'll post a patch that drops
legacy_irq.centirely.
Ok. Where does that leave my GIC fasteoi stuff? I'm becoming more conscious of the chained_entry/exit functions sitting there unused in the kernel and it would be good to get the plumbed into all of the platforms sooner rather than later.
Ideally your cleanup patch will mean that I don't have to touch the Tegra irq.c, leaving me with just the GPIO changes (which you can Ack if you like :).
Cheers,
Will
PATCH 1/1 ARM: tegra: consolidate GIC extension usage
Quoted 30 lines · Will Deacon
Hi Colin,
Quoted 18 lines · Colin Cross
Quoted 17 lines · Marc Zyngier
Quoted 13 lines · On Wed, 27 Apr 2011 09:36:57 +0100 Russell King - ARM Linux…
On Wed, Apr 20, 2011 at 11:58:24AM +0100, Marc Zyngier wrote:
A good follow-on step would be...
Quoted 5 lines
?static void
tegra_mask(struct irq_data *d)
?{
- ?tegra_gic_mask_irq(d);
? ?tegra_legacy_mask_irq(d->irq);
?}... arranging
tegra_legacy_mask_irq()etc to take structirq_datadirectly. These functions could then be removed entirely as they serve no useful purpose other than transforming the new API back to the old API.Quoted 8 lines
Quoted 3 lines
How about the following patch? I haven't touched the
gic_arch_extnpart as it would break Will's fastEOI patch set (which depends on this one), but will prepare another patch cleaning up that part.I have a patch that fixes all of this and more as part of the Tegra PM series, but I was sitting on it assuming Tegra PM would not go into 2.6.40. ?Let me sort out the cleanups from the PM stuff, and I'll post a patch that drops
legacy_irq.centirely.
Quoted 8 lines
Ok. Where does that leave my GIC fasteoi stuff? I'm becoming more conscious of the chained_entry/exit functions sitting there unused in the kernel and it would be good to get the plumbed into all of the platforms sooner rather than later.
Ideally your cleanup patch will mean that I don't have to touch the Tegra
irq.c, leaving me with just the GPIO changes (which you can Ack if you like :).
The irq.c changes call your chained functions. I have changes for gpio.c that will conflict as well, and I haven't had a chance to test yours and reconcile them with mine. I'll try to get to it this week.