drivers: litex_timer: fix usage of DT_ defines

This commit switches from using device tree automatically
generated address-based defines to the instance id-based ones.

Without this change it is not be possible to re-use the driver
on boards where the device is located at different location
than 0xe0002800.

Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
This commit is contained in:
Mateusz Holenko 2019-10-17 11:50:56 +02:00 committed by Kumar Gala
commit a524373004

View file

@ -10,7 +10,7 @@
#include <irq.h>
#include <drivers/timer/system_timer.h>
#define TIMER_BASE DT_LITEX_TIMER0_E0002800_BASE_ADDRESS
#define TIMER_BASE DT_INST_0_LITEX_TIMER0_BASE_ADDRESS
#define TIMER_LOAD_ADDR ((TIMER_BASE) + 0x00)
#define TIMER_RELOAD_ADDR ((TIMER_BASE) + 0x10)
#define TIMER_EN_ADDR ((TIMER_BASE) + 0x20)
@ -18,7 +18,7 @@
#define TIMER_EV_ENABLE_ADDR ((TIMER_BASE) + 0x40)
#define TIMER_EV 0x1
#define TIMER_IRQ DT_LITEX_TIMER0_E0002800_IRQ_0
#define TIMER_IRQ DT_INST_0_LITEX_TIMER0_IRQ_0
#define TIMER_DISABLE 0x0
#define TIMER_ENABLE 0x1
@ -50,7 +50,7 @@ u32_t z_clock_elapsed(void)
int z_clock_driver_init(struct device *device)
{
ARG_UNUSED(device);
IRQ_CONNECT(TIMER_IRQ, DT_LITEX_TIMER0_E0002800_IRQ_0_PRIORITY,
IRQ_CONNECT(TIMER_IRQ, DT_INST_0_LITEX_TIMER0_IRQ_0_PRIORITY,
litex_timer_irq_handler, NULL, 0);
irq_enable(TIMER_IRQ);