From 8f39d03c09b2e6bd7e9b59143f9a22257086ce92 Mon Sep 17 00:00:00 2001 From: Junhui Liu Date: Wed, 9 Sep 2026 00:28:44 +0800 Subject: [PATCH 1/6] dt-bindings: timer: thead,c900-aclint-mtimer: Add SpacemiT K3 Add support for the SpacemiT K3 ACLINT MTIMER, which provides per-hart timer interrupts in Machine mode. Signed-off-by: Junhui Liu Acked-by: Conor Dooley Signed-off-by: Linux RISC-V bot --- .../devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml index cf7c82e980f674..082378b04d72d2 100644 --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml @@ -12,6 +12,7 @@ maintainers: properties: compatible: oneOf: + - const: spacemit,k3-aclint-mtimer - items: - enum: - sophgo,sg2042-aclint-mtimer From ed1a818c6f72b102bbf8660b69e08a985b5be2a4 Mon Sep 17 00:00:00 2001 From: Junhui Liu Date: Wed, 9 Sep 2026 00:28:45 +0800 Subject: [PATCH 2/6] dt-bindings: interrupt-controller: thead,c900-aclint-mswi: Add SpacemiT K3 Add support for the SpacemiT K3 ACLINT MSWI, which provides per-hart software interrupts for inter-processor communication in Machine mode. Signed-off-by: Junhui Liu Acked-by: Conor Dooley Signed-off-by: Linux RISC-V bot --- .../bindings/interrupt-controller/thead,c900-aclint-mswi.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-mswi.yaml b/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-mswi.yaml index 62fd220e126e65..d17f5613612c38 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-mswi.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-mswi.yaml @@ -12,6 +12,7 @@ maintainers: properties: compatible: oneOf: + - const: spacemit,k3-aclint-mswi - items: - enum: - sophgo,sg2042-aclint-mswi From 8f9a277c66ced7616e43737d180de86ee7bd466f Mon Sep 17 00:00:00 2001 From: Junhui Liu Date: Wed, 9 Sep 2026 00:28:46 +0800 Subject: [PATCH 3/6] dt-bindings: interrupt-controller: thead,c900-aclint-sswi: Add SpacemiT K3 Add support for the SpacemiT K3 ACLINT SSWI, which provides inter-processor interrupts in Supervisor mode without calling into Machine-mode firmware. Signed-off-by: Junhui Liu Acked-by: Conor Dooley Signed-off-by: Linux RISC-V bot --- .../interrupt-controller/thead,c900-aclint-sswi.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml b/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml index d02c6886283af7..0b34ed5b4639d0 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml @@ -24,12 +24,13 @@ description: properties: compatible: oneOf: + - enum: + - mips,p8700-aclint-sswi + - spacemit,k3-aclint-sswi - items: - enum: - sophgo,sg2044-aclint-sswi - const: thead,c900-aclint-sswi - - items: - - const: mips,p8700-aclint-sswi - items: - enum: - anlogic,dr1v90-aclint-sswi From 297421a31a81bc92c2074d248a482f75726a5420 Mon Sep 17 00:00:00 2001 From: Junhui Liu Date: Wed, 9 Sep 2026 00:28:47 +0800 Subject: [PATCH 4/6] dt-bindings: timer: sifive,clint: Deprecate spacemit,k3-clint The SpacemiT K3 implements separate ACLINT MSWI, MTIMER and SSWI devices. The existing spacemit,k3-clint compatible incorrectly describes the SSWI register space as a legacy CLINT. Deprecate this compatible in favor of the K3-specific ACLINT compatibles. Fixes: 6cdeb30db4d8 ("dt-bindings: timer: add SpacemiT K3 CLINT") Signed-off-by: Junhui Liu Signed-off-by: Linux RISC-V bot --- Documentation/devicetree/bindings/timer/sifive,clint.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/timer/sifive,clint.yaml b/Documentation/devicetree/bindings/timer/sifive,clint.yaml index 3673836e14deef..88b9be2230a122 100644 --- a/Documentation/devicetree/bindings/timer/sifive,clint.yaml +++ b/Documentation/devicetree/bindings/timer/sifive,clint.yaml @@ -34,7 +34,6 @@ properties: - microchip,pic64gx-clint # Microchip PIC64GX - sifive,fu540-c000-clint # SiFive FU540 - spacemit,k1-clint # SpacemiT K1 - - spacemit,k3-clint # SpacemiT K3 - starfive,jh7100-clint # StarFive JH7100 - starfive,jh7110-clint # StarFive JH7110 - starfive,jh8100-clint # StarFive JH8100 @@ -62,6 +61,10 @@ properties: - const: riscv,clint0 deprecated: true description: For the QEMU virt machine only + - items: + - const: spacemit,k3-clint + - const: sifive,clint0 + deprecated: true description: Should be ",-clint", followed by "sifive,clint" From 7d1a8d0fc4637bb3aecfbc41a65773cae05cb14f Mon Sep 17 00:00:00 2001 From: Junhui Liu Date: Wed, 9 Sep 2026 00:28:48 +0800 Subject: [PATCH 5/6] irqchip/aclint-sswi: Add support for SpacemiT K3 Add a match entry for the spacemit,k3-aclint-sswi compatible. The K3 SSWI device requires no special handling and can use the existing generic ACLINT SSWI initialization function. Signed-off-by: Junhui Liu Signed-off-by: Linux RISC-V bot --- drivers/irqchip/irq-aclint-sswi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-aclint-sswi.c b/drivers/irqchip/irq-aclint-sswi.c index ca06efd86fa1a7..d3ef2cd3b5c552 100644 --- a/drivers/irqchip/irq-aclint-sswi.c +++ b/drivers/irqchip/irq-aclint-sswi.c @@ -179,6 +179,7 @@ static int __init generic_aclint_sswi_early_probe(struct device_node *node, } IRQCHIP_DECLARE(mips_p8700_sswi, "mips,p8700-aclint-sswi", generic_aclint_sswi_early_probe); IRQCHIP_DECLARE(nuclei_ux900_sswi, "nuclei,ux900-aclint-sswi", generic_aclint_sswi_early_probe); +IRQCHIP_DECLARE(spacemit_k3_sswi, "spacemit,k3-aclint-sswi", generic_aclint_sswi_early_probe); /* THEAD variant */ #define THEAD_C9XX_CSR_SXSTATUS 0x5c0 From 3f268e7d1952e2facb879867bcebd7ee4ab8e23d Mon Sep 17 00:00:00 2001 From: Junhui Liu Date: Wed, 9 Sep 2026 00:28:49 +0800 Subject: [PATCH 6/6] riscv: dts: spacemit: k3: Replace incorrect CLINT node with ACLINT nodes The K3 implements separate ACLINT MSWI, MTIMER and SSWI devices. The existing CLINT node at 0xe081c000 incorrectly describes the SSWI register space as a legacy CLINT. Replace the CLINT node with an SSWI interrupt controller using the K3-specific compatible and supervisor software interrupt IDs. Add the MSWI and MTIMER nodes to describe the machine-level devices for firmware such as OpenSBI. Use the secure addresses for MSWI and MTIMER, as their non-secure aliases are inaccessible. Keep SSWI at its non-secure address, 0xe081c000, because an efuse bit can restrict access to its secure alias at 0xf181c000 to Machine mode. Fixes: 56f37e391a62 ("riscv: dts: spacemit: add initial support for K3 SoC") Signed-off-by: Junhui Liu Signed-off-by: Linux RISC-V bot --- arch/riscv/boot/dts/spacemit/k3.dtsi | 37 ++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/arch/riscv/boot/dts/spacemit/k3.dtsi b/arch/riscv/boot/dts/spacemit/k3.dtsi index c3f2dce0969c0c..7ca662fe4cbe53 100644 --- a/arch/riscv/boot/dts/spacemit/k3.dtsi +++ b/arch/riscv/boot/dts/spacemit/k3.dtsi @@ -1261,17 +1261,15 @@ riscv,num-sources = <512>; }; - clint: timer@e081c000 { - compatible = "spacemit,k3-clint", "sifive,clint0"; + aclint_sswi: interrupt-controller@e081c000 { + compatible = "spacemit,k3-aclint-sswi"; reg = <0x0 0xe081c000 0x0 0x4000>; - interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>, - <&cpu1_intc 3>, <&cpu1_intc 7>, - <&cpu2_intc 3>, <&cpu2_intc 7>, - <&cpu3_intc 3>, <&cpu3_intc 7>, - <&cpu4_intc 3>, <&cpu4_intc 7>, - <&cpu5_intc 3>, <&cpu5_intc 7>, - <&cpu6_intc 3>, <&cpu6_intc 7>, - <&cpu7_intc 3>, <&cpu7_intc 7>; + #interrupt-cells = <0>; + interrupt-controller; + interrupts-extended = <&cpu0_intc 1>, <&cpu1_intc 1>, + <&cpu2_intc 1>, <&cpu3_intc 1>, + <&cpu4_intc 1>, <&cpu5_intc 1>, + <&cpu6_intc 1>, <&cpu7_intc 1>; }; /* sec_i2c3: 0xf0614000, not available from Linux */ @@ -1305,5 +1303,24 @@ riscv,num-sources = <512>; status = "reserved"; }; + + aclint_mswi: interrupt-controller@f1810000 { + compatible = "spacemit,k3-aclint-mswi"; + reg = <0x0 0xf1810000 0x0 0x4000>; + interrupts-extended = <&cpu0_intc 3>, <&cpu1_intc 3>, + <&cpu2_intc 3>, <&cpu3_intc 3>, + <&cpu4_intc 3>, <&cpu5_intc 3>, + <&cpu6_intc 3>, <&cpu7_intc 3>; + }; + + aclint_mtimer: timer@f1814000 { + compatible = "spacemit,k3-aclint-mtimer"; + reg = <0x0 0xf1814000 0x0 0x8000>; + reg-names = "mtimecmp"; + interrupts-extended = <&cpu0_intc 7>, <&cpu1_intc 7>, + <&cpu2_intc 7>, <&cpu3_intc 7>, + <&cpu4_intc 7>, <&cpu5_intc 7>, + <&cpu6_intc 7>, <&cpu7_intc 7>; + }; }; };