Skip to content
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

drivers: uart: nrfx_uarte: Major rework of the legacy UART shim to allow using it for nrf54x #75462

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0292896
drivers: serial: nrfx_uarte: Remove CONFIG_UART_n_GPIO_MANAGEMENT
nordic-krch Sep 20, 2024
31e95ef
drivers: serial: nrfx_uarte: Rework driver to support new features
nordic-krch Jul 4, 2024
523733a
drivers: serial: nrfx_uarte: Add support for DMM and cache
nordic-krch Sep 16, 2024
4005737
drivers: serial: nrfx_uarte: Improve RX FIFO flush workaround
nordic-krch Jul 9, 2024
f6ebcec
drivers: serial: nrfx_uarte: Add workaround for BAUDRATE register
nordic-krch Sep 17, 2024
70919e5
drivers: serial: nrfx_uarte: Add lock to uart_rx_disable
nordic-krch Sep 17, 2024
cd57e0d
drivers: serial: nrfx_uarte: Add runtime PM
nordic-krch Sep 16, 2024
40c4f0c
drivers: serial: nrfx: Use legacy shim by default
nordic-krch Oct 7, 2024
ffe83aa
boards: nordic: nrf54h20dk: Disable asserts on cpuppr for tests
nordic-krch Jun 13, 2024
426e0c7
tests: drivers: uart: Add test for async API using two instance
nordic-krch May 31, 2024
ae36199
tests: drivers: uart: async_api: Add nrf54h20 cpuppr
nordic-krch Jun 26, 2024
3ec5836
tests: drivers: uart: async_api: Add missing static keyword
nordic-krch Jul 18, 2024
005bf6e
tests: drivers: uart: async_api: Rework for multi instance
nordic-krch Jul 18, 2024
74be565
tests: drivers: uart: async_api: Fix nrf54h20dk cpurad
nordic-krch Jul 19, 2024
1ae57f7
tests: drivers: uart: async_api: Add uart120 instance to nrf54h20dk
nordic-krch Jul 18, 2024
fc1aec3
tests: drivers: uart: mix_fifo_poll: Add nrf54h20 cpuppr
nordic-krch Jul 4, 2024
c7c225d
tests: drivers: uart: mix_fifo_poll: Rework to support multi-instance
nordic-krch Jul 19, 2024
50a473c
tests: drivers: uart: mix_fifo_poll: Add UARTE120 to nrf54h20dk test
nordic-krch Jul 19, 2024
4ce5e1a
tests: drivers: uart: async_dual: Rework for multi-instance
nordic-krch Jul 19, 2024
f489baa
tests: drivers: uart: async_dual: Add testing of UARTE120
nordic-krch Jul 19, 2024
522bc78
tests: drivers: uart: async_dual: Add test cases with runtime PM
nordic-krch Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions boards/nordic/nrf54h20dk/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ config BT_CTLR
default y if BT

endif # BOARD_NRF54H20DK_NRF54H20_CPURAD

if BOARD_NRF54H20DK_NRF54H20_CPUPPR

# As PPR has limited memory most of tests does not fit with asserts enabled.
config ASSERT
default n

endif # BOARD_NRF54H20DK_NRF54H20_CPUPPR
26 changes: 22 additions & 4 deletions drivers/serial/Kconfig.nrfx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ config UART_NRFX_UARTE
config UART_NRFX_UARTE_LEGACY_SHIM
bool "Legacy UARTE shim"
depends on UART_NRFX_UARTE
depends on !SOC_SERIES_NRF54LX
depends on !SOC_SERIES_NRF54HX || RISCV
depends on !SOC_SERIES_NRF92X || RISCV
# New shim takes more ROM. Until it is fixed use legacy shim.
default y

config UART_NRFX_UARTE_ENHANCED_RX
bool "Enhanced RX handling"
depends on UART_ASYNC_API
depends on UART_NRFX_UARTE_LEGACY_SHIM
default y if !(UART_0_NRF_HW_ASYNC || UART_1_NRF_HW_ASYNC || UART_2_NRF_HW_ASYNC)
help
Enable RX handling mode which is switching buffers on timeout. This is an
enhancement compared to other two modes (default and hardware assisted).
Default mode could miscount bytes when interrupt was not handled on time
and hardware assisted required TIMER peripheral instance and PPI channel
for accurate byte counting.

config UART_ASYNC_TX_CACHE_SIZE
int "TX cache buffer size"
depends on UART_ASYNC_API
Expand All @@ -47,6 +55,16 @@ config UART_ASYNC_TX_CACHE_SIZE
in RAM, because EasyDMA in UARTE peripherals can only transfer data
from RAM.

config UART_NRFX_UARTE_RX_FLUSH_MAGIC_BYTE
int "Byte used for RX FIFO flush workaround"
default 171
range 0 255
help
Byte used to fill the buffer before RX FIFO is flushed into it. Due to the
HW anomaly a workaround need to be applied which checks if content of the
buffer changed. There are cases when specific value of the magic byte is
used if it is known that certain bytes are less likely to occur.

if HAS_HW_NRF_UART0 || HAS_HW_NRF_UARTE0
nrfx_uart_num = 0
rsource "Kconfig.nrfx_uart_instance"
Expand Down
11 changes: 2 additions & 9 deletions drivers/serial/Kconfig.nrfx_uart_instance
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER
depends on HAS_HW_NRF_UARTE$(nrfx_uart_num)
depends on UART_ASYNC_API
depends on UART_NRFX_UARTE_LEGACY_SHIM
depends on !PM_DEVICE
default y
help
When enabled, UARTE is enabled before each TX or RX usage and disabled
when not used. Disabling UARTE while in idle allows to achieve lowest
Expand Down Expand Up @@ -119,12 +121,3 @@ config UART_$(nrfx_uart_num)_A2I_RX_BUF_COUNT
default 0
help
Number of chunks into RX space is divided.

config UART_$(nrfx_uart_num)_GPIO_MANAGEMENT
bool "GPIO management on port $(nrfx_uart_num)"
depends on PM_DEVICE
default y
help
If enabled, the driver will configure the GPIOs used by the uart to
their default configuration when device is powered down. The GPIOs
will be configured back to correct state when UART is powered up.
19 changes: 6 additions & 13 deletions drivers/serial/uart_nrfx_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,12 +1086,9 @@ static int uart_nrfx_pm_action(const struct device *dev,

switch (action) {
case PM_DEVICE_ACTION_RESUME:
if (IS_ENABLED(CONFIG_UART_0_GPIO_MANAGEMENT)) {
ret = pinctrl_apply_state(config->pcfg,
PINCTRL_STATE_DEFAULT);
if (ret < 0) {
return ret;
}
ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);
if (ret < 0) {
return ret;
}

nrf_uart_enable(uart0_addr);
Expand All @@ -1102,13 +1099,9 @@ static int uart_nrfx_pm_action(const struct device *dev,
break;
case PM_DEVICE_ACTION_SUSPEND:
nrf_uart_disable(uart0_addr);

if (IS_ENABLED(CONFIG_UART_0_GPIO_MANAGEMENT)) {
ret = pinctrl_apply_state(config->pcfg,
PINCTRL_STATE_SLEEP);
if (ret < 0) {
return ret;
}
ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
if (ret < 0) {
return ret;
}
break;
default:
Expand Down
Loading
Loading