public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: allwinner: enable h616 timer support
@ 2026-03-29 11:43 Michal Piekos
  2026-03-29 11:53 ` Jernej Škrabec
  2026-03-29 13:22 ` Chen-Yu Tsai
  0 siblings, 2 replies; 5+ messages in thread
From: Michal Piekos @ 2026-03-29 11:43 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
	Michal Piekos

Add support for timer by reusing existing sun4i timer driver.

H616 timer is compatible with earlier sunxi timer variants and provides
both clocksource and clockevent functionality. It runs from 24 MHz
oscillator. It can serve as broadcast clockevent for wake up from idle
states.

Tested on Orange Pi Zero 3:
- timer is registered as clocksource:
- switching clocksource at runtime works
- timer operates as a broadcast clockevent device
- no regression observed compared to arch_sys_counter

Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
---
Test results:

Clocksource switching:
  cat /sys/devices/system/clocksource/clocksource0/available_clocksource
    arch_sys_counter timer
  echo timer > /sys/devices/system/clocksource/clocksource0/current_clocksource
    [ 5031.105997] clocksource: Switched to clocksource timer

Clockevent configuration:
  cat /proc/timer_list
    ...
    Tick Device: mode:     1
    Broadcast device
    Clock Event Device: sun4i_tick
     max_delta_ns:   178956969070
     min_delta_ns:   1000
     mult:           51539608
     shift:          31
     mode:           1
     next_event:     9223372036854775807 nsecs
     set_next_event: sun4i_clkevt_next_event
     shutdown:       sun4i_clkevt_shutdown
     periodic:       sun4i_clkevt_set_periodic
     oneshot:        sun4i_clkevt_set_oneshot
     resume:         sun4i_clkevt_shutdown
     event_handler:  tick_handle_oneshot_broadcast
    ...

Cyclictest measurements:
  Dominated by system scheduler latency and do not reflect clocksource
  precision.
---
 arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
index 8d1110c14bad..bf054869e78b 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
@@ -228,6 +228,15 @@ cpu_speed_grade: cpu-speed-grade@0 {
 			};
 		};
 
+		timer0: timer@3009000 {
+			compatible = "allwinner,sun50i-h616-timer",
+				     "allwinner,sun8i-a23-timer";
+			reg = <0x03009000 0xa0>;
+			interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&osc24M>;
+		};
+
 		watchdog: watchdog@30090a0 {
 			compatible = "allwinner,sun50i-h616-wdt",
 				     "allwinner,sun6i-a31-wdt";

---
base-commit: be762d8b6dd7efacb61937d20f8475db8f207655
change-id: 20260328-h616-timer-046e6ac3549e

Best regards,
-- 
Michal Piekos <michal.piekos@mmpsystems.pl>



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: allwinner: enable h616 timer support
  2026-03-29 11:43 [PATCH] arm64: dts: allwinner: enable h616 timer support Michal Piekos
@ 2026-03-29 11:53 ` Jernej Škrabec
  2026-03-29 12:07   ` Michal Piekos
  2026-03-29 13:22 ` Chen-Yu Tsai
  1 sibling, 1 reply; 5+ messages in thread
From: Jernej Škrabec @ 2026-03-29 11:53 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Samuel Holland, Michal Piekos
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
	Michal Piekos

Dne nedelja, 29. marec 2026 ob 13:43:04 Srednjeevropski poletni čas je Michal Piekos napisal(a):
> Add support for timer by reusing existing sun4i timer driver.
> 
> H616 timer is compatible with earlier sunxi timer variants and provides
> both clocksource and clockevent functionality. It runs from 24 MHz
> oscillator. It can serve as broadcast clockevent for wake up from idle
> states.
> 
> Tested on Orange Pi Zero 3:
> - timer is registered as clocksource:
> - switching clocksource at runtime works
> - timer operates as a broadcast clockevent device
> - no regression observed compared to arch_sys_counter
> 
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> ---
> Test results:
> 
> Clocksource switching:
>   cat /sys/devices/system/clocksource/clocksource0/available_clocksource
>     arch_sys_counter timer
>   echo timer > /sys/devices/system/clocksource/clocksource0/current_clocksource
>     [ 5031.105997] clocksource: Switched to clocksource timer
> 
> Clockevent configuration:
>   cat /proc/timer_list
>     ...
>     Tick Device: mode:     1
>     Broadcast device
>     Clock Event Device: sun4i_tick
>      max_delta_ns:   178956969070
>      min_delta_ns:   1000
>      mult:           51539608
>      shift:          31
>      mode:           1
>      next_event:     9223372036854775807 nsecs
>      set_next_event: sun4i_clkevt_next_event
>      shutdown:       sun4i_clkevt_shutdown
>      periodic:       sun4i_clkevt_set_periodic
>      oneshot:        sun4i_clkevt_set_oneshot
>      resume:         sun4i_clkevt_shutdown
>      event_handler:  tick_handle_oneshot_broadcast
>     ...
> 
> Cyclictest measurements:
>   Dominated by system scheduler latency and do not reflect clocksource
>   precision.
> ---
>  arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> index 8d1110c14bad..bf054869e78b 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> @@ -228,6 +228,15 @@ cpu_speed_grade: cpu-speed-grade@0 {
>  			};
>  		};
>  
> +		timer0: timer@3009000 {
> +			compatible = "allwinner,sun50i-h616-timer",
> +				     "allwinner,sun8i-a23-timer";

You have to add above combo to DT bindings.

Best regards,
Jernej

> +			reg = <0x03009000 0xa0>;
> +			interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>,
> +				     <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&osc24M>;
> +		};
> +
>  		watchdog: watchdog@30090a0 {
>  			compatible = "allwinner,sun50i-h616-wdt",
>  				     "allwinner,sun6i-a31-wdt";
> 
> ---
> base-commit: be762d8b6dd7efacb61937d20f8475db8f207655
> change-id: 20260328-h616-timer-046e6ac3549e
> 
> Best regards,
> 






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: allwinner: enable h616 timer support
  2026-03-29 11:53 ` Jernej Škrabec
@ 2026-03-29 12:07   ` Michal Piekos
  2026-03-29 13:03     ` Jernej Škrabec
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Piekos @ 2026-03-29 12:07 UTC (permalink / raw)
  To: Jernej Škrabec
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel

On Sun, Mar 29, 2026 at 01:53:45PM +0200, Jernej Škrabec wrote:
> Dne nedelja, 29. marec 2026 ob 13:43:04 Srednjeevropski poletni čas je Michal Piekos napisal(a):
> > Add support for timer by reusing existing sun4i timer driver.
> > 
> > H616 timer is compatible with earlier sunxi timer variants and provides
> > both clocksource and clockevent functionality. It runs from 24 MHz
> > oscillator. It can serve as broadcast clockevent for wake up from idle
> > states.
> > 
> > Tested on Orange Pi Zero 3:
> > - timer is registered as clocksource:
> > - switching clocksource at runtime works
> > - timer operates as a broadcast clockevent device
> > - no regression observed compared to arch_sys_counter
> > 
> > Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> > ---
> > Test results:
> > 
> > Clocksource switching:
> >   cat /sys/devices/system/clocksource/clocksource0/available_clocksource
> >     arch_sys_counter timer
> >   echo timer > /sys/devices/system/clocksource/clocksource0/current_clocksource
> >     [ 5031.105997] clocksource: Switched to clocksource timer
> > 
> > Clockevent configuration:
> >   cat /proc/timer_list
> >     ...
> >     Tick Device: mode:     1
> >     Broadcast device
> >     Clock Event Device: sun4i_tick
> >      max_delta_ns:   178956969070
> >      min_delta_ns:   1000
> >      mult:           51539608
> >      shift:          31
> >      mode:           1
> >      next_event:     9223372036854775807 nsecs
> >      set_next_event: sun4i_clkevt_next_event
> >      shutdown:       sun4i_clkevt_shutdown
> >      periodic:       sun4i_clkevt_set_periodic
> >      oneshot:        sun4i_clkevt_set_oneshot
> >      resume:         sun4i_clkevt_shutdown
> >      event_handler:  tick_handle_oneshot_broadcast
> >     ...
> > 
> > Cyclictest measurements:
> >   Dominated by system scheduler latency and do not reflect clocksource
> >   precision.
> > ---
> >  arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> > index 8d1110c14bad..bf054869e78b 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> > @@ -228,6 +228,15 @@ cpu_speed_grade: cpu-speed-grade@0 {
> >  			};
> >  		};
> >  
> > +		timer0: timer@3009000 {
> > +			compatible = "allwinner,sun50i-h616-timer",
> > +				     "allwinner,sun8i-a23-timer";
> 
> You have to add above combo to DT bindings.
> 
> Best regards,
> Jernej

Not sure I understand your comment correctly but binding for h616 is already
there:

Documentation/devicetree/bindings/timer/allwinner,sun4i-a10-timer.yaml:21-27
  - items:
    - enum:
        - allwinner,sun20i-d1-timer
        - allwinner,sun50i-a64-timer
        - allwinner,sun50i-h6-timer
        - allwinner,sun50i-h616-timer
    - const: allwinner,sun8i-a23-timer

BR
Michal

> 
> > +			reg = <0x03009000 0xa0>;
> > +			interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>,
> > +				     <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
> > +			clocks = <&osc24M>;
> > +		};
> > +
> >  		watchdog: watchdog@30090a0 {
> >  			compatible = "allwinner,sun50i-h616-wdt",
> >  				     "allwinner,sun6i-a31-wdt";
> > 
> > ---
> > base-commit: be762d8b6dd7efacb61937d20f8475db8f207655
> > change-id: 20260328-h616-timer-046e6ac3549e
> > 
> > Best regards,
> > 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: allwinner: enable h616 timer support
  2026-03-29 12:07   ` Michal Piekos
@ 2026-03-29 13:03     ` Jernej Škrabec
  0 siblings, 0 replies; 5+ messages in thread
From: Jernej Škrabec @ 2026-03-29 13:03 UTC (permalink / raw)
  To: Michal Piekos
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi,
	linux-kernel

Dne nedelja, 29. marec 2026 ob 14:07:19 Srednjeevropski poletni čas je Michal Piekos napisal(a):
> On Sun, Mar 29, 2026 at 01:53:45PM +0200, Jernej Škrabec wrote:
> > Dne nedelja, 29. marec 2026 ob 13:43:04 Srednjeevropski poletni čas je Michal Piekos napisal(a):
> > > Add support for timer by reusing existing sun4i timer driver.
> > > 
> > > H616 timer is compatible with earlier sunxi timer variants and provides
> > > both clocksource and clockevent functionality. It runs from 24 MHz
> > > oscillator. It can serve as broadcast clockevent for wake up from idle
> > > states.
> > > 
> > > Tested on Orange Pi Zero 3:
> > > - timer is registered as clocksource:
> > > - switching clocksource at runtime works
> > > - timer operates as a broadcast clockevent device
> > > - no regression observed compared to arch_sys_counter
> > > 
> > > Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> > > ---
> > > Test results:
> > > 
> > > Clocksource switching:
> > >   cat /sys/devices/system/clocksource/clocksource0/available_clocksource
> > >     arch_sys_counter timer
> > >   echo timer > /sys/devices/system/clocksource/clocksource0/current_clocksource
> > >     [ 5031.105997] clocksource: Switched to clocksource timer
> > > 
> > > Clockevent configuration:
> > >   cat /proc/timer_list
> > >     ...
> > >     Tick Device: mode:     1
> > >     Broadcast device
> > >     Clock Event Device: sun4i_tick
> > >      max_delta_ns:   178956969070
> > >      min_delta_ns:   1000
> > >      mult:           51539608
> > >      shift:          31
> > >      mode:           1
> > >      next_event:     9223372036854775807 nsecs
> > >      set_next_event: sun4i_clkevt_next_event
> > >      shutdown:       sun4i_clkevt_shutdown
> > >      periodic:       sun4i_clkevt_set_periodic
> > >      oneshot:        sun4i_clkevt_set_oneshot
> > >      resume:         sun4i_clkevt_shutdown
> > >      event_handler:  tick_handle_oneshot_broadcast
> > >     ...
> > > 
> > > Cyclictest measurements:
> > >   Dominated by system scheduler latency and do not reflect clocksource
> > >   precision.
> > > ---
> > >  arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > > 
> > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> > > index 8d1110c14bad..bf054869e78b 100644
> > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> > > @@ -228,6 +228,15 @@ cpu_speed_grade: cpu-speed-grade@0 {
> > >  			};
> > >  		};
> > >  
> > > +		timer0: timer@3009000 {
> > > +			compatible = "allwinner,sun50i-h616-timer",
> > > +				     "allwinner,sun8i-a23-timer";
> > 
> > You have to add above combo to DT bindings.
> > 
> > Best regards,
> > Jernej
> 
> Not sure I understand your comment correctly but binding for h616 is already
> there:
> 
> Documentation/devicetree/bindings/timer/allwinner,sun4i-a10-timer.yaml:21-27
>   - items:
>     - enum:
>         - allwinner,sun20i-d1-timer
>         - allwinner,sun50i-a64-timer
>         - allwinner,sun50i-h6-timer
>         - allwinner,sun50i-h616-timer
>     - const: allwinner,sun8i-a23-timer
> 
> BR
> Michal

Sorry, sometimes tooling fails me. All good.

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

> 
> > 
> > > +			reg = <0x03009000 0xa0>;
> > > +			interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>,
> > > +				     <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
> > > +			clocks = <&osc24M>;
> > > +		};
> > > +
> > >  		watchdog: watchdog@30090a0 {
> > >  			compatible = "allwinner,sun50i-h616-wdt",
> > >  				     "allwinner,sun6i-a31-wdt";
> > > 
> > > ---
> > > base-commit: be762d8b6dd7efacb61937d20f8475db8f207655
> > > change-id: 20260328-h616-timer-046e6ac3549e
> > > 
> > > Best regards,
> > > 
> > 
> > 
> > 
> > 
> 






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: allwinner: enable h616 timer support
  2026-03-29 11:43 [PATCH] arm64: dts: allwinner: enable h616 timer support Michal Piekos
  2026-03-29 11:53 ` Jernej Škrabec
@ 2026-03-29 13:22 ` Chen-Yu Tsai
  1 sibling, 0 replies; 5+ messages in thread
From: Chen-Yu Tsai @ 2026-03-29 13:22 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jernej Skrabec,
	Samuel Holland, Michal Piekos
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel

On Sun, 29 Mar 2026 13:43:04 +0200, Michal Piekos wrote:
> Add support for timer by reusing existing sun4i timer driver.
> 
> H616 timer is compatible with earlier sunxi timer variants and provides
> both clocksource and clockevent functionality. It runs from 24 MHz
> oscillator. It can serve as broadcast clockevent for wake up from idle
> states.
> 
> [...]

Applied to sunxi/dt-for-7.1 in local tree, thanks!

[1/1] arm64: dts: allwinner: enable h616 timer support
      commit: c755e39836ec492b0bc210fd96c2b720b5b4a690

Best regards,
-- 
Chen-Yu Tsai <wens@kernel.org>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-29 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-29 11:43 [PATCH] arm64: dts: allwinner: enable h616 timer support Michal Piekos
2026-03-29 11:53 ` Jernej Škrabec
2026-03-29 12:07   ` Michal Piekos
2026-03-29 13:03     ` Jernej Škrabec
2026-03-29 13:22 ` Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox