Background: This article discusses the reboot mechanism on the i.MX8MP and i.MX93 platforms. It aims to help customers understand how the reboot command works. We will discuss two different kernel versions separately.
1. Linux version : LF_6.12.34_2.1.0
The executable file for the reboot command is as follows:
When the ”reboot“ command is executed, the system enters the ”do_kernel_restart()“ function and executes the reboot mechanism by determining the priority of the registered functions.
Since the ”reboot.c“ file does not print out the registered functions, a print function is added to the file to identify the function that is ultimately executed.
The print output is as follows:
As shown in the figure above, in version 5.12, the reboot is performed via a reset executed by psci.
Continuing to trace the ”psci_sys_reset()“ function, we can see that the system sends the function ID via the PSCI interface to initiate an SMC call, instructing the underlying firmware (ATF/EL3) to perform a system reboot (typically a cold reset).
The value of PSCI_0_2_FN_SYSTEM_RESET is 0x80000009
2. Linux version : LF_6.18.2_1.0.0
Use the same debugging method to examine the reboot mechanism in version 6.18
As shown in the output below, in version 6.18, the system reset is triggered by the `sys_off_notify()` function.
The final execution function is pca9450_i2c_restart_handler()
By examining the `pca9450_i2c_restart_handler()` function, we can see that the system writes a `SW_RST_COMMAND` value to the PMIC via I²C, where `SW_RST_COMMAND = 0x14`.
According to the PMIC data sheet,
10b = Cold Reset; all voltage regulators are reset except
LDO1/LDO2
Summary: Regardless of the kernel version, the `reboot` command triggers a system cold reset. The triggering mechanism has been updated in versions 6.18 and later.