drivers: timer: get ppi configuration from dt

Use device tree provided configurations for arm architecture timer
PPIs.

This fixes issue of timer ppi not working on most hardware where
edge-triggered PPI are not supported.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
This commit is contained in:
Sandeep Tripathy 2020-05-12 15:30:03 +05:30 committed by Carles Cufí
parent e550302a61
commit 17fcaa3fc4
3 changed files with 18 additions and 3 deletions

View file

@ -48,8 +48,8 @@ int z_clock_driver_init(struct device *device)
{
ARG_UNUSED(device);
IRQ_CONNECT(ARM_ARCH_TIMER_IRQ, 0, arm_arch_timer_compare_isr, 0,
ARM_TIMER_FLAGS);
IRQ_CONNECT(ARM_ARCH_TIMER_IRQ, ARM_ARCH_TIMER_PRIO,
arm_arch_timer_compare_isr, NULL, ARM_ARCH_TIMER_FLAGS);
arm_arch_timer_set_compare(arm_arch_timer_count() + CYC_PER_TICK);
arm_arch_timer_enable(true);
irq_enable(ARM_ARCH_TIMER_IRQ);

View file

@ -17,6 +17,9 @@ extern "C" {
#endif
#define ARM_ARCH_TIMER_IRQ ARM_TIMER_VIRTUAL_IRQ
#define ARM_ARCH_TIMER_PRIO ARM_TIMER_VIRTUAL_PRIO
#define ARM_ARCH_TIMER_FLAGS ARM_TIMER_VIRTUAL_FLAGS
#define CNTV_CTL_ENABLE ((1) << 0)

View file

@ -18,6 +18,18 @@
#define ARM_TIMER_VIRTUAL_IRQ DT_IRQ_BY_IDX(ARM_TIMER_NODE, 2, irq)
#define ARM_TIMER_HYP_IRQ DT_IRQ_BY_IDX(ARM_TIMER_NODE, 3, irq)
#define ARM_TIMER_FLAGS IRQ_TYPE_EDGE
#define ARM_TIMER_SECURE_PRIO DT_IRQ_BY_IDX(ARM_TIMER_NODE, 0,\
priority)
#define ARM_TIMER_NON_SECURE_PRIO DT_IRQ_BY_IDX(ARM_TIMER_NODE, 1,\
priority)
#define ARM_TIMER_VIRTUAL_PRIO DT_IRQ_BY_IDX(ARM_TIMER_NODE, 2,\
priority)
#define ARM_TIMER_HYP_PRIO DT_IRQ_BY_IDX(ARM_TIMER_NODE, 3,\
priority)
#define ARM_TIMER_SECURE_FLAGS DT_IRQ_BY_IDX(ARM_TIMER_NODE, 0, flags)
#define ARM_TIMER_NON_SECURE_FLAGS DT_IRQ_BY_IDX(ARM_TIMER_NODE, 1, flags)
#define ARM_TIMER_VIRTUAL_FLAGS DT_IRQ_BY_IDX(ARM_TIMER_NODE, 2, flags)
#define ARM_TIMER_HYP_FLAGS DT_IRQ_BY_IDX(ARM_TIMER_NODE, 3, flags)
#endif /* ZEPHYR_INCLUDE_DRIVERS_TIMER_ARM_ARCH_TIMER_H_ */