From: Neil Armstrong <narmstrong@baylibre.com>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, tglx@linutronix.de,
jason@lakedaemon.net, marc.zyngier@arm.com
Cc: Neil Armstrong <narmstrong@baylibre.com>,
Ma Haijun <mahaijuns@gmail.com>
Subject: [PATCH 02/17] irqchip: Add PLX Technology RPS IRQ Controller
Date: Thu, 3 Mar 2016 12:39:55 +0100 [thread overview]
Message-ID: <1457005210-18485-3-git-send-email-narmstrong@baylibre.com> (raw)
In-Reply-To: <1457005210-18485-1-git-send-email-narmstrong@baylibre.com>
Add PLX Technology RPS IRQ Controller as irqchip driver.
CC: Ma Haijun <mahaijuns@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/irqchip/Kconfig | 5 ++
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-rps.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 134 insertions(+)
create mode 100644 drivers/irqchip/irq-rps.c
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index fb50911..7892c1a 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -135,6 +135,11 @@ config PIC32_EVIC
select GENERIC_IRQ_CHIP
select IRQ_DOMAIN
+config PLXTECH_RPS
+ bool
+ select GENERIC_IRQ_CHIP
+ select IRQ_DOMAIN
+
config RENESAS_INTC_IRQPIN
bool
select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 18caacb..3eec3a0 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_I8259) += irq-i8259.o
obj-$(CONFIG_IMGPDC_IRQ) += irq-imgpdc.o
obj-$(CONFIG_IRQ_MIPS_CPU) += irq-mips-cpu.o
obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o
+obj-$(CONFIG_PLXTECH_RPS) += irq-rps.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
diff --git a/drivers/irqchip/irq-rps.c b/drivers/irqchip/irq-rps.c
new file mode 100644
index 0000000..bcd4a31
--- /dev/null
+++ b/drivers/irqchip/irq-rps.c
@@ -0,0 +1,128 @@
+/*
+ * drivers/irqchip/irq-rps.c
+ *
+ * Copyright (C) 2009 Oxford Semiconductor Ltd
+ * Copyright (C) 2013 Ma Haijun <mahaijuns@gmail.com>
+ * Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/irqdomain.h>
+#include <linux/irq.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/version.h>
+#include <linux/irqchip.h>
+
+#include <asm/exception.h>
+
+struct rps_chip_data {
+ void __iomem *base;
+ struct irq_domain *domain;
+} rps_data;
+
+enum {
+ RPS_IRQ_COUNT = 32,
+
+ RPS_STATUS = 0,
+ RPS_RAW_STATUS = 4,
+ RPS_UNMASK = 8,
+ RPS_MASK = 0xc,
+};
+
+/* Routines to acknowledge, disable and enable interrupts */
+static void rps_mask_irq(struct irq_data *d)
+{
+ u32 mask = BIT(d->hwirq);
+
+ iowrite32(mask, rps_data.base + RPS_MASK);
+}
+
+static void rps_unmask_irq(struct irq_data *d)
+{
+ u32 mask = BIT(d->hwirq);
+
+ iowrite32(mask, rps_data.base + RPS_UNMASK);
+}
+
+static void rps_ack_irq(struct irq_data *d)
+{
+ /* NOP */
+}
+
+static void __exception_irq_entry handle_irq(struct pt_regs *regs)
+{
+ u32 irqstat;
+ int hwirq;
+
+ irqstat = ioread32(rps_data.base + RPS_STATUS);
+ hwirq = __ffs(irqstat);
+
+ do {
+ handle_IRQ(irq_find_mapping(rps_data.domain, hwirq), regs);
+
+ irqstat = ioread32(rps_data.base + RPS_STATUS);
+ hwirq = __ffs(irqstat);
+ } while (irqstat);
+}
+
+int __init rps_of_init(struct device_node *node, struct device_node *parent)
+{
+ int ret;
+ struct irq_chip_generic *gc;
+
+ if (WARN_ON(!node))
+ return -ENODEV;
+
+ rps_data.base = of_iomap(node, 0);
+ WARN(!rps_data.base, "unable to map rps registers\n");
+
+ rps_data.domain = irq_domain_add_linear(node, RPS_IRQ_COUNT,
+ &irq_generic_chip_ops,
+ NULL);
+ if (!rps_data.domain) {
+ pr_err("%s: could add irq domain\n",
+ node->full_name);
+ return -ENOMEM;
+ }
+
+ ret = irq_alloc_domain_generic_chips(rps_data.domain, RPS_IRQ_COUNT, 1,
+ "RPS", handle_level_irq,
+ 0, 0, IRQ_GC_INIT_NESTED_LOCK);
+ if (ret) {
+ pr_err("%s: could not allocate generic chip\n",
+ node->full_name);
+ irq_domain_remove(rps_data.domain);
+ return -EINVAL;
+ }
+
+ gc = irq_get_domain_generic_chip(rps_data.domain, 0);
+ gc->chip_types[0].chip.irq_ack = rps_ack_irq;
+ gc->chip_types[0].chip.irq_mask = rps_mask_irq;
+ gc->chip_types[0].chip.irq_unmask = rps_unmask_irq;
+
+ /* Disable all IRQs */
+ iowrite32(~0, rps_data.base + RPS_MASK);
+
+ set_handle_irq(handle_irq);
+
+ pr_info("Registered %d rps interrupts\n", RPS_IRQ_COUNT);
+
+ return 0;
+}
+
+IRQCHIP_DECLARE(nas782x, "plxtech,nas782x-rps", rps_of_init);
--
1.9.1
next prev parent reply other threads:[~2016-03-03 11:53 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 11:39 [PATCH 00/17] Add Initial support for PLX Technology OX810SE Neil Armstrong
2016-03-03 11:39 ` [PATCH 01/17] dt-bindings: vendor-prefixes: Add PLX Technology Neil Armstrong
2016-03-03 15:02 ` Philipp Zabel
2016-03-05 4:29 ` Rob Herring
2016-03-07 9:55 ` Philipp Zabel
2016-03-03 11:39 ` Neil Armstrong [this message]
2016-03-03 13:01 ` [PATCH 02/17] irqchip: Add PLX Technology RPS IRQ Controller Marc Zyngier
2016-03-03 13:08 ` Arnd Bergmann
2016-03-03 13:36 ` Russell King - ARM Linux
2016-03-03 17:32 ` Arnd Bergmann
2016-03-03 15:32 ` Ma Haijun
2016-03-03 16:56 ` Neil Armstrong
2016-03-03 17:17 ` Marc Zyngier
2016-03-04 11:10 ` Neil Armstrong
2016-03-03 11:39 ` [PATCH 03/17] dt-bindings: Add PLX Technology RPS IRQ Controller bindings Neil Armstrong
2016-03-03 14:53 ` Andrew Lunn
2016-03-03 14:57 ` Neil Armstrong
2016-03-03 15:06 ` Andrew Lunn
2016-03-03 11:39 ` [PATCH 04/17] clocksource: Add PLX Technology RPS Timer Neil Armstrong
2016-03-17 16:13 ` Daniel Lezcano
2016-03-03 11:39 ` [PATCH 05/17] dt-bindings: Add PLX Technology RPS Timer bindings Neil Armstrong
2016-03-03 11:39 ` [PATCH 06/17] reset: Add PLX Technology Reset Controller driver Neil Armstrong
2016-03-03 14:18 ` Philipp Zabel
2016-03-03 14:29 ` Neil Armstrong
2016-03-03 15:00 ` Philipp Zabel
2016-03-03 11:40 ` [PATCH 07/17] dt-bindings: Add PLX Technology Reset Controller bindings Neil Armstrong
2016-03-03 14:21 ` Philipp Zabel
2016-03-03 14:24 ` Neil Armstrong
2016-03-03 14:31 ` Philipp Zabel
2016-03-03 11:40 ` [PATCH 08/17] clk: Add PLX Technology OXNAS Standard Clocks Neil Armstrong
2016-03-04 2:25 ` Stephen Boyd
2016-03-07 11:24 ` Neil Armstrong
2016-03-03 11:40 ` [PATCH 09/17] dt-bindings: Add PLX Technology OXNAS Standard Clocks bindings Neil Armstrong
2016-03-03 11:40 ` [PATCH 10/17] pinctrl: Add PLX Technology OXNAS pinctrl and gpio driver Neil Armstrong
2016-03-15 14:56 ` Linus Walleij
2016-03-16 15:00 ` Neil Armstrong
2016-03-17 14:49 ` Linus Walleij
2016-03-03 11:40 ` [PATCH 11/17] dt-bindings: Add PLX Technology OXNAS pinctrl and gpio bindings Neil Armstrong
2016-03-15 14:30 ` Linus Walleij
2016-03-03 11:40 ` [PATCH 12/17] arm: Add new mach-oxnas Neil Armstrong
2016-03-03 11:49 ` Russell King - ARM Linux
2016-03-03 12:37 ` Neil Armstrong
2016-03-03 12:56 ` Arnd Bergmann
2016-03-03 13:29 ` Russell King - ARM Linux
2016-03-03 13:40 ` Arnd Bergmann
2016-03-03 11:40 ` [PATCH 13/17] arm: Add build support for mach-oxnas Neil Armstrong
2016-03-03 11:40 ` [PATCH 14/17] arm: boot: dts: Add PLX Technology OX810SE dtsi Neil Armstrong
2016-03-03 12:15 ` Arnd Bergmann
2016-03-03 13:39 ` Neil Armstrong
2016-03-03 11:40 ` [PATCH 15/17] dt-bindings: Add OXNAS bindings Neil Armstrong
2016-03-03 11:40 ` [PATCH 16/17] dt-bindings: Add Western Digital to vendor prefixes Neil Armstrong
2016-03-05 4:29 ` Rob Herring
2016-03-03 11:40 ` [PATCH 17/17] arm: boot: dts: Add Western Digital My Book World Edition device tree Neil Armstrong
2016-03-03 12:23 ` [PATCH 00/17] Add Initial support for PLX Technology OX810SE Arnd Bergmann
2016-03-03 12:36 ` Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 00/18] " Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 01/18] clocksource: sp804: Add support for non-32bit width counter Neil Armstrong
2016-03-17 16:40 ` Daniel Lezcano
2016-03-09 10:24 ` [PATCH v2 02/18] dt-bindings: timer: sp804: add timer-width property Neil Armstrong
2016-03-17 17:09 ` Rob Herring
2016-03-17 18:06 ` Robin Murphy
2016-03-17 19:00 ` Rob Herring
2016-03-17 19:21 ` Robin Murphy
2016-03-22 9:21 ` Neil Armstrong
2016-03-22 12:02 ` Robin Murphy
2016-03-22 14:29 ` Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 03/18] irqchip: versatile-fpga: add new arm,rps-irq compatible Neil Armstrong
2016-03-15 11:47 ` Marc Zyngier
2016-03-09 10:24 ` [PATCH v2 04/18] dt-bindings: irq: arm,versatile-fpga: add arm,rps-irq compatible string Neil Armstrong
2016-03-17 17:15 ` Rob Herring
2016-03-09 10:24 ` [PATCH v2 05/18] dt-bindings: vendor-prefixes: Add PLX Technology Neil Armstrong
2016-03-17 17:15 ` Rob Herring
2016-03-09 10:24 ` [PATCH v2 06/18] dt-bindings: Add Oxford Semiconductors to vendor prefixes Neil Armstrong
2016-03-17 17:16 ` Rob Herring
2016-03-09 10:24 ` [PATCH v2 07/18] reset: Add PLX Technology Reset Controller driver Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 08/18] dt-bindings: Add PLX Technology Reset Controller bindings Neil Armstrong
2016-03-17 17:18 ` Rob Herring
2016-03-09 10:24 ` [PATCH v2 09/18] clk: Add PLX Technology OXNAS Standard Clocks Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 10/18] dt-bindings: Add PLX Technology OXNAS Standard Clocks bindings Neil Armstrong
2016-03-17 17:19 ` Rob Herring
2016-03-09 10:24 ` [PATCH v2 11/18] pinctrl: Add PLX Technology OXNAS pinctrl and gpio driver Neil Armstrong
2016-03-10 14:43 ` kbuild test robot
2016-03-09 10:24 ` [PATCH v2 12/18] dt-bindings: Add PLX Technology OXNAS pinctrl and gpio bindings Neil Armstrong
2016-03-17 17:25 ` Rob Herring
2016-03-09 10:24 ` [PATCH v2 13/18] arm: Add new mach-oxnas Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 14/18] arm: Add build support for mach-oxnas Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 15/18] arm: boot: dts: Add PLX Technology OX810SE dtsi Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 16/18] dt-bindings: Add OXNAS bindings Neil Armstrong
2016-03-17 17:27 ` Rob Herring
2016-03-23 8:37 ` Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 17/18] dt-bindings: Add Western Digital to vendor prefixes Neil Armstrong
2016-03-09 10:24 ` [PATCH v2 18/18] arm: boot: dts: Add Western Digital My Book World Edition device tree Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457005210-18485-3-git-send-email-narmstrong@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mahaijuns@gmail.com \
--cc=marc.zyngier@arm.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®