linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shc_work@mail.ru (Alexander Shiyan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 08/18] ARM: clps711x: Implement usage "MULTI_IRQ_HANDLER" kernel option for a platform
Date: Sat, 17 Nov 2012 17:57:14 +0400	[thread overview]
Message-ID: <1353160644-22446-9-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1353160644-22446-1-git-send-email-shc_work@mail.ru>


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/Kconfig                                  |    1 +
 arch/arm/mach-clps711x/autcpu12.c                 |    1 +
 arch/arm/mach-clps711x/cdb89712.c                 |    1 +
 arch/arm/mach-clps711x/clep7312.c                 |    3 +-
 arch/arm/mach-clps711x/common.c                   |   45 +++++++++++++++++--
 arch/arm/mach-clps711x/common.h                   |    3 +-
 arch/arm/mach-clps711x/edb7211.c                  |    1 +
 arch/arm/mach-clps711x/fortunet.c                 |    1 +
 arch/arm/mach-clps711x/include/mach/entry-macro.S |   51 ---------------------
 arch/arm/mach-clps711x/p720t.c                    |    1 +
 10 files changed, 50 insertions(+), 58 deletions(-)
 delete mode 100644 arch/arm/mach-clps711x/include/mach/entry-macro.S

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 896f6bb..f3f1dd3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -377,6 +377,7 @@ config ARCH_CLPS711X
 	select COMMON_CLK
 	select CPU_ARM720T
 	select GENERIC_CLOCKEVENTS
+	select MULTI_IRQ_HANDLER
 	select NEED_MACH_MEMORY_H
 	select SPARSE_IRQ
 	help
diff --git a/arch/arm/mach-clps711x/autcpu12.c b/arch/arm/mach-clps711x/autcpu12.c
index b90a316..3de1955 100644
--- a/arch/arm/mach-clps711x/autcpu12.c
+++ b/arch/arm/mach-clps711x/autcpu12.c
@@ -75,6 +75,7 @@ MACHINE_START(AUTCPU12, "autronix autcpu12")
 	.init_irq	= clps711x_init_irq,
 	.timer		= &clps711x_timer,
 	.init_machine	= autcpu12_init,
+	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
 
diff --git a/arch/arm/mach-clps711x/cdb89712.c b/arch/arm/mach-clps711x/cdb89712.c
index 133794c..60900dd 100644
--- a/arch/arm/mach-clps711x/cdb89712.c
+++ b/arch/arm/mach-clps711x/cdb89712.c
@@ -142,5 +142,6 @@ MACHINE_START(CDB89712, "Cirrus-CDB89712")
 	.init_irq	= clps711x_init_irq,
 	.timer		= &clps711x_timer,
 	.init_machine	= cdb89712_init,
+	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
index be776c5..0b32a48 100644
--- a/arch/arm/mach-clps711x/clep7312.c
+++ b/arch/arm/mach-clps711x/clep7312.c
@@ -33,7 +33,6 @@ fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi)
 	mi->bank[0].size = 0x01000000;
 }
 
-
 MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
 	/* Maintainer: Nobody */
 	.atag_offset	= 0x0100,
@@ -42,6 +41,6 @@ MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
 	.map_io		= clps711x_map_io,
 	.init_irq	= clps711x_init_irq,
 	.timer		= &clps711x_timer,
+	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
-
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index 286d6e6..0842024 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -29,6 +29,7 @@
 #include <linux/clockchips.h>
 #include <linux/clk-provider.h>
 
+#include <asm/exception.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 #include <asm/system_misc.h>
@@ -134,13 +135,11 @@ static struct irq_chip int2_chip = {
 	.irq_unmask	= int2_unmask,
 };
 
-struct clps711x_irqdesc {
+static struct {
 	int			nr;
 	struct irq_chip		*chip;
 	irq_flow_handler_t	handle;
-};
-
-static struct clps711x_irqdesc clps711x_irqdescs[] __initdata = {
+} clps711x_irqdescs[] __initdata = {
 	{ IRQ_CSINT,	&int1_chip,	handle_fasteoi_irq,	},
 	{ IRQ_EINT1,	&int1_chip,	handle_level_irq,	},
 	{ IRQ_EINT2,	&int1_chip,	handle_level_irq,	},
@@ -191,6 +190,44 @@ void __init clps711x_init_irq(void)
 	}
 }
 
