-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Serial driver migration to DT #8847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serial driver migration to DT #8847
Conversation
@anangl @ioannisg @carlescufi : please take a look |
e1b35df
to
7d28a65
Compare
Codecov Report
@@ Coverage Diff @@
## master #8847 +/- ##
=======================================
Coverage 52.31% 52.31%
=======================================
Files 195 195
Lines 24732 24732
Branches 5141 5141
=======================================
Hits 12939 12939
Misses 9719 9719
Partials 2074 2074 Continue to review full report at Codecov.
|
drivers/serial/uart_nrfx_uarte.c
Outdated
@@ -563,6 +567,9 @@ static int uarte_instance_init(struct device *dev, | |||
#define UARTE_CONFIG_INT(idx) \ | |||
.tx_buff_size = UARTE_TX_BUFFER_SIZE(idx) | |||
|
|||
#define UARTE_IRQ_NUMBER_SET(idx) \ | |||
.irq_number = CONFIG_UART_##idx##_IRQ_NUM, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a dedicated field for this, it would be better to move irq_enable
to the UARTE_NRF_IRQ_ENABLED
macro.
drivers/serial/uart_nrfx_uart.c
Outdated
@@ -13,6 +13,8 @@ | |||
#include <hal/nrf_gpio.h> | |||
|
|||
|
|||
static NRF_UART_Type *uart_addr = (NRF_UART_Type *)CONFIG_UART_0_BASE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: uart_addr -> uart0_addr
7d28a65
to
f5644a0
Compare
Fixed |
drivers/serial/uart_nrfx_uart.c
Outdated
@@ -13,6 +13,8 @@ | |||
#include <hal/nrf_gpio.h> | |||
|
|||
|
|||
static NRF_UART_Type *uart0_addr = (NRF_UART_Type *)CONFIG_UART_0_BASE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add const
. After the *
, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
1. dts.fixup files updated with peripheral address and IRQ NUMBER. 2. Peripheral address is taken from DT. 3. IRQ number is taken from DT. Signed-off-by: Jakub Rzeszutko <[email protected]>
f5644a0
to
916ecab
Compare
@@ -483,9 +483,6 @@ static int uarte_instance_init(struct device *dev, | |||
|
|||
#if UARTE_INTERRUPT_DRIVEN | |||
if (interrupts_active) { | |||
|
|||
irq_enable(NRFX_IRQ_NUMBER_GET(uarte)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see this is moved to the UARTE___IRQ_ENABLED() macro function
@@ -549,7 +546,8 @@ static int uarte_instance_init(struct device *dev, | |||
CONFIG_UART_##idx##_IRQ_PRI, \ | |||
uarte_nrfx_isr, \ | |||
DEVICE_GET(uart_nrfx_uarte##idx), \ | |||
0) | |||
0); \ | |||
irq_enable(CONFIG_UART_##idx##_IRQ_NUM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if this should be UARTE_, instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is convention from DT and driver names like:
uart_nrfx_uarte.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see that .fixup defines same macros for UART and UARTE devices
No description provided.