From patchwork Thu Nov 1 09:26:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 1683731 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 2F98CE003B for ; Thu, 1 Nov 2012 09:35:33 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TTr95-0007Dt-TK; Thu, 01 Nov 2012 09:33:04 +0000 Received: from smtp1.mail.ru ([94.100.176.129]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TTr4Z-0005Rk-JC for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2012 09:28:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=PKiPssXNTxOicGZLpmxCqXspYR0Zjwwzav0mksVbdpI=; b=l2C/FEzpQlS9FxF953pBwj6nfRMXZe2x8JKM5yN6MfVU6p19qK42FrkvOQ28RfoXvY2DhqdwySQ6J5DjOpGZBK2ueazjNHF4WOIqHKkP2Uvmm5A/8dvRsb6d4LLhwMuj; Received: from [188.134.40.128] (port=33548 helo=shc.zet) by smtp1.mail.ru with esmtpa (envelope-from ) id 1TTr4Y-0001ZR-3z; Thu, 01 Nov 2012 13:28:22 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 09/15] ARM: clps711x: Implement usage "MULTI_IRQ_HANDLER" kernel option for a platform Date: Thu, 1 Nov 2012 13:26:39 +0400 Message-Id: <1351762006-27368-9-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1351762006-27368-1-git-send-email-shc_work@mail.ru> References: <1351762006-27368-1-git-send-email-shc_work@mail.ru> X-Spam: Not detected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121101_052824_022859_9188F822 X-CRM114-Status: GOOD ( 15.69 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [94.100.176.129 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (shc_work[at]mail.ru) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Olof Johansson , Russell King , Alexander Shiyan , Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Signed-off-by: Alexander Shiyan --- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/autcpu12.c | 1 + arch/arm/mach-clps711x/cdb89712.c | 1 + arch/arm/mach-clps711x/clep7312.c | 1 + arch/arm/mach-clps711x/common.c | 39 ++++++++++++++++ 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, 48 insertions(+), 52 deletions(-) delete mode 100644 arch/arm/mach-clps711x/include/mach/entry-macro.S diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 34ca399..2ee4b14 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -375,6 +375,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 6a4752b..8f9b2e0 100644 --- a/arch/arm/mach-clps711x/autcpu12.c +++ b/arch/arm/mach-clps711x/autcpu12.c @@ -78,6 +78,7 @@ MACHINE_START(AUTCPU12, "autronix autcpu12") .init_machine = autcpu12_init, .nr_irqs = CLPS711X_NR_IRQS, .init_irq = clps711x_init_irq, + .handle_irq = clps711x_handle_irq, .restart = clps711x_restart, .timer = &clps711x_timer, MACHINE_END diff --git a/arch/arm/mach-clps711x/cdb89712.c b/arch/arm/mach-clps711x/cdb89712.c index a526715..88de144 100644 --- a/arch/arm/mach-clps711x/cdb89712.c +++ b/arch/arm/mach-clps711x/cdb89712.c @@ -144,6 +144,7 @@ MACHINE_START(CDB89712, "Cirrus-CDB89712") .init_machine = cdb89712_init, .nr_irqs = CLPS711X_NR_IRQS, .init_irq = clps711x_init_irq, + .handle_irq = clps711x_handle_irq, .restart = clps711x_restart, .timer = &clps711x_timer, MACHINE_END diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c index c76363f..a6b808c 100644 --- a/arch/arm/mach-clps711x/clep7312.c +++ b/arch/arm/mach-clps711x/clep7312.c @@ -47,6 +47,7 @@ MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") .init_machine = clep7312_init, .nr_irqs = CLPS711X_NR_IRQS, .init_irq = clps711x_init_irq, + .handle_irq = clps711x_handle_irq, .restart = clps711x_restart, .timer = &clps711x_timer, MACHINE_END diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c index 286d6e6..3cc0380 100644 --- a/arch/arm/mach-clps711x/common.c +++ b/arch/arm/mach-clps711x/common.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -191,6 +192,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 9757b3e..9d3e9db 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 43a502b..5a43160 100644 --- a/arch/arm/mach-clps711x/edb7211.c +++ b/arch/arm/mach-clps711x/edb7211.c @@ -100,6 +100,7 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") .init_machine = edb7211_init, .nr_irqs = CLPS711X_NR_IRQS, .init_irq = clps711x_init_irq, + .handle_irq = clps711x_handle_irq, .restart = clps711x_restart, .timer = &clps711x_timer, MACHINE_END diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c index dca69c3..72c3745 100644 --- a/arch/arm/mach-clps711x/fortunet.c +++ b/arch/arm/mach-clps711x/fortunet.c @@ -85,6 +85,7 @@ MACHINE_START(FORTUNET, "ARM-FortuNet") .init_machine = fortunet_init, .nr_irqs = CLPS711X_NR_IRQS, .init_irq = clps711x_init_irq, + .handle_irq = clps711x_handle_irq, .restart = clps711x_restart, .timer = &clps711x_timer, 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 - - .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 4383ad8..0b329c3 100644 --- a/arch/arm/mach-clps711x/p720t.c +++ b/arch/arm/mach-clps711x/p720t.c @@ -149,6 +149,7 @@ MACHINE_START(P720T, "ARM-Prospector720T") .init_late = p720t_init_late, .nr_irqs = CLPS711X_NR_IRQS, .init_irq = clps711x_init_irq, + .handle_irq = clps711x_handle_irq, .restart = clps711x_restart, .timer = &clps711x_timer, MACHINE_END