From patchwork Mon Aug 20 14:47:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 10814 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 3019D23E56 for ; Mon, 20 Aug 2012 14:50:22 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0C1A4A18B68 for ; Mon, 20 Aug 2012 14:50:15 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id i2so5358432ggm.11 for ; Mon, 20 Aug 2012 07:50:21 -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=tvYWsK/dU8UJVmIG9wn3l+POQTaiYI0mxeqyr0f3WaI=; b=lyrORNaLwVI8T7kiqn+CbYaDKnlYxt8hAN/FAs3T4CHUyJIc8BhM9LHo1HSjNLP9mw die1yhmp+PjE2IIUD/xDRWsAyKIE5E1Uyc0tJ6WMskurUsKjhxxGe6Qpo0e1dTc9/ShK pR4WE18n7eOySWhdTGgy3P09iYbNw8/Cvgmuiekr7H4vQpFjUbWeFDmKCFBy1qTeqVxp /j1bw1sjDCZgDv69onQNiRbMx8hjZdGts9CgeAYiIFoA+ycOlFUs0tU1h/3l8zPjdPs4 WmhWcILIWd52LlpGptH3KiLS9Yvj9XoHqT6sahgMaGm91TA69wI6QbuioIeIgMn3dYU+ nTCQ== Received: by 10.50.182.161 with SMTP id ef1mr10197770igc.0.1345474221231; Mon, 20 Aug 2012 07:50:21 -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.50.184.232 with SMTP id ex8csp87738igc; Mon, 20 Aug 2012 07:50:20 -0700 (PDT) Received: by 10.66.81.232 with SMTP id d8mr30111630pay.66.1345474220439; Mon, 20 Aug 2012 07:50:20 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id qt3si26954278pbc.353.2012.08.20.07.50.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Aug 2012 07:50:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.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-pz0-f50.google.com with SMTP id e7so2499989dad.37 for ; Mon, 20 Aug 2012 07:50:20 -0700 (PDT) Received: by 10.66.88.1 with SMTP id bc1mr30284545pab.18.1345474220203; Mon, 20 Aug 2012 07:50:20 -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 rm9sm11221399pbc.72.2012.08.20.07.50.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Aug 2012 07:50:19 -0700 (PDT) From: Anton Vorontsov To: Russell King , Jason Wessel , Greg Kroah-Hartman , Alan Cox 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 11/12] ARM: VIC: Add a couple of low-level FIQ management helpers Date: Mon, 20 Aug 2012 07:47:29 -0700 Message-Id: <1345474050-8339-11-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.11.5 In-Reply-To: <20120820144449.GA32560@lizard> References: <20120820144449.GA32560@lizard> X-Gm-Message-State: ALoCoQkU2la7OW37jKs3xeNxHS52GIU/Ld3zPozePDR27XI5tuUq4BJgUhnaKXHuLXz1LPc90kkm 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