+inline u32 fls16(u32 x)
+{
+	u32 r = 15;
+
+	if (!(x & 0xff00)) {
+		x <<= 8;
+		r -= 8;
+	}
+	if (!(x & 0xf000)) {
+		x <<= 4;
+		r -= 4;
+	}
+	if (!(x & 0xc000)) {
+		x <<= 2;
+		r -= 2;
+	}
+	if (!(x & 0x8000))
+		r--;
+
+	return r;
+}
+
+asmlinkage void __exception_irq_entry clps711x_handle_irq(struct pt_regs *regs)
+{
+	u32 irqstat;
+	void __iomem *base = CLPS711X_VIRT_BASE;
+
+	irqstat = readl_relaxed(base + INTSR1) & readl_relaxed(base + INTMR1);
+	if (irqstat) {
+		handle_IRQ(fls16(irqstat), regs);
+		return;
+	}
+
+	irqstat = readl_relaxed(base + INTSR2) & readl_relaxed(base + INTMR2);
+	if (likely(irqstat))
+		handle_IRQ(fls16(irqstat) + 16, regs);
+}
+
 static void clps711x_clockevent_set_mode(enum clock_event_mode mode,
 					 struct clock_event_device *evt)
 {
diff --git a/arch/arm/mach-clps711x/common.h b/arch/arm/mach-clps711x/common.h
index 28b1701..3c7f12c 100644
--- a/arch/arm/mach-clps711x/common.h
+++ b/arch/arm/mach-clps711x/common.h
@@ -12,5 +12,6 @@ struct sys_timer;
 
 extern void clps711x_map_io(void);
 extern void clps711x_init_irq(void);
-extern struct sys_timer clps711x_timer;
+extern void clps711x_handle_irq(struct pt_regs *regs);
 extern void clps711x_restart(char mode, const char *cmd);
+extern struct sys_timer clps711x_timer;
diff --git a/arch/arm/mach-clps711x/edb7211.c b/arch/arm/mach-clps711x/edb7211.c
index 7b161dd..cc32a65 100644
--- a/arch/arm/mach-clps711x/edb7211.c
+++ b/arch/arm/mach-clps711x/edb7211.c
@@ -98,5 +98,6 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
 	.init_irq	= clps711x_init_irq,
 	.timer		= &clps711x_timer,
 	.init_machine	= edb7211_init,
+	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index a5c0816..7d01255 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -79,5 +79,6 @@ MACHINE_START(FORTUNET, "ARM-FortuNet")
 	.map_io		= clps711x_map_io,
 	.init_irq	= clps711x_init_irq,
 	.timer		= &clps711x_timer,
+	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-clps711x/include/mach/entry-macro.S b/arch/arm/mach-clps711x/include/mach/entry-macro.S
deleted file mode 100644
index 56e5c2c..0000000
--- a/arch/arm/mach-clps711x/include/mach/entry-macro.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * arch/arm/mach-clps711x/include/mach/entry-macro.S
- *
- * Low-level IRQ helper macros for CLPS711X-based platforms
- *
- * This file is licensed under  the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <mach/hardware.h>
-
-		.macro	get_irqnr_preamble, base, tmp
-		.endm
-
-#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
-#error INTSR stride != INTMR stride
-#endif
-
-		.macro	get_irqnr_and_base, irqnr, stat, base, mask
-		mov	\base, #CLPS711X_VIRT_BASE
-		ldr	\stat, [\base, #INTSR1]
-		ldr	\mask, [\base, #INTMR1]
-		mov	\irqnr, #4
-		mov	\mask, \mask, lsl #16
-		and	\stat, \stat, \mask, lsr #16
-		movs	\stat, \stat, lsr #4
-		bne	1001f
-
-		add	\base, \base, #INTSR2 - INTSR1
-		ldr	\stat, [\base, #INTSR1]
-		ldr	\mask, [\base, #INTMR1]
-		mov	\irqnr, #16
-		mov	\mask, \mask, lsl #16
-		and	\stat, \stat, \mask, lsr #16
-
-1001:		tst	\stat, #255
-		addeq	\irqnr, \irqnr, #8
-		moveq	\stat, \stat, lsr #8
-		tst	\stat, #15
-		addeq	\irqnr, \irqnr, #4
-		moveq	\stat, \stat, lsr #4
-		tst	\stat, #3
-		addeq	\irqnr, \irqnr, #2
-		moveq	\stat, \stat, lsr #2
-		tst	\stat, #1
-		addeq	\irqnr, \irqnr, #1
-		moveq	\stat, \stat, lsr #1
-		tst	\stat, #1			@ bit 0 should be set
-		.endm
-
-
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c
index fbe7552..a58a058 100644
--- a/arch/arm/mach-clps711x/p720t.c
+++ b/arch/arm/mach-clps711x/p720t.c
@@ -142,5 +142,6 @@ MACHINE_START(P720T, "ARM-Prospector720T")
 	.timer		= &clps711x_timer,
 	.init_machine	= p720t_init,
 	.init_late	= p720t_init_late,
+	.handle_irq	= clps711x_handle_irq,
 	.restart	= clps711x_restart,
 MACHINE_END
-- 
1.7.8.6

  parent reply	other threads:[~2012-11-17 13:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-17 13:57 [PATCH v3 00/18] ARM: Patchset for CLPS711X Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 01/18] ARM: clps711x: Using platform_driver for ethernet device Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 02/18] ARM: clps711x: p720t: Using "leds-gpio" driver for LED control Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 03/18] ARM: clps711x: Transform clps711x-framebuffer to platform driver and use it Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 04/18] ARM: clps711x: p720t: Unneeded inclusion of head-sa1100.S removed Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 05/18] ARM: clps711x: Always select AUTO_ZRELADDR for a platform Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 06/18] ARM: clps711x: cdb89712: Special driver for handling memory is removed Alexander Shiyan
2013-01-10 14:09   ` Uwe Kleine-König
2013-01-10 15:39     ` Alexander Shiyan
2013-01-10 16:20       ` Uwe Kleine-König
2012-11-17 13:57 ` [PATCH v3 07/18] ARM: clps711x: Implement usage "SPARSE_IRQ" kernel option for a platform Alexander Shiyan
2012-11-17 13:57 ` Alexander Shiyan [this message]
2012-11-17 13:57 ` [PATCH v3 09/18] ARM: clps711x: Add FIQ interrupt handling Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 10/18] ARM: clps711x: Unused empty "ACK" calls for IRQ-chips removed Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 11/18] ARM: clps711x: autcpu12: Special driver for handling NAND memory is removed Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 12/18] ARM: clps711x: Moving power management of framebuffer driver to the board Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 13/18] ARM: clps711x: p720t: Special driver for handling NAND memory is removed Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 14/18] ARM: clps711x: Moving backlight controls of framebuffer driver to the board Alexander Shiyan
2012-11-21  6:37   ` Olof Johansson
2012-11-17 13:57 ` [PATCH v3 15/18] ARM: clps711x: edb7211: Add support for NOR-Flash Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 16/18] ARM: clps711x: Rename board files to match functionality Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 17/18] ARM: clps711x: Update defconfig due latest changes and new kernel symbols Alexander Shiyan
2012-11-17 13:57 ` [PATCH v3 18/18] MAINTAINERS: Add ARM CLPS711X entry Alexander Shiyan
2012-11-17 15:45 ` [PATCH v3 00/18] ARM: Patchset for CLPS711X Arnd Bergmann
2012-11-19 10:00   ` Linus Walleij
2012-11-21  6:36   ` Olof Johansson
2012-11-21  9:46     ` Linus Walleij
2012-11-21 10:18     ` Olof Johansson
2012-11-21 10:27       ` Olof Johansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1353160644-22446-9-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).