Skip to contentSkip to conversation

Tegra irq cleanups

PATCH In review Colin Cross 3 participants 13 messages May 1, 2011 – May 4, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Tegra irq cleanups

This patch series cleans up the Tegra irq subsystem, and allows the GIC to be switched to the fasteoi handler. The first three patches have no dependencies on any other trees. Patch 4 should only go in at the same time as Will Deacon's fasteoi patches, and could be squashed into his patch.

As part of this series, power management support is removed from the Tegra irq subsystem. PM support will be added back in a future patch set along with PM support for the rest of the platform.

Colin Cross (4):
ARM: tegra: irq: convert to gic arch extensions
ARM: tegra: irq: Remove PM support
ARM: tegra: irq: Move legacy_irq.c into irq.c
ARM: tegra: irq: Replace tegra_ack with tegra_eoi

 arch/arm/mach-tegra/Makefile                  |    2 +-
 arch/arm/mach-tegra/include/mach/legacy_irq.h |   35 ----
 arch/arm/mach-tegra/irq.c                     |  181 +++++++++------------
 arch/arm/mach-tegra/legacy_irq.c              |  215 -------------------------
 4 files changed, 77 insertions(+), 356 deletions(-)
 delete mode 100644 arch/arm/mach-tegra/include/mach/legacy_irq.h
 delete mode 100644 arch/arm/mach-tegra/legacy_irq.c
#1 lore raw

PATCH 1/4 ARM: tegra: irq: convert to gic arch extensions

Replace the ugly hack that inserts legacy irq controller calls into the irq call paths by reading and replacing the gic irq chip with the new gic arch extensions.

---
 arch/arm/mach-tegra/irq.c |   54 +++++++++++++-------------------------------
 1 files changed, 16 insertions(+), 38 deletions(-)
