Re: [PATCH 2/2] firmware: imx: sm-misc: Print boot/shutdown reasons

From: Peng Fan

Date: Thu Mar 05 2026 - 05:24:33 EST


Hi Alexander,

Thanks for giving a look.

On Thu, Mar 05, 2026 at 08:44:26AM +0100, Alexander Stein wrote:
>Hi,
>
>Am Donnerstag, 5. März 2026, 02:56:45 CET schrieb Peng Fan (OSS):
>> From: Peng Fan <peng.fan@xxxxxxx>
>>
>> Add reset reason string table for i.MX95 and introduce a helper
>> (scmi_imx_misc_get_reason) to query and print both system and LM
>> (Logical Machine) reset reasons via the SCMI MISC protocol.
>>
>> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
>> ---
[...]
>> + if (boot.valid)
>> + dev_info(&sdev->dev, "%s Boot reason: %s, origin: %d, errid: %d\n",
>> + system ? "SYS" : "LM", rst[boot.reason],
>> + boot.orig_valid ? boot.origin : -1,
>> + boot.err_valid ? boot.errid : -1);
>> + if (shutdown.valid)
>> + dev_info(&sdev->dev, "%s shutdown reason: %s, origin: %d, errid: %d\n",
>> + system ? "SYS" : "LM", rst[shutdown.reason],
>> + shutdown.orig_valid ? shutdown.origin : -1,
>> + shutdown.err_valid ? shutdown.errid : -1);
>
>Is there a way to query this from userspace programs instead of printing into kernel log?

I not add sysfs or debugfs to get the information in this patchset, since our
customer only want the information could be shown in kernel boot log.

But I could add also sysfs interface to allow userspace get the information if
you need this feature.

Regards,
Peng

>
>Best regards,
>Alexander
>
>> + } else {
>> + dev_err(&sdev->dev, "Failed to get lm reset reason: %d\n", ret);
>> + }
>> +
>> + return 0;
>> +}
>> +
>> static int scmi_imx_misc_ctrl_probe(struct scmi_device *sdev)
>> {
>> const struct scmi_handle *handle = sdev->handle;
>> @@ -133,6 +204,8 @@ static int scmi_imx_misc_ctrl_probe(struct scmi_device *sdev)
>> scmi_imx_dentry = debugfs_create_dir("scmi_imx", NULL);
>> debugfs_create_file("syslog", 0444, scmi_imx_dentry, &sdev->dev, &syslog_fops);
>>
>> + scmi_imx_misc_get_reason(sdev);
>> +
>> return devm_add_action_or_reset(&sdev->dev, scmi_imx_misc_put, scmi_imx_dentry);
>> }
>>
>>
>>
>
>
>--
>TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
>Amtsgericht München, HRB 105018
>Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
>http://www.tq-group.com/
>
>