From patchwork Fri Nov 23 00:42:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 13086 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 DA34823E13 for ; Fri, 23 Nov 2012 00:48:16 +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 A3274A18BC8 for ; Fri, 23 Nov 2012 00:48:16 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so1222676ieb.11 for ; Thu, 22 Nov 2012 16:48:16 -0800 (PST) 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=lU3fcSfi5gq0qmvGSLTAmXimeyTKiJ0nVjSCVzzFowU=; b=ICifykgXQGVG2GVJY8kij7NahmtGA10H3/sFPXfMIM1twwha+Yowhra05AwsqTblLb 6vVyGgq20FV/pP9gU2MihE3Esmrcw6xU61LlwKypMGs5oTvFCQFcgAc8z9o+1ulw0rKP EX+FCIEL6IWhfT5jpE0/tHCEXLxkOTmnH2SikuBzOBGUxPmuIONOz+Ar9tg7EaFvHNI5 pICxjTYwapUstxEhYigmdOzASuqSQXuY9JddwhNJnV5PDm0IAxJ1msPlv3tcNOgAjjHf H2SzqGuw9yfoOM8S5oMresI+iGjdCVBYWwhRGDGhb8OJLjvdLr3pU2qpWGGq8mNnK2nS +dRQ== Received: by 10.50.152.137 with SMTP id uy9mr2012746igb.62.1353631696431; Thu, 22 Nov 2012 16:48:16 -0800 (PST) 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 n20csp281977igt; Thu, 22 Nov 2012 16:48:16 -0800 (PST) Received: by 10.60.31.8 with SMTP id w8mr1689971oeh.55.1353631695669; Thu, 22 Nov 2012 16:48:15 -0800 (PST) Received: from mail-oa0-f45.google.com (mail-oa0-f45.google.com [209.85.219.45]) by mx.google.com with ESMTPS id ym2si4269729obb.105.2012.11.22.16.48.15 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Nov 2012 16:48:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.219.45 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.219.45; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.219.45 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-oa0-f45.google.com with SMTP id i18so7983032oag.4 for ; Thu, 22 Nov 2012 16:48:15 -0800 (PST) Received: by 10.182.194.70 with SMTP id hu6mr1703633obc.4.1353631695418; Thu, 22 Nov 2012 16:48:15 -0800 (PST) Received: from localhost (ip-64-134-239-153.public.wayport.net. [64.134.239.153]) by mx.google.com with ESMTPS id nd14sm4454326obb.14.2012.11.22.16.48.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Nov 2012 16:48:14 -0800 (PST) From: Anton Vorontsov To: Andrew Morton Cc: Russell King , Jason Wessel , 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: Thu, 22 Nov 2012 16:42:46 -0800 Message-Id: <1353631367-4107-3-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.8.0 In-Reply-To: <20121123002957.GA31679@lizard.mcd25758.sjc.wayport.net> References: <20121123002957.GA31679@lizard.mcd25758.sjc.wayport.net> X-Gm-Message-State: ALoCoQlLR5se3fqH9pvjpK4yGDO9emSAlpehNuB8M1qmgJzdIUAG/IaIDynYIGq9IGBd3e3L9mDo 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