--- zzzz-none-000/linux-5.4.213/drivers/firmware/psci/psci.c 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/drivers/firmware/psci/psci.c 2024-08-14 09:01:39.000000000 +0000 @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -267,6 +268,31 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) { + /* + * From kernel, psci_sys_reset function is called during reboot for + * both warm and cold reset. + * + * QSEE differentiates between warm and cold reset by checking the + * TZ_WONCE register, which is set by SBL based on CDT settings. + * + * During cold reset, QSEE communicates with RPM via glink and requests + * RPM to reset and during warm reset, QSEE directly toggles PSHOLD + * register. + * + * During warm reset case, the "Restarting system" print after reboot + * command is given is not flushed from the serial driver to console + * before which the board gets rebooted. + * + * The pr_emerg("Restarting system\n") is called after the reboot + * notifier callbacks are finished, therefore even if we add a + * reboot notifier in serial driver and flush the tx buffer, it still + * wouldn't help. + * + * We have added this 100 ms delay before invoking psci call for the + * serial driver to flush the tx buf contents to console before + * rebooting. + */ + mdelay(100); if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) && psci_system_reset2_supported) { /*