Re: [PATCH v11 6/7] power: reset: add PSCR NVMEM Driver for Recording Power State Change Reasons
From: Francesco Valla
Date: Fri Jun 20 2025 - 14:16:16 EST
Hi Oleksij,
On Wednesday, 18 June 2025 at 14:02:54 Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> wrote:
> This driver utilizes the Power State Change Reasons Recording (PSCRR)
> framework to store specific power state change information, such as
> shutdown or reboot reasons, into a designated non-volatile memory
> (NVMEM) cell.
>
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> ---
> changes v6:
> - rename pscr_reason to psc_reason
> changes v5:
> - avoid a build against NVMEM=m
> changes v4:
> - remove devicetree dependencies
> ---
> drivers/power/reset/Kconfig | 22 +++
> drivers/power/reset/Makefile | 1 +
> drivers/power/reset/pscrr-nvmem.c | 254 ++++++++++++++++++++++++++++++
> 3 files changed, 277 insertions(+)
> create mode 100644 drivers/power/reset/pscrr-nvmem.c
>
Tested-by: Francesco Valla <francesco@xxxxxxxx>
I tested this on a i.MX93 FRDM using the on-board EEPROM as storage and
a single-byte cell. Unfortunately, the on-board RTC does not have a
scratchpad.
PSCR was set in two different ways during subsequent tests:
- manually from userspace
- simulating a over-temperature condition through the emul_temp sysfs
In both cases, it was re-read correctly after reboot.
This will be very useful to detect and debug anomalous shutdowns or
reboots on the field.
Thank you!
Regards,
Francesco