dt-bindings: timer: Add SiFive CLINT2
PATCH v3 1/1 dt-bindings: timer: Add SiFive CLINT2
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
---
- v3 changes:
- Add the reason for the incompatibility between sifive,clint2 and sifive,clint0.
- v2 changes:
- Don't allow sifive,clint2 by itself. Add '-{}' to the first entry
- Mark the sifive,fine-ctr-bits as the required property when the compatible includes the sifive,clint2
.../bindings/timer/sifive,clint.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
Documentation/devicetree/bindings/timer/sifive,clint.yaml +22 -0
@@ -36,6 +36,12 @@ properties: - starfive,jh7110-clint # StarFive JH7110 - starfive,jh8100-clint # StarFive JH8100 - const: sifive,clint0 # SiFive CLINT v0 IP block + - items: + - {} + - const: sifive,clint2 # SiFive CLINT v2 IP block + description: + SiFive CLINT v2 is the HRT that supports the Zicntr. The control of sifive,clint2 + differs from that of sifive,clint0, making them incompatible. - items: - enum: - allwinner,sun20i-d1-clint
@@ -62,6 +68,22 @@ properties: minItems: 1 maxItems: 4095 + sifive,fine-ctr-bits: + maximum: 15 + description: The width in bits of the fine counter. + +if: + properties: + compatible: + contains: + const: sifive,clint2 +then: + required: + - sifive,fine-ctr-bits +else: + properties: + sifive,fine-ctr-bits: false + additionalProperties: false required:
Signature · 1 line
2.17.1
Quoted 6 lines · Nick Hu
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Signed-off-by Nick Hu <[email protected]>Reviewed-by Samuel Holland <[email protected]>
Quoted 55 lines
---
- v3 changes:
- Add the reason for the incompatibility between sifive,clint2 and sifive,clint0.
- v2 changes:
- Don't allow sifive,clint2 by itself. Add '-{}' to the first entry
- Mark the sifive,fine-ctr-bits as the required property when the compatible includes the sifive,clint2.../bindings/timer/sifive,clint.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)Documentation/devicetree/bindings/timer/sifive,clint.yaml +22
-0@@ -36,6 +36,12 @@ properties: - starfive,jh7110-clint # StarFive JH7110 - starfive,jh8100-clint # StarFive JH8100 - const: sifive,clint0 # SiFive CLINT v0 IP block + - items: + - {} + - const: sifive,clint2 # SiFive CLINT v2 IP block + description: + SiFive CLINT v2 is the HRT that supports the Zicntr. The control of sifive,clint2 + differs from that of sifive,clint0, making them incompatible. - items: - enum: - allwinner,sun20i-d1-clint@@ -62,6 +68,22 @@ properties: minItems: 1 maxItems: 4095 + sifive,fine-ctr-bits: + maximum: 15 + description: The width in bits of the fine counter. + +if: + properties: + compatible: + contains: + const: sifive,clint2 +then: + required: + - sifive,fine-ctr-bits +else: + properties: + sifive,fine-ctr-bits: false + additionalProperties: false required:Signature · 1 line
2.17.1
The following commit has been merged into the timers/clocksource branch of tip:
The following commit has been merged into the timers/clocksource branch of tip:
Commit-ID: 0f920690a82cc99ae08cab08bee2e5685b62fd04 Gitweb: https://git.kernel.org/tip/0f920690a82cc99ae08cab08bee2e5685b62fd04 Author: Nick Hu <[email protected]> AuthorDate: Fri, 21 Mar 2025 16:35:06 +08:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Sun, 23 Mar 2025 10:55:43 +01:00
dt-bindings: timer: Add SiFive CLINT2
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
--- Documentation/devicetree/bindings/timer/sifive,clint.yaml | 22 +++++++- 1 file changed, 22 insertions(+)
Documentation/devicetree/bindings/timer/sifive,clint.yaml +22 -0
@@ -37,6 +37,12 @@ properties: - starfive,jh8100-clint # StarFive JH8100 - const: sifive,clint0 # SiFive CLINT v0 IP block - items: + - {} + - const: sifive,clint2 # SiFive CLINT v2 IP block + description: + SiFive CLINT v2 is the HRT that supports the Zicntr. The control of sifive,clint2 + differs from that of sifive,clint0, making them incompatible. + - items: - enum: - allwinner,sun20i-d1-clint - sophgo,cv1800b-clint
@@ -62,6 +68,22 @@ properties: minItems: 1 maxItems: 4095 + sifive,fine-ctr-bits: + maximum: 15 + description: The width in bits of the fine counter. + +if: + properties: + compatible: + contains: + const: sifive,clint2 +then: + required: + - sifive,fine-ctr-bits +else: + properties: + sifive,fine-ctr-bits: false + additionalProperties: false required:
This patch was applied to riscv/linux.git (fixes) by Daniel Lezcano <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (fixes)
by Daniel Lezcano <[email protected]>:
Quoted 8 lines · On Fri, 21 Mar 2025 16:35:06 +0800 you wrote:
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Signed-off-by Nick Hu <[email protected]>Reviewed-by Samuel Holland <[email protected]>[...]
Here is the summary with links:
- [v3] dt-bindings: timer: Add SiFive CLINT2
https://git.kernel.org/riscv/c/0f920690a82c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 3 lines · Nick Hu
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Hello Nick,
Can you help me understand what is this different control method? I've found that both OpenSBI [1] and U-Boot [2] use the same match data in their clint driver which would indicate that they are compatible.
Also, do you know if there's an easy way to tell if a sifive clint is a v0 or v2?
Thanks,
Charles
[1]: https://elixir.bootlin.com/opensbi/v1.8.1/source/lib/utils/timer/fdt_timer_mtimer.c#L163
[2]: https://elixir.bootlin.com/u-boot/v2026.01/source/drivers/timer/riscv_aclint_timer.c#L86
Quoted 59 lines
Signed-off-by Nick Hu <[email protected]>Reviewed-by Samuel Holland <[email protected]>---
- v3 changes:
- Add the reason for the incompatibility between sifive,clint2 and sifive,clint0.
- v2 changes:
- Don't allow sifive,clint2 by itself. Add '-{}' to the first entry
- Mark the sifive,fine-ctr-bits as the required property when the compatible includes the sifive,clint2.../bindings/timer/sifive,clint.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)Documentation/devicetree/bindings/timer/sifive,clint.yaml +22
-0@@ -36,6 +36,12 @@ properties: - starfive,jh7110-clint # StarFive JH7110 - starfive,jh8100-clint # StarFive JH8100 - const: sifive,clint0 # SiFive CLINT v0 IP block + - items: + - {} + - const: sifive,clint2 # SiFive CLINT v2 IP block + description: + SiFive CLINT v2 is the HRT that supports the Zicntr. The control of sifive,clint2 + differs from that of sifive,clint0, making them incompatible. - items: - enum: - allwinner,sun20i-d1-clint@@ -62,6 +68,22 @@ properties: minItems: 1 maxItems: 4095 + sifive,fine-ctr-bits: + maximum: 15 + description: The width in bits of the fine counter. + +if: + properties: + compatible: + contains: + const: sifive,clint2 +then: + required: + - sifive,fine-ctr-bits +else: + properties: + sifive,fine-ctr-bits: false + additionalProperties: false required:Signature · 1 line
2.17.1
Quoted 10 lines · Charles Perry
Quoted 3 lines · Nick Hu
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Hello Nick,
Can you help me understand what is this different control method? I've found that both OpenSBI [1] and U-Boot [2] use the same match data in their clint driver which would indicate that they are compatible.
Hmm, good point. I didn't see that the drivers were not doing anything different. I guess really the clintv2 should fall back to the clintv0, and the difference in hardware should be elaborated on.
I think I also dropped the ball on sifive,fine-ctr-bits, and that should be removed and the counter width determined from the compatible. There's no users for that yet I think, and there's no valid users of the clintv2 compatible /at all/ so maybe it can just get culled.
Quoted 69 lines
Also, do you know if there's an easy way to tell if a sifive clint is a v0 or v2?
Thanks,
Charles[1]: https://elixir.bootlin.com/opensbi/v1.8.1/source/lib/utils/timer/fdt_timer_mtimer.c#L163
[2]: https://elixir.bootlin.com/u-boot/v2026.01/source/drivers/timer/riscv_aclint_timer.c#L86Quoted 59 lines
Signed-off-by Nick Hu <[email protected]>Reviewed-by Samuel Holland <[email protected]>---
- v3 changes:
- Add the reason for the incompatibility between sifive,clint2 and sifive,clint0.
- v2 changes:
- Don't allow sifive,clint2 by itself. Add '-{}' to the first entry
- Mark the sifive,fine-ctr-bits as the required property when the compatible includes the sifive,clint2.../bindings/timer/sifive,clint.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)Documentation/devicetree/bindings/timer/sifive,clint.yaml +22
-0@@ -36,6 +36,12 @@ properties: - starfive,jh7110-clint # StarFive JH7110 - starfive,jh8100-clint # StarFive JH8100 - const: sifive,clint0 # SiFive CLINT v0 IP block + - items: + - {} + - const: sifive,clint2 # SiFive CLINT v2 IP block + description: + SiFive CLINT v2 is the HRT that supports the Zicntr. The control of sifive,clint2 + differs from that of sifive,clint0, making them incompatible. - items: - enum: - allwinner,sun20i-d1-clint@@ -62,6 +68,22 @@ properties: minItems: 1 maxItems: 4095 + sifive,fine-ctr-bits: + maximum: 15 + description: The width in bits of the fine counter. + +if: + properties: + compatible: + contains: + const: sifive,clint2 +then: + required: + - sifive,fine-ctr-bits +else: + properties: + sifive,fine-ctr-bits: false + additionalProperties: false required:Signature · 1 line
2.17.1
Quoted 13 lines · Conor Dooley
Quoted 10 lines · Charles Perry
Quoted 3 lines · Nick Hu
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Hello Nick,
Can you help me understand what is this different control method? I've found that both OpenSBI [1] and U-Boot [2] use the same match data in their clint driver which would indicate that they are compatible.
Quoted 9 lines
Hmm, good point. I didn't see that the drivers were not doing anything different. I guess really the clintv2 should fall back to the clintv0, and the difference in hardware should be elaborated on.
I think I also dropped the ball on sifive,fine-ctr-bits, and that should be removed and the counter width determined from the compatible. There's no users for that yet I think, and there's no valid users of the clintv2 compatible /at all/ so maybe it can just get culled.
Thanks for pointing that out, I'll send a patch to remove the sifive,fine-ctr-bits property.
Quoted 69 lines
Quoted 69 lines
Also, do you know if there's an easy way to tell if a sifive clint is a v0 or v2?
Thanks,
Charles[1]: https://elixir.bootlin.com/opensbi/v1.8.1/source/lib/utils/timer/fdt_timer_mtimer.c#L163
[2]: https://elixir.bootlin.com/u-boot/v2026.01/source/drivers/timer/riscv_aclint_timer.c#L86Quoted 59 lines
Signed-off-by Nick Hu <[email protected]>Reviewed-by Samuel Holland <[email protected]>---
- v3 changes:
- Add the reason for the incompatibility between sifive,clint2 and sifive,clint0.
- v2 changes:
- Don't allow sifive,clint2 by itself. Add '-{}' to the first entry
- Mark the sifive,fine-ctr-bits as the required property when the compatible includes the sifive,clint2.../bindings/timer/sifive,clint.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)Documentation/devicetree/bindings/timer/sifive,clint.yaml +22
-1@@ -36,6 +36,12 @@ properties: - starfive,jh7110-clint # StarFive JH7110 - starfive,jh8100-clint # StarFive JH8100 - const: sifive,clint0 # SiFive CLINT v0 IP block + - items: + - {} + - const: sifive,clint2 # SiFive CLINT v2 IP block + description: + SiFive CLINT v2 is the HRT that supports the Zicntr. The control of sifive,clint2 + differs from that of sifive,clint0, making them incompatible. - items: - enum: - allwinner,sun20i-d1-clint@@ -62,6 +68,22 @@ properties: minItems: 1 maxItems: 4095 + sifive,fine-ctr-bits: + maximum: 15 + description: The width in bits of the fine counter. + +if: + properties: + compatible: + contains: + const: sifive,clint2 +then: + required: + - sifive,fine-ctr-bits +else: + properties: + sifive,fine-ctr-bits: false + additionalProperties: false required: --2.17.1
Quoted 6 lines · Charles Perry
Quoted 3 lines · Nick Hu
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Quoted 6 lines
Hello Nick,
Can you help me understand what is this different control method? I've found that both OpenSBI [1] and U-Boot [2] use the same match data in their clint driver which would indicate that they are compatible.
Sorry for the late reply.
Unlike v0, v2 requires a write to the mtime register to kick the timer.
Quoted 3 lines
Also, do you know if there's an easy way to tell if a sifive clint is a v0 or v2?
sifive,clint2 introduces additional MMIO registers
Quoted 65 lines
Thanks,
Charles[1]: https://elixir.bootlin.com/opensbi/v1.8.1/source/lib/utils/timer/fdt_timer_mtimer.c#L163
[2]: https://elixir.bootlin.com/u-boot/v2026.01/source/drivers/timer/riscv_aclint_timer.c#L86Quoted 59 lines
Signed-off-by Nick Hu <[email protected]>Reviewed-by Samuel Holland <[email protected]>---
- v3 changes:
- Add the reason for the incompatibility between sifive,clint2 and sifive,clint0.
- v2 changes:
- Don't allow sifive,clint2 by itself. Add '-{}' to the first entry
- Mark the sifive,fine-ctr-bits as the required property when the compatible includes the sifive,clint2.../bindings/timer/sifive,clint.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)Documentation/devicetree/bindings/timer/sifive,clint.yaml +22
-1@@ -36,6 +36,12 @@ properties: - starfive,jh7110-clint # StarFive JH7110 - starfive,jh8100-clint # StarFive JH8100 - const: sifive,clint0 # SiFive CLINT v0 IP block + - items: + - {} + - const: sifive,clint2 # SiFive CLINT v2 IP block + description: + SiFive CLINT v2 is the HRT that supports the Zicntr. The control of sifive,clint2 + differs from that of sifive,clint0, making them incompatible. - items: - enum: - allwinner,sun20i-d1-clint@@ -62,6 +68,22 @@ properties: minItems: 1 maxItems: 4095 + sifive,fine-ctr-bits: + maximum: 15 + description: The width in bits of the fine counter. + +if: + properties: + compatible: + contains: + const: sifive,clint2 +then: + required: + - sifive,fine-ctr-bits +else: + properties: + sifive,fine-ctr-bits: false + additionalProperties: false required: --2.17.1
Quoted 8 lines · Nick Hu
Quoted 6 lines · Charles Perry
Quoted 3 lines · Nick Hu
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Quoted 7 lines
Quoted 6 lines
Hello Nick,
Can you help me understand what is this different control method? I've found that both OpenSBI [1] and U-Boot [2] use the same match data in their clint driver which would indicate that they are compatible.
Sorry for the late reply.
Hello Nick, no worries.
Quoted 1 line
Unlike v0, v2 requires a write to the mtime register to kick the timer.
A kick once at the beginning or every time a machine timer interrupt fires?
Quoted 5 lines
Quoted 4 lines
Also, do you know if there's an easy way to tell if a sifive clint is a v0 or v2?
sifive,clint2 introduces additional MMIO registers
Is that the high resolution timers (HRT) mentionned in the description?
And last question, would you happen to know if sifive made a clint v1 that does NOT require the mtime kick but does have the HRT?
I'm trying to figure out what should be the compatible for PIC64-HPSC. Some code from a repository called "FSFM" used "sifive,clint1" for the compatible. I'm wondering if I should add the clint v1 to this file.
Thanks,
Charles
Quoted 16 lines · Charles Perry
Quoted 14 lines · Nick Hu
Quoted 12 lines · Charles Perry
Quoted 3 lines · Nick Hu
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Hello Nick,
Can you help me understand what is this different control method? I've found that both OpenSBI [1] and U-Boot [2] use the same match data in their clint driver which would indicate that they are compatible.
Quoted 8 lines
Quoted 1 line
Sorry for the late reply.
Hello Nick, no worries.
Quoted 1 line
Unlike v0, v2 requires a write to the mtime register to kick the timer.
A kick once at the beginning or every time a machine timer interrupt fires?
A kick once at the beginning
Quoted 11 lines
Quoted 5 lines
Quoted 4 lines
Also, do you know if there's an easy way to tell if a sifive clint is a v0 or v2?
sifive,clint2 introduces additional MMIO registers
Is that the high resolution timers (HRT) mentionned in the description?
And last question, would you happen to know if sifive made a clint v1 that does NOT require the mtime kick but does have the HRT?
Yes, that's correct.
Quoted 7 lines
I'm trying to figure out what should be the compatible for PIC64-HPSC. Some code from a repository called "FSFM" used "sifive,clint1" for the compatible. I'm wondering if I should add the clint v1 to this file.
Thanks,
Charles
Quoted 20 lines · Nick Hu
Quoted 18 lines · Charles Perry
Quoted 15 lines · Nick Hu
Quoted 6 lines · Charles Perry
Quoted 3 lines · Nick Hu
Add compatible string and property for the SiFive CLINT v2. The SiFive CLINT v2 is incompatible with the SiFive CLINT v0 due to differences in their control methods.
Quoted 6 lines
Hello Nick,
Can you help me understand what is this different control method? I've found that both OpenSBI [1] and U-Boot [2] use the same match data in their clint driver which would indicate that they are compatible.
Sorry for the late reply.
Quoted 7 lines
Quoted 6 lines
Hello Nick, no worries.
Quoted 1 line
Unlike v0, v2 requires a write to the mtime register to kick the timer.
A kick once at the beginning or every time a machine timer interrupt fires?
A kick once at the beginning
That would explain what I observed in U-Boot and OpenSBI. The kick might be in some arch specific code or a prior boot stage.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Also, do you know if there's an easy way to tell if a sifive clint is a v0 or v2?
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
sifive,clint2 introduces additional MMIO registers
Is that the high resolution timers (HRT) mentionned in the description?
And last question, would you happen to know if sifive made a clint v1 that does NOT require the mtime kick but does have the HRT?
Yes, that's correct.
Ok.
Thanks,
Charles
Quoted 8 lines
Quoted 8 lines
I'm trying to figure out what should be the compatible for PIC64-HPSC. Some code from a repository called "FSFM" used "sifive,clint1" for the compatible. I'm wondering if I should add the clint v1 to this file.
Thanks,
Charles