Add interrupt controller for JHB100 SoC
Subsystems (4)
Changhuang Liang
maintainerv2 cover Add interrupt controller for JHB100 SoC
This patchset adds external interrupt controller driver for the StarFive JHB100 SoC. It supports up to 64 interrupt sources, and both level and edge trigger types.
changes since v1:
- irqchip: starfive -> irqchip/starfive
patch 1:
- Update commit title and add Conor's Acked-by tag
patch 3:
- Use __free(kfree) cleanup
- Replace dev_err() with dev_err_probe()
- Replace devm_reset_control_get_optional() + reset_control_deassert() with devm_reset_control_get_optional_exclusive_deasserted()
patch 4:
- Use guard(raw_spinlock)
patch 5:
- Update starfive_intc_set_type()
v1: https://lore.kernel.org/all/[email protected]/
Changhuang Liang (4):
dt-bindings: interrupt-controller: repurpose binding for unreleased
jh8100 for jhb100
irqchip/starfive: Rename jh8100 to jhb100 irqchip/starfive: Use devm_ interfaces to simplify resource release irqchip/starfive: Implement irq_set_type() and irq_ack() callbacks
Mason Huo (1):
irqchip/starfive: Increase the interrupt source number up to 64
...00-intc.yaml => starfive,jhb100-intc.yaml} | 20 +-
MAINTAINERS | 6 +-
drivers/irqchip/Kconfig | 6 +-
drivers/irqchip/Makefile | 2 +-
drivers/irqchip/irq-starfive-jh8100-intc.c | 207 --------------
drivers/irqchip/irq-starfive-jhb100-intc.c | 254 ++++++++++++++++++
6 files changed, 265 insertions(+), 230 deletions(-)
rename Documentation/devicetree/bindings/interrupt-controller/{starfive,jh8100-intc.yaml => starfive,jhb100-intc.yaml} (68%)
delete mode 100644 drivers/irqchip/irq-starfive-jh8100-intc.c
create mode 100644 drivers/irqchip/irq-starfive-jhb100-intc.c--
2.25.1
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Changhuang Liang
maintainerPATCH v2 1/5 dt-bindings: interrupt-controller: repurpose binding for unreleased jh8100 for jhb100
The StarFive JH8100 SoC was discontinued before production. The newly taped-out JHB100 SoC uses the same interrupt controller IP.
Rename the binding file, compatible string, and MAINTAINERS entry from "jh8100" to "jhb100". In JHB100 SoC, The clocks and resets are not operated by users, but they exist in the hardware. Mark them as optional.
---
...00-intc.yaml => starfive,jhb100-intc.yaml} | 20 ++++---------------
MAINTAINERS | 2 +-
2 files changed, 5 insertions(+), 17 deletions(-)
rename Documentation/devicetree/bindings/interrupt-controller/{starfive,jh8100-intc.yaml => starfive,jhb100-intc.yaml} (68%)Documentation/devicetree/bindings/interrupt-controller/starfive,jhb100-intc.yaml renamed from Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml +4 -16
@@ -1,13 +1,13 @@ # 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# +$id: http://devicetree.org/schemas/interrupt-controller/starfive,jhb100-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 + StarFive SoC JHB100 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.
@@ -16,19 +16,11 @@ maintainers: properties: compatible: - const: starfive,jh8100-intc + const: starfive,jhb100-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
@@ -40,8 +32,6 @@ properties: required: - compatible - reg - - clocks - - resets - interrupts - interrupt-controller - "#interrupt-cells"
@@ -51,10 +41,8 @@ additionalProperties: false examples: - | interrupt-controller@12260000 { - compatible = "starfive,jh8100-intc"; + compatible = "starfive,jhb100-intc"; reg = <0x12260000 0x10000>; - clocks = <&syscrg_ne 76>; - resets = <&syscrg_ne 13>; interrupts = <45>; interrupt-controller; #interrupt-cells = <1>;
MAINTAINERS +1 -1
@@ -25312,7 +25312,7 @@ 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: Documentation/devicetree/bindings/interrupt-controller/starfive,jhb100-intc.yaml F: drivers/irqchip/irq-starfive-jh8100-intc.c STATIC BRANCH/CALL
Signature · 7 lines
2.25.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
[tip: irq/drivers] dt-bindings: interrupt-controller: Repurpose binding for unreleased jh8100 for jhb100
The following commit has been merged into the irq/drivers branch of tip:
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: a540d544db1c37d4c138b67384f235a85f79f060 Gitweb: https://git.kernel.org/tip/a540d544db1c37d4c138b67384f235a85f79f060 Author: Changhuang Liang <[email protected]> AuthorDate: Wed, 15 Apr 2026 23:47:47 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 30 Apr 2026 12:53:04 +02:00
dt-bindings: interrupt-controller: Repurpose binding for unreleased jh8100 for jhb100
The StarFive JH8100 SoC was discontinued before production. The newly taped-out JHB100 SoC uses the same interrupt controller IP.
Rename the binding file, compatible string, and MAINTAINERS entry from "jh8100" to "jhb100". In JHB100 SoC, The clocks and resets are not operated by users, but they exist in the hardware. Mark them as optional.
--- Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml | 61 ------------------------------------------------------------- Documentation/devicetree/bindings/interrupt-controller/starfive,jhb100-intc.yaml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 2 +- 3 files changed, 50 insertions(+), 62 deletions(-) delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml create mode 100644 Documentation/devicetree/bindings/interrupt-controller/starfive,jhb100-intc.yaml
Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml deleted +0 -61
@@ -1,61 +0,0 @@ -# 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>; - };
Documentation/devicetree/bindings/interrupt-controller/starfive,jhb100-intc.yaml new file +49 -0
49 lines not on this page · raw message
MAINTAINERS +1 -1
@@ -25536,7 +25536,7 @@ 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: Documentation/devicetree/bindings/interrupt-controller/starfive,jhb100-intc.yaml F: drivers/irqchip/irq-starfive-jh8100-intc.c STATIC BRANCH/CALL
Changhuang Liang
maintainerPATCH v2 2/5 irqchip/starfive: Rename jh8100 to jhb100
In reply to Changhuang LiangThe StarFive JH8100 SoC was discontinued before production. The newly taped-out JHB100 SoC uses the same interrupt controller IP. Rename the driver file, Kconfig symbol, and internal references from "jh8100" to "jhb100" to accurately reflect the supported hardware.
---
MAINTAINERS | 4 ++--
drivers/irqchip/Kconfig | 6 +++---
drivers/irqchip/Makefile | 2 +-
...arfive-jh8100-intc.c => irq-starfive-jhb100-intc.c} | 10 +++++-----
4 files changed, 11 insertions(+), 11 deletions(-)
rename drivers/irqchip/{irq-starfive-jh8100-intc.c => irq-starfive-jhb100-intc.c} (94%)MAINTAINERS +2 -2
@@ -25309,11 +25309,11 @@ 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 +STARFIVE JHB100 EXTERNAL INTERRUPT CONTROLLER DRIVER M: Changhuang Liang <[email protected]> S: Supported F: Documentation/devicetree/bindings/interrupt-controller/starfive,jhb100-intc.yaml -F: drivers/irqchip/irq-starfive-jh8100-intc.c +F: drivers/irqchip/irq-starfive-jhb100-intc.c STATIC BRANCH/CALL M: Peter Zijlstra <[email protected]>
drivers/irqchip/Kconfig +3 -3
@@ -651,13 +651,13 @@ 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" +config STARFIVE_JHB100_INTC + bool "StarFive JHB100 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 + This enables support for the INTC chip found in StarFive JHB100 SoC. If you don't know what to do here, say Y.
drivers/irqchip/Makefile +1 -1
@@ -108,7 +108,7 @@ obj-$(CONFIG_RISCV_APLIC_MSI) += irq-riscv-aplic-msi.o obj-$(CONFIG_RISCV_IMSIC) += irq-riscv-imsic-state.o irq-riscv-imsic-early.o irq-riscv-imsic-platform.o obj-$(CONFIG_RISCV_RPMI_SYSMSI) += irq-riscv-rpmi-sysmsi.o obj-$(CONFIG_SIFIVE_PLIC) += irq-sifive-plic.o -obj-$(CONFIG_STARFIVE_JH8100_INTC) += irq-starfive-jh8100-intc.o +obj-$(CONFIG_STARFIVE_JHB100_INTC) += irq-starfive-jhb100-intc.o obj-$(CONFIG_ACLINT_SSWI) += irq-aclint-sswi.o obj-$(CONFIG_IMX_IRQSTEER) += irq-imx-irqsteer.o obj-$(CONFIG_IMX_INTMUX) += irq-imx-intmux.o
drivers/irqchip/irq-starfive-jhb100-intc.c renamed from drivers/irqchip/irq-starfive-jh8100-intc.c +5 -5
@@ -1,13 +1,13 @@// SPDX-License-Identifier: GPL-2.0 /* -* StarFive JH8100 External Interrupt Controller driver +* StarFive JHB100 External Interrupt Controller driver * * Copyright (C) 2023 StarFive Technology Co., Ltd. * * Author: Changhuang Liang <[email protected]> */ -#define pr_fmt (fmt) "irq-starfive-jh8100: " fmt +#define pr_fmt (fmt) "irq-starfive-jhb100: " fmt#include <linux/bitops.h> #include <linux/clk.h>
@@ -71,7 +71,7 @@ static void starfive_intc_mask(struct irq_data *d) }static struct irq_chip intc_dev = { - .name ="StarFive JH8100 INTC" , + .name ="StarFive JHB100 INTC" , .irq_unmask = starfive_intc_unmask, .irq_mask = starfive_intc_mask, };
@@ -199,9 +199,9 @@ static int starfive_intc_probe(struct platform_device *pdev, struct device_node } IRQCHIP_PLATFORM_DRIVER_BEGIN(starfive_intc) -IRQCHIP_MATCH("starfive,jh8100-intc", starfive_intc_probe) +IRQCHIP_MATCH("starfive,jhb100-intc", starfive_intc_probe) IRQCHIP_PLATFORM_DRIVER_END(starfive_intc) -MODULE_DESCRIPTION("StarFive JH8100 External Interrupt Controller"); +MODULE_DESCRIPTION("StarFive JHB100 External Interrupt Controller");MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Changhuang Liang <[email protected]>" );
Signature · 7 lines
2.25.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
[tip: irq/drivers] irqchip/starfive: Rename jh8100 to jhb100
The following commit has been merged into the irq/drivers branch of tip:
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: ac2005bba8d938c03c3856a96f20afaa42002635 Gitweb: https://git.kernel.org/tip/ac2005bba8d938c03c3856a96f20afaa42002635 Author: Changhuang Liang <[email protected]> AuthorDate: Wed, 15 Apr 2026 23:47:48 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 30 Apr 2026 12:53:05 +02:00
irqchip/starfive: Rename jh8100 to jhb100
The StarFive JH8100 SoC was discontinued before production. The newly taped-out JHB100 SoC uses the same interrupt controller IP. Rename the driver file, Kconfig symbol, and internal references from "jh8100" to "jhb100" to accurately reflect the supported hardware.
--- MAINTAINERS | 4 +- drivers/irqchip/Kconfig | 6 +- drivers/irqchip/Makefile | 2 +- drivers/irqchip/irq-starfive-jh8100-intc.c | 207 +-------------------- drivers/irqchip/irq-starfive-jhb100-intc.c | 207 ++++++++++++++++++++- 5 files changed, 213 insertions(+), 213 deletions(-) delete mode 100644 drivers/irqchip/irq-starfive-jh8100-intc.c create mode 100644 drivers/irqchip/irq-starfive-jhb100-intc.c
MAINTAINERS +2 -2
@@ -25533,11 +25533,11 @@ 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 +STARFIVE JHB100 EXTERNAL INTERRUPT CONTROLLER DRIVER M: Changhuang Liang <[email protected]> S: Supported F: Documentation/devicetree/bindings/interrupt-controller/starfive,jhb100-intc.yaml -F: drivers/irqchip/irq-starfive-jh8100-intc.c +F: drivers/irqchip/irq-starfive-jhb100-intc.c STATIC BRANCH/CALL M: Peter Zijlstra <[email protected]>
drivers/irqchip/Kconfig +3 -3
@@ -677,13 +677,13 @@ 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" +config STARFIVE_JHB100_INTC + bool "StarFive JHB100 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 + This enables support for the INTC chip found in StarFive JHB100 SoC. If you don't know what to do here, say Y.
drivers/irqchip/Makefile +1 -1
@@ -109,7 +109,7 @@ obj-$(CONFIG_RISCV_APLIC_MSI) += irq-riscv-aplic-msi.o obj-$(CONFIG_RISCV_IMSIC) += irq-riscv-imsic-state.o irq-riscv-imsic-early.o irq-riscv-imsic-platform.o obj-$(CONFIG_RISCV_RPMI_SYSMSI) += irq-riscv-rpmi-sysmsi.o obj-$(CONFIG_SIFIVE_PLIC) += irq-sifive-plic.o -obj-$(CONFIG_STARFIVE_JH8100_INTC) += irq-starfive-jh8100-intc.o +obj-$(CONFIG_STARFIVE_JHB100_INTC) += irq-starfive-jhb100-intc.o obj-$(CONFIG_ACLINT_SSWI) += irq-aclint-sswi.o obj-$(CONFIG_IMX_IRQSTEER) += irq-imx-irqsteer.o obj-$(CONFIG_IMX_INTMUX) += irq-imx-intmux.o
drivers/irqchip/irq-starfive-jh8100-intc.c deleted +0 -207
207 lines not on this page · raw message
drivers/irqchip/irq-starfive-jhb100-intc.c new file +207 -0
207 lines not on this page · raw message
Changhuang Liang
maintainerPATCH v2 3/5 irqchip/starfive: Use devm_ interfaces to simplify resource release
In reply to Changhuang LiangUse devm_ interfaces to simplify resource release. Make clock and reset get optional as they are not used on the JHB100 SoC. Replace pr_ logging with dev_* logging. Use __free(kfree) cleanup attribute to auto-free irqc on error paths
--- drivers/irqchip/irq-starfive-jhb100-intc.c | 77 ++++++---------------- 1 file changed, 20 insertions(+), 57 deletions(-)
drivers/irqchip/irq-starfive-jhb100-intc.c +20 -57
@@ -7,16 +7,15 @@* Author: Changhuang Liang <[email protected]> */ -#define pr_fmt (fmt) "irq-starfive-jhb100: " fmt -#include <linux/bitops.h> +#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/irq.h> #include <linux/irqchip.h> #include <linux/irqchip/chained_irq.h> #include <linux/irqdomain.h> -#include <linux/of_address.h> #include <linux/of_irq.h> +#include <linux/platform_device.h> #include <linux/reset.h> #include <linux/spinlock.h>
@@ -117,85 +116,49 @@ static void starfive_intc_irq_handler(struct irq_desc *desc)static int starfive_intc_probe (struct platform_device *pdev,struct device_node *parent) {struct device_node *intc = pdev->dev.of_node; -struct starfive_irq_chip *irqc;struct reset_control *rst;struct clk *clk;int parent_irq; -int ret; - irqc =kzalloc_obj (*irqc); + struct starfive_irq_chip *irqc __free(kfree) = kzalloc_obj(*irqc);if (!irqc)return -ENOMEM ; - irqc->base =of_iomap (intc,0 ); -if (!irqc->base) { -pr_err ("Unable to map registers\n" ); - ret = -ENXIO ; - goto err_free; - } + irqc->base =devm_platform_ioremap_resource (pdev,0 ); +if (!irqc->base) +return dev_err_probe (&pdev->dev, -ENXIO ,"unable to map registers\n" ); - rst =of_reset_control_get_exclusive (intc,NULL ); -if (IS_ERR (rst)) { -pr_err ("Unable to get reset control %pe\n" , rst); - ret =PTR_ERR (rst); - goto err_unmap; - } + rst =devm_reset_control_get_optional_exclusive_deasserted (&pdev->dev,NULL ); +if (IS_ERR (rst)) +return dev_err_probe (&pdev->dev,PTR_ERR (rst), +"Unable to get and deassert reset control\n" ); - clk =of_clk_get (intc,0 ); -if (IS_ERR (clk)) { -pr_err ("Unable to get clock %pe\n" , clk); - ret =PTR_ERR (clk); - goto err_reset_put; - } + clk =devm_clk_get_optional_enabled (&pdev->dev,NULL ); +if (IS_ERR (clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (clk),"Unable to get and enable clock\n" ); - ret =reset_control_deassert (rst); -if (ret) - goto err_clk_put; - - ret =clk_prepare_enable (clk); -if (ret) - goto err_reset_assert;raw_spin_lock_init (&irqc->lock); irqc->domain =irq_domain_create_linear (of_fwnode_handle (intc),STARFIVE_INTC_SRC_IRQ_NUM , &starfive_intc_domain_ops, irqc); -if (!irqc->domain) { -pr_err ("Unable to create IRQ domain\n" ); - ret = -EINVAL ; - goto err_clk_disable; - } +if (!irqc->domain) +return dev_err_probe (&pdev->dev, -EINVAL ,"Unable to create IRQ domain\n" ); parent_irq =of_irq_get (intc,0 );if (parent_irq <0 ) { -pr_err ("Failed to get main IRQ: %d\n" , parent_irq); - ret = parent_irq; - goto err_remove_domain; +irq_domain_remove (irqc->domain); +return dev_err_probe (&pdev->dev, parent_irq,"Failed to get main IRQ\n" ); }irq_set_chained_handler_and_data (parent_irq, starfive_intc_irq_handler, irqc); -pr_info ("Interrupt controller register, nr_irqs %d\n" , -STARFIVE_INTC_SRC_IRQ_NUM ); +dev_info (&pdev->dev,"Interrupt controller register, nr_irqs %d\n" , +STARFIVE_INTC_SRC_IRQ_NUM ); +retain_and_null_ptr (irqc);return 0 ; - -err_remove_domain: -irq_domain_remove (irqc->domain); -err_clk_disable: -clk_disable_unprepare (clk); -err_reset_assert: -reset_control_assert (rst); -err_clk_put: -clk_put (clk); -err_reset_put: -reset_control_put (rst); -err_unmap: -iounmap (irqc->base); -err_free: -kfree (irqc); -return ret; }IRQCHIP_PLATFORM_DRIVER_BEGIN (starfive_intc)
Signature · 7 lines
2.25.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
[tip: irq/drivers] irqchip/starfive: Use devm_ interfaces to simplify resource release
The following commit has been merged into the irq/drivers branch of tip:
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: 2f59ca1854975170c25e8c812405aa309ea4f9f7 Gitweb: https://git.kernel.org/tip/2f59ca1854975170c25e8c812405aa309ea4f9f7 Author: Changhuang Liang <[email protected]> AuthorDate: Wed, 15 Apr 2026 23:47:49 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 30 Apr 2026 12:53:05 +02:00
irqchip/starfive: Use devm_ interfaces to simplify resource release
Use devm_ interfaces to simplify resource release. Make clock and reset get optional as they are not used on the JHB100 SoC. Replace pr_ logging with dev_* logging. Use __free(kfree) cleanup attribute to auto-free irqc on error paths
--- drivers/irqchip/irq-starfive-jhb100-intc.c | 77 +++++---------------- 1 file changed, 20 insertions(+), 57 deletions(-)
drivers/irqchip/irq-starfive-jhb100-intc.c +20 -57
@@ -7,16 +7,15 @@* Author: Changhuang Liang <[email protected]> */ -#define pr_fmt (fmt) "irq-starfive-jhb100: " fmt -#include <linux/bitops.h> +#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/irq.h> #include <linux/irqchip.h> #include <linux/irqchip/chained_irq.h> #include <linux/irqdomain.h> -#include <linux/of_address.h> #include <linux/of_irq.h> +#include <linux/platform_device.h> #include <linux/reset.h> #include <linux/spinlock.h>
@@ -117,85 +116,49 @@ static void starfive_intc_irq_handler(struct irq_desc *desc)static int starfive_intc_probe (struct platform_device *pdev,struct device_node *parent) {struct device_node *intc = pdev->dev.of_node; -struct starfive_irq_chip *irqc;struct reset_control *rst;struct clk *clk;int parent_irq; -int ret; - irqc =kzalloc_obj (*irqc); + struct starfive_irq_chip *irqc __free(kfree) = kzalloc_obj(*irqc);if (!irqc)return -ENOMEM ; - irqc->base =of_iomap (intc,0 ); -if (!irqc->base) { -pr_err ("Unable to map registers\n" ); - ret = -ENXIO ; - goto err_free; - } + irqc->base =devm_platform_ioremap_resource (pdev,0 ); +if (!irqc->base) +return dev_err_probe (&pdev->dev, -ENXIO ,"unable to map registers\n" ); - rst =of_reset_control_get_exclusive (intc,NULL ); -if (IS_ERR (rst)) { -pr_err ("Unable to get reset control %pe\n" , rst); - ret =PTR_ERR (rst); - goto err_unmap; - } + rst =devm_reset_control_get_optional_exclusive_deasserted (&pdev->dev,NULL ); +if (IS_ERR (rst)) +return dev_err_probe (&pdev->dev,PTR_ERR (rst), +"Unable to get and deassert reset control\n" ); - clk =of_clk_get (intc,0 ); -if (IS_ERR (clk)) { -pr_err ("Unable to get clock %pe\n" , clk); - ret =PTR_ERR (clk); - goto err_reset_put; - } + clk =devm_clk_get_optional_enabled (&pdev->dev,NULL ); +if (IS_ERR (clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (clk),"Unable to get and enable clock\n" ); - ret =reset_control_deassert (rst); -if (ret) - goto err_clk_put; - - ret =clk_prepare_enable (clk); -if (ret) - goto err_reset_assert;raw_spin_lock_init (&irqc->lock); irqc->domain =irq_domain_create_linear (of_fwnode_handle (intc),STARFIVE_INTC_SRC_IRQ_NUM , &starfive_intc_domain_ops, irqc); -if (!irqc->domain) { -pr_err ("Unable to create IRQ domain\n" ); - ret = -EINVAL ; - goto err_clk_disable; - } +if (!irqc->domain) +return dev_err_probe (&pdev->dev, -EINVAL ,"Unable to create IRQ domain\n" ); parent_irq =of_irq_get (intc,0 );if (parent_irq <0 ) { -pr_err ("Failed to get main IRQ: %d\n" , parent_irq); - ret = parent_irq; - goto err_remove_domain; +irq_domain_remove (irqc->domain); +return dev_err_probe (&pdev->dev, parent_irq,"Failed to get main IRQ\n" ); }irq_set_chained_handler_and_data (parent_irq, starfive_intc_irq_handler, irqc); -pr_info ("Interrupt controller register, nr_irqs %d\n" , -STARFIVE_INTC_SRC_IRQ_NUM ); +dev_info (&pdev->dev,"Interrupt controller register, nr_irqs %d\n" , +STARFIVE_INTC_SRC_IRQ_NUM ); +retain_and_null_ptr (irqc);return 0 ; - -err_remove_domain: -irq_domain_remove (irqc->domain); -err_clk_disable: -clk_disable_unprepare (clk); -err_reset_assert: -reset_control_assert (rst); -err_clk_put: -clk_put (clk); -err_reset_put: -reset_control_put (rst); -err_unmap: -iounmap (irqc->base); -err_free: -kfree (irqc); -return ret; }IRQCHIP_PLATFORM_DRIVER_BEGIN (starfive_intc)
Changhuang Liang
maintainerPATCH v2 4/5 irqchip/starfive: Increase the interrupt source number up to 64
In reply to Changhuang LiangFrom: Mason Huo <[email protected]>
StarFive JHB100 SoC interrupt controller actually supports 64 interrupt sources, the original code only supported up to 32. now it is extended to 64. Also use guard(raw_spinlock) to automatically release spinlocks.
--- drivers/irqchip/irq-starfive-jhb100-intc.c | 47 +++++++++++++--------- 1 file changed, 29 insertions(+), 18 deletions(-)
drivers/irqchip/irq-starfive-jhb100-intc.c +29 -18
@@ -19,10 +19,11 @@#include <linux/reset.h> #include <linux/spinlock.h> -#define STARFIVE_INTC_SRC0_CLEAR 0x10 -#define STARFIVE_INTC_SRC0_MASK 0x14 -#define STARFIVE_INTC_SRC0_INT 0x1c +#define STARFIVE_INTC_SRC_CLEAR (n) (0x10 + ((n) * 0x20)) +#define STARFIVE_INTC_SRC_MASK (n) (0x14 + ((n) * 0x20)) +#define STARFIVE_INTC_SRC_INT (n) (0x1c + ((n) * 0x20)) +#define STARFIVE_INTC_NUM 2#define STARFIVE_INTC_SRC_IRQ_NUM 32struct starfive_irq_chip {
@@ -54,19 +55,25 @@ static void starfive_intc_bit_clear(struct starfive_irq_chip *irqc,static void starfive_intc_unmask (struct irq_data *d) {struct starfive_irq_chip *irqc =irq_data_get_irq_chip_data (d); +int i, bitpos; -raw_spin_lock (&irqc->lock); -starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC0_MASK ,BIT (d->hwirq)); -raw_spin_unlock (&irqc->lock); + i = d->hwirq /STARFIVE_INTC_SRC_IRQ_NUM ; + bitpos = d->hwirq %STARFIVE_INTC_SRC_IRQ_NUM ; + +guard (raw_spinlock)(&irqc->lock); +starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC_MASK (i),BIT (bitpos)); }static void starfive_intc_mask (struct irq_data *d) {struct starfive_irq_chip *irqc =irq_data_get_irq_chip_data (d); +int i, bitpos; + + i = d->hwirq /STARFIVE_INTC_SRC_IRQ_NUM ; + bitpos = d->hwirq %STARFIVE_INTC_SRC_IRQ_NUM ; -raw_spin_lock (&irqc->lock); -starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC0_MASK ,BIT (d->hwirq)); -raw_spin_unlock (&irqc->lock); +guard (raw_spinlock)(&irqc->lock); +starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC_MASK (i),BIT (bitpos)); }static struct irq_chip intc_dev = {
@@ -98,16 +105,19 @@ static void starfive_intc_irq_handler(struct irq_desc *desc)chained_irq_enter (chip, desc); - value =ioread32 (irqc->base +STARFIVE_INTC_SRC0_INT ); -while (value) { - hwirq =ffs (value) -1 ; +for (int i =0 ; i <STARFIVE_INTC_NUM ; i++) { + value =ioread32 (irqc->base +STARFIVE_INTC_SRC_INT (i)); +while (value) { + hwirq =ffs (value) -1 ; -generic_handle_domain_irq (irqc->domain, hwirq); +generic_handle_domain_irq (irqc->domain, + hwirq + i *STARFIVE_INTC_SRC_IRQ_NUM ); -starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC0_CLEAR ,BIT (hwirq)); -starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC0_CLEAR ,BIT (hwirq)); +starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC_CLEAR (i),BIT (hwirq)); +starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC_CLEAR (i),BIT (hwirq)); -__clear_bit (hwirq, &value); +__clear_bit (hwirq, &value); + } }chained_irq_exit (chip, desc);
@@ -140,7 +150,8 @@ static int starfive_intc_probe(struct platform_device *pdev, struct device_noderaw_spin_lock_init (&irqc->lock); - irqc->domain =irq_domain_create_linear (of_fwnode_handle (intc),STARFIVE_INTC_SRC_IRQ_NUM , + irqc->domain =irq_domain_create_linear (of_fwnode_handle (intc), +STARFIVE_INTC_SRC_IRQ_NUM *STARFIVE_INTC_NUM , &starfive_intc_domain_ops, irqc);if (!irqc->domain)return dev_err_probe (&pdev->dev, -EINVAL ,"Unable to create IRQ domain\n" );
@@ -155,7 +166,7 @@ static int starfive_intc_probe(struct platform_device *pdev, struct device_node irqc);dev_info (&pdev->dev,"Interrupt controller register, nr_irqs %d\n" , -STARFIVE_INTC_SRC_IRQ_NUM ); +STARFIVE_INTC_SRC_IRQ_NUM *STARFIVE_INTC_NUM );retain_and_null_ptr (irqc);return 0 ;
Signature · 1 line
2.25.1
[tip: irq/drivers] irqchip/starfive: Increase the interrupt source number up to 64
The following commit has been merged into the irq/drivers branch of tip:
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: 5d1b12880fd878f315f41ac5dd19fd9fb476e7a0 Gitweb: https://git.kernel.org/tip/5d1b12880fd878f315f41ac5dd19fd9fb476e7a0 Author: Mason Huo <[email protected]> AuthorDate: Wed, 15 Apr 2026 23:47:50 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 30 Apr 2026 12:53:05 +02:00
irqchip/starfive: Increase the interrupt source number up to 64
StarFive JHB100 SoC interrupt controller actually supports 64 interrupt sources, the original code only supported up to 32. now it is extended to 64.
Also use guard(raw_spinlock) to automatically release spinlocks.
--- drivers/irqchip/irq-starfive-jhb100-intc.c | 47 ++++++++++++--------- 1 file changed, 29 insertions(+), 18 deletions(-)
drivers/irqchip/irq-starfive-jhb100-intc.c +29 -18
@@ -19,10 +19,11 @@#include <linux/reset.h> #include <linux/spinlock.h> -#define STARFIVE_INTC_SRC0_CLEAR 0x10 -#define STARFIVE_INTC_SRC0_MASK 0x14 -#define STARFIVE_INTC_SRC0_INT 0x1c +#define STARFIVE_INTC_SRC_CLEAR (n) (0x10 + ((n) * 0x20)) +#define STARFIVE_INTC_SRC_MASK (n) (0x14 + ((n) * 0x20)) +#define STARFIVE_INTC_SRC_INT (n) (0x1c + ((n) * 0x20)) +#define STARFIVE_INTC_NUM 2#define STARFIVE_INTC_SRC_IRQ_NUM 32struct starfive_irq_chip {
@@ -54,19 +55,25 @@ static void starfive_intc_bit_clear(struct starfive_irq_chip *irqc,static void starfive_intc_unmask (struct irq_data *d) {struct starfive_irq_chip *irqc =irq_data_get_irq_chip_data (d); +int i, bitpos; -raw_spin_lock (&irqc->lock); -starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC0_MASK ,BIT (d->hwirq)); -raw_spin_unlock (&irqc->lock); + i = d->hwirq /STARFIVE_INTC_SRC_IRQ_NUM ; + bitpos = d->hwirq %STARFIVE_INTC_SRC_IRQ_NUM ; + +guard (raw_spinlock)(&irqc->lock); +starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC_MASK (i),BIT (bitpos)); }static void starfive_intc_mask (struct irq_data *d) {struct starfive_irq_chip *irqc =irq_data_get_irq_chip_data (d); +int i, bitpos; + + i = d->hwirq /STARFIVE_INTC_SRC_IRQ_NUM ; + bitpos = d->hwirq %STARFIVE_INTC_SRC_IRQ_NUM ; -raw_spin_lock (&irqc->lock); -starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC0_MASK ,BIT (d->hwirq)); -raw_spin_unlock (&irqc->lock); +guard (raw_spinlock)(&irqc->lock); +starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC_MASK (i),BIT (bitpos)); }static struct irq_chip intc_dev = {
@@ -98,16 +105,19 @@ static void starfive_intc_irq_handler(struct irq_desc *desc)chained_irq_enter (chip, desc); - value =ioread32 (irqc->base +STARFIVE_INTC_SRC0_INT ); -while (value) { - hwirq =ffs (value) -1 ; +for (int i =0 ; i <STARFIVE_INTC_NUM ; i++) { + value =ioread32 (irqc->base +STARFIVE_INTC_SRC_INT (i)); +while (value) { + hwirq =ffs (value) -1 ; -generic_handle_domain_irq (irqc->domain, hwirq); +generic_handle_domain_irq (irqc->domain, + hwirq + i *STARFIVE_INTC_SRC_IRQ_NUM ); -starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC0_CLEAR ,BIT (hwirq)); -starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC0_CLEAR ,BIT (hwirq)); +starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC_CLEAR (i),BIT (hwirq)); +starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC_CLEAR (i),BIT (hwirq)); -__clear_bit (hwirq, &value); +__clear_bit (hwirq, &value); + } }chained_irq_exit (chip, desc);
@@ -140,7 +150,8 @@ static int starfive_intc_probe(struct platform_device *pdev, struct device_noderaw_spin_lock_init (&irqc->lock); - irqc->domain =irq_domain_create_linear (of_fwnode_handle (intc),STARFIVE_INTC_SRC_IRQ_NUM , + irqc->domain =irq_domain_create_linear (of_fwnode_handle (intc), +STARFIVE_INTC_SRC_IRQ_NUM *STARFIVE_INTC_NUM , &starfive_intc_domain_ops, irqc);if (!irqc->domain)return dev_err_probe (&pdev->dev, -EINVAL ,"Unable to create IRQ domain\n" );
@@ -155,7 +166,7 @@ static int starfive_intc_probe(struct platform_device *pdev, struct device_node irqc);dev_info (&pdev->dev,"Interrupt controller register, nr_irqs %d\n" , -STARFIVE_INTC_SRC_IRQ_NUM ); +STARFIVE_INTC_SRC_IRQ_NUM *STARFIVE_INTC_NUM );retain_and_null_ptr (irqc);return 0 ;
Changhuang Liang
maintainerPATCH v2 5/5 irqchip/starfive: Implement irq_set_type() and irq_ack() callbacks
In reply to Changhuang LiangAdd irq_set_type() callback to support configuring interrupt trigger types (level high/low, edge rising/falling) for the JHB100 interrupt controller. Also add irq_ack() callabck as required by handle_edge_irq().
--- drivers/irqchip/irq-starfive-jhb100-intc.c | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+)
drivers/irqchip/irq-starfive-jhb100-intc.c +73 -0
@@ -10,6 +10,7 @@#include <linux/bitops.h> #include <linux/cleanup.h> #include <linux/clk.h> +#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/irqchip.h> #include <linux/irqchip/chained_irq.h>
@@ -19,12 +20,20 @@#include <linux/reset.h> #include <linux/spinlock.h> +#define STARFIVE_INTC_SRC_TYPE (n) (0x04 + ((n) * 0x20))#define STARFIVE_INTC_SRC_CLEAR (n) (0x10 + ((n) * 0x20))#define STARFIVE_INTC_SRC_MASK (n) (0x14 + ((n) * 0x20))#define STARFIVE_INTC_SRC_INT (n) (0x1c + ((n) * 0x20)) +#define STARFIVE_INTC_TRIGGER_MASK 0x3 +#define STARFIVE_INTC_TRIGGER_HIGH 0 +#define STARFIVE_INTC_TRIGGER_LOW 1 +#define STARFIVE_INTC_TRIGGER_POSEDGE 2 +#define STARFIVE_INTC_TRIGGER_NEGEDGE 3 +#define STARFIVE_INTC_NUM 2#define STARFIVE_INTC_SRC_IRQ_NUM 32 +#define STARFIVE_INTC_TYPE_NUM 16struct starfive_irq_chip {void __iomem *base;
@@ -32,6 +41,16 @@ struct starfive_irq_chip {raw_spinlock_t lock; }; +static void starfive_intc_mod (struct starfive_irq_chip *irqc,u32 reg,u32 mask,u32 data) +{ +u32 value; + + value =ioread32 (irqc->base + reg) & ~mask; + data &= mask; + data |= value; +iowrite32 (data, irqc->base + reg); +} +static void starfive_intc_bit_set (struct starfive_irq_chip *irqc,u32 reg,u32 bit_mask) {
@@ -76,10 +95,64 @@ static void starfive_intc_mask(struct irq_data *d)starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC_MASK (i),BIT (bitpos)); } +static void starfive_intc_ack (struct irq_data *d) +{ +/* for handle_edge_irq, nothing to do */ +} + +static int starfive_intc_set_type (struct irq_data *d,unsigned int type) +{ +struct starfive_irq_chip *irqc =irq_data_get_irq_chip_data (d); +u32 i, bitpos, ty_pos, ty_shift, trigger, typeval; +irq_flow_handler_t handler; + + i = d->hwirq /STARFIVE_INTC_SRC_IRQ_NUM ; + bitpos = d->hwirq %STARFIVE_INTC_SRC_IRQ_NUM ; + ty_pos = bitpos /STARFIVE_INTC_TYPE_NUM ; + ty_shift = (bitpos %STARFIVE_INTC_TYPE_NUM ) *2 ; + +switch (type) { +case IRQF_TRIGGER_LOW : + trigger =STARFIVE_INTC_TRIGGER_LOW ; + handler = handle_level_irq; +break ; +case IRQF_TRIGGER_HIGH : + trigger =STARFIVE_INTC_TRIGGER_HIGH ; + handler = handle_level_irq; +break ; +case IRQF_TRIGGER_FALLING : + trigger =STARFIVE_INTC_TRIGGER_NEGEDGE ; + handler = handle_edge_irq; +break ; +case IRQF_TRIGGER_RISING : + trigger =STARFIVE_INTC_TRIGGER_POSEDGE ; + handler = handle_edge_irq; +break ; +default : +return -EINVAL ; + } + +irq_set_handler_locked (d, handler); + typeval = trigger << ty_shift; + +guard (raw_spinlock)(&irqc->lock); + +starfive_intc_mod (irqc,STARFIVE_INTC_SRC_TYPE (i) +4 * ty_pos, +STARFIVE_INTC_TRIGGER_MASK << ty_shift, typeval); + +/* Once the type is updated, clear interrupt can help to reset the type value */ +starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC_CLEAR (i),BIT (bitpos)); +starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC_CLEAR (i),BIT (bitpos)); + +return 0 ; +} +static struct irq_chip intc_dev = { .name ="StarFive JHB100 INTC" , .irq_unmask = starfive_intc_unmask, .irq_mask = starfive_intc_mask, + .irq_ack = starfive_intc_ack, + .irq_set_type = starfive_intc_set_type, }; static int starfive_intc_map(struct irq_domain *d, unsigned int irq,
Signature · 1 line
2.25.1
[tip: irq/drivers] irqchip/starfive: Implement irq_set_type() and irq_ack() callbacks
The following commit has been merged into the irq/drivers branch of tip:
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: 96c0c9b488502c89e91f32353b853422a45a1646 Gitweb: https://git.kernel.org/tip/96c0c9b488502c89e91f32353b853422a45a1646 Author: Changhuang Liang <[email protected]> AuthorDate: Wed, 15 Apr 2026 23:47:51 -07:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 30 Apr 2026 12:53:06 +02:00
irqchip/starfive: Implement irq_set_type() and irq_ack() callbacks
Add irq_set_type() callback to support configuring interrupt trigger types (level high/low, edge rising/falling) for the JHB100 interrupt controller. Also add irq_ack() callback as required by handle_edge_irq().
--- drivers/irqchip/irq-starfive-jhb100-intc.c | 73 +++++++++++++++++++++- 1 file changed, 73 insertions(+)
drivers/irqchip/irq-starfive-jhb100-intc.c +73 -0
@@ -10,6 +10,7 @@#include <linux/bitops.h> #include <linux/cleanup.h> #include <linux/clk.h> +#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/irqchip.h> #include <linux/irqchip/chained_irq.h>
@@ -19,12 +20,20 @@#include <linux/reset.h> #include <linux/spinlock.h> +#define STARFIVE_INTC_SRC_TYPE (n) (0x04 + ((n) * 0x20))#define STARFIVE_INTC_SRC_CLEAR (n) (0x10 + ((n) * 0x20))#define STARFIVE_INTC_SRC_MASK (n) (0x14 + ((n) * 0x20))#define STARFIVE_INTC_SRC_INT (n) (0x1c + ((n) * 0x20)) +#define STARFIVE_INTC_TRIGGER_MASK 0x3 +#define STARFIVE_INTC_TRIGGER_HIGH 0 +#define STARFIVE_INTC_TRIGGER_LOW 1 +#define STARFIVE_INTC_TRIGGER_POSEDGE 2 +#define STARFIVE_INTC_TRIGGER_NEGEDGE 3 +#define STARFIVE_INTC_NUM 2#define STARFIVE_INTC_SRC_IRQ_NUM 32 +#define STARFIVE_INTC_TYPE_NUM 16struct starfive_irq_chip {void __iomem *base;
@@ -32,6 +41,16 @@ struct starfive_irq_chip {raw_spinlock_t lock; }; +static void starfive_intc_mod (struct starfive_irq_chip *irqc,u32 reg,u32 mask,u32 data) +{ +u32 value; + + value =ioread32 (irqc->base + reg) & ~mask; + data &= mask; + data |= value; +iowrite32 (data, irqc->base + reg); +} +static void starfive_intc_bit_set (struct starfive_irq_chip *irqc,u32 reg,u32 bit_mask) {
@@ -76,10 +95,64 @@ static void starfive_intc_mask(struct irq_data *d)starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC_MASK (i),BIT (bitpos)); } +static void starfive_intc_ack (struct irq_data *d) +{ +/* for handle_edge_irq, nothing to do */ +} + +static int starfive_intc_set_type (struct irq_data *d,unsigned int type) +{ +struct starfive_irq_chip *irqc =irq_data_get_irq_chip_data (d); +u32 i, bitpos, ty_pos, ty_shift, trigger, typeval; +irq_flow_handler_t handler; + + i = d->hwirq /STARFIVE_INTC_SRC_IRQ_NUM ; + bitpos = d->hwirq %STARFIVE_INTC_SRC_IRQ_NUM ; + ty_pos = bitpos /STARFIVE_INTC_TYPE_NUM ; + ty_shift = (bitpos %STARFIVE_INTC_TYPE_NUM ) *2 ; + +switch (type) { +case IRQF_TRIGGER_LOW : + trigger =STARFIVE_INTC_TRIGGER_LOW ; + handler = handle_level_irq; +break ; +case IRQF_TRIGGER_HIGH : + trigger =STARFIVE_INTC_TRIGGER_HIGH ; + handler = handle_level_irq; +break ; +case IRQF_TRIGGER_FALLING : + trigger =STARFIVE_INTC_TRIGGER_NEGEDGE ; + handler = handle_edge_irq; +break ; +case IRQF_TRIGGER_RISING : + trigger =STARFIVE_INTC_TRIGGER_POSEDGE ; + handler = handle_edge_irq; +break ; +default : +return -EINVAL ; + } + +irq_set_handler_locked (d, handler); + typeval = trigger << ty_shift; + +guard (raw_spinlock)(&irqc->lock); + +starfive_intc_mod (irqc,STARFIVE_INTC_SRC_TYPE (i) +4 * ty_pos, +STARFIVE_INTC_TRIGGER_MASK << ty_shift, typeval); + +/* Once the type is updated, clear interrupt can help to reset the type value */ +starfive_intc_bit_set (irqc,STARFIVE_INTC_SRC_CLEAR (i),BIT (bitpos)); +starfive_intc_bit_clear (irqc,STARFIVE_INTC_SRC_CLEAR (i),BIT (bitpos)); + +return 0 ; +} +static struct irq_chip intc_dev = { .name ="StarFive JHB100 INTC" , .irq_unmask = starfive_intc_unmask, .irq_mask = starfive_intc_mask, + .irq_ack = starfive_intc_ack, + .irq_set_type = starfive_intc_set_type, }; static int starfive_intc_map(struct irq_domain *d, unsigned int irq,