drivers: uart_liteuart: 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 0xe0001800.

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

View file

@ -14,14 +14,14 @@
#define UART_EV_TX (1 << 0)
#define UART_EV_RX (1 << 1)
#define UART_BASE_ADDR DT_LITEX_UART0_E0001800_BASE_ADDRESS
#define UART_BASE_ADDR DT_INST_0_LITEX_UART0_BASE_ADDRESS
#define UART_RXTX ((UART_BASE_ADDR) + 0x00)
#define UART_TXFULL ((UART_BASE_ADDR) + 0x04)
#define UART_RXEMPTY ((UART_BASE_ADDR) + 0x08)
#define UART_EV_STATUS ((UART_BASE_ADDR) + 0x0c)
#define UART_EV_PENDING ((UART_BASE_ADDR) + 0x10)
#define UART_EV_ENABLE ((UART_BASE_ADDR) + 0x14)
#define UART_IRQ DT_LITEX_UART0_E0001800_IRQ_0
#define UART_IRQ DT_INST_0_LITEX_UART0_IRQ_0
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
typedef void (*irq_cfg_func_t)(void);
@ -313,10 +313,10 @@ static int uart_liteuart_init(struct device *dev);
static const struct uart_liteuart_device_config uart_liteuart_dev_cfg_0 = {
.port = UART_BASE_ADDR,
.baud_rate = DT_LITEX_UART0_E0001800_CURRENT_SPEED
.baud_rate = DT_INST_0_LITEX_UART0_CURRENT_SPEED
};
DEVICE_AND_API_INIT(uart_liteuart_0, DT_LITEX_UART0_E0001800_LABEL,
DEVICE_AND_API_INIT(uart_liteuart_0, DT_INST_0_LITEX_UART0_LABEL,
uart_liteuart_init,
&uart_liteuart_data_0, &uart_liteuart_dev_cfg_0,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
@ -327,7 +327,7 @@ static int uart_liteuart_init(struct device *dev)
sys_write8(UART_EV_TX | UART_EV_RX, UART_EV_PENDING);
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
IRQ_CONNECT(UART_IRQ, DT_LITEX_UART0_E0001800_IRQ_0_PRIORITY,
IRQ_CONNECT(UART_IRQ, DT_INST_0_LITEX_UART0_IRQ_0_PRIORITY,
liteuart_uart_irq_handler, DEVICE_GET(uart_liteuart_0),
0);
irq_enable(UART_IRQ);