From patchwork Mon Sep 10 04:14:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 11279 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 65CE223F26 for ; Mon, 10 Sep 2012 04:17:10 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 18A48A1831C for ; Mon, 10 Sep 2012 04:17:09 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id k11so2310032iea.11 for ; Sun, 09 Sep 2012 21:17:09 -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:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-gm-message-state; bh=tvYWsK/dU8UJVmIG9wn3l+POQTaiYI0mxeqyr0f3WaI=; b=hO2aDZ+pzT2KiP4AQoS6Dc7VXt48j4ZZl4rpoIRnKNMs3AEAFGUVzSZP6KO0cgAscy wGRKH3MLUK0xSPkDFZP9ATVtbMIgCGItiDaex5Z58eiR/7YOwZV9Q8fDYLJynBaej0XQ gZecJ9aKl7GH2dI7oJqbxoBbgOD6mmmvo6ccTqYr0mwJ3hwdwTdd8RU5l3msMziziSNw a0eimH0wUYmX/caxtF4r4hWD4TIbF5pWF7Fz8371DJDA20WmdR9mr6Jt/aHgHp7itCA1 xduQ3nypheob4mxQBz+LtmuyifdzCYYZqJSxQ3H44YVWmanUKIel51m35FWu9wk40LxY Jnuw== Received: by 10.50.191.227 with SMTP id hb3mr863568igc.43.1347250629893; Sun, 09 Sep 2012 21:17:09 -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 ex8csp72991igc; Sun, 9 Sep 2012 21:17:09 -0700 (PDT) Received: by 10.68.232.194 with SMTP id tq2mr3854360pbc.111.1347250629199; Sun, 09 Sep 2012 21:17:09 -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 nr4si12805903pbc.96.2012.09.09.21.17.09 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 09 Sep 2012 21:17:09 -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 md12so2061699pbc.37 for ; Sun, 09 Sep 2012 21:17:09 -0700 (PDT) Received: by 10.66.72.197 with SMTP id f5mr19869361pav.20.1347250628897; Sun, 09 Sep 2012 21:17:08 -0700 (PDT) Received: from localhost (ip-64-134-230-8.public.wayport.net. [64.134.230.8]) by mx.google.com with ESMTPS id vh7sm7441885pbc.22.2012.09.09.21.17.08 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 09 Sep 2012 21:17:08 -0700 (PDT) Date: Sun, 9 Sep 2012 21:14:36 -0700 From: Anton Vorontsov To: Andrew Morton , Russell King , Jason Wessel , Greg Kroah-Hartman , Alan Cox Cc: Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , Colin Cross , Brian Swetland , 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, linux-serial@vger.kernel.org Subject: [PATCH 13/14] ARM: VIC: Add a couple of low-level FIQ management helpers Message-ID: <20120910041436.GM29537@lizard> References: <20120910040802.GA1261@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120910040802.GA1261@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQlldEBeLiuf7hIAmo88aYowEWQo4ACWqF4gf1NXhv3T5mUMvSdQdeK+fGiSUihg+NjJtk8c 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