dts: nrf: Remove UART dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup. Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
This commit is contained in:
parent
c1f7e0c955
commit
34cb33daa8
8 changed files with 72 additions and 115 deletions
|
@ -13,7 +13,8 @@
|
|||
#include <hal/nrf_gpio.h>
|
||||
|
||||
|
||||
static NRF_UART_Type *const uart0_addr = (NRF_UART_Type *)DT_UART_0_BASE;
|
||||
static NRF_UART_Type *const uart0_addr =
|
||||
(NRF_UART_Type *)DT_NORDIC_NRF_UART_UART_0_BASE_ADDRESS;
|
||||
|
||||
#ifdef CONFIG_UART_0_INTERRUPT_DRIVEN
|
||||
|
||||
|
@ -281,7 +282,7 @@ static void uart_nrfx_irq_tx_enable(struct device *dev)
|
|||
/* Due to HW limitation first TXDRDY interrupt shall be
|
||||
* triggered by the software.
|
||||
*/
|
||||
NVIC_SetPendingIRQ(DT_UART_0_IRQ_NUM);
|
||||
NVIC_SetPendingIRQ(DT_NORDIC_NRF_UART_UART_0_IRQ);
|
||||
}
|
||||
irq_unlock(key);
|
||||
}
|
||||
|
@ -404,33 +405,35 @@ static int uart_nrfx_init(struct device *dev)
|
|||
/* Setting default height state of the TX PIN to avoid glitches
|
||||
* on the line during peripheral activation/deactivation.
|
||||
*/
|
||||
nrf_gpio_pin_write(DT_UART_0_TX_PIN, 1);
|
||||
nrf_gpio_cfg_output(DT_UART_0_TX_PIN);
|
||||
nrf_gpio_pin_write(DT_NORDIC_NRF_UART_UART_0_TX_PIN, 1);
|
||||
nrf_gpio_cfg_output(DT_NORDIC_NRF_UART_UART_0_TX_PIN);
|
||||
|
||||
nrf_gpio_cfg_input(DT_UART_0_RX_PIN, NRF_GPIO_PIN_NOPULL);
|
||||
nrf_gpio_cfg_input(DT_NORDIC_NRF_UART_UART_0_RX_PIN,
|
||||
NRF_GPIO_PIN_NOPULL);
|
||||
|
||||
nrf_uart_txrx_pins_set(uart0_addr,
|
||||
DT_UART_0_TX_PIN,
|
||||
DT_UART_0_RX_PIN);
|
||||
DT_NORDIC_NRF_UART_UART_0_TX_PIN,
|
||||
DT_NORDIC_NRF_UART_UART_0_RX_PIN);
|
||||
|
||||
#ifdef CONFIG_UART_0_NRF_FLOW_CONTROL
|
||||
#ifndef DT_UART_0_RTS_PIN
|
||||
#ifndef DT_NORDIC_NRF_UART_UART_0_RTS_PIN
|
||||
#error Flow control for UART0 is enabled, but RTS pin is not defined.
|
||||
#endif
|
||||
#ifndef DT_UART_0_CTS_PIN
|
||||
#ifndef DT_NORDIC_NRF_UART_UART_0_CTS_PIN
|
||||
#error Flow control for UART0 is enabled, but CTS pin is not defined.
|
||||
#endif
|
||||
/* Setting default height state of the RTS PIN to avoid glitches
|
||||
* on the line during peripheral activation/deactivation.
|
||||
*/
|
||||
nrf_gpio_pin_write(DT_UART_0_RTS_PIN, 1);
|
||||
nrf_gpio_cfg_output(DT_UART_0_RTS_PIN);
|
||||
nrf_gpio_pin_write(DT_NORDIC_NRF_UART_UART_0_RTS_PIN, 1);
|
||||
nrf_gpio_cfg_output(DT_NORDIC_NRF_UART_UART_0_RTS_PIN);
|
||||
|
||||
nrf_gpio_cfg_input(DT_UART_0_CTS_PIN, NRF_GPIO_PIN_NOPULL);
|
||||
nrf_gpio_cfg_input(DT_NORDIC_NRF_UART_UART_0_CTS_PIN,
|
||||
NRF_GPIO_PIN_NOPULL);
|
||||
|
||||
nrf_uart_hwfc_pins_set(uart0_addr,
|
||||
DT_UART_0_RTS_PIN,
|
||||
DT_UART_0_CTS_PIN);
|
||||
DT_NORDIC_NRF_UART_UART_0_RTS_PIN,
|
||||
DT_NORDIC_NRF_UART_UART_0_CTS_PIN);
|
||||
#endif /* CONFIG_UART_0_NRF_FLOW_CONTROL */
|
||||
|
||||
nrf_uart_configure(uart0_addr,
|
||||
|
@ -446,7 +449,7 @@ static int uart_nrfx_init(struct device *dev)
|
|||
#endif /* CONFIG_UART_0_NRF_PARITY_BIT */
|
||||
|
||||
/* Set baud rate */
|
||||
err = baudrate_set(dev, DT_UART_0_BAUD_RATE);
|
||||
err = baudrate_set(dev, DT_NORDIC_NRF_UART_UART_0_CURRENT_SPEED);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
@ -467,12 +470,12 @@ static int uart_nrfx_init(struct device *dev)
|
|||
*/
|
||||
uart_sw_event_txdrdy = 1;
|
||||
|
||||
IRQ_CONNECT(DT_UART_0_IRQ_NUM,
|
||||
DT_UART_0_IRQ_PRI,
|
||||
IRQ_CONNECT(DT_NORDIC_NRF_UART_UART_0_IRQ,
|
||||
DT_NORDIC_NRF_UART_UART_0_IRQ_PRIORITY,
|
||||
uart_nrfx_isr,
|
||||
DEVICE_GET(uart_nrfx_uart0),
|
||||
0);
|
||||
irq_enable(DT_UART_0_IRQ_NUM);
|
||||
irq_enable(DT_NORDIC_NRF_UART_UART_0_IRQ);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -540,7 +543,7 @@ static int uart_nrfx_pm_control(struct device *dev,
|
|||
#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */
|
||||
|
||||
DEVICE_DEFINE(uart_nrfx_uart0,
|
||||
DT_UART_0_NAME,
|
||||
DT_NORDIC_NRF_UART_UART_0_LABEL,
|
||||
uart_nrfx_init,
|
||||
uart_nrfx_pm_control,
|
||||
NULL,
|
||||
|
|
|
@ -502,42 +502,44 @@ static int uarte_instance_init(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define UART_NRF_UARTE_DEVICE(idx) \
|
||||
DEVICE_DECLARE(uart_nrfx_uarte##idx); \
|
||||
UARTE_##idx##_CREATE_TX_BUFF; \
|
||||
static struct uarte_nrfx_data uarte_##idx##_data = { \
|
||||
UARTE_##idx##_DATA_INIT \
|
||||
}; \
|
||||
static const struct uarte_nrfx_config uarte_##idx##_config = { \
|
||||
.uarte_regs = (NRF_UARTE_Type *)DT_UART_##idx##_BASE, \
|
||||
UARTE_##idx##_CONFIG_INIT \
|
||||
}; \
|
||||
static int uarte_##idx##_init(struct device *dev) \
|
||||
{ \
|
||||
const struct uarte_init_config init_config = { \
|
||||
.pseltxd = DT_UART_##idx##_TX_PIN, \
|
||||
.pselrxd = DT_UART_##idx##_RX_PIN, \
|
||||
UARTE_##idx##_NRF_HWFC_CONFIG \
|
||||
.parity = UARTE_##idx##_NRF_PARITY_BIT, \
|
||||
.baudrate = DT_UART_##idx##_BAUD_RATE \
|
||||
}; \
|
||||
UARTE_##idx##_INTERRUPTS_INIT(); \
|
||||
return uarte_instance_init(dev, \
|
||||
&init_config, \
|
||||
UARTE_##idx##_INTERRUPT_DRIVEN); \
|
||||
} \
|
||||
DEVICE_AND_API_INIT(uart_nrfx_uarte##idx, \
|
||||
DT_UART_##idx##_NAME, \
|
||||
uarte_##idx##_init, \
|
||||
&uarte_##idx##_data, \
|
||||
&uarte_##idx##_config, \
|
||||
PRE_KERNEL_1, \
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||
&uart_nrfx_uarte_driver_api)
|
||||
#define UART_NRF_UARTE_DEVICE(idx) \
|
||||
DEVICE_DECLARE(uart_nrfx_uarte##idx); \
|
||||
UARTE_##idx##_CREATE_TX_BUFF; \
|
||||
static struct uarte_nrfx_data uarte_##idx##_data = { \
|
||||
UARTE_##idx##_DATA_INIT \
|
||||
}; \
|
||||
static const struct uarte_nrfx_config uarte_##idx##_config = { \
|
||||
.uarte_regs = (NRF_UARTE_Type *) \
|
||||
DT_NORDIC_NRF_UARTE_UART_##idx##_BASE_ADDRESS, \
|
||||
UARTE_##idx##_CONFIG_INIT \
|
||||
}; \
|
||||
static int uarte_##idx##_init(struct device *dev) \
|
||||
{ \
|
||||
const struct uarte_init_config init_config = { \
|
||||
.pseltxd = DT_NORDIC_NRF_UARTE_UART_##idx##_TX_PIN, \
|
||||
.pselrxd = DT_NORDIC_NRF_UARTE_UART_##idx##_RX_PIN, \
|
||||
UARTE_##idx##_NRF_HWFC_CONFIG \
|
||||
.parity = UARTE_##idx##_NRF_PARITY_BIT, \
|
||||
.baudrate = \
|
||||
DT_NORDIC_NRF_UARTE_UART_##idx##_CURRENT_SPEED \
|
||||
}; \
|
||||
UARTE_##idx##_INTERRUPTS_INIT(); \
|
||||
return uarte_instance_init(dev, \
|
||||
&init_config, \
|
||||
UARTE_##idx##_INTERRUPT_DRIVEN); \
|
||||
} \
|
||||
DEVICE_AND_API_INIT(uart_nrfx_uarte##idx, \
|
||||
DT_NORDIC_NRF_UARTE_UART_##idx##_LABEL, \
|
||||
uarte_##idx##_init, \
|
||||
&uarte_##idx##_data, \
|
||||
&uarte_##idx##_config, \
|
||||
PRE_KERNEL_1, \
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||
&uart_nrfx_uarte_driver_api)
|
||||
|
||||
#define UARTE_NRF_HWFC_ENABLED(idx) \
|
||||
.pselcts = DT_UART_##idx##_CTS_PIN, \
|
||||
.pselrts = DT_UART_##idx##_RTS_PIN, \
|
||||
.pselcts = DT_NORDIC_NRF_UARTE_UART_##idx##_CTS_PIN, \
|
||||
.pselrts = DT_NORDIC_NRF_UARTE_UART_##idx##_RTS_PIN, \
|
||||
.hwfc = NRF_UARTE_HWFC_ENABLED,
|
||||
#define UARTE_NRF_HWFC_DISABLED \
|
||||
.pselcts = NRF_UARTE_PSEL_DISCONNECTED, \
|
||||
|
@ -546,11 +548,11 @@ static int uarte_instance_init(struct device *dev,
|
|||
|
||||
#define UARTE_NRF_IRQ_ENABLED(idx) \
|
||||
IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_UARTE##idx), \
|
||||
DT_UART_##idx##_IRQ_PRI, \
|
||||
DT_NORDIC_NRF_UARTE_UART_##idx##_IRQ_PRIORITY, \
|
||||
uarte_nrfx_isr, \
|
||||
DEVICE_GET(uart_nrfx_uarte##idx), \
|
||||
0); \
|
||||
irq_enable(DT_UART_##idx##_IRQ_NUM)
|
||||
irq_enable(DT_NORDIC_NRF_UARTE_UART_##idx##_IRQ)
|
||||
|
||||
#define UARTE_TX_BUFFER_SIZE(idx) \
|
||||
CONFIG_UART_##idx##_NRF_TX_BUFFER_SIZE < \
|
||||
|
@ -584,10 +586,10 @@ static int uarte_instance_init(struct device *dev,
|
|||
|
||||
#ifdef CONFIG_UART_0_NRF_FLOW_CONTROL
|
||||
#define UARTE_0_NRF_HWFC_CONFIG UARTE_NRF_HWFC_ENABLED(0)
|
||||
#ifndef DT_UART_0_RTS_PIN
|
||||
#ifndef DT_NORDIC_NRF_UARTE_UART_0_RTS_PIN
|
||||
#error Flow control for UARTE0 is enabled, but RTS pin is not defined.
|
||||
#endif
|
||||
#ifndef DT_UART_0_CTS_PIN
|
||||
#ifndef DT_NORDIC_NRF_UARTE_UART_0_CTS_PIN
|
||||
#error Flow control for UARTE0 is enabled, but CTS pin is not defined.
|
||||
#endif
|
||||
#else
|
||||
|
@ -620,10 +622,10 @@ static int uarte_instance_init(struct device *dev,
|
|||
|
||||
#ifdef CONFIG_UART_1_NRF_FLOW_CONTROL
|
||||
#define UARTE_1_NRF_HWFC_CONFIG UARTE_NRF_HWFC_ENABLED(1)
|
||||
#ifndef DT_UART_1_RTS_PIN
|
||||
#ifndef DT_NORDIC_NRF_UARTE_UART_1_RTS_PIN
|
||||
#error Flow control for UARTE1 is enabled, but RTS pin is not defined.
|
||||
#endif
|
||||
#ifndef DT_UART_1_CTS_PIN
|
||||
#ifndef DT_NORDIC_NRF_UARTE_UART_1_CTS_PIN
|
||||
#error Flow control for UARTE1 is enabled, but CTS pin is not defined.
|
||||
#endif
|
||||
#else
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
i2c-1 = &i2c1;
|
||||
spi-0 = &spi0;
|
||||
spi-1 = &spi1;
|
||||
uart-0 = &uart0;
|
||||
};
|
||||
|
||||
soc {
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
aliases {
|
||||
i2c-0 = &i2c0;
|
||||
spi-0 = &spi0;
|
||||
uart-0 = &uart0;
|
||||
};
|
||||
|
||||
soc {
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
spi-0 = &spi0;
|
||||
spi-1 = &spi1;
|
||||
spi-2 = &spi2;
|
||||
uart-0 = &uart0;
|
||||
};
|
||||
|
||||
soc {
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
spi-1 = &spi1;
|
||||
spi-2 = &spi2;
|
||||
spi-3 = &spi3;
|
||||
uart-0 = &uart0;
|
||||
uart-1 = &uart1;
|
||||
};
|
||||
|
||||
soc {
|
||||
|
|
|
@ -6,19 +6,7 @@
|
|||
#define CONFIG_ADC_0_IRQ_PRI DT_NORDIC_NRF_ADC_40007000_IRQ_0_PRIORITY
|
||||
#define CONFIG_ADC_0_NAME DT_NORDIC_NRF_ADC_40007000_LABEL
|
||||
|
||||
#define DT_UART_0_BASE DT_NORDIC_NRF_UART_40002000_BASE_ADDRESS
|
||||
#define DT_UART_0_IRQ_PRI DT_NORDIC_NRF_UART_40002000_IRQ_0_PRIORITY
|
||||
#define DT_UART_0_IRQ_NUM DT_NORDIC_NRF_UART_40002000_IRQ_0
|
||||
#define DT_UART_0_BAUD_RATE DT_NORDIC_NRF_UART_40002000_CURRENT_SPEED
|
||||
#define DT_UART_0_NAME DT_NORDIC_NRF_UART_40002000_LABEL
|
||||
#define DT_UART_0_TX_PIN DT_NORDIC_NRF_UART_40002000_TX_PIN
|
||||
#define DT_UART_0_RX_PIN DT_NORDIC_NRF_UART_40002000_RX_PIN
|
||||
#if defined(DT_NORDIC_NRF_UART_40002000_RTS_PIN)
|
||||
#define DT_UART_0_RTS_PIN DT_NORDIC_NRF_UART_40002000_RTS_PIN
|
||||
#endif
|
||||
#if defined(DT_NORDIC_NRF_UART_40002000_CTS_PIN)
|
||||
#define DT_UART_0_CTS_PIN DT_NORDIC_NRF_UART_40002000_CTS_PIN
|
||||
#endif
|
||||
#define DT_UART_0_NAME DT_NORDIC_NRF_UART_UART_0_LABEL
|
||||
|
||||
#define DT_FLASH_DEV_NAME DT_NRF_NRF51_FLASH_CONTROLLER_4001E000_LABEL
|
||||
|
||||
|
|
|
@ -6,49 +6,8 @@
|
|||
#define CONFIG_ADC_0_IRQ_PRI DT_NORDIC_NRF_SAADC_40007000_IRQ_0_PRIORITY
|
||||
#define CONFIG_ADC_0_NAME DT_NORDIC_NRF_SAADC_40007000_LABEL
|
||||
|
||||
#if defined(DT_NORDIC_NRF_UARTE_40002000_BASE_ADDRESS)
|
||||
#define DT_UART_0_BASE DT_NORDIC_NRF_UARTE_40002000_BASE_ADDRESS
|
||||
#define DT_UART_0_IRQ_PRI DT_NORDIC_NRF_UARTE_40002000_IRQ_0_PRIORITY
|
||||
#define DT_UART_0_IRQ_NUM DT_NORDIC_NRF_UARTE_40002000_IRQ_0
|
||||
#define DT_UART_0_BAUD_RATE DT_NORDIC_NRF_UARTE_40002000_CURRENT_SPEED
|
||||
#define DT_UART_0_NAME DT_NORDIC_NRF_UARTE_40002000_LABEL
|
||||
#define DT_UART_0_TX_PIN DT_NORDIC_NRF_UARTE_40002000_TX_PIN
|
||||
#define DT_UART_0_RX_PIN DT_NORDIC_NRF_UARTE_40002000_RX_PIN
|
||||
#if defined(DT_NORDIC_NRF_UARTE_40002000_RTS_PIN)
|
||||
#define DT_UART_0_RTS_PIN DT_NORDIC_NRF_UARTE_40002000_RTS_PIN
|
||||
#endif
|
||||
#if defined(DT_NORDIC_NRF_UARTE_40002000_CTS_PIN)
|
||||
#define DT_UART_0_CTS_PIN DT_NORDIC_NRF_UARTE_40002000_CTS_PIN
|
||||
#endif
|
||||
#else
|
||||
#define DT_UART_0_BASE DT_NORDIC_NRF_UART_40002000_BASE_ADDRESS
|
||||
#define DT_UART_0_IRQ_PRI DT_NORDIC_NRF_UART_40002000_IRQ_0_PRIORITY
|
||||
#define DT_UART_0_IRQ_NUM DT_NORDIC_NRF_UART_40002000_IRQ_0
|
||||
#define DT_UART_0_BAUD_RATE DT_NORDIC_NRF_UART_40002000_CURRENT_SPEED
|
||||
#define DT_UART_0_NAME DT_NORDIC_NRF_UART_40002000_LABEL
|
||||
#define DT_UART_0_TX_PIN DT_NORDIC_NRF_UART_40002000_TX_PIN
|
||||
#define DT_UART_0_RX_PIN DT_NORDIC_NRF_UART_40002000_RX_PIN
|
||||
#if defined(DT_NORDIC_NRF_UART_40002000_RTS_PIN)
|
||||
#define DT_UART_0_RTS_PIN DT_NORDIC_NRF_UART_40002000_RTS_PIN
|
||||
#endif
|
||||
#if defined(DT_NORDIC_NRF_UART_40002000_RTS_PIN)
|
||||
#define DT_UART_0_CTS_PIN DT_NORDIC_NRF_UART_40002000_CTS_PIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DT_UART_1_BASE DT_NORDIC_NRF_UARTE_40028000_BASE_ADDRESS
|
||||
#define DT_UART_1_IRQ_PRI DT_NORDIC_NRF_UARTE_40028000_IRQ_0_PRIORITY
|
||||
#define DT_UART_1_IRQ_NUM DT_NORDIC_NRF_UARTE_40028000_IRQ_0
|
||||
#define DT_UART_1_BAUD_RATE DT_NORDIC_NRF_UARTE_40028000_CURRENT_SPEED
|
||||
#define DT_UART_1_NAME DT_NORDIC_NRF_UARTE_40028000_LABEL
|
||||
#define DT_UART_1_TX_PIN DT_NORDIC_NRF_UARTE_40028000_TX_PIN
|
||||
#define DT_UART_1_RX_PIN DT_NORDIC_NRF_UARTE_40028000_RX_PIN
|
||||
#if defined(DT_NORDIC_NRF_UARTE_40028000_RTS_PIN)
|
||||
#define DT_UART_1_RTS_PIN DT_NORDIC_NRF_UARTE_40028000_RTS_PIN
|
||||
#endif
|
||||
#if defined(DT_NORDIC_NRF_UARTE_40028000_CTS_PIN)
|
||||
#define DT_UART_1_CTS_PIN DT_NORDIC_NRF_UARTE_40028000_CTS_PIN
|
||||
#endif
|
||||
#define DT_UART_0_NAME DT_NORDIC_NRF_UART_UART_0_LABEL
|
||||
#define DT_UART_1_NAME DT_NORDIC_NRF_UART_UART_1_LABEL
|
||||
|
||||
#define DT_FLASH_DEV_NAME DT_NRF_NRF52_FLASH_CONTROLLER_4001E000_LABEL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue