* [PATCH v4 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller
@ 2026-11-17 20:29 Fil Dunsky via B4 Relay
2026-11-17 20:29 ` [PATCH v4 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 " Fil Dunsky via B4 Relay
2026-11-17 20:29 ` [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx " Fil Dunsky via B4 Relay
0 siblings, 2 replies; 4+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-17 20:29 UTC (permalink / raw)
To: Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-kernel, devicetree, linux-arm-kernel, Fil Dunsky
The timers, GPIO banks, I2C, MDIO, SPI and a few other low speed
peripherals of the Cortina Systems CS75xx ("Goldengate G2") SoCs share
one GIC interrupt. This series adds the binding and a chained driver for
the small controller in the peripheral register block that reports the
level of these 15 sources and masks them; each source is acknowledged in
its peripheral.
There is a second status/enable pair right behind it whose purpose I do
not know; it is not described.
The driver used to be part of a series with the GPIO, I2C and watchdog
drivers and the device tree changes. That series is now split per
subsystem: the driver builds with COMPILE_TEST and does not depend on
the platform series [1], which is under review separately. The device
tree nodes will follow with the other CS75xx dts changes once the
platform is merged.
There is no public documentation; the register layout comes from the GPL
vendor kernels and was checked on a Securifi Almond+ (CS7542), where the
GPIO and I2C interrupts of the board are delivered through this
controller.
[1] https://lore.kernel.org/all/20261114-b4-cs75xx-v7-0-8f17f38821b4@gmail.com/
---
Changes in v4:
- rebase on v7.4-rc1; update the platform reference to v7
- split out of "Cortina Systems CS75xx: interrupt controller, GPIO, I2C
and TWD watchdog" so that each driver can go through its own tree; no
longer based on the platform series
- declare the variables of the chained handler from the longest to the
shortest line
- do not wrap lines that fit in 100 columns (Thomas)
- collect Reviewed-by tags
- Link to v3: https://patch.msgid.link/20261013-b4-cs75xx-s2-v3-0-181bb0d23f4c@gmail.com
Changes in v3:
- rebase on v6 of the platform series
- Link to v2: https://patch.msgid.link/20261013-b4-cs75xx-s2-v2-0-94f8c0a90cda@gmail.com
Changes in v2:
- rebase on v5 of the platform series
- Link to v1: https://patch.msgid.link/20261012-b4-cs75xx-s2-v1-0-8a7641b7b79c@gmail.com
To: Thomas Gleixner <tglx@kernel.org>
To: Radu Rendec <radu@rendec.net>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
---
Fil Dunsky (2):
dt-bindings: interrupt-controller: Add Cortina Systems CS7542 peripheral interrupt controller
irqchip: Add Cortina Systems CS75xx peripheral interrupt controller
.../interrupt-controller/cortina,cs7542-intc.yaml | 57 ++++++++++++
drivers/irqchip/Kconfig | 12 +++
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-cs75xx.c | 100 +++++++++++++++++++++
4 files changed, 170 insertions(+)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261015-cs75xx-intc-b422801c7a5d
Best regards,
--
Fil Dunsky <filipp.dunsky@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v4 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 peripheral interrupt controller 2026-11-17 20:29 [PATCH v4 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller Fil Dunsky via B4 Relay @ 2026-11-17 20:29 ` Fil Dunsky via B4 Relay 2026-11-17 20:29 ` [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx " Fil Dunsky via B4 Relay 1 sibling, 0 replies; 4+ messages in thread From: Fil Dunsky via B4 Relay @ 2026-11-17 20:29 UTC (permalink / raw) To: Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-kernel, devicetree, linux-arm-kernel, Fil Dunsky From: Fil Dunsky <filipp.dunsky@gmail.com> The low speed peripherals of the Cortina Systems CS75xx SoCs share one GIC interrupt. A small controller in the peripheral register block reports which of its 15 sources are asserted and allows masking them. Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com> --- .../interrupt-controller/cortina,cs7542-intc.yaml | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Documentation/devicetree/bindings/interrupt-controller/cortina,cs7542-intc.yaml b/Documentation/devicetree/bindings/interrupt-controller/cortina,cs7542-intc.yaml new file mode 100644 index 000000000..2963acaf7 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/cortina,cs7542-intc.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/cortina,cs7542-intc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 peripheral interrupt controller + +maintainers: + - Fil Dunsky <filipp.dunsky@gmail.com> + +description: + The low speed peripherals of the Cortina Systems CS75xx (Goldengate G2) + SoCs (two software interrupts, two timers, the AXI bridge, SPI, the five + GPIO banks, I2C, MDIO, SSP and the random number generator) share one GIC + interrupt. This controller has a status register showing the level of the + 15 sources and an enable register to mask them. The sources are cleared in + the peripherals themselves. + +properties: + compatible: + const: cortina,cs7542-intc + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 1 + description: + The number of the source, 0 to 14. All sources are active high level + interrupts. + +required: + - compatible + - reg + - interrupts + - interrupt-controller + - "#interrupt-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + interrupt-controller@f0070004 { + compatible = "cortina,cs7542-intc"; + reg = <0xf0070004 0x8>; + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + }; -- 2.53.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller 2026-11-17 20:29 [PATCH v4 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller Fil Dunsky via B4 Relay 2026-11-17 20:29 ` [PATCH v4 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 " Fil Dunsky via B4 Relay @ 2026-11-17 20:29 ` Fil Dunsky via B4 Relay 2026-11-17 20:52 ` sashiko-bot 1 sibling, 1 reply; 4+ messages in thread From: Fil Dunsky via B4 Relay @ 2026-11-17 20:29 UTC (permalink / raw) To: Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-kernel, devicetree, linux-arm-kernel, Fil Dunsky 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 | 100 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 136bab41f..db5edd4ec 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 16a5fd126..7ed8f8b33 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -136,3 +136,4 @@ 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_IRQCHIP_XILINX_SMMU_CSR) += irq-xilinx-smmu-csr.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..f3d71b06c --- /dev/null +++ b/drivers/irqchip/irq-cs75xx.c @@ -0,0 +1,100 @@ +// 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 *chip = irq_desc_get_chip(desc); + struct irq_chip_generic *gc; + unsigned long pending; + unsigned int hwirq; + + gc = irq_get_domain_generic_chip(domain, 0); + 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller 2026-11-17 20:29 ` [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx " Fil Dunsky via B4 Relay @ 2026-11-17 20:52 ` sashiko-bot 0 siblings, 0 replies; 4+ messages in thread From: sashiko-bot @ 2026-11-17 20:52 UTC (permalink / raw) To: Fil Dunsky; +Cc: devicetree, robh, conor+dt Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] irqchip: CS75XX_INTC uses undefined ARCH_CORTINA_ACCESS and lacks HAS_IOMEM - [Medium] irqchip: cs75xx: missing IRQ_LEVEL and wrong IRQ_NOPROBE in cs75xx_intc_init() - [Medium] irqchip: cs75xx: leaked MMIO region reservation in cs75xx_intc_init() -- commit 57fad06ce5781b2c6a356fbbe01aad10d8c69bd9 Author: Fil Dunsky <filipp.dunsky@gmail.com> irqchip: Add Cortina Systems CS75xx peripheral interrupt controller This commit adds a chained interrupt controller driver for the low-speed peripheral interrupt combiner on Cortina Systems CS75xx SoCs. > diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig > index 136bab41f8011..db5edd4ec0927 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 [Severity: Medium] Is ARCH_CORTINA_ACCESS defined anywhere in the tree, and does CS75XX_INTC need to depend on HAS_IOMEM? Because ARCH_CORTINA_ACCESS is not defined in any Kconfig file, CS75XX_INTC cannot be enabled without COMPILE_TEST and its default always evaluates to n. In addition, enabling CS75XX_INTC under COMPILE_TEST on architectures without HAS_IOMEM (such as s390 with PCI disabled) fails to build in cs75xx_intc_init() due to an implicit declaration of iounmap(). [ ... ] > diff --git a/drivers/irqchip/irq-cs75xx.c b/drivers/irqchip/irq-cs75xx.c > new file mode 100644 > index 0000000000000..f3d71b06c59de > --- /dev/null > +++ b/drivers/irqchip/irq-cs75xx.c > @@ -0,0 +1,100 @@ [ ... ] > +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); [Severity: Medium] Should irq_alloc_domain_generic_chips() set IRQ_LEVEL | IRQ_NOPROBE in the set argument instead of passing 0 and clearing IRQ_NOPROBE? Because the interrupt specifiers have no trigger type cell and the chip does not implement .irq_set_type(), leaving IRQ_LEVEL out of the set flags means _IRQ_LEVEL and IRQD_LEVEL are never set on the mapped descriptors. As a result, check_irq_resend() treats these level interrupts as edge-triggered during enable_irq() and schedules software resends via irq_sw_resend(). Passing IRQ_NOPROBE in the clear mask also makes the interrupts probeable instead of preventing probing. > + 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; > +} [Severity: Medium] Does the err_unmap path leak the memory region reserved by of_io_request_and_map()? of_io_request_and_map() reserves the physical range via request_mem_region() before mapping it, and iounmap() only drops the virtual mapping, leaving the region permanently reserved in iomem_resource if initialization fails. Using of_iomap() or releasing the region on error would avoid the leak. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261117-cs75xx-intc-v4-0-0a678f35e5f3@gmail.com?part=2 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-17 20:52 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-17 20:29 [PATCH v4 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller Fil Dunsky via B4 Relay 2026-11-17 20:29 ` [PATCH v4 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 " Fil Dunsky via B4 Relay 2026-11-17 20:29 ` [PATCH v4 2/2] irqchip: Add Cortina Systems CS75xx " Fil Dunsky via B4 Relay 2026-11-17 20:52 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox