* [PATCH v5 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller
@ 2026-11-20 17:24 ` Fil Dunsky
0 siblings, 0 replies; 7+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-20 17:24 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 depends on OF and HAS_IOMEM, with no dependency 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. The v5 IRQ flags and normal initialization path were checked
in RAM with PROVE_LOCKING; MMIO cleanup on initialization failure was
reviewed but not fault-injected on the board.
[1] https://lore.kernel.org/all/20261114-b4-cs75xx-v7-0-8f17f38821b4@gmail.com/
---
Changes in v5:
- replace the ARCH_CORTINA_ACCESS || COMPILE_TEST dependency and
architecture default with OF, retaining HAS_IOMEM, so the driver can
be merged without the platform series
- build built-in on ARM and x86-64 with COMPILE_TEST=n and without the
platform series; check that OF and MMIO dependencies gate the option
- require HAS_IOMEM for COMPILE_TEST builds
- mark child interrupts as level-triggered and keep them non-probeable
- release the reserved MMIO region on initialization failure
- Link to v4: https://patch.msgid.link/20261117-cs75xx-intc-v4-0-0a678f35e5f3@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 | 107 +++++++++++++++++++++
4 files changed, 177 insertions(+)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261015-cs75xx-intc-b422801c7a5d
Best regards,
--
Fil Dunsky <filipp.dunsky@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v5 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller @ 2026-11-20 17:24 ` Fil Dunsky 0 siblings, 0 replies; 7+ messages in thread From: Fil Dunsky @ 2026-11-20 17:24 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 depends on OF and HAS_IOMEM, with no dependency 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. The v5 IRQ flags and normal initialization path were checked in RAM with PROVE_LOCKING; MMIO cleanup on initialization failure was reviewed but not fault-injected on the board. [1] https://lore.kernel.org/all/20261114-b4-cs75xx-v7-0-8f17f38821b4@gmail.com/ --- Changes in v5: - replace the ARCH_CORTINA_ACCESS || COMPILE_TEST dependency and architecture default with OF, retaining HAS_IOMEM, so the driver can be merged without the platform series - build built-in on ARM and x86-64 with COMPILE_TEST=n and without the platform series; check that OF and MMIO dependencies gate the option - require HAS_IOMEM for COMPILE_TEST builds - mark child interrupts as level-triggered and keep them non-probeable - release the reserved MMIO region on initialization failure - Link to v4: https://patch.msgid.link/20261117-cs75xx-intc-v4-0-0a678f35e5f3@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 | 107 +++++++++++++++++++++ 4 files changed, 177 insertions(+) --- base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 change-id: 20261015-cs75xx-intc-b422801c7a5d Best regards, -- Fil Dunsky <filipp.dunsky@gmail.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v5 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 peripheral interrupt controller 2026-11-20 17:24 ` Fil Dunsky @ 2026-11-20 17:24 ` Fil Dunsky -1 siblings, 0 replies; 7+ messages in thread From: Fil Dunsky via B4 Relay @ 2026-11-20 17:24 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] 7+ messages in thread
* [PATCH v5 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 peripheral interrupt controller @ 2026-11-20 17:24 ` Fil Dunsky 0 siblings, 0 replies; 7+ messages in thread From: Fil Dunsky @ 2026-11-20 17:24 UTC (permalink / raw) To: Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-kernel, devicetree, linux-arm-kernel, Fil Dunsky 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] 7+ messages in thread
* [PATCH v5 2/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller 2026-11-20 17:24 ` Fil Dunsky @ 2026-11-20 17:24 ` Fil Dunsky -1 siblings, 0 replies; 7+ messages in thread From: Fil Dunsky via B4 Relay @ 2026-11-20 17:24 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. The driver depends on OF and HAS_IOMEM and can be enabled independently of the CS75xx platform support. Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com> --- drivers/irqchip/Kconfig | 12 +++++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-cs75xx.c | 107 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 136bab41f..12bf87e8e 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 OF + depends on HAS_IOMEM + 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..18f10eb7e --- /dev/null +++ b/drivers/irqchip/irq-cs75xx.c @@ -0,0 +1,107 @@ +// 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/ioport.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; + struct resource res; + void __iomem *base; + int parent_irq; + int ret; + + ret = of_address_to_resource(np, 0, &res); + if (ret) + return 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_LEVEL | IRQ_NOPROBE, 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); + release_mem_region(res.start, resource_size(&res)); + return ret; +} + +IRQCHIP_DECLARE(cs7542_intc, "cortina,cs7542-intc", cs75xx_intc_init); -- 2.53.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5 2/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller @ 2026-11-20 17:24 ` Fil Dunsky 0 siblings, 0 replies; 7+ messages in thread From: Fil Dunsky @ 2026-11-20 17:24 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 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. The driver depends on OF and HAS_IOMEM and can be enabled independently of the CS75xx platform support. Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com> --- drivers/irqchip/Kconfig | 12 +++++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-cs75xx.c | 107 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 136bab41f..12bf87e8e 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 OF + depends on HAS_IOMEM + 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..18f10eb7e --- /dev/null +++ b/drivers/irqchip/irq-cs75xx.c @@ -0,0 +1,107 @@ +// 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/ioport.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; + struct resource res; + void __iomem *base; + int parent_irq; + int ret; + + ret = of_address_to_resource(np, 0, &res); + if (ret) + return 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_LEVEL | IRQ_NOPROBE, 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); + release_mem_region(res.start, resource_size(&res)); + return ret; +} + +IRQCHIP_DECLARE(cs7542_intc, "cortina,cs7542-intc", cs75xx_intc_init); -- 2.53.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v5 2/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller 2026-11-20 17:24 ` Fil Dunsky (?) @ 2026-12-01 18:29 ` Thomas Gleixner -1 siblings, 0 replies; 7+ messages in thread From: Thomas Gleixner @ 2026-12-01 18:29 UTC (permalink / raw) To: Fil Dunsky via B4 Relay, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: linux-kernel, devicetree, linux-arm-kernel, Fil Dunsky On Fri, Nov 20 2026 at 20:24, Fil Dunsky via wrote: > 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. > The driver depends on OF and HAS_IOMEM and can be enabled independently > of the CS75xx platform support. My comments on V4 still apply. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-12-01 18:29 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-20 17:24 [PATCH v5 0/2] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller Fil Dunsky via B4 Relay 2026-11-20 17:24 ` Fil Dunsky 2026-11-20 17:24 ` [PATCH v5 1/2] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 " Fil Dunsky via B4 Relay 2026-11-20 17:24 ` Fil Dunsky 2026-11-20 17:24 ` [PATCH v5 2/2] irqchip: Add Cortina Systems CS75xx " Fil Dunsky via B4 Relay 2026-11-20 17:24 ` Fil Dunsky 2026-12-01 18:29 ` Thomas Gleixner
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.