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

Enable S32K3 WKPU IP block to pass interrupt trigger through GPIO #62623

Merged
merged 7 commits into from
Oct 11, 2023

Conversation

manuargue
Copy link
Member

@manuargue manuargue commented Sep 14, 2023

This PR introduces an interrupt controller driver for the NXP S32 WKPU and integrates it with the GPIO driver to extend the number of GPIO pins that can interrupt the core.

GPIO pins that are input-interrupt capable support triggering SIUL2 EIRQ interrupts (existing interrupt controller implementation) and/or WKPU interrupts (introduced in this patch). To configure WKPU to trigger an interrupt from a GPIO pin, a SoC-specific flag must be supplied to the gpios specifier to instruct the GPIO driver which interrupt controller to use.

Important

WKPU supports triggering interrupts from certain input pads that support this function, as well as generating wake-up events to the power management domain. This patch only adds WKPU functionality as an interrupt controller to extend on this SoC the number of input pads that can interrupt the core. Power management functionalities (ie. wake-up events to power management domain) are not supported and are not in the scope of this PR.

Tests:

> west twister -p mr_canhubk3 -T .\tests\drivers\gpio\gpio_basic_api --device-testing --device-serial=COM4 --fixture=gpio_loopback
INFO    - Using Ninja..
INFO    - Zephyr version: v3.5.0-rc1-95-g066503e2555a
INFO    - Using 'zephyr' toolchain.
...
INFO    - Total complete:    3/   3  100%  skipped:    1, failed:    0, error:    0
INFO    - 3 test scenarios (3 test instances) selected, 1 configurations skipped (1 by static filter, 0 at runtime).
INFO    - 2 of 3 test configurations passed (100.00%), 0 failed, 0 errored, 1 skipped with 0 warnings in 291.60 seconds
INFO    - In total 10 test cases were executed, 5 skipped on 1 out of total 626 platforms (0.16%)
INFO    - 2 test configurations executed on platforms, 0 test configurations were only built.

Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

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

what about wakeup-source standard property?

@zephyrbot zephyrbot added manifest manifest-hal_nxp DNM This PR should not be merged (Do Not Merge) labels Sep 14, 2023
@zephyrbot
Copy link
Collaborator

zephyrbot commented Sep 14, 2023

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

Name Old Revision New Revision Diff
hal_nxp zephyrproject-rtos/hal_nxp@a87e6a8 zephyrproject-rtos/hal_nxp@596ea20 (master) zephyrproject-rtos/hal_nxp@a87e6a8b..596ea205

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

@manuargue
Copy link
Member Author

what about wakeup-source standard property?

I have added the missing property to allow declaring the GPIO port wake-up capable and updated the test to use it.

@gmarull
Copy link
Member

gmarull commented Sep 14, 2023

In general I think we need a solution that is cross-vendor compatible. We have now STM32 using HAL directly in their power off sample, Nordic using gpio_interrupt_configure (it works by chance, because what is configured turns out to allow wake-up from pins) and now NXP introducing a vendor specific option.

Please, let's propose something that can be made portable. There are enough SoCs with a similar feature.

@bperseghetti
Copy link
Member

@manuargue Thanks for getting this much needed PR in! This is a necessity to allow for using the shields on the CANHUBK3 boards!

In general I think we need a solution that is cross-vendor compatible. We have now STM32 using HAL directly in their power off sample, Nordic using gpio_interrupt_configure (it works by chance, because what is configured turns out to allow wake-up from pins) and now NXP introducing a vendor specific option.

Please, let's propose something that can be made portable. There are enough SoCs with a similar feature.

@gmarull were you looking at bringing an RFC forward for doing that? I assume your suggestion to find a better eventual combined solution is non-blocking for this PR.

Introduce an interrupt controller for the NXP S32 WKPU peripheral
that can be integrated with GPIO to trigger interrupts through
external interrupt pad inputs.

WKPU can trigger interrupts from certain input pads that support this
function, as well as wake-up events to the power management domain. This
patch only adds WKPU functionality as an interrupt controller to extend
the number of input pads that can interrupt the core. Power management
functionalities are not supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Refactor external interrupts infrastructure to prepare supporting
multiple interrupt controllers.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Extend the NXP S32 GPIO driver to be able to route external interrupts
to either SIUL2 EIRQ interrupt controller or, when available on the
SoC, WKPU interrupt controller.

Since WKPU can support up to 64 external interrupt sources and SIUL2
EIRQ up to 32, gpio_get_pending_int() is removed and the interrupt
controller specific API must be used instead.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Define WKPU interrupt controller node and its respective interrupt
sources mapping to GPIO pins.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Enhance the documentation by providing an explanation of WKPU
interrupt controller support and how it integrates with GPIO.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
When configuring in/out pins for callback tests, pass the GPIO flags
coming from the in/out-gpios respective nodes.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Use the same pins as when testing with SIUL2 EIRQ interrupt
controller, but instead test routing the external interrupts
to WKPU controller.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
@jhedberg
Copy link
Member

@dleach02 @manuargue is this something that you're hoping would go in for 3.5? If so, please set the target milestone.

@gmarull gmarull dismissed their stale review October 10, 2023 14:11

concerns addressed

@dleach02 dleach02 added this to the v3.5.0 milestone Oct 10, 2023
@jhedberg
Copy link
Member

Why does this still have the DNM label?

@fabiobaltieri
Copy link
Member

Why does this still have the DNM label?

Because of the "TSC" tag.

@fabiobaltieri fabiobaltieri removed the TSC Topics that need TSC discussion label Oct 11, 2023
@fabiobaltieri
Copy link
Member

TSC passed this for merge during stabilization. Thanks everyone for your patience.

@fabiobaltieri fabiobaltieri merged commit 402e1da into zephyrproject-rtos:main Oct 11, 2023
19 of 20 checks passed
@manuargue manuargue deleted the manuargue-k3-wkpu branch October 11, 2023 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.