Skip to contentSkip to conversation

ARM: clps711x: Add CLPS711X irqchip driver

PATCH Superseded Alexander Shiyan 2 participants 9 messages Dec 19, 2013 – Jan 13, 2014

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

PATCH v2 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  | 243 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 255 insertions(+), 2 deletions(-)
 create mode 100644 drivers/irqchip/irq-clps711x.c
arch/arm/Kconfig +0 -2
index a95e067..7bb5f3e 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 +243 -0

243 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v2 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
#2 lore raw

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

In reply to Alexander Shiyan
Quoted 3 lines · Alexander Shiyan

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

Just one more question from my side, otherwise

drivers/irqchip/irq-clps711x.c line 197

Quoted 9 lines
drivers/irqchip/irq-clps711x.c new file +9 -0
+	err = irq_alloc_descs(-1, 0, ARRAY_SIZE(clps711x_irqs), numa_node_id());
+	if (IS_ERR_VALUE(err))
+		goto out_iounmap;
+
+	clps711x_intc->ops.map = clps711x_intc_irq_map;
+	clps711x_intc->ops.xlate = irq_domain_xlate_onecell;
+	clps711x_intc->domain =
+		irq_domain_add_legacy(np, ARRAY_SIZE(clps711x_irqs),
+				      0, 0, &clps711x_intc->ops, NULL);

Can't you use irq_domain_add_simple() here? When you are booting with DT and SPARSE_IRQ, you should not need to allocate the descriptors at boot time, but only as needed.

You will have to pass '0' as the first_irq argument for the DT case then, and '1' for the non-DT case to actually allocate virqs starting at number 1.

Arnd

#3 lore raw

Hello.

Quoted 23 lines · Alexander Shiyan
Quoted 3 lines

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

Just one more question from my side, otherwise

drivers/irqchip/irq-clps711x.c line 197

Quoted 9 lines
drivers/irqchip/irq-clps711x.c new file +9 -0
+	err = irq_alloc_descs(-1, 0, ARRAY_SIZE(clps711x_irqs), numa_node_id());
+	if (IS_ERR_VALUE(err))
+		goto out_iounmap;
+
+	clps711x_intc->ops.map = clps711x_intc_irq_map;
+	clps711x_intc->ops.xlate = irq_domain_xlate_onecell;
+	clps711x_intc->domain =
+		irq_domain_add_legacy(np, ARRAY_SIZE(clps711x_irqs),
+				      0, 0, &clps711x_intc->ops, NULL);

Can't you use irq_domain_add_simple() here? When you are booting with DT and SPARSE_IRQ, you should not need to allocate the descriptors at boot time, but only as needed.

Quoted 2 lines

You will have to pass '0' as the first_irq argument for the DT case then, and '1' for the non-DT case to actually allocate virqs starting at number 1.

Using irq_domain_add_simple() cause double usage of irq_alloc_descs(), so we cannot do it. At least now.
Thanks.

PS: Arnd, can you merge this series for 3.14-rc within arm-soc?

---

#4 lore raw

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

Quoted 14 lines · On Friday 03 January 2014 17:26:45 Alexander Shiyan wrote:
Quoted 14 lines

drivers/irqchip/irq-clps711x.c line 197

Quoted 9 lines
drivers/irqchip/irq-clps711x.c new file +9 -0
+   err = irq_alloc_descs(-1, 0, ARRAY_SIZE(clps711x_irqs), numa_node_id());
+   if (IS_ERR_VALUE(err))
+           goto out_iounmap;
+
+   clps711x_intc->ops.map = clps711x_intc_irq_map;
+   clps711x_intc->ops.xlate = irq_domain_xlate_onecell;
+   clps711x_intc->domain =
+           irq_domain_add_legacy(np, ARRAY_SIZE(clps711x_irqs),
+                                 0, 0, &clps711x_intc->ops, NULL);

Can't you use irq_domain_add_simple() here? When you are booting with DT and SPARSE_IRQ, you should not need to allocate the descriptors at boot time, but only as needed.

Quoted 5 lines
Quoted 2 lines

You will have to pass '0' as the first_irq argument for the DT case then, and '1' for the non-DT case to actually allocate virqs starting at number 1.

Using irq_domain_add_simple() cause double usage of irq_alloc_descs(), so we cannot do it. At least now.

Well, the idea would be to remove the irq_alloc_descs() from your code, and have irq_domain_add_simple() call it for the ATAGS case but not at all for the DT case. That is exactly the purpose of '_simple', i.e. to let the irq_alloc_descs() part be handled automatically if needed.

Quoted 1 line

PS: Arnd, can you merge this series for 3.14-rc within arm-soc?

I'd feel more comfortable if Thomas could have a look first and either merge it himself or provide an Ack. I'm not much of an irqchip expert and I don't want to step on his toes there.

Arnd

#5 lore raw

Hello.

Quoted 18 lines · On Friday 03 January 2014 17:26:45 Alexander Shiyan wrote:
Quoted 17 lines
Quoted 16 lines

drivers/irqchip/irq-clps711x.c line 197

Quoted 9 lines
drivers/irqchip/irq-clps711x.c new file +9 -0
+   err = irq_alloc_descs(-1, 0, ARRAY_SIZE(clps711x_irqs), numa_node_id());
+   if (IS_ERR_VALUE(err))
+           goto out_iounmap;
+
+   clps711x_intc->ops.map = clps711x_intc_irq_map;
+   clps711x_intc->ops.xlate = irq_domain_xlate_onecell;
+   clps711x_intc->domain =
+           irq_domain_add_legacy(np, ARRAY_SIZE(clps711x_irqs),
+                                 0, 0, &clps711x_intc->ops, NULL);

Can't you use irq_domain_add_simple() here? When you are booting with DT and SPARSE_IRQ, you should not need to allocate the descriptors at boot time, but only as needed.

You will have to pass '0' as the first_irq argument for the DT case then, and '1' for the non-DT case to actually allocate virqs starting at number 1.

Quoted 7 lines
Quoted 2 lines

Using irq_domain_add_simple() cause double usage of irq_alloc_descs(), so we cannot do it. At least now.

Well, the idea would be to remove the irq_alloc_descs() from your code, and have irq_domain_add_simple() call it for the ATAGS case but not at all for the DT case. That is exactly the purpose of '_simple', i.e. to let the irq_alloc_descs() part be handled automatically if needed.

OK. In any case this need to be tested on HW (this is not a fast thing :) ), and such change can be provided later as a patch to current version.

Quoted 5 lines
Quoted 1 line

PS: Arnd, can you merge this series for 3.14-rc within arm-soc?

I'd feel more comfortable if Thomas could have a look first and either merge it himself or provide an Ack. I'm not much of an irqchip expert and I don't want to step on his toes there.

OK, let's wait. I'll notify again about this series within 2 weeks or so. Thanks.

---

#6 lore raw

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

In reply to Arnd Bergmann
Quoted 18 lines · On Fri, 03 Jan 2014 14:58:53 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 17 lines · On Friday 03 January 2014 17:26:45 Alexander Shiyan wrote:
Quoted 16 lines

drivers/irqchip/irq-clps711x.c line 197

Quoted 9 lines
drivers/irqchip/irq-clps711x.c new file +9 -0
+   err = irq_alloc_descs(-1, 0, ARRAY_SIZE(clps711x_irqs), numa_node_id());
+   if (IS_ERR_VALUE(err))
+           goto out_iounmap;
+
+   clps711x_intc->ops.map = clps711x_intc_irq_map;
+   clps711x_intc->ops.xlate = irq_domain_xlate_onecell;
+   clps711x_intc->domain =
+           irq_domain_add_legacy(np, ARRAY_SIZE(clps711x_irqs),
+                                 0, 0, &clps711x_intc->ops, NULL);

Can't you use irq_domain_add_simple() here? When you are booting with DT and SPARSE_IRQ, you should not need to allocate the descriptors at boot time, but only as needed.

You will have to pass '0' as the first_irq argument for the DT case then, and '1' for the non-DT case to actually allocate virqs starting at number 1.

Quoted 7 lines
Quoted 2 lines

Using irq_domain_add_simple() cause double usage of irq_alloc_descs(), so we cannot do it. At least now.

Well, the idea would be to remove the irq_alloc_descs() from your code, and have irq_domain_add_simple() call it for the ATAGS case but not at all for the DT case. That is exactly the purpose of '_simple', i.e. to let the irq_alloc_descs() part be handled automatically if needed.

So, irq_domain_add_simple() do not work for me.
Current driver uses 1:1 mapping between hwirq and virq. Since DT is not supported by all CLPS711X drivers, I am initialize some devices in init_machine call, so these devices uses 0-based IRQs (i.e. old scheme). Using irq_domain_add_simple() means all our IRQs will be dynamic and its numbers starts from NR_IRQS, so usage irq_domain_add_simple() at this stage is not possible. Once all boards will be ported to DT, I'll review this code, but cannot do it now.

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

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

Quoted 8 lines · On Thursday 09 January 2014 16:20:35 Alexander Shiyan wrote:

So, irq_domain_add_simple() do not work for me.
Current driver uses 1:1 mapping between hwirq and virq. Since DT is not supported by all CLPS711X drivers, I am initialize some devices in init_machine call, so these devices uses 0-based IRQs (i.e. old scheme). Using irq_domain_add_simple() means all our IRQs will be dynamic and its numbers starts from NR_IRQS, so usage irq_domain_add_simple() at this stage is not possible. Once all boards will be ported to DT, I'll review this code, but cannot do it now.

Ok, makes sense. I didn't know you were mixing static devices with DT-probed ones. Your driver looks good then.

Arnd

#8 lore raw

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

Hello.

Quoted 10 lines · On Thu, 09 Jan 2014 13:26:41 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 8 lines · On Thursday 09 January 2014 16:20:35 Alexander Shiyan wrote:

So, irq_domain_add_simple() do not work for me.
Current driver uses 1:1 mapping between hwirq and virq. Since DT is not supported by all CLPS711X drivers, I am initialize some devices in init_machine call, so these devices uses 0-based IRQs (i.e. old scheme). Using irq_domain_add_simple() means all our IRQs will be dynamic and its numbers starts from NR_IRQS, so usage irq_domain_add_simple() at this stage is not possible. Once all boards will be ported to DT, I'll review this code, but cannot do it now.

Quoted 2 lines

Ok, makes sense. I didn't know you were mixing static devices with DT-probed ones. Your driver looks good then.

So, I still hope for the chance to put this into 3.14-rc. Thanks.

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