arch/arm/mach-tegra/irq.c +16 -38
index 4330d89..567b75c 100644
@@ -1,8 +1,8 @@
 /*
- * Copyright (C) 2010 Google, Inc.
+ * Copyright (C) 2011 Google, Inc.
  *
  * Author:
- *	Colin Cross <[email protected]>
+ *	Colin Cross <[email protected]>
  *
  * Copyright (C) 2010, NVIDIA Corporation
  *
@@ -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,58 +99,40 @@ 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);
+	if (d->irq >= 32)
+		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);
+	if (d->irq >= 32)
+		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);
+	if (d->irq >= 32)
+		tegra_legacy_force_irq_clr(d->irq);
 }
 
 static int tegra_retrigger(struct irq_data *d)
 {
+	if (d->irq < 32)
+		return 0;
+
 	tegra_legacy_force_irq_set(d->irq);
 	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_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.4.1
#4 lore raw

PATCH 2/4 ARM: tegra: irq: Remove PM support

In reply to Colin Cross

Tegra PM irq support is being improved, remove it for now until the rest of the platform gets PM support.

---
 arch/arm/mach-tegra/include/mach/legacy_irq.h |    3 -
 arch/arm/mach-tegra/irq.c                     |   66 ---------------------
 arch/arm/mach-tegra/legacy_irq.c              |   77 -------------------------
 3 files changed, 0 insertions(+), 146 deletions(-)
arch/arm/mach-tegra/include/mach/legacy_irq.h +0 -3
index d898c0e..4c1f535 100644
@@ -27,9 +27,6 @@ int tegra_legacy_force_irq_status(unsigned int irq);
 void tegra_legacy_select_fiq(unsigned int irq, 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);
-void tegra_legacy_irq_set_lp1_wake_mask(void);
-void tegra_legacy_irq_restore_mask(void);
 void tegra_init_legacy_irq(void);
 
 #endif
arch/arm/mach-tegra/irq.c +0 -66

75 lines not on this page · raw message

arch/arm/mach-tegra/legacy_irq.c +0 -77

92 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#5 lore raw

PATCH 3/4 ARM: tegra: irq: Move legacy_irq.c into irq.c

In reply to Colin Cross

Now that irq.c is just an interface layer between the gic and legacy_irq.c, move the contents of legacy_irq.c into irq.c.

---
 arch/arm/mach-tegra/Makefile                  |    2 +-
 arch/arm/mach-tegra/include/mach/legacy_irq.h |   32 ------
 arch/arm/mach-tegra/irq.c                     |   83 +++++++++++++--
 arch/arm/mach-tegra/legacy_irq.c              |  138 -------------------------
 4 files changed, 72 insertions(+), 183 deletions(-)
 delete mode 100644 arch/arm/mach-tegra/include/mach/legacy_irq.h
 delete mode 100644 arch/arm/mach-tegra/legacy_irq.c
arch/arm/mach-tegra/Makefile +1 -1
index 1afe050..823c703 100644
@@ -1,7 +1,7 @@
 obj-y                                   += common.o
 obj-y                                   += devices.o
 obj-y                                   += io.o
-obj-y                                   += irq.o legacy_irq.o
+obj-y                                   += irq.o
 obj-y                                   += clock.o
 obj-y                                   += timer.o
 obj-y                                   += gpio.o
arch/arm/mach-tegra/include/mach/legacy_irq.h deleted +0 -32
deleted file mode 100644
index 4c1f535..0000000
@@ -1,32 +0,0 @@
-/*
- * arch/arm/mach-tegra/include/mach/legacy_irq.h
- *
- * Copyright (C) 2010 Google, Inc.
- * Author: Colin Cross <[email protected]>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#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);
-unsigned long tegra_legacy_vfiq(int nr);
-unsigned long tegra_legacy_class(int nr);
-void tegra_init_legacy_irq(void);
-
-#endif
arch/arm/mach-tegra/irq.c +71 -12

119 lines not on this page · raw message

arch/arm/mach-tegra/legacy_irq.c deleted +0 -138

138 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 4/4 ARM: tegra: irq: Replace tegra_ack with tegra_eoi

In reply to Colin Cross

When the GIC flow control function is replaced with handle_fasteoi_irq, the eoi arch extension will be called instead of ack.

---
 arch/arm/mach-tegra/irq.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/irq.c +2 -2
index 1883203..35fb2f10 100644
@@ -83,7 +83,7 @@ static void tegra_unmask(struct irq_data *d)
 	writel(1 << (leg_irq & 31), base + ICTLR_CPU_IER_SET);
 }
 
-static void tegra_ack(struct irq_data *d)
+static void tegra_eoi(struct irq_data *d)
 {
 	void __iomem *base;
 	int leg_irq;
@@ -121,7 +121,7 @@ void __init tegra_init_irq(void)
 		writel(0, ictlr + ICTLR_CPU_IEP_CLASS);
 	}
 
-	gic_arch_extn.irq_ack = tegra_ack;
+	gic_arch_extn.irq_eoi = tegra_eoi;
 	gic_arch_extn.irq_mask = tegra_mask;
 	gic_arch_extn.irq_unmask = tegra_unmask;
 	gic_arch_extn.irq_retrigger = tegra_retrigger;
Signature · 1 line
1.7.4.1
#12 lore raw

cover Tegra irq cleanups

In reply to Colin Cross
Quoted 17 lines · Colin Cross

This patch series cleans up the Tegra irq subsystem, and allows the GIC to be switched to the fasteoi handler. ?The first three patches have no dependencies on any other trees. ?Patch 4 should only go in at the same time as Will Deacon's fasteoi patches, and could be squashed into his patch.

As part of this series, power management support is removed from the Tegra irq subsystem. ?PM support will be added back in a future patch set along with PM support for the rest of the platform.

Colin Cross (4):
? ? ?ARM: tegra: irq: convert to gic arch extensions ? ? ?ARM: tegra: irq: Remove PM support
? ? ?ARM: tegra: irq: Move legacy_irq.c into irq.c ? ? ?ARM: tegra: irq: Replace tegra_ack with tegra_eoi

Quoted 8 lines
?arch/arm/mach-tegra/Makefile ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-tegra/include/mach/legacy_irq.h | ? 35 ----
?arch/arm/mach-tegra/irq.c ? ? ? ? ? ? ? ? ? ? | ?181 +++++++++------------
?arch/arm/mach-tegra/legacy_irq.c ? ? ? ? ? ? ?| ?215 -------------------------

?4 files changed, 77 insertions(+), 356 deletions(-) ?delete mode 100644 arch/arm/mach-tegra/include/mach/legacy_irq.h ?delete mode 100644 arch/arm/mach-tegra/legacy_irq.c

Sorry Marc, forgot to CC you on this patch set.

I just noticed that you kept both tegra_ack as well as tegra_eoi in your patch set. That seems like a reasonable way to avoid merge order problems between Will's fasteoi patches and these patches, at least in one direction, so I'll add that in v2 (only affects the last patch in the series).

#6 lore raw

PATCH v2 3/4 ARM: tegra: irq: Move legacy_irq.c into irq.c

In reply to Colin Cross

Now that irq.c is just an interface layer between the gic and legacy_irq.c, move the contents of legacy_irq.c into irq.c.

---
v2: Remove duplicated code

 arch/arm/mach-tegra/Makefile                  |    2 +-
 arch/arm/mach-tegra/include/mach/legacy_irq.h |   32 ------
 arch/arm/mach-tegra/irq.c                     |   77 ++++++++++++--
 arch/arm/mach-tegra/legacy_irq.c              |  138 -------------------------
 4 files changed, 66 insertions(+), 183 deletions(-)
 delete mode 100644 arch/arm/mach-tegra/include/mach/legacy_irq.h
 delete mode 100644 arch/arm/mach-tegra/legacy_irq.c
arch/arm/mach-tegra/Makefile +1 -1
index 1afe050..823c703 100644
@@ -1,7 +1,7 @@
 obj-y                                   += common.o
 obj-y                                   += devices.o
 obj-y                                   += io.o
-obj-y                                   += irq.o legacy_irq.o
+obj-y                                   += irq.o
 obj-y                                   += clock.o
 obj-y                                   += timer.o
 obj-y                                   += gpio.o
arch/arm/mach-tegra/include/mach/legacy_irq.h deleted +0 -32
deleted file mode 100644
index 4c1f535..0000000
@@ -1,32 +0,0 @@
-/*
- * arch/arm/mach-tegra/include/mach/legacy_irq.h
- *
- * Copyright (C) 2010 Google, Inc.
- * Author: Colin Cross <[email protected]>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#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);
-unsigned long tegra_legacy_vfiq(int nr);
-unsigned long tegra_legacy_class(int nr);
-void tegra_init_legacy_irq(void);
-
-#endif
arch/arm/mach-tegra/irq.c +65 -12

113 lines not on this page · raw message

arch/arm/mach-tegra/legacy_irq.c deleted +0 -138

138 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#8 lore raw

PATCH v2 4/4 ARM: tegra: irq: Add tegra_eoi

In reply to Colin Cross

Implement irq_eoi to allow the GIC irq chip flow controller to be changed to fasteoi.

---
v2: Add tegra_eoi without removing tegra_ack, patch can now be
merged safely before Will Deacon's gic fasteoi patch

 arch/arm/mach-tegra/irq.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/irq.c +9 -0
index da17491..4956c3c 100644
@@ -95,6 +95,14 @@ static void tegra_ack(struct irq_data *d)
 	tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR);
 }
 
+static void tegra_eoi(struct irq_data *d)
+{
+	if (d->irq < FIRST_LEGACY_IRQ)
+		return;
+
+	tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR);
+}
+
 static int tegra_retrigger(struct irq_data *d)
 {
 	if (d->irq < FIRST_LEGACY_IRQ)
@@ -116,6 +124,7 @@ void __init tegra_init_irq(void)
 	}
 
 	gic_arch_extn.irq_ack = tegra_ack;
+	gic_arch_extn.irq_eoi = tegra_eoi;
 	gic_arch_extn.irq_mask = tegra_mask;
 	gic_arch_extn.irq_unmask = tegra_unmask;
 	gic_arch_extn.irq_retrigger = tegra_retrigger;
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 1/4] ARM: tegra: irq: convert to gic arch extensions

In reply to Colin Cross

Dear Colin Cross,

Quoted 3 lines · In message <[email protected]> you wrote:

Replace the ugly hack that inserts legacy irq controller calls into the irq call paths by reading and replacing the gic irq chip with the new gic arch extensions.

...

Quoted 2 lines

- * Copyright (C) 2010 Google, Inc.
+ * Copyright (C) 2011 Google, Inc.

Sorry for nitpicking, but should this not be "(C) 2010-2011" instead? You don't want to revoke the 2010 rights on the code, do you?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It usually takes more than three weeks to prepare  a  good  impromptu
speech.                                                  - Mark Twain
#3 lore raw

Re: [PATCH 1/4] ARM: tegra: irq: convert to gic arch extensions

Quoted 6 lines · Wolfgang Denk

Dear Colin Cross,

Quoted 3 lines · In message <[email protected]> you wrote:

Replace the ugly hack that inserts legacy irq controller calls into the irq call paths by reading and replacing the gic irq chip with the new gic arch extensions.

Quoted 6 lines

...

Quoted 2 lines

- * Copyright (C) 2010 Google, Inc.
+ * Copyright (C) 2011 Google, Inc.

Sorry for nitpicking, but should this not be "(C) 2010-2011" instead? You don't want to revoke the 2010 rights on the code, do you?

You're right, I'll fix it.

Acked-by on v2 4/4
#9 lore raw

Re: [PATCHv2 4/4] ARM: tegra: irq: Add tegra_eoi

In reply to Colin Cross

Hi Colin,

Quoted 39 lines · Colin Cross

Implement irq_eoi to allow the GIC irq chip flow controller to be changed to fasteoi.

---
v2: Add tegra_eoi without removing tegra_ack, patch can now be
merged safely before Will Deacon's gic fasteoi patch

 arch/arm/mach-tegra/irq.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/irq.c +9 -1
index da17491..4956c3c 100644
@@ -95,6 +95,14 @@ static void tegra_ack(struct irq_data *d)
        tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR);
 }
 
+static void tegra_eoi(struct irq_data *d)
+{
+       if (d->irq < FIRST_LEGACY_IRQ)
+               return;
+
+       tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR);
+}
+
 static int tegra_retrigger(struct irq_data *d)
 {
        if (d->irq < FIRST_LEGACY_IRQ)
@@ -116,6 +124,7 @@ void __init tegra_init_irq(void)
        }
 
        gic_arch_extn.irq_ack = tegra_ack;
+       gic_arch_extn.irq_eoi = tegra_eoi;
        gic_arch_extn.irq_mask = tegra_mask;
        gic_arch_extn.irq_unmask = tegra_unmask;
        gic_arch_extn.irq_retrigger = tegra_retrigger;
--
Quoted 1 line

1.7.4.1

Just the job!

Thanks,

Will

#10 lore raw

Re: [PATCHv2 4/4] ARM: tegra: irq: Add tegra_eoi

Quoted 46 lines · Will Deacon

Hi Colin,

Quoted 39 lines · Colin Cross

Implement irq_eoi to allow the GIC irq chip flow controller to be changed to fasteoi.

---
v2: Add tegra_eoi without removing tegra_ack, patch can now be ? ? merged safely before Will Deacon's gic fasteoi patch

?arch/arm/mach-tegra/irq.c | ? ?9 +++++++++
?1 files changed, 9 insertions(+), 0 deletions(-)

arch/arm/mach-tegra/irq.c +9 -1
index da17491..4956c3c 100644
@@ -95,6 +95,14 @@ static void tegra_ack(struct irq_data *d)
 ? ? ? ? tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR);
 ?}
 
+static void tegra_eoi(struct irq_data *d)
+{
+ ? ? ? if (d->irq < FIRST_LEGACY_IRQ)
+ ? ? ? ? ? ? ? return;
+
+ ? ? ? tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR);
+}
+
 ?static int tegra_retrigger(struct irq_data *d)
 ?{
 ? ? ? ? if (d->irq < FIRST_LEGACY_IRQ)
@@ -116,6 +124,7 @@ void __init tegra_init_irq(void)
 ? ? ? ? }
 
 ? ? ? ? gic_arch_extn.irq_ack = tegra_ack;
+ ? ? ? gic_arch_extn.irq_eoi = tegra_eoi;
 ? ? ? ? gic_arch_extn.irq_mask = tegra_mask;
 ? ? ? ? gic_arch_extn.irq_unmask = tegra_unmask;
 ? ? ? ? gic_arch_extn.irq_retrigger = tegra_retrigger;
--
Quoted 1 line

1.7.4.1

Just the job!

Quoted 7 lines

Thanks,

Will

What is your plan for merging the fasteoi patches? If you are planning to put them in 2.6.40, can you pull these patches into your tree? I don't have any other Tegra changes planned for 2.6.40, so they shouldn't cause conflicts later.

#11 lore raw

Re: [PATCHv2 4/4] ARM: tegra: irq: Add tegra_eoi

Quoted 4 lines · Colin Cross

What is your plan for merging the fasteoi patches? If you are planning to put them in 2.6.40, can you pull these patches into your tree? I don't have any other Tegra changes planned for 2.6.40, so they shouldn't cause conflicts later.

Ok, since Santosh would like me to take his relaxed I/O stuff for the GIC too then I guess I can put all of this into an irq branch along with the fasteoi changes.

Russell - would you be happy pulling this from me if I put it together?

Cheers,

Will