Add JH8100 external interrupt controller support
Subsystems (2)
cover Add JH8100 external interrupt controller support
This patchset adds external interrupt controller driver for the StarFive JH81000 SoC. It can be used to handle high-level input interrupt signals. It also send the output interrupt signal to RISC-V PLIC.
Changhuang Liang (2):
dt-bindings: interrupt-controller: Add starfive,jh8100-intc
irqchip: Add StarFive external interrupt controller
.../starfive,jh8100-intc.yaml | 61 ++++++ MAINTAINERS | 6 + drivers/irqchip/Kconfig | 11 ++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-starfive-jh8100-intc.c | 180 ++++++++++++++++++ 5 files changed, 259 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml create mode 100644 drivers/irqchip/irq-starfive-jh8100-intc.c
--
2.25.1
PATCH 1/2 dt-bindings: interrupt-controller: Add starfive,jh8100-intc
StarFive SoCs like the JH8100 use a interrupt controller. Add a binding for it.
--- .../starfive,jh8100-intc.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml
Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml new file +61 -0
@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/starfive,jh8100-intc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive External Interrupt Controller + +description: + StarFive SoC JH8100 contain a external interrupt controller. It can be used + to handle high-level input interrupt signals. It also send the output + interrupt signal to RISC-V PLIC. + +maintainers: + - Changhuang Liang <[email protected]> + +properties: + compatible: + const: starfive,jh8100-intc + + reg: + maxItems: 1 + + clocks: + description: APB clock for the interrupt controller + maxItems: 1 + + resets: + description: APB reset for the interrupt controller + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 1 + +required: + - compatible + - reg + - clocks + - resets + - interrupts + - interrupt-controller + - "#interrupt-cells" + +additionalProperties: false + +examples: + - | + interrupt-controller@12260000 { + compatible = "starfive,jh8100-intc"; + reg = <0x12260000 0x10000>; + clocks = <&syscrg_ne 76>; + resets = <&syscrg_ne 13>; + interrupts = <45>; + interrupt-controller; + #interrupt-cells = <1>; + };
Signature · 1 line
2.25.1
Re: [PATCH v1 1/2] dt-bindings: interrupt-controller: Add starfive,jh8100-intc
Quoted 10 lines · Changhuang Liang
StarFive SoCs like the JH8100 use a interrupt controller. Add a binding for it.
Signed-off-by Changhuang Liang <[email protected]>Reviewed-by Ley Foon Tan <[email protected]>--- .../starfive,jh8100-intc.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml
Best regards,
Krzysztof
PATCH 2/2 irqchip: Add StarFive external interrupt controller
In reply to Changhuang LiangAdd StarFive external interrupt controller for JH8100 SoC.
--- MAINTAINERS | 6 + drivers/irqchip/Kconfig | 11 ++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-starfive-jh8100-intc.c | 180 +++++++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 drivers/irqchip/irq-starfive-jh8100-intc.c
MAINTAINERS +6 -0
@@ -20691,6 +20691,12 @@ F: Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml F: drivers/phy/starfive/phy-jh7110-pcie.c F: drivers/phy/starfive/phy-jh7110-usb.c +STARFIVE JH8100 EXTERNAL INTERRUPT CONTROLLER DRIVER +M: Changhuang Liang <[email protected]> +S: Supported +F: Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml +F: drivers/irqchip/irq-starfive-jh8100-intc.c + STATIC BRANCH/CALL M: Peter Zijlstra <[email protected]> M: Josh Poimboeuf <[email protected]>
drivers/irqchip/Kconfig +11 -0
@@ -546,6 +546,17 @@ config SIFIVE_PLIC select IRQ_DOMAIN_HIERARCHY select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP +config STARFIVE_JH8100_INTC + bool "StarFive JH8100 External Interrupt Controller" + depends on ARCH_STARFIVE || COMPILE_TEST + default ARCH_STARFIVE + select IRQ_DOMAIN_HIERARCHY + help + This enables support for the INTC chip found in StarFive JH8100 + SoC. + + If you don't know what to do here, say Y. + config EXYNOS_IRQ_COMBINER bool "Samsung Exynos IRQ combiner support" if COMPILE_TEST depends on (ARCH_EXYNOS && ARM) || COMPILE_TEST
drivers/irqchip/Makefile +1 -0
@@ -96,6 +96,7 @@ obj-$(CONFIG_CSKY_MPINTC) += irq-csky-mpintc.o obj-$(CONFIG_CSKY_APB_INTC) += irq-csky-apb-intc.o obj-$(CONFIG_RISCV_INTC) += irq-riscv-intc.o obj-$(CONFIG_SIFIVE_PLIC) += irq-sifive-plic.o +obj-$(CONFIG_STARFIVE_JH8100_INTC) += irq-starfive-jh8100-intc.o obj-$(CONFIG_IMX_IRQSTEER) += irq-imx-irqsteer.o obj-$(CONFIG_IMX_INTMUX) += irq-imx-intmux.o obj-$(CONFIG_IMX_MU_MSI) += irq-imx-mu-msi.o
drivers/irqchip/irq-starfive-jh8100-intc.c new file +180 -0
180 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v1 2/2] irqchip: Add StarFive external interrupt controller
On Mi, 2024-01-10 at 18:32 -0800, Changhuang Liang wrote:
[...]
Quoted 6 lines
drivers/irqchip/irq-starfive-jh8100-intc.c new file +0
-0@@ -0,0 +1,180 @@
[...]
drivers/irqchip/irq-starfive-jh8100-intc.c line 32
Quoted 5 lines
drivers/irqchip/irq-starfive-jh8100-intc.c new file +5
-0+struct starfive_irq_chip { +void __iomem *base; +struct irq_domain *root_domain; +struct clk *clk; +struct reset_control *rst;
Since rst is never used outside of starfive_intc_init, there is no need to store it here.
[...]
Quoted 9 lines
drivers/irqchip/irq-starfive-jh8100-intc.c new file +9
-0+static int __init starfive_intc_init (struct device_node *intc, +struct device_node *parent) +{ +struct starfive_irq_chip *irqc; +int ret; +int parent_irq; + + irqc =kzalloc (sizeof (*irqc),GFP_KERNEL ); +if (!irqc)
drivers/irqchip/irq-starfive-jh8100-intc.c line 120
Quoted 10 lines
drivers/irqchip/irq-starfive-jh8100-intc.c new file +10
-0+return -ENOMEM ; + + irqc->base =of_iomap (intc,0 ); +if (!irqc->base) { +pr_err ("Unable to map IC registers\n" ); + ret = -ENXIO ; + goto err_free; + } + + irqc->rst =of_reset_control_get_by_index (intc,0 );
Please use of_reset_control_get_exclusive(intc, NULL) instead.
drivers/irqchip/irq-starfive-jh8100-intc.c line 123
Quoted 3 lines
drivers/irqchip/irq-starfive-jh8100-intc.c new file +3
-0+if (IS_ERR (irqc->rst)) { +pr_err ("Unable to get reset control\n" ); + ret =PTR_ERR (irqc->rst);
Consider printing the error code via %pe.
regards
Philipp
回复: [PATCH v1 2/2] irqchip: Add StarFive external interrupt controller
Hi Philipp,
Quoted 6 lines · Changhuang Liang
drivers/irqchip/irq-starfive-jh8100-intc.c line 120
Quoted 2 lines
[...]
drivers/irqchip/irq-starfive-jh8100-intc.c new file +1
-0+ irqc->rst =of_reset_control_get_by_index (intc,0 );Please use
of_reset_control_get_exclusive(intc, NULL)instead.
Quoted 7 lines
drivers/irqchip/irq-starfive-jh8100-intc.c line 123
Quoted 3 lines
drivers/irqchip/irq-starfive-jh8100-intc.c new file +3
-0+if (IS_ERR (irqc->rst)) { +pr_err ("Unable to get reset control\n" ); + ret =PTR_ERR (irqc->rst);Consider printing the error code via %pe.
Thanks for your comments. Follow your advice, will change in next version.
regards
Changhuang