From patchwork Thu Jul 5 23:12:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 9876 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CAC4923E2F for ; Thu, 5 Jul 2012 23:15:14 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9A70DA182F4 for ; Thu, 5 Jul 2012 23:15:14 +0000 (UTC) Received: by mail-gh0-f180.google.com with SMTP id z12so8668869ghb.11 for ; Thu, 05 Jul 2012 16:15:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=R+7LbXRESBE+3YTeimhn2KFHcitWnQ11Yft3qHACaDI=; b=PP/deA6A5GVc0B/Su+tPZ6LzJGVTCKtxuY6AlEDF4xWYLaZz5xVVYeEXrxGspR/rjj v566zRAn2GSEGNem51rnR2FVyudbZhVEN6XY5Wdg97VFxZE9DUpe0iQGfGNp9uCH5fg8 zk9phsFmtYbFdOHOGMkYgyX8Fsmtx/UKA3yMk2fMcy3ih2o+zRgkv/I++WQInmcxFb0B 1xjoMuXdJhoqqXZ+UMoiLS474tWHZ8O7kT5SX9BD7OVKYWTpGNvPFSIz+S0KpNYAQRS7 6CLGsZJeX4TtJIk4SD/Fb2L2B3C8Np6z+Vb1LKNRM8p5uxcGju4b1zWZ4ZmVs9f/wIIL nq/A== Received: by 10.50.193.196 with SMTP id hq4mr1013536igc.57.1341530114102; Thu, 05 Jul 2012 16:15:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp1910ibb; Thu, 5 Jul 2012 16:15:13 -0700 (PDT) Received: by 10.68.242.7 with SMTP id wm7mr31621856pbc.98.1341530113491; Thu, 05 Jul 2012 16:15:13 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id wt7si40242066pbc.172.2012.07.05.16.15.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 16:15:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pb0-f50.google.com with SMTP id rr4so15920100pbb.37 for ; Thu, 05 Jul 2012 16:15:13 -0700 (PDT) Received: by 10.68.238.232 with SMTP id vn8mr31051004pbc.78.1341530113055; Thu, 05 Jul 2012 16:15:13 -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 rv9sm20583170pbc.43.2012.07.05.16.15.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 16:15:12 -0700 (PDT) From: Anton Vorontsov To: Russell King , Jason Wessel Cc: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Colin Cross , John Stultz , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com, kgdb-bugreport@lists.sourceforge.net Subject: [PATCH 5/6] ARM: VIC: Add a couple of low-level FIQ management helpers Date: Thu, 5 Jul 2012 16:12:39 -0700 Message-Id: <1341529960-18370-5-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20120705231034.GA16931@lizard> References: <20120705231034.GA16931@lizard> X-Gm-Message-State: ALoCoQlQFGHSwWyN7JMTysREm1IYhNOCfpbDe7O2U4Fvc8qR/+TlW7BD05XkM/lDAX0oeB7bQg88 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