How to detect reset source in imx8qm

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to detect reset source in imx8qm

2,615 次查看
mrigendra_chaub
Contributor III

Hi all,

Recently I needed to implement a function for our imx8qm board, which need to know the reset cause/reason/source.

This function is required to be in uboot as well as kernel.

For this reason I tried using sc firmware apis, like this

sc_pm_reset_reason((sc_ipc_t)ipcHndl, reason);

but in uboot and in kernel, even after I issue reset(uboot) or reboot(kernel) the return value from this function is always 0, i.e. POR.

This is the version file of my sc-firmware source,

NXP i.MX System Controller Firmware

--------------------------------------------

Git repo: ssh://git@bitm-us-cdc01.sw.nxp.com:7999/bitbucket/imx/imx-sc-firmware.git
Branch name: imx_4.14.78_1.0.0_ga
Build version: 3008
Commit ID: 0x01f1cd7df
Build date: Feb 28 2019
Build time: 11:15:30

1. So how or what we need to do in order to get correct reset source?

2. In uboot do we need to implement a watchdog driver that is based on scfw?

0 项奖励
回复
3 回复数

2,185 次查看
vinothkumareswa
Contributor II

Hi,

Did you able to get the reset reason from the linux system using system controller API's.

if so, could you comment the steps?

Thanks & Regards,

Vinothkumar

0 项奖励
回复

2,185 次查看
igorpadykov
NXP Employee
NXP Employee

Hi mrigendra

one can try to change in function imx_system_reset()..
{    sc_pm_reboot(ipc_handle, SC_PM_RESET_TYPE_COLD);..

for example to sc_pm_reboot(SC_IPC_CH, SC_PM_RESET_TYPE_WARM);

imx8_psci.c\common\imx\plat - imx-atf - i.MX ARM Trusted firmware 

"sc_pm_reset_type_t" can be found in

sci_pm_api.h\pm\svc\sci\include\common\imx\plat - imx-atf - i.MX ARM Trusted firmware 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

2,184 次查看
mrigendra_chaub
Contributor III

Hi Igor

kernel version: 4.14.78

uboot version : U-Boot 2018.03-34664-g91acfdb46d-dirty

First thing I did was your suggestion but that doesnot change reset reason.

even this call does not do anything, because this is never called/reached,

void reset_cpu(ulong addr)
{
    puts("SCI reboot request");
    sc_pm_reboot(SC_IPC_CH, SC_PM_RESET_TYPE_COLD);
    while (1)
        putc('.');
}

reset command comes from this file reset.c

this is the function

int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
    puts ("resetting...\n");

    udelay (50000); /* wait 50 ms */
    disable_interrupts();
    reset_misc(); /*call goes to armv8 fwcall.c PSCI reset and never returns*/
    reset_cpu(0);

    /*NOTREACHED*/
    return 0;
}

So I think sc_pm_reboot never gets called and system gets psci reset via   fwcall.c  file's

void __noreturn __efi_runtime psci_system_reset(void)

function.

If I comment out misc_reset, I get dots in while loop.

....................................

that means sc_pm_reboot never worked and this while loop starts executing.

Can you clarify what is to be done to get sc_pm_reboot() function working ?

0 项奖励
回复