Skip to contentSkip to conversation

ARM: clps711x: Add CLPS711X irqchip driver

PATCH New Alexander Shiyan 2 participants 10 messages Dec 2, 2013 – Dec 18, 2013

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

PATCH 1/3 ARM: clps711x: Add CLPS711X irqchip driver

This adds the irqchip driver for Cirrus Logic CLPS711X series SoCs.

---
 arch/arm/Kconfig                |   2 -
 arch/arm/mach-clps711x/common.h |   3 +
 drivers/irqchip/Kconfig         |   8 ++
 drivers/irqchip/Makefile        |   1 +
 drivers/irqchip/irq-clps711x.c  | 246 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 258 insertions(+), 2 deletions(-)
 create mode 100644 drivers/irqchip/irq-clps711x.c
arch/arm/Kconfig +0 -2
index ff4fa7b..441f52b 100644
@@ -382,8 +382,6 @@ config ARCH_CLPS711X
 	select CPU_ARM720T
 	select GENERIC_CLOCKEVENTS
 	select MFD_SYSCON
-	select MULTI_IRQ_HANDLER
-	select SPARSE_IRQ
 	help
 	  Support for Cirrus Logic 711x/721x/731x based boards.
 
arch/arm/mach-clps711x/common.h +3 -0
index 9a6767b..f6b43a9 100644
@@ -16,3 +16,6 @@ extern void clps711x_timer_init(void);
 extern void clps711x_handle_irq(struct pt_regs *regs);
 extern void clps711x_restart(enum reboot_mode mode, const char *cmd);
 extern void clps711x_init_early(void);
+
+/* drivers/irqchip/irq-clps711x.c */
+void clps711x_intc_init(phys_addr_t, resource_size_t);
drivers/irqchip/Kconfig +8 -0
index 07bc79c..b4d618c 100644
@@ -35,6 +35,14 @@ config IMGPDC_IRQ
 	select GENERIC_IRQ_CHIP
 	select IRQ_DOMAIN
 
+config CLPS711X_IRQCHIP
+	bool
+	depends on ARCH_CLPS711X
+	select IRQ_DOMAIN
+	select MULTI_IRQ_HANDLER
+	select SPARSE_IRQ
+	default y
+
 config ORION_IRQCHIP
 	bool
 	select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
index 679e2d1..0f0413d 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_ARCH_S3C24XX)		+= irq-s3c24xx.o
 obj-$(CONFIG_METAG)			+= irq-metag-ext.o
 obj-$(CONFIG_METAG_PERFCOUNTER_IRQS)	+= irq-metag.o
 obj-$(CONFIG_ARCH_MOXART)		+= irq-moxart.o
+obj-$(CONFIG_CLPS711X_IRQCHIP)		+= irq-clps711x.o
 obj-$(CONFIG_ORION_IRQCHIP)		+= irq-orion.o
 obj-$(CONFIG_ARCH_SUNXI)		+= irq-sun4i.o
 obj-$(CONFIG_ARCH_SPEAR3XX)		+= spear-shirq.o
drivers/irqchip/irq-clps711x.c new file +246 -0

246 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 3/3 ARM: clps711x: Migrate CLPS711X subarch to the new irqchip driver

This patch remove old code and migrate Cirrus Logic CLPS711X subarch to the new irqchip driver.

---
 arch/arm/mach-clps711x/board-autcpu12.c        |   2 -
 arch/arm/mach-clps711x/board-cdb89712.c        |   2 -
 arch/arm/mach-clps711x/board-clep7312.c        |   2 -
 arch/arm/mach-clps711x/board-edb7211.c         |   2 -
 arch/arm/mach-clps711x/board-p720t.c           |   2 -
 arch/arm/mach-clps711x/common.c                | 201 +------------------------
 arch/arm/mach-clps711x/common.h                |   2 -
 arch/arm/mach-clps711x/include/mach/clps711x.h |  16 --
 8 files changed, 3 insertions(+), 226 deletions(-)
arch/arm/mach-clps711x/board-autcpu12.c +0 -2
index f8d71a8..eb945b2 100644
@@ -265,14 +265,12 @@ static void __init autcpu12_init_late(void)
 MACHINE_START(AUTCPU12, "autronix autcpu12")
 	/* Maintainer: Thomas Gleixner */
 	.atag_offset	= 0x20000,
-	.nr_irqs	= CLPS711X_NR_IRQS,
 	.map_io		= clps711x_map_io,
 	.init_early	= clps711x_init_early,
 	.init_irq	= clps711x_init_irq,
 	.init_time	= clps711x_timer_init,
 	.init_machine	= autcpu12_init,
 	.init_late	= autcpu12_init_late,
-	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
 
arch/arm/mach-clps711x/board-cdb89712.c +0 -2
index a9e38c6..e261a47 100644
@@ -139,12 +139,10 @@ static void __init cdb89712_init(void)
 MACHINE_START(CDB89712, "Cirrus-CDB89712")
 	/* Maintainer: Ray Lehtiniemi */
 	.atag_offset	= 0x100,
-	.nr_irqs	= CLPS711X_NR_IRQS,
 	.map_io		= clps711x_map_io,
 	.init_early	= clps711x_init_early,
 	.init_irq	= clps711x_init_irq,
 	.init_time	= clps711x_timer_init,
 	.init_machine	= cdb89712_init,
-	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
arch/arm/mach-clps711x/board-clep7312.c +0 -2
index b476424..221b9de 100644
@@ -36,12 +36,10 @@ fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi)
 MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
 	/* Maintainer: Nobody */
 	.atag_offset	= 0x0100,
-	.nr_irqs	= CLPS711X_NR_IRQS,
 	.fixup		= fixup_clep7312,
 	.map_io		= clps711x_map_io,
 	.init_early	= clps711x_init_early,
 	.init_irq	= clps711x_init_irq,
 	.init_time	= clps711x_timer_init,
-	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
arch/arm/mach-clps711x/board-edb7211.c +0 -2
index fe6184e..0776098 100644
@@ -177,7 +177,6 @@ static void __init edb7211_init_late(void)
 MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
 	/* Maintainer: Jon McClintock */
 	.atag_offset	= VIDEORAM_SIZE + 0x100,
-	.nr_irqs	= CLPS711X_NR_IRQS,
 	.fixup		= fixup_edb7211,
 	.reserve	= edb7211_reserve,
 	.map_io		= clps711x_map_io,
@@ -186,6 +185,5 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
 	.init_time	= clps711x_timer_init,
 	.init_machine	= edb7211_init,
 	.init_late	= edb7211_init_late,
-	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
arch/arm/mach-clps711x/board-p720t.c +0 -2
index dd81b06..67b7337 100644
@@ -363,7 +363,6 @@ static void __init p720t_init_late(void)
 MACHINE_START(P720T, "ARM-Prospector720T")
 	/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
 	.atag_offset	= 0x100,
-	.nr_irqs	= CLPS711X_NR_IRQS,
 	.fixup		= fixup_p720t,
 	.map_io		= clps711x_map_io,
 	.init_early	= clps711x_init_early,
@@ -371,6 +370,5 @@ MACHINE_START(P720T, "ARM-Prospector720T")
 	.init_time	= clps711x_timer_init,
 	.init_machine	= p720t_init,
 	.init_late	= p720t_init_late,
-	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
arch/arm/mach-clps711x/common.c +3 -198

221 lines not on this page · raw message

arch/arm/mach-clps711x/common.h +0 -2
index f6b43a9..7489139 100644
@@ -6,14 +6,12 @@
 
 #include <linux/reboot.h>
 
-#define CLPS711X_NR_IRQS	(33)
 #define CLPS711X_NR_GPIO	(4 * 8 + 3)
 #define CLPS711X_GPIO(prt, bit)	((prt) * 8 + (bit))
 
 extern void clps711x_map_io(void);
 extern void clps711x_init_irq(void);
 extern void clps711x_timer_init(void);
-extern void clps711x_handle_irq(struct pt_regs *regs);
 extern void clps711x_restart(enum reboot_mode mode, const char *cmd);
 extern void clps711x_init_early(void);
 
arch/arm/mach-clps711x/include/mach/clps711x.h +0 -16
index 0286f4b..eb052a1 100644
@@ -40,8 +40,6 @@
 #define MEMCFG1		(0x0180)
 #define MEMCFG2		(0x01c0)
 #define DRFPR		(0x0200)
-#define INTSR1		(0x0240)
-#define INTMR1		(0x0280)
 #define LCDCON		(0x02c0)
 #define TC1D		(0x0300)
 #define TC2D		(0x0340)
@@ -55,28 +53,16 @@
 #define PALLSW		(0x0540)
 #define PALMSW		(0x0580)
 #define STFCLR		(0x05c0)
-#define BLEOI		(0x0600)
-#define MCEOI		(0x0640)
-#define TEOI		(0x0680)
-#define TC1EOI		(0x06c0)
-#define TC2EOI		(0x0700)
-#define RTCEOI		(0x0740)
-#define UMSEOI		(0x0780)
-#define COEOI		(0x07c0)
 #define HALT		(0x0800)
 #define STDBY		(0x0840)
 
 #define FBADDR		(0x1000)
 #define SYSCON2		(0x1100)
 #define SYSFLG2		(0x1140)
-#define INTSR2		(0x1240)
-#define INTMR2		(0x1280)
 #define UARTDR2		(0x1480)
 #define UBRLCR2		(0x14c0)
 #define SS2DR		(0x1500)
-#define SRXEOF		(0x1600)
 #define SS2POP		(0x16c0)
-#define KBDEOI		(0x1700)
 
 #define DAIR		(0x2000)
 #define DAIDR0		(0x2040)
@@ -84,8 +70,6 @@
 #define DAIDR2		(0x20c0)
 #define DAISR		(0x2100)
 #define SYSCON3		(0x2200)
-#define INTSR3		(0x2240)
-#define INTMR3		(0x2280)
 #define LEDFLSH		(0x22c0)
 #define SDCONF		(0x2300)
 #define SDRFPR		(0x2340)
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 1/3 ARM: clps711x: Add CLPS711X irqchip driver

In reply to Alexander Shiyan
Quoted 11 lines · Alexander Shiyan

This adds the irqchip driver for Cirrus Logic CLPS711X series SoCs.

---
 arch/arm/Kconfig                |   2 -
 arch/arm/mach-clps711x/common.h |   3 +
 drivers/irqchip/Kconfig         |   8 ++
 drivers/irqchip/Makefile        |   1 +
 drivers/irqchip/irq-clps711x.c  | 246 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 258 insertions(+), 2 deletions(-)

create mode 100644 drivers/irqchip/irq-clps711x.c

It seems you forgot to add the irqchip maintainer to Cc, I've added him in this reply.

Quoted 18 lines
drivers/irqchip/irq-clps711x.c new file +18 -0
+static void clps711x_intc_eoi(struct irq_data *d)
+{
+	irq_hw_number_t hwirq = irqd_to_hwirq(d);
+
+	writel_relaxed(0, clps711x_intc->base + clps711x_irqs[hwirq].eoi);
+}
+
+static void clps711x_intc_mask(struct irq_data *d)
+{
+	irq_hw_number_t hwirq = irqd_to_hwirq(d);
+	void __iomem *intmr = clps711x_intc->intmr[hwirq / 16];
+	u32 tmp;
+
+	tmp = readl_relaxed(intmr);
+	tmp &= ~(1 << (hwirq % 16));
+	writel_relaxed(tmp, intmr);
+}
+

drivers/irqchip/irq-clps711x.c line 126

