I am working on a custom iMX6 Solo board running kernel 4.19. The issue I'm having is that when I run the 'reboot' command, it is the watchdog that's doing the rebooting (https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/watchdog/imx2_wdt.c?h=imx_4.19.35_...). So when the board reboots, the reboot cause is being reported as 'WDOG'. I need the reset reason to not always be WDOG because the firmware that will run on the board needs to know exactly what caused the reset for infield debugging purposes.
I tried this with NXP's kernel https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_4.19.35_1.1.0 and https://github.com/Freescale/linux-fslc/tree/4.19.x+fslc but both give the same result.
Any idea how I can fix this issue?
See below, please!
1. reboot will call wdog operation
To be precise, what you see is correct. Because when the reboot command is running, it has a calling relationship with the low level wdog. In other words, the reboot command finally executes the wdog operation to reset the board.
2. About reset
For the entire board, there are only 3 RESET methods:
(1) Power On Reset
(2) Reset from wdog
(3) Reset Button
Essentially, the above 3 reset operations are exactly the same, because all three of them are reset signals issued to the POR_B pin of the CPU through the RESETMCU of the PMIC. So these are not reset reasons, but reset source.
3. For the reset reason you mentioned
You mean when the board is reset, you need to know what caused the board to be reset. This is difficult to judge, because any driver, application bug, etc. may cause the wdog to be triggered, thus resetting the board.
Hope this information is helpful to you.
Have a nice day!