drivers: serial: convert nrf drivers to dt device defines

Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-10-29 10:28:11 -05:00 committed by Anas Nashif
commit cf33927933
2 changed files with 8 additions and 10 deletions

View file

@ -52,7 +52,7 @@ BUILD_ASSERT((PROP(hw_flow_control) && HW_FLOW_CONTROL_AVAILABLE) ||
static NRF_UART_Type *const uart0_addr = (NRF_UART_Type *)DT_INST_REG_ADDR(0);
DEVICE_DECLARE(uart_nrfx_uart0);
DEVICE_DT_DECLARE(DT_DRV_INST(0));
/* Device data structure */
struct uart_nrfx_data {
@ -755,7 +755,7 @@ void uart_nrfx_isr(const struct device *uart)
static void rx_timeout(struct k_timer *timer)
{
rx_rdy_evt(DEVICE_GET(uart_nrfx_uart0));
rx_rdy_evt(DEVICE_DT_GET(DT_DRV_INST(0)));
}
#if HW_FLOW_CONTROL_AVAILABLE
@ -772,7 +772,7 @@ static void tx_timeout(struct k_timer *timer)
evt.data.tx.len = uart0_cb.tx_buffer_length;
uart0_cb.tx_buffer_length = 0;
uart0_cb.tx_counter = 0;
user_callback(DEVICE_GET(uart_nrfx_uart0), &evt);
user_callback(DEVICE_DT_GET(DT_DRV_INST(0)), &evt);
}
#endif
@ -1042,7 +1042,7 @@ static int uart_nrfx_init(const struct device *dev)
IRQ_CONNECT(IRQN,
IRQ_PRIO,
uart_nrfx_isr,
DEVICE_GET(uart_nrfx_uart0),
DEVICE_DT_GET(DT_DRV_INST(0)),
0);
irq_enable(IRQN);
#endif
@ -1195,8 +1195,7 @@ static struct uart_nrfx_data uart_nrfx_uart0_data = {
}
};
DEVICE_DEFINE(uart_nrfx_uart0,
DT_INST_LABEL(0),
DEVICE_DT_DEFINE(DT_DRV_INST(0),
uart_nrfx_init,
uart_nrfx_pm_control,
&uart_nrfx_uart0_data,

View file

@ -1625,7 +1625,7 @@ static int uarte_nrfx_pm_control(const struct device *dev,
#define UARTE_IRQ_CONFIGURE(idx, isr_handler) \
do { \
IRQ_CONNECT(DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority), \
isr_handler, DEVICE_GET(uart_nrfx_uarte##idx), 0); \
isr_handler, DEVICE_DT_GET(UARTE(idx)), 0); \
irq_enable(DT_IRQN(UARTE(idx))); \
} while (0)
@ -1638,7 +1638,7 @@ static int uarte_nrfx_pm_control(const struct device *dev,
#define UART_NRF_UARTE_DEVICE(idx) \
HWFC_CONFIG_CHECK(idx); \
DEVICE_DECLARE(uart_nrfx_uarte##idx); \
DEVICE_DT_DECLARE(UARTE(idx)); \
UARTE_INT_DRIVEN(idx); \
UARTE_ASYNC(idx); \
static struct uarte_nrfx_data uarte_##idx##_data = { \
@ -1675,8 +1675,7 @@ static int uarte_nrfx_pm_control(const struct device *dev,
&init_config, \
IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN)); \
} \
DEVICE_DEFINE(uart_nrfx_uarte##idx, \
DT_LABEL(UARTE(idx)), \
DEVICE_DT_DEFINE(UARTE(idx), \
uarte_##idx##_init, \
uarte_nrfx_pm_control, \
&uarte_##idx##_data, \