Quoted 10 lines
drivers/irqchip/irq-clps711x.c new file +10 -0
+static void clps711x_intc_unmask(struct irq_data *d)
+{
+	irq_hw_number_t hwirq = irqd_to_hwirq(d);
+	void __iomem *intmr = clps711x_intc->intmr[hwirq / 16];
+	u32 tmp;
+
+	tmp = readl_relaxed(intmr);
+	tmp |= 1 << (hwirq % 16);
+	writel_relaxed(tmp, intmr);
+}

These look rather simple, have you checked if you can reuse the generic irqchip code?

drivers/irqchip/irq-clps711x.c line 199

Quoted 3 lines
drivers/irqchip/irq-clps711x.c new file +3 -0
+	clps711x_intc->domain =
+		irq_domain_add_legacy(np, ARRAY_SIZE(clps711x_irqs),
+				      0, 0, &clps711x_intc_ops, NULL);

You should probably use irq_domain_add_simple() here, and pass first_irq = -1 for the DT case, unless you still need a mix of DT with platform devices that have hardwired IRQ resources.

drivers/irqchip/irq-clps711x.c line 230

Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+void __init clps711x_intc_init(phys_addr_t base, resource_size_t size)
+{
+	BUG_ON(_clps711x_intc_init(NULL, base, size));
+}
+EXPORT_SYMBOL(clps711x_intc_init);

No need to export this symbol, because you don't call the function from loadable modules.

Arnd

#4 lore raw
Quoted 4 lines · Alexander Shiyan
Quoted 3 lines

This adds the irqchip driver for Cirrus Logic CLPS711X series SoCs.

...

Quoted 5 lines
Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+static void clps711x_intc_unmask(struct irq_data *d)
+{
+	irq_hw_number_t hwirq = irqd_to_hwirq(d);
+	void __iomem *intmr = clps711x_intc->intmr[hwirq / 16];
+	u32 tmp;
Quoted 8 lines

drivers/irqchip/irq-clps711x.c line 126

Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+
+	tmp = readl_relaxed(intmr);
+	tmp |= 1 << (hwirq % 16);
+	writel_relaxed(tmp, intmr);
+}

These look rather simple, have you checked if you can reuse the generic irqchip code?

I thought about it but did not come to a decision for EOI handlers.

...

Quoted 8 lines

drivers/irqchip/irq-clps711x.c line 230

Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+void __init clps711x_intc_init(phys_addr_t base, resource_size_t size)
+{
+	BUG_ON(_clps711x_intc_init(NULL, base, size));
+}
+EXPORT_SYMBOL(clps711x_intc_init);

No need to export this symbol, because you don't call the function from loadable modules.

OK. I will remove it in the next version by adding "maybe_unused" to this function to avoid possible warnings.

---

#5 lore raw

PATCH 1/3 ARM: clps711x: Add CLPS711X irqchip driver

Quoted 11 lines · Alexander Shiyan
Quoted 8 lines

drivers/irqchip/irq-clps711x.c line 230

Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+void __init clps711x_intc_init(phys_addr_t base, resource_size_t size)
+{
+   BUG_ON(_clps711x_intc_init(NULL, base, size));
+}
+EXPORT_SYMBOL(clps711x_intc_init);

No need to export this symbol, because you don't call the function from loadable modules.

OK. I will remove it in the next version by adding "maybe_unused" to this function to avoid possible warnings.

The __maybe_unused should not be needed, as the function will still have global scope.

Arnd

#6 lore raw
Quoted 10 lines · Alexander Shiyan
Quoted 9 lines
Quoted 8 lines

drivers/irqchip/irq-clps711x.c line 230

Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+void __init clps711x_intc_init(phys_addr_t base, resource_size_t size)
+{
+   BUG_ON(_clps711x_intc_init(NULL, base, size));
+}
+EXPORT_SYMBOL(clps711x_intc_init);

No need to export this symbol, because you don't call the function from loadable modules.

Quoted 5 lines
Quoted 2 lines

OK. I will remove it in the next version by adding "maybe_unused" to this function to avoid possible warnings.

The __maybe_unused should not be needed, as the function will still have global scope.

OK. Then, if additional comments not appears, I will ask you to apply this series and remove EXPORT() during the merge. I was remind of this in a week.

---

#7 lore raw

PATCH 1/3 ARM: clps711x: Add CLPS711X irqchip driver

In reply to Arnd Bergmann
Quoted 10 lines · On Sat, 7 Dec 2013 17:14:25 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 9 lines · Alexander Shiyan
Quoted 8 lines

drivers/irqchip/irq-clps711x.c line 230

Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+void __init clps711x_intc_init(phys_addr_t base, resource_size_t size)
+{
+   BUG_ON(_clps711x_intc_init(NULL, base, size));
+}
+EXPORT_SYMBOL(clps711x_intc_init);

No need to export this symbol, because you don't call the function from loadable modules.

Quoted 5 lines
Quoted 2 lines

OK. I will remove it in the next version by adding "maybe_unused" to this function to avoid possible warnings.

The __maybe_unused should not be needed, as the function will still have global scope.

Arnd can you merge this series with manual EXPORT_SYMBOL removal? Resend?

Signature · 1 line
Alexander Shiyan <[email protected]>
#8 lore raw

PATCH 1/3 ARM: clps711x: Add CLPS711X irqchip driver

Quoted 13 lines · Alexander Shiyan
Quoted 10 lines · On Sat, 7 Dec 2013 17:14:25 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 9 lines · Alexander Shiyan
Quoted 8 lines

drivers/irqchip/irq-clps711x.c line 230

Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+void __init clps711x_intc_init(phys_addr_t base, resource_size_t size)
+{
+   BUG_ON(_clps711x_intc_init(NULL, base, size));
+}
+EXPORT_SYMBOL(clps711x_intc_init);

No need to export this symbol, because you don't call the function from loadable modules.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

OK. I will remove it in the next version by adding "maybe_unused" to this function to avoid possible warnings.

The __maybe_unused should not be needed, as the function will still have global scope.

Arnd can you merge this series with manual EXPORT_SYMBOL removal? Resend?

I'm still traveling at the moment and will only be resuming my normal arm-soc work in January. All arm-soc patches are handled by Olof and Kevin still, and irqchip patches go through Thomas anyway (or can get merged through arm-soc with his Ack in case of dependencies).

Arnd

#9 lore raw

PATCH 1/3 ARM: clps711x: Add CLPS711X irqchip driver

On Sat, 14 Dec 2013 13:31:39 +0100
Arnd Bergmann <[email protected]> wrote:

...

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 11 lines
Quoted 8 lines

drivers/irqchip/irq-clps711x.c line 230

Quoted 5 lines
drivers/irqchip/irq-clps711x.c new file +5 -0
+void __init clps711x_intc_init(phys_addr_t base, resource_size_t size)
+{
+   BUG_ON(_clps711x_intc_init(NULL, base, size));
+}
+EXPORT_SYMBOL(clps711x_intc_init);

No need to export this symbol, because you don't call the function from loadable modules.

OK. I will remove it in the next version by adding "maybe_unused" to this function to avoid possible warnings.

The __maybe_unused should not be needed, as the function will still have global scope.

Quoted 6 lines
Quoted 1 line

Arnd can you merge this series with manual EXPORT_SYMBOL removal? Resend?

I'm still traveling at the moment and will only be resuming my normal arm-soc work in January. All arm-soc patches are handled by Olof and Kevin still, and irqchip patches go through Thomas anyway (or can get merged through arm-soc with his Ack in case of dependencies).

We do not have a separate mailing list for irqchip drivers, so at this time I just re-send an updated patchset as v2 with Thomas in CC.

Signature · 1 line
Alexander Shiyan <[email protected]>