From patchwork Mon Jul 30 11:58:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 1254441 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 5F3C5DF24C for ; Mon, 30 Jul 2012 12:21: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 1Svotx-0000gt-15; Mon, 30 Jul 2012 12:16:45 +0000 Received: from mail-yx0-f177.google.com ([209.85.213.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Svofp-0006J0-Bh for linux-arm-kernel@lists.infradead.org; Mon, 30 Jul 2012 12:02:09 +0000 Received: by yenr9 with SMTP id r9so4799568yen.36 for ; Mon, 30 Jul 2012 05:01:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=R+7LbXRESBE+3YTeimhn2KFHcitWnQ11Yft3qHACaDI=; b=ir8eOXQB/3CFqzEyauE6J3KyzaHbB2FBh7hZOjZjKYLN/TR0jnRGdKiW9O48+47TMS qau7pFHYP+Btjx5OOuKWleviJVLPYuL26Ke/vpoK6LKglZAlfVJSyX8fKnqHc1KiM/L5 5gGWbfYXiP3wQVxGun+ZrmqOfqOLT+yH/6Zz9rrLFc7Td9qLh5qOAZWQp9nAiEferCmI GddrbKbixjHZgHmz0/vwhAZqEJACS96JvaE8dt5qVzPfXmjsNUjGLXEZ+7N1FKltflGe yrZkv2uloNY9mE3CWQz4Ck1NhI9LWEdMQJOCwEd9rrBNXggm8ZGGDz8S5RyTWWMMBdQy NgNA== Received: by 10.66.83.39 with SMTP id n7mr23969631pay.82.1343649718990; Mon, 30 Jul 2012 05:01:58 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id ms9sm7813506pbb.43.2012.07.30.05.01.57 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2012 05:01:58 -0700 (PDT) From: Anton Vorontsov To: Russell King , Jason Wessel , Greg Kroah-Hartman , Alan Cox Subject: [PATCH 09/11] ARM: VIC: Add a couple of low-level FIQ management helpers Date: Mon, 30 Jul 2012 04:58:18 -0700 Message-Id: <1343649500-18491-9-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20120730115719.GA5742@lizard> References: <20120730115719.GA5742@lizard> X-Gm-Message-State: ALoCoQncCCoxyaIRuItStddWthC9vJnHvDgQdqQ9wloYNi4D0LQhh9eqcppmPjcJT0LpTTSEhk0h X-Spam-Note: CRM114 invocation failed X-Spam-Note: SpamAssassin invocation failed Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , John Stultz , Colin Cross , kernel-team@android.com, linux-arm-kernel@lists.infradead.org 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 Just a couple of calls to manage VIC FIQ routing. We'll use them for KGDB FIQ support on ARM Versatile machines. Signed-off-by: Anton Vorontsov --- arch/arm/common/vic.c | 28 ++++++++++++++++++++++++++++ arch/arm/include/asm/hardware/vic.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c index e0d5388..df2fc82 100644 --- a/arch/arm/common/vic.c +++ b/arch/arm/common/vic.c @@ -66,6 +66,34 @@ static struct vic_device vic_devices[CONFIG_ARM_VIC_NR]; static int vic_id; +static void __iomem *vic_base(struct irq_data *d) +{ + return (void __iomem *)irq_data_get_irq_chip_data(d); +} + +void vic_fiq_select(unsigned int irq, bool on) +{ + void __iomem *base = vic_base(&irq_to_desc(irq)->irq_data); + void __iomem *sel = base + VIC_INT_SELECT; + u32 msk = 1 << irq; + u32 val; + + pr_debug("rerouting VIC vector %d to %s\n", irq, on ? "FIQ" : "IRQ"); + + val = readl(sel); + val &= ~msk; + if (on) + val |= msk; + writel(val, sel); +} + +bool vic_is_fiq_rised(unsigned int irq) +{ + void __iomem *base = vic_base(&irq_to_desc(irq)->irq_data); + + return readl(base + VIC_FIQ_STATUS) & (1 << irq); +} + /** * vic_init2 - common initialisation code * @base: Base of the VIC. diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h index e14af1a..2728975 100644 --- a/arch/arm/include/asm/hardware/vic.h +++ b/arch/arm/include/asm/hardware/vic.h @@ -52,6 +52,8 @@ void __vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); int vic_of_init(struct device_node *node, struct device_node *parent); void vic_handle_irq(struct pt_regs *regs); +void vic_fiq_select(unsigned int irq, bool on); +bool vic_is_fiq_rised(unsigned int irq); #endif /* __ASSEMBLY__ */ #endif