-
Notifications
You must be signed in to change notification settings - Fork 724
drivers: serial: nrfx_uarte: Legacy shim rework to support nrf54x and runtime device PM #2146
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3e9affe to
45f28f2
Compare
45f28f2 to
adc9b32
Compare
462733d to
2bcb6b3
Compare
… structure Split async control block structure into tx and rx structures. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 701beec)
…operty Add property which indicates that UARTE support frame timeout feature. Property is added to nrf54h20, nrf9280, nrf54l20 and nrf54l15. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit ac1cc17)
…_MANAGEMENT This is a leftover from pre-pinctrl era and no longer makes sense. Driver always manages gpio through pinctrl. Support removed from uart and uarte shims. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 76db5b2)
…O_MANAGEMENT Remove Kconfig option that no longer has any use after pinctrl driver is introduced. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit cae53af)
…MENT removal Add note that those Kconfig options were removed from Nordic UART driver configuration. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 3a4c5a9)
Use nrfx_gppi as abstraction over (D)PPI. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 2668476)
…struct pointer Refactor RX asynchronous API function to use a pointer to the RX async data structure instead of top level data structure pointer. It improves readability with more concise code. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit d82808e)
…new features Rework driver to support new way of asynchronous RX handling. Previously RX was handled in two modes: using RXDRDY interrupt for byte counting or TIMER + PPI. Both modes had flaws. RXDRDY interrupt mode could miscalculated amount of received bytes when interrupt was not handled on time. Data was not lost but was not reported on time that could lead to issues. PPI+TIMER mode requires additional resources thus it was not the default mode. Often user was not aware of that option and was expiriencing driver RX faults. New RX mode is switching buffers when there is new data (RXDRDY event not set for given amount of time). It does not require additional resources to get precise byte counting. Additionally, this is in line with new UARTE feature (RX frame timeout) which is present in nRF54X devices. The behavior of the driver is the same for legacy devices and new one. For legacy devices k_timer periodic interrupts are used to check if there are any new bytes and it is not needed when RX frame timeout is present. Improved RX mode is enabled by default (CONFIG_UART_NRFX_UARTE_ENHANCED_RX=y) but legacy modes are still available though not recommended to be used. Note that new RX mode (CONFIG_UART_NRFX_UARTE_ENHANCED_RX=y) behaves a bit different because timeout always triggers switch of buffers which means that there will be no UART_RX_RDY events with non-zero offset. It also means that every UART_RX_RDY will be followed by UART_RX_BUF_RELEASED. After rework, driver is recommended to be used for all platforms as it performs much better and takes much less code than the second UART shim available for Nordic devices. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 399a235)
…eout Frame timeout is a hardware feature present in newer versions of UARTE (e.g. in NRF54X platforms) for detecting idle state on RX line and ending RX after configurable timeout. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 1f96e62)
…ache Add support for DMM which manages cache and dedicated memory spaces. Added support for data cache for buffers which are not DMM managed. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 9517106)
…karound Add configurable magic byte instead of fixed 0xAA. In some cases, it is known that certain bytes are less likely in the transmission and picking specific magic byte may reduce probability of failure of detection of the correct amount of flushed data. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 7735302)
…TE register On uart120 BAUDRATE register is not retained when ENABLE=0 and because of that BAUDRATE must be set after enabling. Add workaround to the driver. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 5eaafba)
Add lock to fix race when uart_rx_disable is interrupted by RXTO event which lead to driver state corruption. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 317de0c)
Add include path to nordic/soc/nordic/common where some internal headers for nordic devices are kept (e.g. dmm.h). Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit ec224fd)
…igurable One of the test case is performing long transfers using 1k buffers. For some targets there may be not enough RAM to perform such transfers. Make long buffer length configurable. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit d612982)
…r for nrf54h20 nrf54h20dk_nrf54h20_cpurad by default has less RAM dedicated for DMA transfers and default 1k buffer cannot be used for uart_async_long_buf case. Use custom value. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit d480093)
…cpuapp overlay Add overlay for nrf54l15dk/nrf54l15/cpuapp target. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit a04c1db)
A code ifdefed by UARTE_BAUDRATE_RETENTION_WORKAROUND was missing a closing bracket. It was missed because CI did not compile any target that is applying this workaround and enables code compilation. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit a98bde9)
…m a structure Remove aborted flag from uarte_async_rx structure. Flag is not used. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit cfc87da)
Add runtime PM to the driver. When asynchronous or interrupt driven API is used, there are 3 independent paths for enabling the device: RX, TX and TX poll_out. TX poll_out requires special handling because number of poll_out calls does not need to much number of TXSTOPPED interrupts. To handle that special flag is added. For standard RX and TX is simpler. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 3ce19da)
…workaround Improved a workaround. When FIFO is not empty then FLUSHRX task will generate RXSTARTED event to indicated that DMA transfer was started. This property can be used to detect when FIFO was not empty and workaroud a HW bug where RX.AMOUNT register is not updated after flushing empty FIFO. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 68903ca)
So far new platforms did not use legacy shim but it shall be now a default uart shim for all platforms. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 7e94fca)
Optimize function which enables UARTE peripheral. It is called only when interrupts are locked so data->flags does not require atomic operation. Use standard logical operations so save few bytes. Simplify uarte_disable_locked. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 9ccaf9b)
|
@anangl @bjarki-andreasen PR contains all fromtree UART changes. |
anangl
approved these changes
Oct 28, 2024
bjarki-andreasen
approved these changes
Oct 28, 2024
trantanen
added a commit
to trantanen/sdk-nrf
that referenced
this pull request
Oct 30, 2024
Setting CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n because having it enabled makes Thingy91x jam early in the boot. Suspecting nrfconnect/sdk-zephyr#2146 Proper fix will be analyzed and handled in NCSDK-29992. Signed-off-by: Tommi Rantanen <[email protected]>
nordicjm
pushed a commit
to nrfconnect/sdk-nrf
that referenced
this pull request
Oct 31, 2024
Setting CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n because having it enabled makes Thingy91x jam early in the boot. Suspecting nrfconnect/sdk-zephyr#2146 Proper fix will be analyzed and handled in NCSDK-29992. Signed-off-by: Tommi Rantanen <[email protected]>
NordicBuilder
pushed a commit
to nrfconnect/sdk-nrf
that referenced
this pull request
Oct 31, 2024
Setting CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n because having it enabled makes Thingy91x jam early in the boot. Suspecting nrfconnect/sdk-zephyr#2146 Proper fix will be analyzed and handled in NCSDK-29992. Signed-off-by: Tommi Rantanen <[email protected]> (cherry picked from commit 5c5c153)
rlubos
pushed a commit
to nrfconnect/sdk-nrf
that referenced
this pull request
Oct 31, 2024
Setting CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n because having it enabled makes Thingy91x jam early in the boot. Suspecting nrfconnect/sdk-zephyr#2146 Proper fix will be analyzed and handled in NCSDK-29992. Signed-off-by: Tommi Rantanen <[email protected]> (cherry picked from commit 5c5c153)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes from upstream and upstream PR zephyrproject-rtos/zephyr#80201