Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'timers-clocksource-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull clocksource updates from Thomas Gleixner:
"Updates for clocksource/clockevent drivers:

- The final conversion of text formatted device tree binding to
schemas

- A new driver fot the System Timer Module on S32G NXP SoCs

- A new driver fot the Econet HPT timer

- The usual improvements and device tree binding updates"

* tag 'timers-clocksource-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (31 commits)
clocksource/drivers/renesas-ostm: Unconditionally enable reprobe support
dt-bindings: timer: renesas,ostm: Document RZ/V2N (R9A09G056) support
dt-bindings: timer: Convert marvell,armada-370-timer to DT schema
dt-bindings: timer: Convert ti,keystone-timer to DT schema
dt-bindings: timer: Convert st,spear-timer to DT schema
dt-bindings: timer: Convert socionext,milbeaut-timer to DT schema
dt-bindings: timer: Convert snps,arc-timer to DT schema
dt-bindings: timer: Convert snps,archs-rtc to DT schema
dt-bindings: timer: Convert snps,archs-gfrc to DT schema
dt-bindings: timer: Convert lsi,zevio-timer to DT schema
dt-bindings: timer: Convert jcore,pit to DT schema
dt-bindings: timer: Convert img,pistachio-gptimer to DT schema
dt-bindings: timer: Convert ezchip,nps400-timer to DT schema
dt-bindings: timer: Convert cirrus,clps711x-timer to DT schema
dt-bindings: timer: Convert altr,timer-1.0 to DT schema
dt-bindings: timer: Add ESWIN EIC7700 CLINT
clocksource/drivers: Add EcoNet Timer HPT driver
dt-bindings: timer: Add EcoNet EN751221 "HPT" CPU Timer
dt-bindings: timer: Convert arm,mps2-timer to DT schema
dt-bindings: timer: Add Sophgo SG2044 ACLINT timer
...

+1886 -549
-18
Documentation/devicetree/bindings/timer/altr,timer-1.0.txt
··· 1 - Altera Timer 2 - 3 - Required properties: 4 - 5 - - compatible : should be "altr,timer-1.0" 6 - - reg : Specifies base physical address and size of the registers. 7 - - interrupts : Should contain the timer interrupt number 8 - - clock-frequency : The frequency of the clock that drives the counter, in Hz. 9 - 10 - Example: 11 - 12 - timer { 13 - compatible = "altr,timer-1.0"; 14 - reg = <0x00400000 0x00000020>; 15 - interrupt-parent = <&cpu>; 16 - interrupts = <11>; 17 - clock-frequency = <125000000>; 18 - };
+39
Documentation/devicetree/bindings/timer/altr,timer-1.0.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/altr,timer-1.0.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Altera Timer 8 + 9 + maintainers: 10 + - Dinh Nguyen <dinguyen@kernel.org> 11 + 12 + properties: 13 + compatible: 14 + const: altr,timer-1.0 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + interrupts: 20 + maxItems: 1 21 + 22 + clock-frequency: 23 + description: Frequency of the clock that drives the counter, in Hz. 24 + 25 + required: 26 + - compatible 27 + - reg 28 + - interrupts 29 + 30 + additionalProperties: false 31 + 32 + examples: 33 + - | 34 + timer@400000 { 35 + compatible = "altr,timer-1.0"; 36 + reg = <0x00400000 0x00000020>; 37 + interrupts = <11>; 38 + clock-frequency = <125000000>; 39 + };
-28
Documentation/devicetree/bindings/timer/arm,mps2-timer.txt
··· 1 - ARM MPS2 timer 2 - 3 - The MPS2 platform has simple general-purpose 32 bits timers. 4 - 5 - Required properties: 6 - - compatible : Should be "arm,mps2-timer" 7 - - reg : Address and length of the register set 8 - - interrupts : Reference to the timer interrupt 9 - 10 - Required clocking property, have to be one of: 11 - - clocks : The input clock of the timer 12 - - clock-frequency : The rate in HZ in input of the ARM MPS2 timer 13 - 14 - Examples: 15 - 16 - timer1: mps2-timer@40000000 { 17 - compatible = "arm,mps2-timer"; 18 - reg = <0x40000000 0x1000>; 19 - interrupts = <8>; 20 - clocks = <&sysclk>; 21 - }; 22 - 23 - timer2: mps2-timer@40001000 { 24 - compatible = "arm,mps2-timer"; 25 - reg = <0x40001000 0x1000>; 26 - interrupts = <9>; 27 - clock-frequency = <25000000>; 28 - };
+49
Documentation/devicetree/bindings/timer/arm,mps2-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/arm,mps2-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: ARM MPS2 timer 8 + 9 + maintainers: 10 + - Vladimir Murzin <vladimir.murzin@arm.com> 11 + 12 + description: 13 + The MPS2 platform has simple general-purpose 32 bits timers. 14 + 15 + properties: 16 + compatible: 17 + const: arm,mps2-timer 18 + 19 + reg: 20 + maxItems: 1 21 + 22 + interrupts: 23 + maxItems: 1 24 + 25 + clocks: 26 + maxItems: 1 27 + 28 + clock-frequency: 29 + description: Rate in Hz of the timer input clock 30 + 31 + oneOf: 32 + - required: [clocks] 33 + - required: [clock-frequency] 34 + 35 + required: 36 + - compatible 37 + - reg 38 + - interrupts 39 + 40 + additionalProperties: false 41 + 42 + examples: 43 + - | 44 + timer@40000000 { 45 + compatible = "arm,mps2-timer"; 46 + reg = <0x40000000 0x1000>; 47 + interrupts = <8>; 48 + clocks = <&sysclk>; 49 + };
-29
Documentation/devicetree/bindings/timer/cirrus,clps711x-timer.txt
··· 1 - * Cirrus Logic CLPS711X Timer Counter 2 - 3 - Required properties: 4 - - compatible: Shall contain "cirrus,ep7209-timer". 5 - - reg : Address and length of the register set. 6 - - interrupts: The interrupt number of the timer. 7 - - clocks : phandle of timer reference clock. 8 - 9 - Note: Each timer should have an alias correctly numbered in "aliases" node. 10 - 11 - Example: 12 - aliases { 13 - timer0 = &timer1; 14 - timer1 = &timer2; 15 - }; 16 - 17 - timer1: timer@80000300 { 18 - compatible = "cirrus,ep7312-timer", "cirrus,ep7209-timer"; 19 - reg = <0x80000300 0x4>; 20 - interrupts = <8>; 21 - clocks = <&clks 5>; 22 - }; 23 - 24 - timer2: timer@80000340 { 25 - compatible = "cirrus,ep7312-timer", "cirrus,ep7209-timer"; 26 - reg = <0x80000340 0x4>; 27 - interrupts = <9>; 28 - clocks = <&clks 6>; 29 - };
+45
Documentation/devicetree/bindings/timer/cirrus,clps711x-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/cirrus,clps711x-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Cirrus Logic CLPS711X Timer Counter 8 + 9 + maintainers: 10 + - Alexander Shiyan <shc_work@mail.ru> 11 + 12 + properties: 13 + compatible: 14 + oneOf: 15 + - items: 16 + - enum: 17 + - cirrus,ep7312-timer 18 + - const: cirrus,ep7209-timer 19 + - const: cirrus,ep7209-timer 20 + 21 + reg: 22 + maxItems: 1 23 + 24 + clocks: 25 + maxItems: 1 26 + 27 + interrupts: 28 + maxItems: 1 29 + 30 + required: 31 + - compatible 32 + - reg 33 + - clocks 34 + - interrupts 35 + 36 + additionalProperties: false 37 + 38 + examples: 39 + - | 40 + timer@80000300 { 41 + compatible = "cirrus,ep7312-timer", "cirrus,ep7209-timer"; 42 + reg = <0x80000300 0x4>; 43 + interrupts = <8>; 44 + clocks = <&clks 5>; 45 + };
+49
Documentation/devicetree/bindings/timer/cnxt,cx92755-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/cnxt,cx92755-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Conexant Digicolor SoCs Timer Controller 8 + 9 + maintainers: 10 + - Baruch Siach <baruch@tkos.co.il> 11 + 12 + properties: 13 + compatible: 14 + const: cnxt,cx92755-timer 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + interrupts: 20 + description: Contains 8 interrupts, one for each timer 21 + items: 22 + - description: interrupt for timer 0 23 + - description: interrupt for timer 1 24 + - description: interrupt for timer 2 25 + - description: interrupt for timer 3 26 + - description: interrupt for timer 4 27 + - description: interrupt for timer 5 28 + - description: interrupt for timer 6 29 + - description: interrupt for timer 7 30 + 31 + clocks: 32 + maxItems: 1 33 + 34 + required: 35 + - compatible 36 + - reg 37 + - interrupts 38 + - clocks 39 + 40 + additionalProperties: false 41 + 42 + examples: 43 + - | 44 + timer@f0000fc0 { 45 + compatible = "cnxt,cx92755-timer"; 46 + reg = <0xf0000fc0 0x40>; 47 + interrupts = <19>, <31>, <34>, <35>, <52>, <53>, <54>, <55>; 48 + clocks = <&main_clk>; 49 + };
-42
Documentation/devicetree/bindings/timer/csky,gx6605s-timer.txt
··· 1 - ================= 2 - gx6605s SOC Timer 3 - ================= 4 - 5 - The timer is used in gx6605s soc as system timer and the driver 6 - contain clk event and clk source. 7 - 8 - ============================== 9 - timer node bindings definition 10 - ============================== 11 - 12 - Description: Describes gx6605s SOC timer 13 - 14 - PROPERTIES 15 - 16 - - compatible 17 - Usage: required 18 - Value type: <string> 19 - Definition: must be "csky,gx6605s-timer" 20 - - reg 21 - Usage: required 22 - Value type: <u32 u32> 23 - Definition: <phyaddr size> in soc from cpu view 24 - - clocks 25 - Usage: required 26 - Value type: phandle + clock specifier cells 27 - Definition: must be input clk node 28 - - interrupt 29 - Usage: required 30 - Value type: <u32> 31 - Definition: must be timer irq num defined by soc 32 - 33 - Examples: 34 - --------- 35 - 36 - timer0: timer@20a000 { 37 - compatible = "csky,gx6605s-timer"; 38 - reg = <0x0020a000 0x400>; 39 - clocks = <&dummy_apb_clk>; 40 - interrupts = <10>; 41 - interrupt-parent = <&intc>; 42 - };
+40
Documentation/devicetree/bindings/timer/csky,gx6605s-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/csky,gx6605s-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: gx6605s SOC Timer 8 + 9 + maintainers: 10 + - Guo Ren <guoren@kernel.org> 11 + 12 + properties: 13 + compatible: 14 + const: csky,gx6605s-timer 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + clocks: 20 + maxItems: 1 21 + 22 + interrupts: 23 + maxItems: 1 24 + 25 + required: 26 + - compatible 27 + - reg 28 + - clocks 29 + - interrupts 30 + 31 + additionalProperties: false 32 + 33 + examples: 34 + - | 35 + timer@20a000 { 36 + compatible = "csky,gx6605s-timer"; 37 + reg = <0x0020a000 0x400>; 38 + clocks = <&dummy_apb_clk>; 39 + interrupts = <10>; 40 + };
-42
Documentation/devicetree/bindings/timer/csky,mptimer.txt
··· 1 - ============================ 2 - C-SKY Multi-processors Timer 3 - ============================ 4 - 5 - C-SKY multi-processors timer is designed for C-SKY SMP system and the 6 - regs is accessed by cpu co-processor 4 registers with mtcr/mfcr. 7 - 8 - - PTIM_CTLR "cr<0, 14>" Control reg to start reset timer. 9 - - PTIM_TSR "cr<1, 14>" Interrupt cleanup status reg. 10 - - PTIM_CCVR "cr<3, 14>" Current counter value reg. 11 - - PTIM_LVR "cr<6, 14>" Window value reg to trigger next event. 12 - 13 - ============================== 14 - timer node bindings definition 15 - ============================== 16 - 17 - Description: Describes SMP timer 18 - 19 - PROPERTIES 20 - 21 - - compatible 22 - Usage: required 23 - Value type: <string> 24 - Definition: must be "csky,mptimer" 25 - - clocks 26 - Usage: required 27 - Value type: <node> 28 - Definition: must be input clk node 29 - - interrupts 30 - Usage: required 31 - Value type: <u32> 32 - Definition: must be timer irq num defined by soc 33 - 34 - Examples: 35 - --------- 36 - 37 - timer: timer { 38 - compatible = "csky,mptimer"; 39 - clocks = <&dummy_apb_clk>; 40 - interrupts = <16>; 41 - interrupt-parent = <&intc>; 42 - };
+46
Documentation/devicetree/bindings/timer/csky,mptimer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/csky,mptimer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: C-SKY Multi-processors Timer 8 + 9 + maintainers: 10 + - Flavio Suligoi <f.suligoi@asem.it> 11 + - Guo Ren <guoren@kernel.org> 12 + 13 + description: | 14 + C-SKY multi-processors timer is designed for C-SKY SMP system and the regs are 15 + accessed by cpu co-processor 4 registers with mtcr/mfcr. 16 + 17 + - PTIM_CTLR "cr<0, 14>" Control reg to start reset timer. 18 + - PTIM_TSR "cr<1, 14>" Interrupt cleanup status reg. 19 + - PTIM_CCVR "cr<3, 14>" Current counter value reg. 20 + - PTIM_LVR "cr<6, 14>" Window value reg to trigger next event. 21 + 22 + properties: 23 + compatible: 24 + items: 25 + - const: csky,mptimer 26 + 27 + clocks: 28 + maxItems: 1 29 + 30 + interrupts: 31 + maxItems: 1 32 + 33 + required: 34 + - compatible 35 + - clocks 36 + - interrupts 37 + 38 + additionalProperties: false 39 + 40 + examples: 41 + - | 42 + timer { 43 + compatible = "csky,mptimer"; 44 + clocks = <&dummy_apb_clk>; 45 + interrupts = <16>; 46 + };
-18
Documentation/devicetree/bindings/timer/digicolor-timer.txt
··· 1 - Conexant Digicolor SoCs Timer Controller 2 - 3 - Required properties: 4 - 5 - - compatible : should be "cnxt,cx92755-timer" 6 - - reg : Specifies base physical address and size of the "Agent Communication" 7 - timer registers 8 - - interrupts : Contains 8 interrupts, one for each timer 9 - - clocks: phandle to the main clock 10 - 11 - Example: 12 - 13 - timer@f0000fc0 { 14 - compatible = "cnxt,cx92755-timer"; 15 - reg = <0xf0000fc0 0x40>; 16 - interrupts = <19>, <31>, <34>, <35>, <52>, <53>, <54>, <55>; 17 - clocks = <&main_clk>; 18 - };
+80
Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/econet,en751221-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: EcoNet EN751221 High Precision Timer (HPT) 8 + 9 + maintainers: 10 + - Caleb James DeLisle <cjd@cjdns.fr> 11 + 12 + description: 13 + The EcoNet High Precision Timer (HPT) is a timer peripheral found in various 14 + EcoNet SoCs, including the EN751221 and EN751627 families. It provides per-VPE 15 + count/compare registers and a per-CPU control register, with a single interrupt 16 + line using a percpu-devid interrupt mechanism. 17 + 18 + properties: 19 + compatible: 20 + oneOf: 21 + - const: econet,en751221-timer 22 + - items: 23 + - const: econet,en751627-timer 24 + - const: econet,en751221-timer 25 + 26 + reg: 27 + minItems: 1 28 + maxItems: 2 29 + 30 + interrupts: 31 + maxItems: 1 32 + description: A percpu-devid timer interrupt shared across CPUs. 33 + 34 + clocks: 35 + maxItems: 1 36 + 37 + required: 38 + - compatible 39 + - reg 40 + - interrupts 41 + - clocks 42 + 43 + allOf: 44 + - if: 45 + properties: 46 + compatible: 47 + contains: 48 + const: econet,en751627-timer 49 + then: 50 + properties: 51 + reg: 52 + items: 53 + - description: VPE timers 0 and 1 54 + - description: VPE timers 2 and 3 55 + else: 56 + properties: 57 + reg: 58 + items: 59 + - description: VPE timers 0 and 1 60 + 61 + additionalProperties: false 62 + 63 + examples: 64 + - | 65 + timer@1fbf0400 { 66 + compatible = "econet,en751627-timer", "econet,en751221-timer"; 67 + reg = <0x1fbf0400 0x100>, <0x1fbe0000 0x100>; 68 + interrupt-parent = <&intc>; 69 + interrupts = <30>; 70 + clocks = <&hpt_clock>; 71 + }; 72 + - | 73 + timer@1fbf0400 { 74 + compatible = "econet,en751221-timer"; 75 + reg = <0x1fbe0400 0x100>; 76 + interrupt-parent = <&intc>; 77 + interrupts = <30>; 78 + clocks = <&hpt_clock>; 79 + }; 80 + ...
+45
Documentation/devicetree/bindings/timer/ezchip,nps400-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/ezchip,nps400-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: EZChip NPS400 Timers 8 + 9 + maintainers: 10 + - Noam Camus <noamca@mellanox.com> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - ezchip,nps400-timer0 16 + - ezchip,nps400-timer1 17 + 18 + interrupts: 19 + maxItems: 1 20 + 21 + clocks: 22 + maxItems: 1 23 + 24 + required: 25 + - compatible 26 + - clocks 27 + 28 + additionalProperties: false 29 + 30 + allOf: 31 + - if: 32 + properties: 33 + compatible: 34 + contains: 35 + const: ezchip,nps400-timer0 36 + then: 37 + required: [ interrupts ] 38 + 39 + examples: 40 + - | 41 + timer { 42 + compatible = "ezchip,nps400-timer0"; 43 + interrupts = <3>; 44 + clocks = <&sysclk>; 45 + };
-17
Documentation/devicetree/bindings/timer/ezchip,nps400-timer0.txt
··· 1 - NPS Network Processor 2 - 3 - Required properties: 4 - 5 - - compatible : should be "ezchip,nps400-timer0" 6 - 7 - Clocks required for compatible = "ezchip,nps400-timer0": 8 - - interrupts : The interrupt of the first timer 9 - - clocks : Must contain a single entry describing the clock input 10 - 11 - Example: 12 - 13 - timer { 14 - compatible = "ezchip,nps400-timer0"; 15 - interrupts = <3>; 16 - clocks = <&sysclk>; 17 - };
-15
Documentation/devicetree/bindings/timer/ezchip,nps400-timer1.txt
··· 1 - NPS Network Processor 2 - 3 - Required properties: 4 - 5 - - compatible : should be "ezchip,nps400-timer1" 6 - 7 - Clocks required for compatible = "ezchip,nps400-timer1": 8 - - clocks : Must contain a single entry describing the clock input 9 - 10 - Example: 11 - 12 - timer { 13 - compatible = "ezchip,nps400-timer1"; 14 - clocks = <&sysclk>; 15 - };
-30
Documentation/devicetree/bindings/timer/fsl,gtm.txt
··· 1 - * Freescale General-purpose Timers Module 2 - 3 - Required properties: 4 - - compatible : should be 5 - "fsl,<chip>-gtm", "fsl,gtm" for SOC GTMs 6 - "fsl,<chip>-qe-gtm", "fsl,qe-gtm", "fsl,gtm" for QE GTMs 7 - "fsl,<chip>-cpm2-gtm", "fsl,cpm2-gtm", "fsl,gtm" for CPM2 GTMs 8 - - reg : should contain gtm registers location and length (0x40). 9 - - interrupts : should contain four interrupts. 10 - - clock-frequency : specifies the frequency driving the timer. 11 - 12 - Example: 13 - 14 - timer@500 { 15 - compatible = "fsl,mpc8360-gtm", "fsl,gtm"; 16 - reg = <0x500 0x40>; 17 - interrupts = <90 8 78 8 84 8 72 8>; 18 - interrupt-parent = <&ipic>; 19 - /* filled by u-boot */ 20 - clock-frequency = <0>; 21 - }; 22 - 23 - timer@440 { 24 - compatible = "fsl,mpc8360-qe-gtm", "fsl,qe-gtm", "fsl,gtm"; 25 - reg = <0x440 0x40>; 26 - interrupts = <12 13 14 15>; 27 - interrupt-parent = <&qeic>; 28 - /* filled by u-boot */ 29 - clock-frequency = <0>; 30 - };
+83
Documentation/devicetree/bindings/timer/fsl,gtm.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/fsl,gtm.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Freescale General-purpose Timers Module 8 + 9 + maintainers: 10 + - J. Neuschäfer <j.ne@posteo.net> 11 + 12 + properties: 13 + compatible: 14 + oneOf: 15 + # for SoC GTMs 16 + - items: 17 + - enum: 18 + - fsl,mpc8308-gtm 19 + - fsl,mpc8313-gtm 20 + - fsl,mpc8315-gtm 21 + - fsl,mpc8360-gtm 22 + - const: fsl,gtm 23 + 24 + # for QE GTMs 25 + - items: 26 + - enum: 27 + - fsl,mpc8360-qe-gtm 28 + - fsl,mpc8569-qe-gtm 29 + - const: fsl,qe-gtm 30 + - const: fsl,gtm 31 + 32 + # for CPM2 GTMs (no known examples) 33 + - items: 34 + # - enum: 35 + # - fsl,<chip>-cpm2-gtm 36 + - const: fsl,cpm2-gtm 37 + - const: fsl,gtm 38 + 39 + reg: 40 + maxItems: 1 41 + 42 + interrupts: 43 + items: 44 + - description: Interrupt for timer 1 (e.g. GTM1 or GTM5) 45 + - description: Interrupt for timer 2 (e.g. GTM2 or GTM6) 46 + - description: Interrupt for timer 3 (e.g. GTM3 or GTM7) 47 + - description: Interrupt for timer 4 (e.g. GTM4 or GTM8) 48 + 49 + clock-frequency: true 50 + 51 + required: 52 + - compatible 53 + - reg 54 + - interrupts 55 + - clock-frequency 56 + 57 + additionalProperties: false 58 + 59 + examples: 60 + - | 61 + #include <dt-bindings/interrupt-controller/irq.h> 62 + 63 + timer@500 { 64 + compatible = "fsl,mpc8360-gtm", "fsl,gtm"; 65 + reg = <0x500 0x40>; 66 + interrupts = <90 IRQ_TYPE_LEVEL_LOW>, 67 + <78 IRQ_TYPE_LEVEL_LOW>, 68 + <84 IRQ_TYPE_LEVEL_LOW>, 69 + <72 IRQ_TYPE_LEVEL_LOW>; 70 + /* filled by u-boot */ 71 + clock-frequency = <0>; 72 + }; 73 + 74 + - | 75 + timer@440 { 76 + compatible = "fsl,mpc8360-qe-gtm", "fsl,qe-gtm", "fsl,gtm"; 77 + reg = <0x440 0x40>; 78 + interrupts = <12>, <13>, <14>, <15>; 79 + /* filled by u-boot */ 80 + clock-frequency = <0>; 81 + }; 82 + 83 + ...
-28
Documentation/devicetree/bindings/timer/img,pistachio-gptimer.txt
··· 1 - * Pistachio general-purpose timer based clocksource 2 - 3 - Required properties: 4 - - compatible: "img,pistachio-gptimer". 5 - - reg: Address range of the timer registers. 6 - - interrupts: An interrupt for each of the four timers 7 - - clocks: Should contain a clock specifier for each entry in clock-names 8 - - clock-names: Should contain the following entries: 9 - "sys", interface clock 10 - "slow", slow counter clock 11 - "fast", fast counter clock 12 - - img,cr-periph: Must contain a phandle to the peripheral control 13 - syscon node. 14 - 15 - Example: 16 - timer: timer@18102000 { 17 - compatible = "img,pistachio-gptimer"; 18 - reg = <0x18102000 0x100>; 19 - interrupts = <GIC_SHARED 60 IRQ_TYPE_LEVEL_HIGH>, 20 - <GIC_SHARED 61 IRQ_TYPE_LEVEL_HIGH>, 21 - <GIC_SHARED 62 IRQ_TYPE_LEVEL_HIGH>, 22 - <GIC_SHARED 63 IRQ_TYPE_LEVEL_HIGH>; 23 - clocks = <&clk_periph PERIPH_CLK_COUNTER_FAST>, 24 - <&clk_periph PERIPH_CLK_COUNTER_SLOW>, 25 - <&cr_periph SYS_CLK_TIMER>; 26 - clock-names = "fast", "slow", "sys"; 27 - img,cr-periph = <&cr_periph>; 28 - };
+69
Documentation/devicetree/bindings/timer/img,pistachio-gptimer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/img,pistachio-gptimer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Pistachio general-purpose timer 8 + 9 + maintainers: 10 + - Ezequiel Garcia <ezequiel.garcia@imgtec.com> 11 + 12 + properties: 13 + compatible: 14 + const: img,pistachio-gptimer 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + interrupts: 20 + items: 21 + - description: Timer0 interrupt 22 + - description: Timer1 interrupt 23 + - description: Timer2 interrupt 24 + - description: Timer3 interrupt 25 + 26 + clocks: 27 + items: 28 + - description: Fast counter clock 29 + - description: Slow counter clock 30 + - description: Interface clock 31 + 32 + clock-names: 33 + items: 34 + - const: fast 35 + - const: slow 36 + - const: sys 37 + 38 + img,cr-periph: 39 + description: Peripheral control syscon phandle 40 + $ref: /schemas/types.yaml#/definitions/phandle 41 + 42 + required: 43 + - compatible 44 + - reg 45 + - interrupts 46 + - clocks 47 + - clock-names 48 + - img,cr-periph 49 + 50 + additionalProperties: false 51 + 52 + examples: 53 + - | 54 + #include <dt-bindings/interrupt-controller/mips-gic.h> 55 + #include <dt-bindings/clock/pistachio-clk.h> 56 + 57 + timer@18102000 { 58 + compatible = "img,pistachio-gptimer"; 59 + reg = <0x18102000 0x100>; 60 + interrupts = <GIC_SHARED 60 IRQ_TYPE_LEVEL_HIGH>, 61 + <GIC_SHARED 61 IRQ_TYPE_LEVEL_HIGH>, 62 + <GIC_SHARED 62 IRQ_TYPE_LEVEL_HIGH>, 63 + <GIC_SHARED 63 IRQ_TYPE_LEVEL_HIGH>; 64 + clocks = <&clk_periph PERIPH_CLK_COUNTER_FAST>, 65 + <&clk_periph PERIPH_CLK_COUNTER_SLOW>, 66 + <&cr_periph SYS_CLK_TIMER>; 67 + clock-names = "fast", "slow", "sys"; 68 + img,cr-periph = <&cr_periph>; 69 + };
-24
Documentation/devicetree/bindings/timer/jcore,pit.txt
··· 1 - J-Core Programmable Interval Timer and Clocksource 2 - 3 - Required properties: 4 - 5 - - compatible: Must be "jcore,pit". 6 - 7 - - reg: Memory region(s) for timer/clocksource registers. For SMP, 8 - there should be one region per cpu, indexed by the sequential, 9 - zero-based hardware cpu number. 10 - 11 - - interrupts: An interrupt to assign for the timer. The actual pit 12 - core is integrated with the aic and allows the timer interrupt 13 - assignment to be programmed by software, but this property is 14 - required in order to reserve an interrupt number that doesn't 15 - conflict with other devices. 16 - 17 - 18 - Example: 19 - 20 - timer@200 { 21 - compatible = "jcore,pit"; 22 - reg = < 0x200 0x30 0x500 0x30 >; 23 - interrupts = < 0x48 >; 24 - };
+43
Documentation/devicetree/bindings/timer/jcore,pit.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/jcore,pit.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: J-Core Programmable Interval Timer and Clocksource 8 + 9 + maintainers: 10 + - Rich Felker <dalias@libc.org> 11 + 12 + properties: 13 + compatible: 14 + const: jcore,pit 15 + 16 + reg: 17 + description: 18 + Memory region(s) for timer/clocksource registers. For SMP, there should be 19 + one region per cpu, indexed by the sequential, zero-based hardware cpu 20 + number. 21 + 22 + interrupts: 23 + description: 24 + An interrupt to assign for the timer. The actual pit core is integrated 25 + with the aic and allows the timer interrupt assignment to be programmed by 26 + software, but this property is required in order to reserve an interrupt 27 + number that doesn't conflict with other devices. 28 + maxItems: 1 29 + 30 + required: 31 + - compatible 32 + - reg 33 + - interrupts 34 + 35 + additionalProperties: false 36 + 37 + examples: 38 + - | 39 + timer@200 { 40 + compatible = "jcore,pit"; 41 + reg = <0x200 0x30 0x500 0x30>; 42 + interrupts = <0x48>; 43 + };
-33
Documentation/devicetree/bindings/timer/lsi,zevio-timer.txt
··· 1 - TI-NSPIRE timer 2 - 3 - Required properties: 4 - 5 - - compatible : should be "lsi,zevio-timer". 6 - - reg : The physical base address and size of the timer (always first). 7 - - clocks: phandle to the source clock. 8 - 9 - Optional properties: 10 - 11 - - interrupts : The interrupt number of the first timer. 12 - - reg : The interrupt acknowledgement registers 13 - (always after timer base address) 14 - 15 - If any of the optional properties are not given, the timer is added as a 16 - clock-source only. 17 - 18 - Example: 19 - 20 - timer { 21 - compatible = "lsi,zevio-timer"; 22 - reg = <0x900D0000 0x1000>, <0x900A0020 0x8>; 23 - interrupts = <19>; 24 - clocks = <&timer_clk>; 25 - }; 26 - 27 - Example (no clock-events): 28 - 29 - timer { 30 - compatible = "lsi,zevio-timer"; 31 - reg = <0x900D0000 0x1000>; 32 - clocks = <&timer_clk>; 33 - };
+56
Documentation/devicetree/bindings/timer/lsi,zevio-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/lsi,zevio-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: TI-NSPIRE timer 8 + 9 + maintainers: 10 + - Daniel Tang <dt.tangr@gmail.com> 11 + 12 + properties: 13 + compatible: 14 + const: lsi,zevio-timer 15 + 16 + reg: 17 + minItems: 1 18 + items: 19 + - description: Timer registers 20 + - description: Interrupt acknowledgement registers (optional) 21 + 22 + interrupts: 23 + maxItems: 1 24 + 25 + clocks: 26 + maxItems: 1 27 + 28 + required: 29 + - compatible 30 + - reg 31 + - clocks 32 + 33 + allOf: 34 + - if: 35 + required: [ interrupts ] 36 + then: 37 + properties: 38 + reg: 39 + minItems: 2 40 + 41 + additionalProperties: false 42 + 43 + examples: 44 + - | 45 + timer@900d0000 { 46 + compatible = "lsi,zevio-timer"; 47 + reg = <0x900D0000 0x1000>, <0x900A0020 0x8>; 48 + interrupts = <19>; 49 + clocks = <&timer_clk>; 50 + }; 51 + - | 52 + timer@900d0000 { 53 + compatible = "lsi,zevio-timer"; 54 + reg = <0x900D0000 0x1000>; 55 + clocks = <&timer_clk>; 56 + };
+88
Documentation/devicetree/bindings/timer/marvell,armada-370-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/marvell,armada-370-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Marvell Armada 370, 375, 380 and XP Timers 8 + 9 + maintainers: 10 + - Andrew Lunn <andrew@lunn.ch> 11 + - Gregory Clement <gregory.clement@bootlin.com> 12 + 13 + properties: 14 + compatible: 15 + oneOf: 16 + - items: 17 + - const: marvell,armada-380-timer 18 + - const: marvell,armada-xp-timer 19 + - items: 20 + - const: marvell,armada-375-timer 21 + - const: marvell,armada-370-timer 22 + - enum: 23 + - marvell,armada-370-timer 24 + - marvell,armada-xp-timer 25 + 26 + reg: 27 + items: 28 + - description: Global timer registers 29 + - description: Local/private timer registers 30 + 31 + interrupts: 32 + items: 33 + - description: Global timer interrupt 0 34 + - description: Global timer interrupt 1 35 + - description: Global timer interrupt 2 36 + - description: Global timer interrupt 3 37 + - description: First private timer interrupt 38 + - description: Second private timer interrupt 39 + 40 + clocks: 41 + minItems: 1 42 + maxItems: 2 43 + 44 + clock-names: 45 + items: 46 + - const: nbclk 47 + - const: fixed 48 + 49 + required: 50 + - compatible 51 + - reg 52 + - interrupts 53 + - clocks 54 + 55 + additionalProperties: false 56 + 57 + allOf: 58 + - if: 59 + properties: 60 + compatible: 61 + contains: 62 + enum: 63 + - marvell,armada-375-timer 64 + - marvell,armada-xp-timer 65 + then: 66 + properties: 67 + clocks: 68 + minItems: 2 69 + clock-names: 70 + minItems: 2 71 + required: 72 + - clock-names 73 + else: 74 + properties: 75 + clocks: 76 + maxItems: 1 77 + clock-names: 78 + maxItems: 1 79 + 80 + examples: 81 + - | 82 + timer@20300 { 83 + compatible = "marvell,armada-xp-timer"; 84 + reg = <0x20300 0x30>, <0x21040 0x30>; 85 + interrupts = <37>, <38>, <39>, <40>, <5>, <6>; 86 + clocks = <&coreclk 2>, <&refclk>; 87 + clock-names = "nbclk", "fixed"; 88 + };
-44
Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt
··· 1 - Marvell Armada 370 and Armada XP Timers 2 - --------------------------------------- 3 - 4 - Required properties: 5 - - compatible: Should be one of the following 6 - "marvell,armada-370-timer", 7 - "marvell,armada-375-timer", 8 - "marvell,armada-xp-timer". 9 - - interrupts: Should contain the list of Global Timer interrupts and 10 - then local timer interrupts 11 - - reg: Should contain location and length for timers register. First 12 - pair for the Global Timer registers, second pair for the 13 - local/private timers. 14 - 15 - Clocks required for compatible = "marvell,armada-370-timer": 16 - - clocks : Must contain a single entry describing the clock input 17 - 18 - Clocks required for compatibles = "marvell,armada-xp-timer", 19 - "marvell,armada-375-timer": 20 - - clocks : Must contain an entry for each entry in clock-names. 21 - - clock-names : Must include the following entries: 22 - "nbclk" (L2/coherency fabric clock), 23 - "fixed" (Reference 25 MHz fixed-clock). 24 - 25 - Examples: 26 - 27 - - Armada 370: 28 - 29 - timer { 30 - compatible = "marvell,armada-370-timer"; 31 - reg = <0x20300 0x30>, <0x21040 0x30>; 32 - interrupts = <37>, <38>, <39>, <40>, <5>, <6>; 33 - clocks = <&coreclk 2>; 34 - }; 35 - 36 - - Armada XP: 37 - 38 - timer { 39 - compatible = "marvell,armada-xp-timer"; 40 - reg = <0x20300 0x30>, <0x21040 0x30>; 41 - interrupts = <37>, <38>, <39>, <40>, <5>, <6>; 42 - clocks = <&coreclk 2>, <&refclk>; 43 - clock-names = "nbclk", "fixed"; 44 - };
-16
Documentation/devicetree/bindings/timer/marvell,orion-timer.txt
··· 1 - Marvell Orion SoC timer 2 - 3 - Required properties: 4 - - compatible: shall be "marvell,orion-timer" 5 - - reg: base address of the timer register starting with TIMERS CONTROL register 6 - - interrupts: should contain the interrupts for Timer0 and Timer1 7 - - clocks: phandle of timer reference clock (tclk) 8 - 9 - Example: 10 - timer: timer { 11 - compatible = "marvell,orion-timer"; 12 - reg = <0x20300 0x20>; 13 - interrupt-parent = <&bridge_intc>; 14 - interrupts = <1>, <2>; 15 - clocks = <&core_clk 0>; 16 - };
+43
Documentation/devicetree/bindings/timer/marvell,orion-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/marvell,orion-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Marvell Orion SoC timer 8 + 9 + maintainers: 10 + - Andrew Lunn <andrew@lunn.ch> 11 + - Gregory Clement <gregory.clement@bootlin.com> 12 + 13 + properties: 14 + compatible: 15 + const: marvell,orion-timer 16 + 17 + reg: 18 + maxItems: 1 19 + 20 + clocks: 21 + maxItems: 1 22 + 23 + interrupts: 24 + items: 25 + - description: Timer0 interrupt 26 + - description: Timer1 interrupt 27 + 28 + required: 29 + - compatible 30 + - reg 31 + - interrupts 32 + - clocks 33 + 34 + additionalProperties: false 35 + 36 + examples: 37 + - | 38 + timer@20300 { 39 + compatible = "marvell,orion-timer"; 40 + reg = <0x20300 0x20>; 41 + interrupts = <1>, <2>; 42 + clocks = <&core_clk 0>; 43 + };
+64
Documentation/devicetree/bindings/timer/nxp,s32g2-stm.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/nxp,s32g2-stm.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: NXP System Timer Module (STM) 8 + 9 + maintainers: 10 + - Daniel Lezcano <daniel.lezcano@kernel.org> 11 + 12 + description: 13 + The System Timer Module supports commonly required system and application 14 + software timing functions. STM includes a 32-bit count-up timer and four 15 + 32-bit compare channels with a separate interrupt source for each channel. 16 + The timer is driven by the STM module clock divided by an 8-bit prescale 17 + value. 18 + 19 + properties: 20 + compatible: 21 + oneOf: 22 + - const: nxp,s32g2-stm 23 + - items: 24 + - const: nxp,s32g3-stm 25 + - const: nxp,s32g2-stm 26 + 27 + reg: 28 + maxItems: 1 29 + 30 + interrupts: 31 + maxItems: 1 32 + 33 + clocks: 34 + items: 35 + - description: Counter clock 36 + - description: Module clock 37 + - description: Register clock 38 + 39 + clock-names: 40 + items: 41 + - const: counter 42 + - const: module 43 + - const: register 44 + 45 + required: 46 + - compatible 47 + - reg 48 + - interrupts 49 + - clocks 50 + - clock-names 51 + 52 + additionalProperties: false 53 + 54 + examples: 55 + - | 56 + #include <dt-bindings/interrupt-controller/arm-gic.h> 57 + 58 + timer@4011c000 { 59 + compatible = "nxp,s32g2-stm"; 60 + reg = <0x4011c000 0x3000>; 61 + interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; 62 + clocks = <&clks 0x3b>, <&clks 0x3c>, <&clks 0x3c>; 63 + clock-names = "counter", "module", "register"; 64 + };
+6 -6
Documentation/devicetree/bindings/timer/renesas,ostm.yaml
··· 26 26 - renesas,r9a07g043-ostm # RZ/G2UL and RZ/Five 27 27 - renesas,r9a07g044-ostm # RZ/G2{L,LC} 28 28 - renesas,r9a07g054-ostm # RZ/V2L 29 + - renesas,r9a09g056-ostm # RZ/V2N 29 30 - renesas,r9a09g057-ostm # RZ/V2H(P) 30 31 - const: renesas,ostm # Generic 31 32 ··· 55 54 if: 56 55 properties: 57 56 compatible: 58 - contains: 59 - enum: 60 - - renesas,r9a07g043-ostm 61 - - renesas,r9a07g044-ostm 62 - - renesas,r9a07g054-ostm 63 - - renesas,r9a09g057-ostm 57 + not: 58 + contains: 59 + enum: 60 + - renesas,r7s72100-ostm 61 + - renesas,r7s9210-ostm 64 62 then: 65 63 required: 66 64 - resets
+1
Documentation/devicetree/bindings/timer/sifive,clint.yaml
··· 30 30 - items: 31 31 - enum: 32 32 - canaan,k210-clint # Canaan Kendryte K210 33 + - eswin,eic7700-clint # ESWIN EIC7700 33 34 - sifive,fu540-c000-clint # SiFive FU540 34 35 - spacemit,k1-clint # SpacemiT K1 35 36 - starfive,jh7100-clint # StarFive JH7100
-27
Documentation/devicetree/bindings/timer/snps,arc-timer.txt
··· 1 - Synopsys ARC Local Timer with Interrupt Capabilities 2 - - Found on all ARC CPUs (ARC700/ARCHS) 3 - - Can be optionally programmed to interrupt on Limit 4 - - Two identical copies TIMER0 and TIMER1 exist in ARC cores and historically 5 - TIMER0 used as clockevent provider (true for all ARC cores) 6 - TIMER1 used for clocksource (mandatory for ARC700, optional for ARC HS) 7 - 8 - Required properties: 9 - 10 - - compatible : should be "snps,arc-timer" 11 - - interrupts : single Interrupt going into parent intc 12 - (16 for ARCHS cores, 3 for ARC700 cores) 13 - - clocks : phandle to the source clock 14 - 15 - Example: 16 - 17 - timer0 { 18 - compatible = "snps,arc-timer"; 19 - interrupts = <3>; 20 - interrupt-parent = <&core_intc>; 21 - clocks = <&core_clk>; 22 - }; 23 - 24 - timer1 { 25 - compatible = "snps,arc-timer"; 26 - clocks = <&core_clk>; 27 - };
+45
Documentation/devicetree/bindings/timer/snps,arc-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/snps,arc-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Synopsys ARC Local Timer 8 + 9 + maintainers: 10 + - Vineet Gupta <vgupta@synopsys.com> 11 + 12 + description: > 13 + Synopsys ARC Local Timer with Interrupt Capabilities 14 + 15 + - Found on all ARC CPUs (ARC700/ARCHS) 16 + - Can be optionally programmed to interrupt on Limit 17 + - Two identical copies TIMER0 and TIMER1 exist in ARC cores and historically 18 + TIMER0 used as clockevent provider (true for all ARC cores) 19 + TIMER1 used for clocksource (mandatory for ARC700, optional for ARC HS) 20 + 21 + properties: 22 + compatible: 23 + const: snps,arc-timer 24 + 25 + interrupts: 26 + maxItems: 1 27 + description: A single timer interrupt going into the parent interrupt controller. 28 + Use <16> for ARCHS cores, <3> for ARC700 cores. 29 + 30 + clocks: 31 + maxItems: 1 32 + 33 + required: 34 + - compatible 35 + - clocks 36 + 37 + additionalProperties: false 38 + 39 + examples: 40 + - | 41 + timer0 { 42 + compatible = "snps,arc-timer"; 43 + interrupts = <3>; 44 + clocks = <&core_clk>; 45 + };
-14
Documentation/devicetree/bindings/timer/snps,archs-gfrc.txt
··· 1 - Synopsys ARC Free Running 64-bit Global Timer for ARC HS CPUs 2 - - clocksource provider for SMP SoC 3 - 4 - Required properties: 5 - 6 - - compatible : should be "snps,archs-gfrc" 7 - - clocks : phandle to the source clock 8 - 9 - Example: 10 - 11 - gfrc { 12 - compatible = "snps,archs-gfrc"; 13 - clocks = <&core_clk>; 14 - };
+30
Documentation/devicetree/bindings/timer/snps,archs-gfrc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/snps,archs-gfrc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Synopsys ARC Free Running 64-bit Global Timer for ARC HS CPUs 8 + 9 + maintainers: 10 + - Vineet Gupta <vgupta@synopsys.com> 11 + 12 + properties: 13 + compatible: 14 + const: snps,archs-gfrc 15 + 16 + clocks: 17 + maxItems: 1 18 + 19 + required: 20 + - compatible 21 + - clocks 22 + 23 + additionalProperties: false 24 + 25 + examples: 26 + - | 27 + timer { 28 + compatible = "snps,archs-gfrc"; 29 + clocks = <&core_clk>; 30 + };
-14
Documentation/devicetree/bindings/timer/snps,archs-rtc.txt
··· 1 - Synopsys ARC Free Running 64-bit Local Timer for ARC HS CPUs 2 - - clocksource provider for UP SoC 3 - 4 - Required properties: 5 - 6 - - compatible : should be "snps,archs-rtc" 7 - - clocks : phandle to the source clock 8 - 9 - Example: 10 - 11 - rtc { 12 - compatible = "snps,arc-rtc"; 13 - clocks = <&core_clk>; 14 - };
+30
Documentation/devicetree/bindings/timer/snps,archs-rtc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/snps,archs-rtc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Synopsys ARC Free Running 64-bit Local Timer for ARC HS CPUs 8 + 9 + maintainers: 10 + - Vineet Gupta <vgupta@synopsys.com> 11 + 12 + properties: 13 + compatible: 14 + const: snps,archs-rtc 15 + 16 + clocks: 17 + maxItems: 1 18 + 19 + required: 20 + - compatible 21 + - clocks 22 + 23 + additionalProperties: false 24 + 25 + examples: 26 + - | 27 + rtc { 28 + compatible = "snps,archs-rtc"; 29 + clocks = <&core_clk>; 30 + };
-17
Documentation/devicetree/bindings/timer/socionext,milbeaut-timer.txt
··· 1 - Milbeaut SoCs Timer Controller 2 - 3 - Required properties: 4 - 5 - - compatible : should be "socionext,milbeaut-timer". 6 - - reg : Specifies base physical address and size of the registers. 7 - - interrupts : The interrupt of the first timer. 8 - - clocks: phandle to the input clk. 9 - 10 - Example: 11 - 12 - timer { 13 - compatible = "socionext,milbeaut-timer"; 14 - reg = <0x1e000050 0x20> 15 - interrupts = <0 91 4>; 16 - clocks = <&clk 4>; 17 - };
+40
Documentation/devicetree/bindings/timer/socionext,milbeaut-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/socionext,milbeaut-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Milbeaut SoCs Timer Controller 8 + 9 + maintainers: 10 + - Sugaya Taichi <sugaya.taichi@socionext.com> 11 + 12 + properties: 13 + compatible: 14 + const: socionext,milbeaut-timer 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + interrupts: 20 + maxItems: 1 21 + 22 + clocks: 23 + maxItems: 1 24 + 25 + required: 26 + - compatible 27 + - reg 28 + - interrupts 29 + - clocks 30 + 31 + additionalProperties: false 32 + 33 + examples: 34 + - | 35 + timer@1e000050 { 36 + compatible = "socionext,milbeaut-timer"; 37 + reg = <0x1e000050 0x20>; 38 + interrupts = <0 91 4>; 39 + clocks = <&clk 4>; 40 + };
-16
Documentation/devicetree/bindings/timer/st,spear-timer.txt
··· 1 - * SPEAr ARM Timer 2 - 3 - ** Timer node required properties: 4 - 5 - - compatible : Should be: 6 - "st,spear-timer" 7 - - reg: Address range of the timer registers 8 - - interrupt: Should contain the timer interrupt number 9 - 10 - Example: 11 - 12 - timer@f0000000 { 13 - compatible = "st,spear-timer"; 14 - reg = <0xf0000000 0x400>; 15 - interrupts = <2>; 16 - };
+36
Documentation/devicetree/bindings/timer/st,spear-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/timer/st,spear-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: SPEAr ARM Timer 8 + 9 + maintainers: 10 + - Viresh Kumar <vireshk@kernel.org> 11 + - Shiraz Hashim <shiraz.linux.kernel@gmail.com> 12 + 13 + properties: 14 + compatible: 15 + const: st,spear-timer 16 + 17 + reg: 18 + maxItems: 1 19 + 20 + interrupts: 21 + maxItems: 1 22 + 23 + required: 24 + - compatible 25 + - reg 26 + - interrupts 27 + 28 + additionalProperties: false 29 + 30 + examples: 31 + - | 32 + timer@f0000000 { 33 + compatible = "st,spear-timer"; 34 + reg = <0xf0000000 0x400>; 35 + interrupts = <2>; 36 + };
+1
Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml
··· 14 14 items: 15 15 - enum: 16 16 - sophgo,sg2042-aclint-mtimer 17 + - sophgo,sg2044-aclint-mtimer 17 18 - const: thead,c900-aclint-mtimer 18 19 19 20 reg:
-29
Documentation/devicetree/bindings/timer/ti,keystone-timer.txt
··· 1 - * Device tree bindings for Texas instruments Keystone timer 2 - 3 - This document provides bindings for the 64-bit timer in the KeyStone 4 - architecture devices. The timer can be configured as a general-purpose 64-bit 5 - timer, dual general-purpose 32-bit timers. When configured as dual 32-bit 6 - timers, each half can operate in conjunction (chain mode) or independently 7 - (unchained mode) of each other. 8 - 9 - It is global timer is a free running up-counter and can generate interrupt 10 - when the counter reaches preset counter values. 11 - 12 - Documentation: 13 - https://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdf 14 - 15 - Required properties: 16 - 17 - - compatible : should be "ti,keystone-timer". 18 - - reg : specifies base physical address and count of the registers. 19 - - interrupts : interrupt generated by the timer. 20 - - clocks : the clock feeding the timer clock. 21 - 22 - Example: 23 - 24 - timer@22f0000 { 25 - compatible = "ti,keystone-timer"; 26 - reg = <0x022f0000 0x80>; 27 - interrupts = <GIC_SPI 110 IRQ_TYPE_EDGE_RISING>; 28 - clocks = <&clktimer15>; 29 - };
+63
Documentation/devicetree/bindings/timer/ti,keystone-timer.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/ti,keystone-timer.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: TI Keystone timer 8 + 9 + maintainers: 10 + - Alexander A. Klimov <grandmaster@al2klimov.de> 11 + - Ivan Khoronzhuk <ivan.khoronzhuk@ti.com> 12 + 13 + description: > 14 + A 64-bit timer in the KeyStone architecture devices. The timer can be 15 + configured as a general-purpose 64-bit timer, dual general-purpose 32-bit 16 + timers. When configured as dual 32-bit timers, each half can operate in 17 + conjunction (chain mode) or independently (unchained mode) of each other. 18 + 19 + It is global timer is a free running up-counter and can generate interrupt 20 + when the counter reaches preset counter values. 21 + 22 + Documentation: 23 + https://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdf 24 + 25 + properties: 26 + compatible: 27 + const: ti,keystone-timer 28 + 29 + reg: 30 + maxItems: 1 31 + 32 + interrupts: 33 + maxItems: 1 34 + 35 + interrupt-names: 36 + items: 37 + - const: irq 38 + 39 + clocks: 40 + maxItems: 1 41 + 42 + clock-names: 43 + items: 44 + - const: timer 45 + 46 + required: 47 + - compatible 48 + - reg 49 + - interrupts 50 + - clocks 51 + 52 + additionalProperties: false 53 + 54 + examples: 55 + - | 56 + #include <dt-bindings/interrupt-controller/irq.h> 57 + 58 + timer@22f0000 { 59 + compatible = "ti,keystone-timer"; 60 + reg = <0x022f0000 0x80>; 61 + interrupts = <110 IRQ_TYPE_EDGE_RISING>; 62 + clocks = <&clktimer15>; 63 + };
+18 -2
drivers/clocksource/Kconfig
··· 73 73 select DW_APB_TIMER 74 74 select TIMER_OF 75 75 76 + config ECONET_EN751221_TIMER 77 + bool "EcoNet EN751221 High Precision Timer" if COMPILE_TEST 78 + depends on HAS_IOMEM 79 + select CLKSRC_MMIO 80 + select TIMER_OF 81 + help 82 + Support for CPU timer found on EcoNet MIPS based SoCs. 83 + 76 84 config FTTMR010_TIMER 77 85 bool "Faraday Technology timer driver" if COMPILE_TEST 78 86 depends on HAS_IOMEM ··· 445 437 446 438 config ATMEL_TCB_CLKSRC 447 439 bool "Atmel TC Block timer driver" if COMPILE_TEST 448 - depends on ARM && HAS_IOMEM 449 - select TIMER_OF if OF 440 + depends on ARM && OF && HAS_IOMEM 441 + select TIMER_OF 450 442 help 451 443 Support for Timer Counter Blocks on Atmel SoCs. 452 444 ··· 770 762 help 771 763 Enables support for system tick counter present on 772 764 Ralink SoCs RT3352 and MT7620. 765 + 766 + config NXP_STM_TIMER 767 + bool "NXP System Timer Module driver" 768 + depends on ARCH_S32 || COMPILE_TEST 769 + select CLKSRC_MMIO 770 + help 771 + Enables the support for NXP System Timer Module found in the 772 + s32g NXP platform series. 773 773 774 774 endmenu
+2
drivers/clocksource/Makefile
··· 17 17 obj-$(CONFIG_CLKSRC_MMIO) += mmio.o 18 18 obj-$(CONFIG_DAVINCI_TIMER) += timer-davinci.o 19 19 obj-$(CONFIG_DIGICOLOR_TIMER) += timer-digicolor.o 20 + obj-$(CONFIG_ECONET_EN751221_TIMER) += timer-econet-en751221.o 20 21 obj-$(CONFIG_OMAP_DM_TIMER) += timer-ti-dm.o 21 22 obj-$(CONFIG_OMAP_DM_SYSTIMER) += timer-ti-dm-systimer.o 22 23 obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o ··· 93 92 obj-$(CONFIG_CLKSRC_LOONGSON1_PWM) += timer-loongson1-pwm.o 94 93 obj-$(CONFIG_EP93XX_TIMER) += timer-ep93xx.o 95 94 obj-$(CONFIG_RALINK_TIMER) += timer-ralink.o 95 + obj-$(CONFIG_NXP_STM_TIMER) += timer-nxp-stm.o
+1 -3
drivers/clocksource/renesas-ostm.c
··· 225 225 226 226 TIMER_OF_DECLARE(ostm, "renesas,ostm", ostm_init); 227 227 228 - #if defined(CONFIG_ARCH_RZG2L) || defined(CONFIG_ARCH_R9A09G057) 229 228 static int __init ostm_probe(struct platform_device *pdev) 230 229 { 231 230 struct device *dev = &pdev->dev; ··· 232 233 return ostm_init(dev->of_node); 233 234 } 234 235 235 - static const struct of_device_id ostm_of_table[] = { 236 + static const struct of_device_id __maybe_unused ostm_of_table[] = { 236 237 { .compatible = "renesas,ostm", }, 237 238 { /* sentinel */ } 238 239 }; ··· 245 246 }, 246 247 }; 247 248 builtin_platform_driver_probe(ostm_device_driver, ostm_probe); 248 - #endif
+216
drivers/clocksource/timer-econet-en751221.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Timer present on EcoNet EN75xx MIPS based SoCs. 4 + * 5 + * Copyright (C) 2025 by Caleb James DeLisle <cjd@cjdns.fr> 6 + */ 7 + 8 + #include <linux/io.h> 9 + #include <linux/cpumask.h> 10 + #include <linux/interrupt.h> 11 + #include <linux/clockchips.h> 12 + #include <linux/sched_clock.h> 13 + #include <linux/of.h> 14 + #include <linux/of_irq.h> 15 + #include <linux/of_address.h> 16 + #include <linux/cpuhotplug.h> 17 + #include <linux/clk.h> 18 + 19 + #define ECONET_BITS 32 20 + #define ECONET_MIN_DELTA 0x00001000 21 + #define ECONET_MAX_DELTA GENMASK(ECONET_BITS - 2, 0) 22 + /* 34Kc hardware has 1 block and 1004Kc has 2. */ 23 + #define ECONET_NUM_BLOCKS DIV_ROUND_UP(NR_CPUS, 2) 24 + 25 + static struct { 26 + void __iomem *membase[ECONET_NUM_BLOCKS]; 27 + u32 freq_hz; 28 + } econet_timer __ro_after_init; 29 + 30 + static DEFINE_PER_CPU(struct clock_event_device, econet_timer_pcpu); 31 + 32 + /* Each memory block has 2 timers, the order of registers is: 33 + * CTL, CMR0, CNT0, CMR1, CNT1 34 + */ 35 + static inline void __iomem *reg_ctl(u32 timer_n) 36 + { 37 + return econet_timer.membase[timer_n >> 1]; 38 + } 39 + 40 + static inline void __iomem *reg_compare(u32 timer_n) 41 + { 42 + return econet_timer.membase[timer_n >> 1] + (timer_n & 1) * 0x08 + 0x04; 43 + } 44 + 45 + static inline void __iomem *reg_count(u32 timer_n) 46 + { 47 + return econet_timer.membase[timer_n >> 1] + (timer_n & 1) * 0x08 + 0x08; 48 + } 49 + 50 + static inline u32 ctl_bit_enabled(u32 timer_n) 51 + { 52 + return 1U << (timer_n & 1); 53 + } 54 + 55 + static inline u32 ctl_bit_pending(u32 timer_n) 56 + { 57 + return 1U << ((timer_n & 1) + 16); 58 + } 59 + 60 + static bool cevt_is_pending(int cpu_id) 61 + { 62 + return ioread32(reg_ctl(cpu_id)) & ctl_bit_pending(cpu_id); 63 + } 64 + 65 + static irqreturn_t cevt_interrupt(int irq, void *dev_id) 66 + { 67 + struct clock_event_device *dev = this_cpu_ptr(&econet_timer_pcpu); 68 + int cpu = cpumask_first(dev->cpumask); 69 + 70 + /* Each VPE has its own events, 71 + * so this will only happen on spurious interrupt. 72 + */ 73 + if (!cevt_is_pending(cpu)) 74 + return IRQ_NONE; 75 + 76 + iowrite32(ioread32(reg_count(cpu)), reg_compare(cpu)); 77 + dev->event_handler(dev); 78 + return IRQ_HANDLED; 79 + } 80 + 81 + static int cevt_set_next_event(ulong delta, struct clock_event_device *dev) 82 + { 83 + u32 next; 84 + int cpu; 85 + 86 + cpu = cpumask_first(dev->cpumask); 87 + next = ioread32(reg_count(cpu)) + delta; 88 + iowrite32(next, reg_compare(cpu)); 89 + 90 + if ((s32)(next - ioread32(reg_count(cpu))) < ECONET_MIN_DELTA / 2) 91 + return -ETIME; 92 + 93 + return 0; 94 + } 95 + 96 + static int cevt_init_cpu(uint cpu) 97 + { 98 + struct clock_event_device *cd = &per_cpu(econet_timer_pcpu, cpu); 99 + u32 reg; 100 + 101 + pr_debug("%s: Setting up clockevent for CPU %d\n", cd->name, cpu); 102 + 103 + reg = ioread32(reg_ctl(cpu)) | ctl_bit_enabled(cpu); 104 + iowrite32(reg, reg_ctl(cpu)); 105 + 106 + enable_percpu_irq(cd->irq, IRQ_TYPE_NONE); 107 + 108 + /* Do this last because it synchronously configures the timer */ 109 + clockevents_config_and_register(cd, econet_timer.freq_hz, 110 + ECONET_MIN_DELTA, ECONET_MAX_DELTA); 111 + 112 + return 0; 113 + } 114 + 115 + static u64 notrace sched_clock_read(void) 116 + { 117 + /* Always read from clock zero no matter the CPU */ 118 + return (u64)ioread32(reg_count(0)); 119 + } 120 + 121 + /* Init */ 122 + 123 + static void __init cevt_dev_init(uint cpu) 124 + { 125 + iowrite32(0, reg_count(cpu)); 126 + iowrite32(U32_MAX, reg_compare(cpu)); 127 + } 128 + 129 + static int __init cevt_init(struct device_node *np) 130 + { 131 + int i, irq, ret; 132 + 133 + irq = irq_of_parse_and_map(np, 0); 134 + if (irq <= 0) { 135 + pr_err("%pOFn: irq_of_parse_and_map failed", np); 136 + return -EINVAL; 137 + } 138 + 139 + ret = request_percpu_irq(irq, cevt_interrupt, np->name, &econet_timer_pcpu); 140 + 141 + if (ret < 0) { 142 + pr_err("%pOFn: IRQ %d setup failed (%d)\n", np, irq, ret); 143 + goto err_unmap_irq; 144 + } 145 + 146 + for_each_possible_cpu(i) { 147 + struct clock_event_device *cd = &per_cpu(econet_timer_pcpu, i); 148 + 149 + cd->rating = 310, 150 + cd->features = CLOCK_EVT_FEAT_ONESHOT | 151 + CLOCK_EVT_FEAT_C3STOP | 152 + CLOCK_EVT_FEAT_PERCPU; 153 + cd->set_next_event = cevt_set_next_event; 154 + cd->irq = irq; 155 + cd->cpumask = cpumask_of(i); 156 + cd->name = np->name; 157 + 158 + cevt_dev_init(i); 159 + } 160 + 161 + cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, 162 + "clockevents/econet/timer:starting", 163 + cevt_init_cpu, NULL); 164 + return 0; 165 + 166 + err_unmap_irq: 167 + irq_dispose_mapping(irq); 168 + return ret; 169 + } 170 + 171 + static int __init timer_init(struct device_node *np) 172 + { 173 + int num_blocks = DIV_ROUND_UP(num_possible_cpus(), 2); 174 + struct clk *clk; 175 + int ret; 176 + 177 + clk = of_clk_get(np, 0); 178 + if (IS_ERR(clk)) { 179 + pr_err("%pOFn: Failed to get CPU clock from DT %ld\n", np, PTR_ERR(clk)); 180 + return PTR_ERR(clk); 181 + } 182 + 183 + econet_timer.freq_hz = clk_get_rate(clk); 184 + 185 + for (int i = 0; i < num_blocks; i++) { 186 + econet_timer.membase[i] = of_iomap(np, i); 187 + if (!econet_timer.membase[i]) { 188 + pr_err("%pOFn: failed to map register [%d]\n", np, i); 189 + return -ENXIO; 190 + } 191 + } 192 + 193 + /* For clocksource purposes always read clock zero, whatever the CPU */ 194 + ret = clocksource_mmio_init(reg_count(0), np->name, 195 + econet_timer.freq_hz, 301, ECONET_BITS, 196 + clocksource_mmio_readl_up); 197 + if (ret) { 198 + pr_err("%pOFn: clocksource_mmio_init failed: %d", np, ret); 199 + return ret; 200 + } 201 + 202 + ret = cevt_init(np); 203 + if (ret < 0) 204 + return ret; 205 + 206 + sched_clock_register(sched_clock_read, ECONET_BITS, 207 + econet_timer.freq_hz); 208 + 209 + pr_info("%pOFn: using %u.%03u MHz high precision timer\n", np, 210 + econet_timer.freq_hz / 1000000, 211 + (econet_timer.freq_hz / 1000) % 1000); 212 + 213 + return 0; 214 + } 215 + 216 + TIMER_OF_DECLARE(econet_timer_hpt, "econet,en751221-timer", timer_init);
+495
drivers/clocksource/timer-nxp-stm.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Copyright 2016 Freescale Semiconductor, Inc. 4 + * Copyright 2018,2021-2025 NXP 5 + * 6 + * NXP System Timer Module: 7 + * 8 + * STM supports commonly required system and application software 9 + * timing functions. STM includes a 32-bit count-up timer and four 10 + * 32-bit compare channels with a separate interrupt source for each 11 + * channel. The timer is driven by the STM module clock divided by an 12 + * 8-bit prescale value (1 to 256). It has ability to stop the timer 13 + * in Debug mode 14 + */ 15 + #include <linux/clk.h> 16 + #include <linux/clockchips.h> 17 + #include <linux/cpuhotplug.h> 18 + #include <linux/interrupt.h> 19 + #include <linux/module.h> 20 + #include <linux/of_irq.h> 21 + #include <linux/platform_device.h> 22 + #include <linux/sched_clock.h> 23 + #include <linux/units.h> 24 + 25 + #define STM_CR(__base) (__base) 26 + 27 + #define STM_CR_TEN BIT(0) 28 + #define STM_CR_FRZ BIT(1) 29 + #define STM_CR_CPS_OFFSET 8u 30 + #define STM_CR_CPS_MASK GENMASK(15, STM_CR_CPS_OFFSET) 31 + 32 + #define STM_CNT(__base) ((__base) + 0x04) 33 + 34 + #define STM_CCR0(__base) ((__base) + 0x10) 35 + #define STM_CCR1(__base) ((__base) + 0x20) 36 + #define STM_CCR2(__base) ((__base) + 0x30) 37 + #define STM_CCR3(__base) ((__base) + 0x40) 38 + 39 + #define STM_CCR_CEN BIT(0) 40 + 41 + #define STM_CIR0(__base) ((__base) + 0x14) 42 + #define STM_CIR1(__base) ((__base) + 0x24) 43 + #define STM_CIR2(__base) ((__base) + 0x34) 44 + #define STM_CIR3(__base) ((__base) + 0x44) 45 + 46 + #define STM_CIR_CIF BIT(0) 47 + 48 + #define STM_CMP0(__base) ((__base) + 0x18) 49 + #define STM_CMP1(__base) ((__base) + 0x28) 50 + #define STM_CMP2(__base) ((__base) + 0x38) 51 + #define STM_CMP3(__base) ((__base) + 0x48) 52 + 53 + #define STM_ENABLE_MASK (STM_CR_FRZ | STM_CR_TEN) 54 + 55 + struct stm_timer { 56 + void __iomem *base; 57 + unsigned long rate; 58 + unsigned long delta; 59 + unsigned long counter; 60 + struct clock_event_device ced; 61 + struct clocksource cs; 62 + atomic_t refcnt; 63 + }; 64 + 65 + static DEFINE_PER_CPU(struct stm_timer *, stm_timers); 66 + 67 + static struct stm_timer *stm_sched_clock; 68 + 69 + /* 70 + * Global structure for multiple STMs initialization 71 + */ 72 + static int stm_instances; 73 + 74 + /* 75 + * This global lock is used to prevent race conditions with the 76 + * stm_instances in case the driver is using the ASYNC option 77 + */ 78 + static DEFINE_MUTEX(stm_instances_lock); 79 + 80 + DEFINE_GUARD(stm_instances, struct mutex *, mutex_lock(_T), mutex_unlock(_T)) 81 + 82 + static struct stm_timer *cs_to_stm(struct clocksource *cs) 83 + { 84 + return container_of(cs, struct stm_timer, cs); 85 + } 86 + 87 + static struct stm_timer *ced_to_stm(struct clock_event_device *ced) 88 + { 89 + return container_of(ced, struct stm_timer, ced); 90 + } 91 + 92 + static u64 notrace nxp_stm_read_sched_clock(void) 93 + { 94 + return readl(STM_CNT(stm_sched_clock->base)); 95 + } 96 + 97 + static u32 nxp_stm_clocksource_getcnt(struct stm_timer *stm_timer) 98 + { 99 + return readl(STM_CNT(stm_timer->base)); 100 + } 101 + 102 + static void nxp_stm_clocksource_setcnt(struct stm_timer *stm_timer, u32 cnt) 103 + { 104 + writel(cnt, STM_CNT(stm_timer->base)); 105 + } 106 + 107 + static u64 nxp_stm_clocksource_read(struct clocksource *cs) 108 + { 109 + struct stm_timer *stm_timer = cs_to_stm(cs); 110 + 111 + return (u64)nxp_stm_clocksource_getcnt(stm_timer); 112 + } 113 + 114 + static void nxp_stm_module_enable(struct stm_timer *stm_timer) 115 + { 116 + u32 reg; 117 + 118 + reg = readl(STM_CR(stm_timer->base)); 119 + 120 + reg |= STM_ENABLE_MASK; 121 + 122 + writel(reg, STM_CR(stm_timer->base)); 123 + } 124 + 125 + static void nxp_stm_module_disable(struct stm_timer *stm_timer) 126 + { 127 + u32 reg; 128 + 129 + reg = readl(STM_CR(stm_timer->base)); 130 + 131 + reg &= ~STM_ENABLE_MASK; 132 + 133 + writel(reg, STM_CR(stm_timer->base)); 134 + } 135 + 136 + static void nxp_stm_module_put(struct stm_timer *stm_timer) 137 + { 138 + if (atomic_dec_and_test(&stm_timer->refcnt)) 139 + nxp_stm_module_disable(stm_timer); 140 + } 141 + 142 + static void nxp_stm_module_get(struct stm_timer *stm_timer) 143 + { 144 + if (atomic_inc_return(&stm_timer->refcnt) == 1) 145 + nxp_stm_module_enable(stm_timer); 146 + } 147 + 148 + static int nxp_stm_clocksource_enable(struct clocksource *cs) 149 + { 150 + struct stm_timer *stm_timer = cs_to_stm(cs); 151 + 152 + nxp_stm_module_get(stm_timer); 153 + 154 + return 0; 155 + } 156 + 157 + static void nxp_stm_clocksource_disable(struct clocksource *cs) 158 + { 159 + struct stm_timer *stm_timer = cs_to_stm(cs); 160 + 161 + nxp_stm_module_put(stm_timer); 162 + } 163 + 164 + static void nxp_stm_clocksource_suspend(struct clocksource *cs) 165 + { 166 + struct stm_timer *stm_timer = cs_to_stm(cs); 167 + 168 + nxp_stm_clocksource_disable(cs); 169 + stm_timer->counter = nxp_stm_clocksource_getcnt(stm_timer); 170 + } 171 + 172 + static void nxp_stm_clocksource_resume(struct clocksource *cs) 173 + { 174 + struct stm_timer *stm_timer = cs_to_stm(cs); 175 + 176 + nxp_stm_clocksource_setcnt(stm_timer, stm_timer->counter); 177 + nxp_stm_clocksource_enable(cs); 178 + } 179 + 180 + static void __init devm_clocksource_unregister(void *data) 181 + { 182 + struct stm_timer *stm_timer = data; 183 + 184 + clocksource_unregister(&stm_timer->cs); 185 + } 186 + 187 + static int __init nxp_stm_clocksource_init(struct device *dev, struct stm_timer *stm_timer, 188 + const char *name, void __iomem *base, struct clk *clk) 189 + { 190 + int ret; 191 + 192 + stm_timer->base = base; 193 + stm_timer->rate = clk_get_rate(clk); 194 + 195 + stm_timer->cs.name = name; 196 + stm_timer->cs.rating = 460; 197 + stm_timer->cs.read = nxp_stm_clocksource_read; 198 + stm_timer->cs.enable = nxp_stm_clocksource_enable; 199 + stm_timer->cs.disable = nxp_stm_clocksource_disable; 200 + stm_timer->cs.suspend = nxp_stm_clocksource_suspend; 201 + stm_timer->cs.resume = nxp_stm_clocksource_resume; 202 + stm_timer->cs.mask = CLOCKSOURCE_MASK(32); 203 + stm_timer->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; 204 + 205 + ret = clocksource_register_hz(&stm_timer->cs, stm_timer->rate); 206 + if (ret) 207 + return ret; 208 + 209 + ret = devm_add_action_or_reset(dev, devm_clocksource_unregister, stm_timer); 210 + if (ret) { 211 + clocksource_unregister(&stm_timer->cs); 212 + return ret; 213 + } 214 + 215 + stm_sched_clock = stm_timer; 216 + 217 + sched_clock_register(nxp_stm_read_sched_clock, 32, stm_timer->rate); 218 + 219 + dev_dbg(dev, "Registered clocksource %s\n", name); 220 + 221 + return 0; 222 + } 223 + 224 + static int nxp_stm_clockevent_read_counter(struct stm_timer *stm_timer) 225 + { 226 + return readl(STM_CNT(stm_timer->base)); 227 + } 228 + 229 + static void nxp_stm_clockevent_disable(struct stm_timer *stm_timer) 230 + { 231 + writel(0, STM_CCR0(stm_timer->base)); 232 + } 233 + 234 + static void nxp_stm_clockevent_enable(struct stm_timer *stm_timer) 235 + { 236 + writel(STM_CCR_CEN, STM_CCR0(stm_timer->base)); 237 + } 238 + 239 + static int nxp_stm_clockevent_shutdown(struct clock_event_device *ced) 240 + { 241 + struct stm_timer *stm_timer = ced_to_stm(ced); 242 + 243 + nxp_stm_clockevent_disable(stm_timer); 244 + 245 + return 0; 246 + } 247 + 248 + static int nxp_stm_clockevent_set_next_event(unsigned long delta, struct clock_event_device *ced) 249 + { 250 + struct stm_timer *stm_timer = ced_to_stm(ced); 251 + u32 val; 252 + 253 + nxp_stm_clockevent_disable(stm_timer); 254 + 255 + stm_timer->delta = delta; 256 + 257 + val = nxp_stm_clockevent_read_counter(stm_timer) + delta; 258 + 259 + writel(val, STM_CMP0(stm_timer->base)); 260 + 261 + /* 262 + * The counter is shared across the channels and can not be 263 + * stopped while we are setting the next event. If the delta 264 + * is very small it is possible the counter increases above 265 + * the computed 'val'. The min_delta value specified when 266 + * registering the clockevent will prevent that. The second 267 + * case is if the counter wraps while we compute the 'val' and 268 + * before writing the comparator register. We read the counter, 269 + * check if we are back in time and abort the timer with -ETIME. 270 + */ 271 + if (val > nxp_stm_clockevent_read_counter(stm_timer) + delta) 272 + return -ETIME; 273 + 274 + nxp_stm_clockevent_enable(stm_timer); 275 + 276 + return 0; 277 + } 278 + 279 + static int nxp_stm_clockevent_set_periodic(struct clock_event_device *ced) 280 + { 281 + struct stm_timer *stm_timer = ced_to_stm(ced); 282 + 283 + return nxp_stm_clockevent_set_next_event(stm_timer->rate, ced); 284 + } 285 + 286 + static void nxp_stm_clockevent_suspend(struct clock_event_device *ced) 287 + { 288 + struct stm_timer *stm_timer = ced_to_stm(ced); 289 + 290 + nxp_stm_module_put(stm_timer); 291 + } 292 + 293 + static void nxp_stm_clockevent_resume(struct clock_event_device *ced) 294 + { 295 + struct stm_timer *stm_timer = ced_to_stm(ced); 296 + 297 + nxp_stm_module_get(stm_timer); 298 + } 299 + 300 + static int __init nxp_stm_clockevent_per_cpu_init(struct device *dev, struct stm_timer *stm_timer, 301 + const char *name, void __iomem *base, int irq, 302 + struct clk *clk, int cpu) 303 + { 304 + stm_timer->base = base; 305 + stm_timer->rate = clk_get_rate(clk); 306 + 307 + stm_timer->ced.name = name; 308 + stm_timer->ced.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 309 + stm_timer->ced.set_state_shutdown = nxp_stm_clockevent_shutdown; 310 + stm_timer->ced.set_state_periodic = nxp_stm_clockevent_set_periodic; 311 + stm_timer->ced.set_next_event = nxp_stm_clockevent_set_next_event; 312 + stm_timer->ced.suspend = nxp_stm_clockevent_suspend; 313 + stm_timer->ced.resume = nxp_stm_clockevent_resume; 314 + stm_timer->ced.cpumask = cpumask_of(cpu); 315 + stm_timer->ced.rating = 460; 316 + stm_timer->ced.irq = irq; 317 + 318 + per_cpu(stm_timers, cpu) = stm_timer; 319 + 320 + nxp_stm_module_get(stm_timer); 321 + 322 + dev_dbg(dev, "Initialized per cpu clockevent name=%s, irq=%d, cpu=%d\n", name, irq, cpu); 323 + 324 + return 0; 325 + } 326 + 327 + static int nxp_stm_clockevent_starting_cpu(unsigned int cpu) 328 + { 329 + struct stm_timer *stm_timer = per_cpu(stm_timers, cpu); 330 + int ret; 331 + 332 + if (WARN_ON(!stm_timer)) 333 + return -EFAULT; 334 + 335 + ret = irq_force_affinity(stm_timer->ced.irq, cpumask_of(cpu)); 336 + if (ret) 337 + return ret; 338 + 339 + /* 340 + * The timings measurement show reading the counter register 341 + * and writing to the comparator register takes as a maximum 342 + * value 1100 ns at 133MHz rate frequency. The timer must be 343 + * set above this value and to be secure we set the minimum 344 + * value equal to 2000ns, so 2us. 345 + * 346 + * minimum ticks = (rate / MICRO) * 2 347 + */ 348 + clockevents_config_and_register(&stm_timer->ced, stm_timer->rate, 349 + (stm_timer->rate / MICRO) * 2, ULONG_MAX); 350 + 351 + return 0; 352 + } 353 + 354 + static irqreturn_t nxp_stm_module_interrupt(int irq, void *dev_id) 355 + { 356 + struct stm_timer *stm_timer = dev_id; 357 + struct clock_event_device *ced = &stm_timer->ced; 358 + u32 val; 359 + 360 + /* 361 + * The interrupt is shared across the channels in the 362 + * module. But this one is configured to run only one channel, 363 + * consequently it is pointless to test the interrupt flags 364 + * before and we can directly reset the channel 0 irq flag 365 + * register. 366 + */ 367 + writel(STM_CIR_CIF, STM_CIR0(stm_timer->base)); 368 + 369 + /* 370 + * Update STM_CMP value using the counter value 371 + */ 372 + val = nxp_stm_clockevent_read_counter(stm_timer) + stm_timer->delta; 373 + 374 + writel(val, STM_CMP0(stm_timer->base)); 375 + 376 + /* 377 + * stm hardware doesn't support oneshot, it will generate an 378 + * interrupt and start the counter again so software needs to 379 + * disable the timer to stop the counter loop in ONESHOT mode. 380 + */ 381 + if (likely(clockevent_state_oneshot(ced))) 382 + nxp_stm_clockevent_disable(stm_timer); 383 + 384 + ced->event_handler(ced); 385 + 386 + return IRQ_HANDLED; 387 + } 388 + 389 + static int __init nxp_stm_timer_probe(struct platform_device *pdev) 390 + { 391 + struct stm_timer *stm_timer; 392 + struct device *dev = &pdev->dev; 393 + struct device_node *np = dev->of_node; 394 + const char *name = of_node_full_name(np); 395 + struct clk *clk; 396 + void __iomem *base; 397 + int irq, ret; 398 + 399 + /* 400 + * The device tree can have multiple STM nodes described, so 401 + * it makes this driver a good candidate for the async probe. 402 + * It is still unclear if the time framework correctly handles 403 + * parallel loading of the timers but at least this driver is 404 + * ready to support the option. 405 + */ 406 + guard(stm_instances)(&stm_instances_lock); 407 + 408 + /* 409 + * The S32Gx are SoCs featuring a diverse set of cores. Linux 410 + * is expected to run on Cortex-A53 cores, while other 411 + * software stacks will operate on Cortex-M cores. The number 412 + * of STM instances has been sized to include at most one 413 + * instance per core. 414 + * 415 + * As we need a clocksource and a clockevent per cpu, we 416 + * simply initialize a clocksource per cpu along with the 417 + * clockevent which makes the resulting code simpler. 418 + * 419 + * However if the device tree is describing more STM instances 420 + * than the number of cores, then we ignore them. 421 + */ 422 + if (stm_instances >= num_possible_cpus()) 423 + return 0; 424 + 425 + base = devm_of_iomap(dev, np, 0, NULL); 426 + if (IS_ERR(base)) 427 + return dev_err_probe(dev, PTR_ERR(base), "Failed to iomap %pOFn\n", np); 428 + 429 + irq = platform_get_irq(pdev, 0); 430 + if (irq < 0) 431 + return dev_err_probe(dev, irq, "Failed to get IRQ\n"); 432 + 433 + clk = devm_clk_get_enabled(dev, NULL); 434 + if (IS_ERR(clk)) 435 + return dev_err_probe(dev, PTR_ERR(clk), "Clock not found\n"); 436 + 437 + stm_timer = devm_kzalloc(dev, sizeof(*stm_timer), GFP_KERNEL); 438 + if (!stm_timer) 439 + return -ENOMEM; 440 + 441 + ret = devm_request_irq(dev, irq, nxp_stm_module_interrupt, 442 + IRQF_TIMER | IRQF_NOBALANCING, name, stm_timer); 443 + if (ret) 444 + return dev_err_probe(dev, ret, "Unable to allocate interrupt line\n"); 445 + 446 + ret = nxp_stm_clocksource_init(dev, stm_timer, name, base, clk); 447 + if (ret) 448 + return ret; 449 + 450 + /* 451 + * Next probed STM will be a per CPU clockevent, until we 452 + * probe as many as we have CPUs available on the system, we 453 + * do a partial initialization 454 + */ 455 + ret = nxp_stm_clockevent_per_cpu_init(dev, stm_timer, name, 456 + base, irq, clk, 457 + stm_instances); 458 + if (ret) 459 + return ret; 460 + 461 + stm_instances++; 462 + 463 + /* 464 + * The number of probed STMs for per CPU clockevent is 465 + * equal to the number of available CPUs on the 466 + * system. We install the cpu hotplug to finish the 467 + * initialization by registering the clockevents 468 + */ 469 + if (stm_instances == num_possible_cpus()) { 470 + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "STM timer:starting", 471 + nxp_stm_clockevent_starting_cpu, NULL); 472 + if (ret < 0) 473 + return ret; 474 + } 475 + 476 + return 0; 477 + } 478 + 479 + static const struct of_device_id nxp_stm_of_match[] = { 480 + { .compatible = "nxp,s32g2-stm" }, 481 + { } 482 + }; 483 + MODULE_DEVICE_TABLE(of, nxp_stm_of_match); 484 + 485 + static struct platform_driver nxp_stm_probe = { 486 + .probe = nxp_stm_timer_probe, 487 + .driver = { 488 + .name = "nxp-stm", 489 + .of_match_table = nxp_stm_of_match, 490 + }, 491 + }; 492 + module_platform_driver(nxp_stm_probe); 493 + 494 + MODULE_DESCRIPTION("NXP System Timer Module driver"); 495 + MODULE_LICENSE("GPL");
+63 -37
drivers/clocksource/timer-tegra186.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (c) 2019-2020 NVIDIA Corporation. All rights reserved. 3 + * Copyright (c) 2019-2025 NVIDIA Corporation. All rights reserved. 4 4 */ 5 5 6 + #include <linux/bitfield.h> 6 7 #include <linux/clocksource.h> 7 8 #include <linux/module.h> 8 9 #include <linux/interrupt.h> ··· 30 29 31 30 #define TMRSR 0x004 32 31 #define TMRSR_INTR_CLR BIT(30) 32 + #define TMRSR_PCV GENMASK(28, 0) 33 33 34 34 #define TMRCSSR 0x008 35 35 #define TMRCSSR_SRC_USEC (0 << 0) ··· 46 44 #define WDTCR_PERIOD(x) (((x) & 0xff) << 4) 47 45 #define WDTCR_TIMER_SOURCE_MASK 0xf 48 46 #define WDTCR_TIMER_SOURCE(x) ((x) & 0xf) 47 + 48 + #define WDTSR 0x004 49 + #define WDTSR_CURRENT_EXPIRATION_COUNT GENMASK(14, 12) 49 50 50 51 #define WDTCMDR 0x008 51 52 #define WDTCMDR_DISABLE_COUNTER BIT(1) ··· 174 169 value &= ~WDTCR_PERIOD_MASK; 175 170 value |= WDTCR_PERIOD(1); 176 171 177 - /* enable local interrupt for WDT petting */ 178 - value |= WDTCR_LOCAL_INT_ENABLE; 179 - 180 - /* enable local FIQ and remote interrupt for debug dump */ 181 - if (0) 182 - value |= WDTCR_REMOTE_INT_ENABLE | 183 - WDTCR_LOCAL_FIQ_ENABLE; 184 - 185 - /* enable system debug reset (doesn't properly reboot) */ 186 - if (0) 187 - value |= WDTCR_SYSTEM_DEBUG_RESET_ENABLE; 188 - 189 172 /* enable system POR reset */ 190 173 value |= WDTCR_SYSTEM_POR_RESET_ENABLE; 191 174 ··· 227 234 return 0; 228 235 } 229 236 237 + static unsigned int tegra186_wdt_get_timeleft(struct watchdog_device *wdd) 238 + { 239 + struct tegra186_wdt *wdt = to_tegra186_wdt(wdd); 240 + u32 expiration, val; 241 + u64 timeleft; 242 + 243 + if (!watchdog_active(&wdt->base)) { 244 + /* return zero if the watchdog timer is not activated. */ 245 + return 0; 246 + } 247 + 248 + /* 249 + * Reset occurs on the fifth expiration of the 250 + * watchdog timer and so when the watchdog timer is configured, 251 + * the actual value programmed into the counter is 1/5 of the 252 + * timeout value. Once the counter reaches 0, expiration count 253 + * will be increased by 1 and the down counter restarts. 254 + * Hence to get the time left before system reset we must 255 + * combine 2 parts: 256 + * 1. value of the current down counter 257 + * 2. (number of counter expirations remaining) * (timeout/5) 258 + */ 259 + 260 + /* Get the current number of counter expirations. Should be a 261 + * value between 0 and 4 262 + */ 263 + val = readl_relaxed(wdt->regs + WDTSR); 264 + expiration = FIELD_GET(WDTSR_CURRENT_EXPIRATION_COUNT, val); 265 + if (WARN_ON_ONCE(expiration > 4)) 266 + return 0; 267 + 268 + /* Get the current counter value in microsecond. */ 269 + val = readl_relaxed(wdt->tmr->regs + TMRSR); 270 + timeleft = FIELD_GET(TMRSR_PCV, val); 271 + 272 + /* 273 + * Calculate the time remaining by adding the time for the 274 + * counter value to the time of the counter expirations that 275 + * remain. 276 + */ 277 + timeleft += (((u64)wdt->base.timeout * USEC_PER_SEC) / 5) * (4 - expiration); 278 + 279 + /* 280 + * Convert the current counter value to seconds, 281 + * rounding up to the nearest second. Cast u64 to 282 + * u32 under the assumption that no overflow happens 283 + * when coverting to seconds. 284 + */ 285 + timeleft = DIV_ROUND_CLOSEST_ULL(timeleft, USEC_PER_SEC); 286 + 287 + if (WARN_ON_ONCE(timeleft > U32_MAX)) 288 + return U32_MAX; 289 + 290 + return lower_32_bits(timeleft); 291 + } 292 + 230 293 static const struct watchdog_ops tegra186_wdt_ops = { 231 294 .owner = THIS_MODULE, 232 295 .start = tegra186_wdt_start, 233 296 .stop = tegra186_wdt_stop, 234 297 .ping = tegra186_wdt_ping, 235 298 .set_timeout = tegra186_wdt_set_timeout, 299 + .get_timeleft = tegra186_wdt_get_timeleft, 236 300 }; 237 301 238 302 static struct tegra186_wdt *tegra186_wdt_create(struct tegra186_timer *tegra, ··· 415 365 return clocksource_register_hz(&tegra->usec, USEC_PER_SEC); 416 366 } 417 367 418 - static irqreturn_t tegra186_timer_irq(int irq, void *data) 419 - { 420 - struct tegra186_timer *tegra = data; 421 - 422 - if (watchdog_active(&tegra->wdt->base)) { 423 - tegra186_wdt_disable(tegra->wdt); 424 - tegra186_wdt_enable(tegra->wdt); 425 - } 426 - 427 - return IRQ_HANDLED; 428 - } 429 - 430 368 static int tegra186_timer_probe(struct platform_device *pdev) 431 369 { 432 370 struct device *dev = &pdev->dev; 433 371 struct tegra186_timer *tegra; 434 - unsigned int irq; 435 372 int err; 436 373 437 374 tegra = devm_kzalloc(dev, sizeof(*tegra), GFP_KERNEL); ··· 436 399 err = platform_get_irq(pdev, 0); 437 400 if (err < 0) 438 401 return err; 439 - 440 - irq = err; 441 402 442 403 /* create a watchdog using a preconfigured timer */ 443 404 tegra->wdt = tegra186_wdt_create(tegra, 0); ··· 463 428 goto unregister_osc; 464 429 } 465 430 466 - err = devm_request_irq(dev, irq, tegra186_timer_irq, 0, 467 - "tegra186-timer", tegra); 468 - if (err < 0) { 469 - dev_err(dev, "failed to request IRQ#%u: %d\n", irq, err); 470 - goto unregister_usec; 471 - } 472 - 473 431 return 0; 474 432 475 - unregister_usec: 476 - clocksource_unregister(&tegra->usec); 477 433 unregister_osc: 478 434 clocksource_unregister(&tegra->osc); 479 435 unregister_tsc: