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

serial: nxp_s32: use instance-based DT macros #64230

Merged

Conversation

manuargue
Copy link
Member

@manuargue manuargue commented Oct 23, 2023

At present, many of the NXP S32 shim drivers do not make use of devicetree instance-based macros because the NXP S32 HAL relies on an index-based approach, requiring knowledge of the peripheral instance index during both compilation and runtime, and this index might not align with the devicetree instance index.

The proposed solution in this patch eliminates this limitation by determining the peripheral instance index during compilation through macrobatics and defining the driver's ISR within the shim driver itself.

Note that for some peripheral instances is needed to redefine the HAL macros of the peripheral base address, since the naming is not uniform for all instances.

west twister -p s32z270dc2_rtu0_r52@D --device-testing --device-serial=/dev/ttyUSB0 -T tests/drivers/uart/ -T tests/drivers/console/
INFO    - Using Ninja..
INFO    - Zephyr version: zephyr-v3.5.0-239-g5a30e6ff013c
INFO    - Using 'zephyr' toolchain.
INFO    - Building initial testsuite list...
INFO    - Writing JSON report /home/user/zephyrproject/zephyr/twister-out/testplan.json

Device testing on:

| Platform              | ID   | Serial device   |
|-----------------------|------|-----------------|
| s32z270dc2_rtu0_r52@D |      | /dev/ttyUSB0    |

INFO    - JOBS: 8
INFO    - Adding tasks to the queue...
INFO    - Added initial list of jobs to queue
INFO    - Total complete:   30/  30  100%  skipped:   29, failed:    0, error:    0
INFO    - 30 test scenarios (30 test instances) selected, 29 configurations skipped (29 by static filter, 0 at runtime).
INFO    - 1 of 30 test configurations passed (100.00%), 0 failed, 0 errored, 29 skipped with 0 warnings in 20.03 seconds
INFO    - In total 1 test cases were executed, 141 skipped on 1 out of total 627 platforms (0.16%)
INFO    - 1 test configurations executed on platforms, 0 test configurations were only built.

@zephyrbot
Copy link
Collaborator

zephyrbot commented Oct 23, 2023

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff

Note: This message is automatically posted and updated by the Manifest GitHub Action.

Copy link
Collaborator

@danieldegrasse danieldegrasse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor nit- can you update commit message to be drivers: serial: ...? This better aligns with the commit messages for most updates to drivers/serial

decsny
decsny previously approved these changes Oct 31, 2023
bperseghetti
bperseghetti previously approved these changes Nov 1, 2023
@manuargue manuargue dismissed stale reviews from bperseghetti and decsny via 09dcf9e November 4, 2023 02:09
@zephyrbot zephyrbot removed the DNM This PR should not be merged (Do Not Merge) label Nov 4, 2023
danieldegrasse
danieldegrasse previously approved these changes Nov 6, 2023
decsny
decsny previously approved these changes Nov 6, 2023
dleach02
dleach02 previously approved these changes Nov 6, 2023
At present, many of the NXP S32 shim drivers do not make use of
devicetree instance-based macros because the NXP S32 HAL relies on an
index-based approach, requiring knowledge of the peripheral instance
index during both compilation and runtime, and this index might not
align with the devicetree instance index.

The proposed solution in this patch eliminates this limitation by
determining the peripheral instance index during compilation
through macrobatics and defining the driver's ISR within the shim
driver itself.

Note that for some peripheral instances is needed to redefine the
HAL macros of the peripheral base address, since the naming is not
uniform for all instances.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
@carlescufi carlescufi merged commit bda3b10 into zephyrproject-rtos:main Nov 8, 2023
18 checks passed
@manuargue manuargue deleted the manuargue-dt-inst-uart branch November 8, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UART Universal Asynchronous Receiver-Transmitter platform: NXP NXP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants