Skip to contentSkip to conversation

ARM: clps711x: Add CLPS711X irqchip driver

PATCH RESEND Superseded Alexander Shiyan 3 participants 8 messages Feb 2, 2014 – Mar 5, 2014

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

PATCH RESEND 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 e254198..56a56f7 100644
@@ -388,8 +388,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 61ffdca..ec42d2d 100644
@@ -39,6 +39,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 98589e7..9c84342 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_DW_APB_ICTL)		+= irq-dw-apb-ictl.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 RESEND v2 1/3 ARM: clps711x: Add CLPS711X irqchip driver

Quoted 11 lines · On Sun, 2 Feb 2014 12:07:46 +0400 Alexander Shiyan <[email protected]> wrote:

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

...

Ping.

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

???????, 28 ??????? 2014, 17:37 +01:00 ?? Arnd Bergmann <[email protected]>:

Quoted 8 lines · Alexander Shiyan
Quoted 3 lines

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

Applied all three patches on next/soc branch now.

Sorry it took this long.

Oh my god, I did not hope :) Thanks.

I think now more on the issue raised by you in the name of the compatible string in a thread about the PWM driver ... I'll respond in the that thread, please, if possible, do not lost it.

Thanks again.
---

#4 lore raw

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

In reply to Alexander Shiyan
Quoted 16 lines · Alexander Shiyan
drivers/irqchip/irq-clps711x.c new file +16 -0
+static const struct {
+#define CLPS711X_FLAG_EN	(1 << 0)
+#define CLPS711X_FLAG_FIQ	(1 << 1)
+	unsigned int	flags;
+	phys_addr_t	eoi;
+} clps711x_irqs[] = {
+	[1]	= { CLPS711X_FLAG_FIQ, CLPS711X_BLEOI, },
+	[3]	= { CLPS711X_FLAG_FIQ, CLPS711X_MCEOI, },
+	[4]	= { CLPS711X_FLAG_EN, CLPS711X_COEOI, },
+	[5]	= { CLPS711X_FLAG_EN, },
+	[6]	= { CLPS711X_FLAG_EN, },
+	[7]	= { CLPS711X_FLAG_EN, },
+	[8]	= { CLPS711X_FLAG_EN, CLPS711X_TC1EOI, },
+	[9]	= { CLPS711X_FLAG_EN, CLPS711X_TC2EOI, },
+	[10]	= { CLPS711X_FLAG_EN, CLPS711X_RTCEOI, },
+	[11]	= { CLPS711X_FLAG_EN, CLPS711X_TEOI, },

drivers/irqchip/irq-clps711x.c line 66

Quoted 10 lines
drivers/irqchip/irq-clps711x.c new file +10 -0
+	[12]	= { CLPS711X_FLAG_EN, },
+	[13]	= { CLPS711X_FLAG_EN, },
+	[14]	= { CLPS711X_FLAG_EN, CLPS711X_UMSEOI, },
+	[15]	= { CLPS711X_FLAG_EN, CLPS711X_SRXEOF, },
+	[16]	= { CLPS711X_FLAG_EN, CLPS711X_KBDEOI, },
+	[17]	= { CLPS711X_FLAG_EN, },
+	[18]	= { CLPS711X_FLAG_EN, },
+	[28]	= { CLPS711X_FLAG_EN, },
+	[29]	= { CLPS711X_FLAG_EN, },
+	[32]	= { CLPS711X_FLAG_FIQ, },

Is anything really using the FIQs on those clps711x machines?

If yes, I have no objections to export the no_action handler.

drivers/irqchip/irq-clps711x.c line 115

Quoted 11 lines
drivers/irqchip/irq-clps711x.c new file +10 -0
+};
 
+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);

Why can't you use a generic irq chip for all of this ?

Thanks,

tglx

#5 lore raw

???????, 4 ????? 2014, 21:15 +01:00 ?? Thomas Gleixner <[email protected]>:

Quoted 31 lines · Alexander Shiyan
Quoted 17 lines
drivers/irqchip/irq-clps711x.c new file +16 -0
+static const struct {
+#define CLPS711X_FLAG_EN	(1 << 0)
+#define CLPS711X_FLAG_FIQ	(1 << 1)
+	unsigned int	flags;
+	phys_addr_t	eoi;
+} clps711x_irqs[] = {
+	[1]	= { CLPS711X_FLAG_FIQ, CLPS711X_BLEOI, },
+	[3]	= { CLPS711X_FLAG_FIQ, CLPS711X_MCEOI, },
+	[4]	= { CLPS711X_FLAG_EN, CLPS711X_COEOI, },
+	[5]	= { CLPS711X_FLAG_EN, },
+	[6]	= { CLPS711X_FLAG_EN, },
+	[7]	= { CLPS711X_FLAG_EN, },
+	[8]	= { CLPS711X_FLAG_EN, CLPS711X_TC1EOI, },
+	[9]	= { CLPS711X_FLAG_EN, CLPS711X_TC2EOI, },
+	[10]	= { CLPS711X_FLAG_EN, CLPS711X_RTCEOI, },
+	[11]	= { CLPS711X_FLAG_EN, CLPS711X_TEOI, },

drivers/irqchip/irq-clps711x.c line 66

Quoted 10 lines
drivers/irqchip/irq-clps711x.c new file +10 -0
+	[12]	= { CLPS711X_FLAG_EN, },
+	[13]	= { CLPS711X_FLAG_EN, },
+	[14]	= { CLPS711X_FLAG_EN, CLPS711X_UMSEOI, },
+	[15]	= { CLPS711X_FLAG_EN, CLPS711X_SRXEOF, },
+	[16]	= { CLPS711X_FLAG_EN, CLPS711X_KBDEOI, },
+	[17]	= { CLPS711X_FLAG_EN, },
+	[18]	= { CLPS711X_FLAG_EN, },
+	[28]	= { CLPS711X_FLAG_EN, },
+	[29]	= { CLPS711X_FLAG_EN, },
+	[32]	= { CLPS711X_FLAG_FIQ, },

Is anything really using the FIQs on those clps711x machines?

Quoted 1 line

If yes, I have no objections to export the no_action handler.

Yes, the patch ("no_action") is the result of the question raised by the driver that uses FIQ.
http://thread.gmane.org/gmane.linux.alsa.devel/119730/focus=119842

Quoted 11 lines

drivers/irqchip/irq-clps711x.c line 115

Quoted 9 lines
drivers/irqchip/irq-clps711x.c new file +9 -0
+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);

Why can't you use a generic irq chip for all of this ?

I thought many times on this subject, but I can not imagine how to handle EOI, because each EOI interrupt uses a separate register.

Thanks.
---

#6 lore raw

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

Quoted 8 lines · Alexander Shiyan

???????, 4 ????? 2014, 21:15 +01:00 ?? Thomas Gleixner <[email protected]>:

Quoted 3 lines

Is anything really using the FIQs on those clps711x machines?

If yes, I have no objections to export the no_action handler.

Yes, the patch ("no_action") is the result of the question raised by the driver that uses FIQ.
http://thread.gmane.org/gmane.linux.alsa.devel/119730/focus=119842

Fair enough.

Quoted 12 lines
Quoted 11 lines

drivers/irqchip/irq-clps711x.c line 115

Quoted 9 lines
drivers/irqchip/irq-clps711x.c new file +9 -0
+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);

Why can't you use a generic irq chip for all of this ?

Quoted 2 lines

I thought many times on this subject, but I can not imagine how to handle EOI, because each EOI interrupt uses a separate register.

You specify the functions which are used by the generic chip implementation.

So you can assign:

   chip->irq_mask = irq_gc_mask_clear_bit;
   chip->irq_unmask = irq_gc_mask_set_bit;
   chip->irq_eoi = cpls_eoi_magic_function;

The eoi callback is only going to be used by the interrupts which have the handle_irq_fasteoi handler installed. So you do not even need any sanity checks in your cpls_eoi_magic_function.

Hmm?

tglx

#7 lore raw

???????, 4 ????? 2014, 23:32 +01:00 ?? Thomas Gleixner <[email protected]>:

Quoted 32 lines · Alexander Shiyan
Quoted 8 lines

???????, 4 ????? 2014, 21:15 +01:00 ?? Thomas Gleixner <[email protected]>:

Quoted 3 lines

Is anything really using the FIQs on those clps711x machines?

If yes, I have no objections to export the no_action handler.

Yes, the patch ("no_action") is the result of the question raised by the driver that uses FIQ.
http://thread.gmane.org/gmane.linux.alsa.devel/119730/focus=119842

Fair enough.

Quoted 12 lines
Quoted 11 lines

drivers/irqchip/irq-clps711x.c line 115

Quoted 9 lines
drivers/irqchip/irq-clps711x.c new file +9 -0
+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);

Why can't you use a generic irq chip for all of this ?

Quoted 2 lines

I thought many times on this subject, but I can not imagine how to handle EOI, because each EOI interrupt uses a separate register.

You specify the functions which are used by the generic chip implementation.

So you can assign:

Quoted 7 lines
   chip->irq_mask = irq_gc_mask_clear_bit;
   chip->irq_unmask = irq_gc_mask_set_bit;
   chip->irq_eoi = cpls_eoi_magic_function;

The eoi callback is only going to be used by the interrupts which have the handle_irq_fasteoi handler installed. So you do not even need any sanity checks in your cpls_eoi_magic_function.

Ie if I understand correctly, we need to create three irq chip using irq_alloc_domain_generic_chips() and assign the mask address for each chip. And use a single EOI handler, taking the value of EOI register from an existing table. If so, I'll try to implement this.

---