summaryrefslogtreecommitdiff
path: root/include/scmi_nxp_protocols.h
diff options
context:
space:
mode:
authorPeng Fan <[email protected]>2025-09-23 10:14:55 +0800
committerFabio Estevam <[email protected]>2025-09-26 09:51:21 -0300
commit998c6cc450e61152b6d0e800989d2d19358e25c2 (patch)
treefdb82c2b69c96e2463884726ca8cdfc80072b0c5 /include/scmi_nxp_protocols.h
parenta2d62d3b1d357dccc2e9ed56a4e7bdbb030ca06f (diff)
imx95: Add get_reset_reason() to retrieve the LM/system last booted/shutdown reasons
System Manager provides the last booted and shutdown reasons of the logical machines (LM) and system using the SCMI misc protocol (Protocol ID: 0x84, Message ID: 0xA). This path adds get_reset_reason() to query and print these reasons in SPL and U-Boot. Signed-off-by: Peng Fan <[email protected]> Signed-off-by: Alice Guo <[email protected]> Reviewed-by: Ye Li <[email protected]>
Diffstat (limited to 'include/scmi_nxp_protocols.h')
-rw-r--r--include/scmi_nxp_protocols.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/include/scmi_nxp_protocols.h b/include/scmi_nxp_protocols.h
new file mode 100644
index 00000000000..fe6ecd6a7cf
--- /dev/null
+++ b/include/scmi_nxp_protocols.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
+/*
+ * Copyright 2025 NXP
+ */
+
+#ifndef _SCMI_NXP_PROTOCOLS_H
+#define _SCMI_NXP_PROTOCOLS_H
+
+#include <asm/types.h>
+#include <linux/bitops.h>
+
+enum scmi_imx_protocol {
+ SCMI_IMX_PROTOCOL_ID_MISC = 0x84,
+};
+
+#define SCMI_PAYLOAD_LEN 100
+
+#define SCMI_ARRAY(X, Y) ((SCMI_PAYLOAD_LEN - (X)) / sizeof(Y))
+
+#define SCMI_IMX_MISC_RESET_REASON 0xA
+
+struct scmi_imx_misc_reset_reason_in {
+#define MISC_REASON_FLAG_SYSTEM BIT(0)
+ u32 flags;
+};
+
+struct scmi_imx_misc_reset_reason_out {
+ s32 status;
+ /* Boot reason flags */
+#define MISC_BOOT_FLAG_VLD BIT(31)
+#define MISC_BOOT_FLAG_ORG_VLD BIT(28)
+#define MISC_BOOT_FLAG_ORIGIN GENMASK(27, 24)
+#define MISC_BOOT_FLAG_O_SHIFT 24
+#define MISC_BOOT_FLAG_ERR_VLD BIT(23)
+#define MISC_BOOT_FLAG_ERR_ID GENMASK(22, 8)
+#define MISC_BOOT_FLAG_E_SHIFT 8
+#define MISC_BOOT_FLAG_REASON GENMASK(7, 0)
+ u32 bootflags;
+ /* Shutdown reason flags */
+#define MISC_SHUTDOWN_FLAG_VLD BIT(31)
+#define MISC_SHUTDOWN_FLAG_EXT_LEN GENMASK(30, 29)
+#define MISC_SHUTDOWN_FLAG_ORG_VLD BIT(28)
+#define MISC_SHUTDOWN_FLAG_ORIGIN GENMASK(27, 24)
+#define MISC_SHUTDOWN_FLAG_O_SHIFT 24
+#define MISC_SHUTDOWN_FLAG_ERR_VLD BIT(23)
+#define MISC_SHUTDOWN_FLAG_ERR_ID GENMASK(22, 8)
+#define MISC_SHUTDOWN_FLAG_E_SHIFT 8
+#define MISC_SHUTDOWN_FLAG_REASON GENMASK(7, 0)
+ u32 shutdownflags;
+ /* Array of extended info words */
+#define MISC_MAX_EXTINFO SCMI_ARRAY(16, u32)
+ u32 extInfo[MISC_MAX_EXTINFO];
+};
+
+#endif