From patchwork Tue Oct 16 00:39:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 12253 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 6591423F62 for ; Tue, 16 Oct 2012 00:43:41 +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 1CDB2A1905B for ; Tue, 16 Oct 2012 00:43:41 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so8650334iej.11 for ; Mon, 15 Oct 2012 17:43:40 -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=76WmanV++BpU0ZFF3G4drAZKaqz3FB7cYZmrPlTYS/c=; b=EjHO7VnqQU69n9Wrmh+pzYMAoGBjE9z8ix0zapaWmwO4xEe3hLYIMxC2XvTuSZLITP Wnpdg5UrkKqK/pA9/5l7XrSQcehsHYacl7s7bcLT3W/+UUtG4aK/3bSpp7viumZxKZag wJDhNcla/XYbKJWmgnYbsipJFRfSqFcalQ7Y83A51McbsditQwi4wrgo7EfKuI8HgnHP ge57qnUgMITMto7lBZzNzgIjpon6LaAozsiCAeI492cItnh1kXgw8JnkUoGDtxDN76AS l4UiYUxNS6plOdIjpc5mPb1qRScQNgqdf5sioGANn7tD5CT63zdtx3dHnQYlVHlIY6SV T5kg== Received: by 10.50.168.37 with SMTP id zt5mr10311156igb.57.1350348220880; Mon, 15 Oct 2012 17:43:40 -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.67.148 with SMTP id n20csp656698igt; Mon, 15 Oct 2012 17:43:40 -0700 (PDT) Received: by 10.68.138.166 with SMTP id qr6mr41828159pbb.69.1350348219724; Mon, 15 Oct 2012 17:43:39 -0700 (PDT) Received: from mail-da0-f50.google.com (mail-da0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id ku3si24516103pbc.313.2012.10.15.17.43.39 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 17:43:39 -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-da0-f50.google.com with SMTP id z20so3256806dae.37 for ; Mon, 15 Oct 2012 17:43:39 -0700 (PDT) Received: by 10.66.73.6 with SMTP id h6mr37240930pav.69.1350348219495; Mon, 15 Oct 2012 17:43:39 -0700 (PDT) Received: from localhost (ip-64-134-230-8.public.wayport.net. [64.134.230.8]) by mx.google.com with ESMTPS id pj10sm9817479pbb.46.2012.10.15.17.43.36 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 17:43:38 -0700 (PDT) From: Anton Vorontsov To: Russell King Cc: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , 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 Subject: [PATCH 3/4] ARM: VIC: Add a couple of low-level FIQ management helpers Date: Mon, 15 Oct 2012 17:39:55 -0700 Message-Id: <1350347996-25412-3-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.12.3 In-Reply-To: <20121016003756.GA23146@lizard> References: <20121016003756.GA23146@lizard> X-Gm-Message-State: ALoCoQmXlsdn3ARzrtjUyzh35pQH9qTaf+2+b7MnMd9cCv4EkGJnURoLt1leG8Rtp9i8QqxU7v42 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