imx: Guard print_cpuinfo with !CONFIG_IS_ENABLED(CPU)

When CONFIG_CPU is enabled, print_cpuinfo is defined in common/board_f.c
with static property. However in imx cpu.c, print_cpuinfo is not a local
function, so guard it with !CONFIG_IS_ENABLED(CPU).

And all i.MX8M boards has CONFIG_CPU and CONFIG_CPU_IMX set, so remove the
dead code.

However legacy print_cpuinfo also print reset reason, to keep reset
reason printed as before, export get_reset_reason() and invoke it
at arch_misc_init().

Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
Peng Fan
2026-06-26 17:05:56 -03:00
committed by Fabio Estevam
parent 2571e319c5
commit 902cf2bf67
2 changed files with 31 additions and 59 deletions
+1 -59
View File
@@ -47,7 +47,7 @@ u32 get_imx_reset_cause(void)
return reset_cause;
}
#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_XPL_BUILD)
#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_XPL_BUILD) && !CONFIG_IS_ENABLED(CPU)
static char *get_reset_cause(void)
{
switch (get_imx_reset_cause()) {
@@ -75,11 +75,6 @@ static char *get_reset_cause(void)
return "WDOG4";
case 0x00200:
return "TEMPSENSE";
#elif defined(CONFIG_IMX8M)
case 0x00100:
return "WDOG2";
case 0x00200:
return "TEMPSENSE";
#else
case 0x00100:
return "TEMPSENSE";
@@ -90,63 +85,10 @@ static char *get_reset_cause(void)
return "unknown reset";
}
}
#endif
#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_XPL_BUILD)
const char *get_imx_type(u32 imxtype)
{
switch (imxtype) {
case MXC_CPU_IMX8MP:
return "8MP[8]"; /* Quad-core version of the imx8mp */
case MXC_CPU_IMX8MPD2:
return "8MP Dual[2]"; /* Dual-core version of the imx8mp, low cost industrial & HMI */
case MXC_CPU_IMX8MPD:
return "8MP Dual[3]"; /* Dual-core version of the imx8mp */
case MXC_CPU_IMX8MPL:
return "8MP Lite[4]"; /* Quad-core Lite version of the imx8mp */
case MXC_CPU_IMX8MP5:
return "8MP[5]"; /* Quad-core version of the imx8mp, low cost industrial & HMI */
case MXC_CPU_IMX8MP6:
return "8MP[6]"; /* Quad-core version of the imx8mp, NPU fused */
case MXC_CPU_IMX8MPUL:
return "8MP UltraLite"; /* Quad-core UltraLite version of the imx8mp */
case MXC_CPU_IMX8MN:
return "8MNano Quad"; /* Quad-core version */
case MXC_CPU_IMX8MND:
return "8MNano Dual"; /* Dual-core version */
case MXC_CPU_IMX8MNS:
return "8MNano Solo"; /* Single-core version */
case MXC_CPU_IMX8MNL:
return "8MNano QuadLite"; /* Quad-core Lite version */
case MXC_CPU_IMX8MNDL:
return "8MNano DualLite"; /* Dual-core Lite version */
case MXC_CPU_IMX8MNSL:
return "8MNano SoloLite";/* Single-core Lite version of the imx8mn */
case MXC_CPU_IMX8MNUQ:
return "8MNano UltraLite Quad";/* Quad-core UltraLite version of the imx8mn */
case MXC_CPU_IMX8MNUD:
return "8MNano UltraLite Dual";/* Dual-core UltraLite version of the imx8mn */
case MXC_CPU_IMX8MNUS:
return "8MNano UltraLite Solo";/* Single-core UltraLite version of the imx8mn */
case MXC_CPU_IMX8MM:
return "8MMQ"; /* Quad-core version of the imx8mm */
case MXC_CPU_IMX8MML:
return "8MMQL"; /* Quad-core Lite version of the imx8mm */
case MXC_CPU_IMX8MMD:
return "8MMD"; /* Dual-core version of the imx8mm */
case MXC_CPU_IMX8MMDL:
return "8MMDL"; /* Dual-core Lite version of the imx8mm */
case MXC_CPU_IMX8MMS:
return "8MMS"; /* Single-core version of the imx8mm */
case MXC_CPU_IMX8MMSL:
return "8MMSL"; /* Single-core Lite version of the imx8mm */
case MXC_CPU_IMX8MQ:
return "8MQ"; /* Quad-core version of the imx8mq */
case MXC_CPU_IMX8MQL:
return "8MQLite"; /* Quad-core Lite version of the imx8mq */
case MXC_CPU_IMX8MD:
return "8MD"; /* Dual-core version of the imx8mq */
case MXC_CPU_MX7S:
return "7S"; /* Single-core version of the mx7 */
case MXC_CPU_MX7D:
+30
View File
@@ -1480,6 +1480,33 @@ void reset_cpu(void)
#endif
#if IS_ENABLED(CONFIG_ARCH_MISC_INIT)
static char *get_reset_cause(void)
{
switch (get_imx_reset_cause()) {
case 0x00001:
case 0x00011:
return "POR";
case 0x00004:
return "CSU";
case 0x00008:
return "IPP USER";
case 0x00010:
return "WDOG";
case 0x00020:
return "JTAG HIGH-Z";
case 0x00040:
return "JTAG SW";
case 0x00080:
return "WDOG3";
case 0x00100:
return "WDOG2";
case 0x00200:
return "TEMPSENSE";
default:
return "unknown reset";
}
}
int arch_misc_init(void)
{
if (IS_ENABLED(CONFIG_FSL_CAAM)) {
@@ -1491,6 +1518,9 @@ int arch_misc_init(void)
printf("Failed to initialize caam_jr: %d\n", ret);
}
if (IS_ENABLED(CONFIG_XPL_BUILD))
printf("Reset cause: %s\n", get_reset_cause());
return 0;
}
#endif