From ec048128ae8b8977c78b0c972eac6797b672f30b Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 2 Apr 2020 15:25:40 -0500 Subject: [PATCH] drivers: timer: rv32m1_lptmr: Convert driver to new DT_INST macros Convert driver to use DT_INST macros. Signed-off-by: Kumar Gala --- drivers/timer/rv32m1_lptmr_timer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/timer/rv32m1_lptmr_timer.c b/drivers/timer/rv32m1_lptmr_timer.c index 649839c4a4f..6d6a36b0be0 100644 --- a/drivers/timer/rv32m1_lptmr_timer.c +++ b/drivers/timer/rv32m1_lptmr_timer.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define DT_DRV_COMPAT openisa_rv32m1_lptmr + #include #include #include @@ -32,7 +34,7 @@ #endif #define SYSTEM_TIMER_INSTANCE \ - ((LPTMR_Type *)(DT_OPENISA_RV32M1_LPTMR_SYSTEM_LPTMR_BASE_ADDRESS)) + ((LPTMR_Type *)(DT_INST_REG_ADDR(0))) #define SIRC_RANGE_8MHZ SCG_SIRCCFG_RANGE(1) #define SIRCDIV3_DIVIDE_BY_1 1 @@ -56,7 +58,7 @@ int z_clock_driver_init(struct device *unused) u32_t csr, psr, sircdiv; /* LPTMR registers */ ARG_UNUSED(unused); - IRQ_CONNECT(DT_OPENISA_RV32M1_LPTMR_SYSTEM_LPTMR_IRQ_0, + IRQ_CONNECT(DT_INST_IRQN(0), 0, lptmr_irq_handler, NULL, 0); if ((SCG->SIRCCSR & SCG_SIRCCSR_SIRCEN_MASK) == SCG_SIRCCSR_SIRCEN(0)) { @@ -122,7 +124,7 @@ int z_clock_driver_init(struct device *unused) * Enable interrupts and the timer. There's no need to clear the * TFC bit in the csr variable, as it's already clear. */ - irq_enable(DT_OPENISA_RV32M1_LPTMR_SYSTEM_LPTMR_IRQ_0); + irq_enable(DT_INST_IRQN(0)); csr = SYSTEM_TIMER_INSTANCE->CSR; csr |= LPTMR_CSR_TEN(1); SYSTEM_TIMER_INSTANCE->CSR = csr;