ARM: arch timer: Set the TVAL before timer is enabled
Subsystems (3)
PATCH v2 1/2 ARM: arch timer: Set the TVAL before timer is enabled
On some hardware, the timer deasserts the interrupt when a new TVAL is written only when the enable bit is cleared. Hence explicitly disable the timer and then program the TVAL followed by enabling the timer.
If this order is not followed, there are chances that you would not receive any timer interrupts.
Signed-off-by Rohit Vaswani <[email protected]>
--- arch/arm/kernel/arch_timer.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/kernel/arch_timer.c +3 -2
@@ -206,9 +206,10 @@ static inline void set_next_event(const int access, unsigned long evt) {unsigned long ctrl; ctrl =arch_timer_reg_read (access,ARCH_TIMER_REG_CTRL ); - ctrl |=ARCH_TIMER_CTRL_ENABLE ; - ctrl &= ~ARCH_TIMER_CTRL_IT_MASK ; + ctrl &= ~(ARCH_TIMER_CTRL_ENABLE |ARCH_TIMER_CTRL_IT_MASK ); +arch_timer_reg_write (access,ARCH_TIMER_REG_CTRL , ctrl);arch_timer_reg_write (access,ARCH_TIMER_REG_TVAL , evt); + ctrl |=ARCH_TIMER_CTRL_ENABLE ;arch_timer_reg_write (access,ARCH_TIMER_REG_CTRL , ctrl); }
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 2/2 ARM: local timers: add timer support using IO mapped register
The current arch_timer only support accessing through CP15 interface. Add support for ARM processors that only support IO mapped register interface. The memory mapped timer interface works with SPI interrupts instead of PPI.
Signed-off-by Rohit Vaswani <[email protected]>
--- .../devicetree/bindings/arm/arch_timer.txt | 9 +- arch/arm/kernel/arch_timer.c | 299 +++++++++++++++++++- 2 files changed, 297 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/arm/arch_timer.txt +6 -3
@@ -7,10 +7,13 @@ The timer is attached to a GIC to deliver its per-processor interrupts. ** Timer node properties: -- compatible : Should at least contain "arm,armv7-timer". +- compatible : Should at least contain "arm,armv7-timer" or + "arm,armv7-timer-mem" if using the memory mapped arch timer interface. -- interrupts : Interrupt list for secure, non-secure, virtual and - hypervisor timers, in that order. +- interrupts : If using the cp15 interface, the interrupt list for secure, + non-secure, virtual and hypervisor timers, in that order. + If using the memory mapped interface, list the interrupts for each core, + starting with core 0. - clock-frequency : The frequency of the main counter, in Hz. Optional.
arch/arm/kernel/arch_timer.c +291 -8
426 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation