drivers: timer: rv32m1_lptmr: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
8c60bc0b07
commit
ec048128ae
1 changed files with 5 additions and 3 deletions
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT openisa_rv32m1_lptmr
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <sys/util.h>
|
||||
#include <drivers/timer/system_timer.h>
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue