zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.62k stars 6.5k forks source link

PM: drivers require a mechanism to reinitialize when transitioning between PM states #59194

Open knthm opened 1 year ago

knthm commented 1 year ago

Describe the bug

The peripherals on many SoCs lose register contents (and additional bus configuration) when entering low-power modes, even though RAM contents and general OS state is persisted.

The drivers for these peripherals need a mechanism for reinitializing the partial configuration lost.

Example:

With CONFIG_PM enabled on STM32* series, accessing certain peripherals after returning from STOP2 to RUN mode will fail.

To Reproduce

  1. Choose a sample on an SoC utilizing an affected peripheral, e.g. SPI/I2C1-2/ADC/SUBGHZSPI-LoRa on STM32WL
  2. Enable CONFIG_PM and build
  3. Run the sample, and observe peripheral accesses failing after the SoC has entered and left STOP2 mode

Expected behavior

Peripherals operate correctly after the SoC returns from a low-power mode.

Impact

Environment (please complete the following information):

Related issues

adrienbruant commented 6 months ago

Thank you for the work on this issue. Looking forward to see this merged. This set of PRs is still the only way for to have STOP2 mode supported with STM32WL. We merge it with every release.