From patchwork Sun May 12 04:23:01 2013
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Daniel Tang
X-Patchwork-Id: 2555181
Return-Path:
X-Original-To: patchwork-linux-arm@patchwork.kernel.org
Delivered-To: patchwork-process-083081@patchwork2.kernel.org
Received: from casper.infradead.org (casper.infradead.org [85.118.1.10])
by patchwork2.kernel.org (Postfix) with ESMTP id DD99ADF215
for ;
Sun, 12 May 2013 04:27:37 +0000 (UTC)
Received: from merlin.infradead.org ([2001:4978:20e::2])
by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux))
id 1UbNr0-0003Bs-7z; Sun, 12 May 2013 04:25:48 +0000
Received: from localhost ([::1] helo=merlin.infradead.org)
by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux))
id 1UbNq1-0008Ro-Cw; Sun, 12 May 2013 04:24:45 +0000
Received: from mail-da0-x236.google.com ([2607:f8b0:400e:c00::236])
by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux))
id 1UbNpk-0008NM-VQ for linux-arm-kernel@lists.infradead.org;
Sun, 12 May 2013 04:24:32 +0000
Received: by mail-da0-f54.google.com with SMTP id u36so2975107dak.13
for ;
Sat, 11 May 2013 21:24:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to
:references; bh=KDaf96OQZOopKtbGWSOEL+KZ+Scu377K4K9HjBGKTv4=;
b=OXTq143CSFe9W7aLgvYmRcG7deQVEPU0GX8NWUpjXCXErbU1hxZ9iMJW6FVsUpR5mu
KFu4U+IwT8muz/xeqkPob9AWovU0BnHH7P4K0pw0UmbIk4qaPYLzuhsY9Dz/4XPeEOoU
Z+NCgHCnPE35Rat6EI/2rE92bDnBh93pX8Mjen1L4toToEwPcOZVGlPoSeVPzU2Hrks/
5xyZUs1DcPYGBP5YNVPgok8gmflJkI63XiS+0eu2IKtL8fvYHNRd3Rv/jOU9ez62ixZy
zTCadBfPqFSsbnWX8V4WXsNkOayJKzYWcFZSC6ftcygbdWSQ/KXAvS4n39pu5M4Dvl+v
WvBA==
X-Received: by 10.66.248.40 with SMTP id yj8mr23988571pac.95.1368332647329;
Sat, 11 May 2013 21:24:07 -0700 (PDT)
Received: from tangrs.lan (110-175-69-66.static.tpgi.com.au. [110.175.69.66])
by mx.google.com with ESMTPSA id 10sm8737984pbm.0.2013.05.11.21.24.02
for
(version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Sat, 11 May 2013 21:24:06 -0700 (PDT)
From: Daniel Tang
To: linux-arm-kernel@lists.infradead.org,
linux@arm.linux.org.uk
Subject: [RFC PATCHv3 6/6] irqchip: Add TI-Nspire irqchip
Date: Sun, 12 May 2013 14:23:01 +1000
Message-Id: <1368332581-94691-7-git-send-email-dt.tangr@gmail.com>
X-Mailer: git-send-email 1.8.1.3
In-Reply-To: <1368332581-94691-1-git-send-email-dt.tangr@gmail.com>
References: <1368332581-94691-1-git-send-email-dt.tangr@gmail.com>
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
X-CRM114-CacheID: sfid-20130512_002429_241678_E2C451B4
X-CRM114-Status: GOOD ( 18.76 )
X-Spam-Score: -2.0 (--)
X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary:
Content analysis details: (-2.0 points)
pts rule name description
---- ----------------------
--------------------------------------------------
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
provider (dt.tangr[at]gmail.com)
-0.0 SPF_PASS SPF: sender matches SPF record
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
author's domain
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily valid
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
Cc: Arnd Bergmann , Linus Walleij ,
linux-kernel@vger.kernel.org,
"fabian@ritter-vogt.de Vogt" ,
Daniel Tang ,
Lionel Debroux
X-BeenThere: linux-arm-kernel@lists.infradead.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id:
List-Unsubscribe:
,
List-Archive:
List-Post:
List-Help:
List-Subscribe:
,
MIME-Version: 1.0
Sender: "linux-arm-kernel"
Errors-To:
linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org
Signed-off-by: Daniel Tang
---
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-nspire-classic.c | 177 +++++++++++++++++++++++++++++++++++
2 files changed, 178 insertions(+)
create mode 100644 drivers/irqchip/irq-nspire-classic.c
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index cda4cb5..056ad7d 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -15,4 +15,5 @@ obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o
obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o
obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o
obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o
+obj-$(CONFIG_ARCH_NSPIRE) += irq-nspire-classic.o
obj-$(CONFIG_ARCH_VT8500) += irq-vt8500.o
diff --git a/drivers/irqchip/irq-nspire-classic.c b/drivers/irqchip/irq-nspire-classic.c
new file mode 100644
index 0000000..9e6413a
--- /dev/null
+++ b/drivers/irqchip/irq-nspire-classic.c
@@ -0,0 +1,177 @@
+/*
+ * linux/drivers/irqchip/irq-nspire-classic.c
+ *
+ * Copyright (C) 2013 Daniel Tang
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "irqchip.h"
+
+#define IO_STATUS 0x000
+#define IO_RAW_STATUS 0x004
+#define IO_ENABLE 0x008
+#define IO_DISABLE 0x00C
+#define IO_CURRENT 0x020
+#define IO_RESET 0x028
+#define IO_MAX_PRIOTY 0x02C
+
+#define IO_IRQ_BASE 0x000
+#define IO_FIQ_BASE 0x100
+
+#define IO_INVERT_SEL 0x200
+#define IO_STICKY_SEL 0x204
+#define IO_PRIORITY_SEL 0x300
+
+#define MAX_INTRS 32
+#define FIQ_START MAX_INTRS
+
+
+static void __iomem *irq_io_base;
+static struct irq_domain *nspire_irq_domain;
+
+static void nspire_irq_ack(struct irq_data *irqd)
+{
+ void __iomem *base = irq_io_base;
+
+ if (irqd->hwirq < FIQ_START)
+ base += IO_IRQ_BASE;
+ else
+ base += IO_FIQ_BASE;
+
+ readl(base + IO_RESET);
+}
+
+static void nspire_irq_unmask(struct irq_data *irqd)
+{
+ void __iomem *base = irq_io_base;
+ int irqnr = irqd->hwirq;
+
+ if (irqnr < FIQ_START) {
+ base += IO_IRQ_BASE;
+ } else {
+ irqnr -= MAX_INTRS;
+ base += IO_FIQ_BASE;
+ }
+
+ writel((1<hwirq;
+
+ if (irqnr < FIQ_START) {
+ base += IO_IRQ_BASE;
+ } else {
+ irqnr -= FIQ_START;
+ base += IO_FIQ_BASE;
+ }
+
+ writel((1<