From 01b7aee2ee995ca5089797f82bf3da7d4cc7025b Mon Sep 17 00:00:00 2001 From: Joseph Guo Date: Tue, 28 Jul 2026 15:03:14 +0900 Subject: imx: scmi: suppress invalid origin/errid in reset reason print Only print origin and errid fields when the corresponding valid bits (MISC_BOOT_FLAG_ORG_VLD and MISC_BOOT_FLAG_ERR_VLD) are set. For a normal power-on reset, these fields are not valid, and printing -1 is just noise. Signed-off-by: Joseph Guo --- arch/arm/mach-imx/imx9/scmi/soc.c | 52 ++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c b/arch/arm/mach-imx/imx9/scmi/soc.c index e8f739920be..8bb3ce5cad9 100644 --- a/arch/arm/mach-imx/imx9/scmi/soc.c +++ b/arch/arm/mach-imx/imx9/scmi/soc.c @@ -773,22 +773,20 @@ int get_reset_reason(bool sys, bool lm) } if (out.bootflags & MISC_BOOT_FLAG_VLD) { - printf("SYS Boot reason: %s, origin: %ld, errid: %ld\n", - rst[out.bootflags & MISC_BOOT_FLAG_REASON], - out.bootflags & MISC_BOOT_FLAG_ORG_VLD ? - FIELD_GET(MISC_BOOT_FLAG_ORIGIN, out.bootflags) : -1, - out.bootflags & MISC_BOOT_FLAG_ERR_VLD ? - FIELD_GET(MISC_BOOT_FLAG_ERR_ID, out.bootflags) : -1 - ); + printf("SYS Boot reason: %s", rst[out.bootflags & MISC_BOOT_FLAG_REASON]); + if (out.bootflags & MISC_BOOT_FLAG_ORG_VLD) + printf(", origin: %ld", FIELD_GET(MISC_BOOT_FLAG_ORIGIN, out.bootflags)); + if (out.bootflags & MISC_BOOT_FLAG_ERR_VLD) + printf(", errid: %ld", FIELD_GET(MISC_BOOT_FLAG_ERR_ID, out.bootflags)); + puts("\n"); } if (out.shutdownflags & MISC_SHUTDOWN_FLAG_VLD) { - printf("SYS shutdown reason: %s, origin: %ld, errid: %ld\n", - rst[out.shutdownflags & MISC_SHUTDOWN_FLAG_REASON], - out.shutdownflags & MISC_SHUTDOWN_FLAG_ORG_VLD ? - FIELD_GET(MISC_SHUTDOWN_FLAG_ORIGIN, out.shutdownflags) : -1, - out.shutdownflags & MISC_SHUTDOWN_FLAG_ERR_VLD ? - FIELD_GET(MISC_SHUTDOWN_FLAG_ERR_ID, out.shutdownflags) : -1 - ); + printf("SYS shutdown reason: %s", rst[out.shutdownflags & MISC_SHUTDOWN_FLAG_REASON]); + if (out.shutdownflags & MISC_SHUTDOWN_FLAG_ORG_VLD) + printf(", origin: %ld", FIELD_GET(MISC_SHUTDOWN_FLAG_ORIGIN, out.shutdownflags)); + if (out.shutdownflags & MISC_SHUTDOWN_FLAG_ERR_VLD) + printf(", errid: %ld", FIELD_GET(MISC_SHUTDOWN_FLAG_ERR_ID, out.shutdownflags)); + puts("\n"); } } @@ -803,23 +801,21 @@ int get_reset_reason(bool sys, bool lm) } if (out.bootflags & MISC_BOOT_FLAG_VLD) { - printf("LM Boot reason: %s, origin: %ld, errid: %ld\n", - rst[out.bootflags & MISC_BOOT_FLAG_REASON], - out.bootflags & MISC_BOOT_FLAG_ORG_VLD ? - FIELD_GET(MISC_BOOT_FLAG_ORIGIN, out.bootflags) : -1, - out.bootflags & MISC_BOOT_FLAG_ERR_VLD ? - FIELD_GET(MISC_BOOT_FLAG_ERR_ID, out.bootflags) : -1 - ); + printf("LM Boot reason: %s", rst[out.bootflags & MISC_BOOT_FLAG_REASON]); + if (out.bootflags & MISC_BOOT_FLAG_ORG_VLD) + printf(", origin: %ld", FIELD_GET(MISC_BOOT_FLAG_ORIGIN, out.bootflags)); + if (out.bootflags & MISC_BOOT_FLAG_ERR_VLD) + printf(", errid: %ld", FIELD_GET(MISC_BOOT_FLAG_ERR_ID, out.bootflags)); + puts("\n"); } if (out.shutdownflags & MISC_SHUTDOWN_FLAG_VLD) { - printf("LM shutdown reason: %s, origin: %ld, errid: %ld\n", - rst[out.shutdownflags & MISC_SHUTDOWN_FLAG_REASON], - out.shutdownflags & MISC_SHUTDOWN_FLAG_ORG_VLD ? - FIELD_GET(MISC_SHUTDOWN_FLAG_ORIGIN, out.shutdownflags) : -1, - out.shutdownflags & MISC_SHUTDOWN_FLAG_ERR_VLD ? - FIELD_GET(MISC_SHUTDOWN_FLAG_ERR_ID, out.shutdownflags) : -1 - ); + printf("LM shutdown reason: %s", rst[out.shutdownflags & MISC_SHUTDOWN_FLAG_REASON]); + if (out.shutdownflags & MISC_SHUTDOWN_FLAG_ORG_VLD) + printf(", origin: %ld", FIELD_GET(MISC_SHUTDOWN_FLAG_ORIGIN, out.shutdownflags)); + if (out.shutdownflags & MISC_SHUTDOWN_FLAG_ERR_VLD) + printf(", errid: %ld", FIELD_GET(MISC_SHUTDOWN_FLAG_ERR_ID, out.shutdownflags)); + puts("\n"); } } -- cgit v1.3.1