-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
rw6xx: Add Support for Standby Power Mode #84945
Conversation
Push a commit from #74371 to fix CI failures. |
3428e54
to
a49fb1c
Compare
a49fb1c
to
2c4e466
Compare
88eedf5
to
0e0ce34
Compare
drivers/serial/uart_mcux_flexcomm.c
Outdated
usart_intenset = USART_GetEnabledInterrupts(config->base); | ||
return 0; | ||
case PM_DEVICE_ACTION_TURN_ON: | ||
mcux_flexcomm_init(dev); |
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.
pm_device_driver_init()
must be added to the end of mcux_flexcomm_init()
, and will call TURN_ON, potentially followed by resume. Once pm_device_driver_init()
is added, calling init here will result in infinite recursion.
the mcux_flexcomm_init()
should only be called once, on init, and later reinits are a result of calls to mcux_flexcomm_pm_action()
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.
@bjarki-andreasen, thank you. I have made the change to call pm_device_driver_init()
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.
pm_device_driver_init()
must be added to the gpio_mcux_lpc and uart_mcux_flexcomm init functions to properly initialize the devices. This has further implications which will be clear once pm_device_driver_init()
is added.
0e0ce34
to
576f004
Compare
576f004
to
30a9519
Compare
Add PM action for MCUX LPC driver Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Add power action callback handlers to the driver. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This maps to Power Mode 3 in the SoC. Add RTC node that is used to wakeup from this mode. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This is required to re-initialize the peripherals on exit from Power Mode 3. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This clock is used for certain peripherals such as RTC. On certain RW612 boards such as rd_rw612_bga, XTAL32K and ENET share pins. Add code to check if ENET and XTAL32 are enabled at the same time. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Since the clock source when running in PM mode 3 is the slower 1KHx clock, we adjust the SYS_CLOCK_TICKS_PER_SEC value to get better accuracy. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This maps to Zephyr power state Standby. In this power state the OS Timer cannot be used as a wakeup source as it will be powered off. Hence the counter is enabled and RTC is used to keep track of system ticks and wakeup the system. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Update the clock init code to gate off unused clocks. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Power Domains are used to re-enable peripherals when exit Power Mode 3 (Standby). Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Provide an API for other drivers to fire GPIO callbacks Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Call the API provided to fire a GPIO interrupt if registered on wakeup from PM Mode 3. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This is used as wakeup source to wakeup from Power Modes 3 and 4. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Enable PM mode 3 on NXP FRDM_RW612 and RD_RW612 boards. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Enable testing this sample with PM Mode 3 Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
30a9519
to
14d43cf
Compare
@bjarki-andreasen , can you please revisit this PR? |
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.
Looks fine, added a note regarding some code which could be a bit simpler, but it will not have any impact once compiled :)
case PM_DEVICE_ACTION_RESUME: | ||
break; | ||
case PM_DEVICE_ACTION_SUSPEND: | ||
break; | ||
case PM_DEVICE_ACTION_TURN_OFF: | ||
break; |
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.
None of these are supported, so should also return -ENOTSUP, can be simplified to
if (action == PM_DEVICE_ACTION_TURN_ON) {
const struct gpio_mcux_lpc_config *config = dev->config;
GPIO_PortInit(config->gpio_base, config->port_no);
return 0;
}
return -ENOTSUP;
@@ -1067,6 +1117,42 @@ static int mcux_flexcomm_init(const struct device *dev) | |||
return 0; | |||
} | |||
|
|||
static uint32_t usart_intenset; |
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 variable is not used outside the scope of mcux_flexcomm_pm_action
, move it inside, also does not need to be static
This maps to Power Mode 3 in the SoC Power Profile
This PR is dependent on #74371 and #84938