From: Fil Dunsky via B4 Relay <devnull+filipp.dunsky.gmail.com@kernel.org>
To: Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Andi Shyti <andi.shyti@kernel.org>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>,
Russell King <linux@armlinux.org.uk>,
Arnd Bergmann <arnd@arndb.de>,
Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-watchdog@vger.kernel.org,
Fil Dunsky <filipp.dunsky@gmail.com>
Subject: [PATCH 02/11] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller
Date: Mon, 12 Oct 2026 20:32:57 +0300 [thread overview]
Message-ID: <20261012-b4-cs75xx-s2-v1-2-8a7641b7b79c@gmail.com> (raw)
In-Reply-To: <20261012-b4-cs75xx-s2-v1-0-8a7641b7b79c@gmail.com>
From: Fil Dunsky <filipp.dunsky@gmail.com>
The timers, GPIO banks, I2C, MDIO, SPI and a few other low speed
peripherals of the Cortina Systems CS75xx SoCs share a single GIC
interrupt. A status register shows the level of the 15 sources and an
enable register masks them; there is nothing to acknowledge, each source
is cleared in its peripheral.
Add a chained driver using a generic chip on a linear domain.
Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
drivers/irqchip/Kconfig | 12 +++++
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-cs75xx.c | 103 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 116 insertions(+)
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index a8f8c423b..89afb4580 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -187,6 +187,18 @@ config BRCMSTB_L2_IRQ
select GENERIC_IRQ_CHIP
select IRQ_DOMAIN
+config CS75XX_INTC
+ bool "Cortina Systems CS75xx peripheral interrupt controller"
+ depends on ARCH_CORTINA_ACCESS || COMPILE_TEST
+ default ARCH_CORTINA_ACCESS
+ select GENERIC_IRQ_CHIP
+ select IRQ_DOMAIN
+ help
+ Support for the interrupt controller of the Cortina Systems
+ CS75xx SoCs that combines the interrupts of the low speed
+ peripherals (timers, GPIO banks, I2C, MDIO, SPI) into a single
+ GIC interrupt. Say Y if you have a board with such an SoC.
+
config DAVINCI_CP_INTC
bool
select GENERIC_IRQ_CHIP
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index ab33cccd8..38c94bfb3 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -135,3 +135,4 @@ obj-$(CONFIG_APPLE_AIC) += irq-apple-aic.o
obj-$(CONFIG_MCHP_EIC) += irq-mchp-eic.o
obj-$(CONFIG_SOPHGO_SG2042_MSI) += irq-sg2042-msi.o
obj-$(CONFIG_SUNPLUS_SP7021_INTC) += irq-sp7021-intc.o
+obj-$(CONFIG_CS75XX_INTC) += irq-cs75xx.o
diff --git a/drivers/irqchip/irq-cs75xx.c b/drivers/irqchip/irq-cs75xx.c
new file mode 100644
index 000000000..4d458039a
--- /dev/null
+++ b/drivers/irqchip/irq-cs75xx.c
@@ -0,0 +1,103 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Cortina Systems CS75xx peripheral interrupt controller
+ *
+ * The low speed peripherals on the register bus (timers, GPIO banks, I2C,
+ * MDIO, SPI, ...) share a single GIC interrupt. A status register shows
+ * the level of the 15 sources and an enable register masks them; there is
+ * nothing to acknowledge, the sources are cleared in the peripherals.
+ */
+
+#include <linux/bitops.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#define CS75XX_INTC_STATUS 0x00
+#define CS75XX_INTC_ENABLE 0x04
+
+#define CS75XX_INTC_NR_IRQS 15
+
+static void cs75xx_intc_handler(struct irq_desc *desc)
+{
+ struct irq_domain *domain = irq_desc_get_handler_data(desc);
+ struct irq_chip_generic *gc = irq_get_domain_generic_chip(domain, 0);
+ struct irq_chip *chip = irq_desc_get_chip(desc);
+ unsigned long pending;
+ unsigned int hwirq;
+
+ chained_irq_enter(chip, desc);
+
+ pending = readl(gc->reg_base + CS75XX_INTC_STATUS) & gc->mask_cache;
+ for_each_set_bit(hwirq, &pending, CS75XX_INTC_NR_IRQS)
+ generic_handle_domain_irq(domain, hwirq);
+
+ chained_irq_exit(chip, desc);
+}
+
+static int __init cs75xx_intc_init(struct device_node *np,
+ struct device_node *parent)
+{
+ struct irq_chip_generic *gc;
+ struct irq_domain *domain;
+ void __iomem *base;
+ int parent_irq;
+ int ret;
+
+ base = of_io_request_and_map(np, 0, of_node_full_name(np));
+ if (IS_ERR(base)) {
+ pr_err("%pOF: unable to map registers\n", np);
+ return PTR_ERR(base);
+ }
+
+ /* Mask everything before the chained handler is installed */
+ writel(0, base + CS75XX_INTC_ENABLE);
+
+ parent_irq = irq_of_parse_and_map(np, 0);
+ if (!parent_irq) {
+ pr_err("%pOF: unable to map parent interrupt\n", np);
+ ret = -EINVAL;
+ goto err_unmap;
+ }
+
+ domain = irq_domain_create_linear(of_fwnode_handle(np),
+ CS75XX_INTC_NR_IRQS,
+ &irq_generic_chip_ops, NULL);
+ if (!domain) {
+ ret = -ENOMEM;
+ goto err_dispose;
+ }
+
+ ret = irq_alloc_domain_generic_chips(domain, CS75XX_INTC_NR_IRQS, 1,
+ "cs75xx-intc", handle_level_irq,
+ IRQ_NOREQUEST | IRQ_NOPROBE, 0,
+ IRQ_GC_INIT_MASK_CACHE);
+ if (ret)
+ goto err_domain;
+
+ gc = irq_get_domain_generic_chip(domain, 0);
+ gc->reg_base = base;
+ gc->chip_types[0].regs.mask = CS75XX_INTC_ENABLE;
+ gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
+ gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
+
+ irq_set_chained_handler_and_data(parent_irq, cs75xx_intc_handler,
+ domain);
+
+ return 0;
+
+err_domain:
+ irq_domain_remove(domain);
+err_dispose:
+ irq_dispose_mapping(parent_irq);
+err_unmap:
+ iounmap(base);
+ return ret;
+}
+
+IRQCHIP_DECLARE(cs7542_intc, "cortina,cs7542-intc", cs75xx_intc_init);
--
2.53.0
next prev parent reply other threads:[~2026-10-12 17:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 17:32 [PATCH 00/11] Cortina Systems CS75xx: interrupt controller, GPIO, I2C and TWD watchdog Fil Dunsky via B4 Relay
2026-10-12 17:32 ` [PATCH 01/11] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 peripheral interrupt controller Fil Dunsky via B4 Relay
2026-10-12 17:32 ` Fil Dunsky via B4 Relay [this message]
2026-10-12 17:32 ` [PATCH 03/11] dt-bindings: gpio: Add Cortina Systems CS7542 GPIO controller Fil Dunsky via B4 Relay
2026-10-12 17:32 ` [PATCH 04/11] gpio: Add Cortina Systems CS75xx GPIO driver Fil Dunsky via B4 Relay
2026-10-12 20:32 ` Uwe Kleine-König
2026-10-12 20:57 ` Fil Dunsky
2026-10-12 17:33 ` [PATCH 05/11] dt-bindings: i2c: Add Cortina Systems CS7542 I2C controller Fil Dunsky via B4 Relay
2026-10-12 17:33 ` [PATCH 06/11] i2c: Add Cortina Systems CS75xx I2C controller driver Fil Dunsky via B4 Relay
2026-10-12 17:33 ` [PATCH 07/11] watchdog: Add ARM TWD (MPCore private) watchdog driver Fil Dunsky via B4 Relay
2026-10-12 17:33 ` [PATCH 08/11] ARM: dts: cortina: cs7542: Add interrupt controller, GPIO and I2C Fil Dunsky via B4 Relay
2026-10-12 17:33 ` [PATCH 09/11] ARM: dts: cortina: almondplus: Add reset button and enable I2C Fil Dunsky via B4 Relay
2026-10-12 17:33 ` [PATCH 10/11] ARM: multi_v7_defconfig: Enable Cortina Systems CS75xx GPIO, I2C and TWD watchdog Fil Dunsky via B4 Relay
2026-10-12 17:33 ` [PATCH 11/11] MAINTAINERS: Add Cortina Systems CS75xx interrupt controller, GPIO and I2C Fil Dunsky via B4 Relay
2026-10-12 18:48 ` [PATCH 00/11] Cortina Systems CS75xx: interrupt controller, GPIO, I2C and TWD watchdog Conor Dooley
2026-10-13 7:10 ` Fil Dunsky
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=20261012-b4-cs75xx-s2-v1-2-8a7641b7b79c@gmail.com \
--to=devnull+filipp.dunsky.gmail.com@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=arnd@arndb.de \
--cc=brgl@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=filipp.dunsky@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@roeck-us.net \
--cc=radu@rendec.net \
--cc=robh@kernel.org \
--cc=tglx@kernel.org \
--cc=wim@linux-watchdog.org \
/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®