In my use-case, before uboot jumps to booting linux, it should start watchdog on SCU. After kernel boots and everything is fine, the application on linux side would stop the watchdog.
Since we don't have a driver in uboot, I am initializing watchdog in uboot like this:
#define IMX_SIP_TIMER 0xC2000002
#define IMX_SIP_TIMER_START_WDOG 0x01
#define IMX_SIP_TIMER_STOP_WDOG 0x02
#define IMX_SIP_TIMER_SET_WDOG_ACT 0x03
#define IMX_SIP_TIMER_PING_WDOG 0x04
#define IMX_SIP_TIMER_SET_TIMEOUT_WDOG 0x05
#define IMX_SIP_TIMER_GET_WDOG_STAT 0x06
#define IMX_SIP_TIMER_SET_PRETIME_WDOG 0x07
#define SC_TIMER_WDOG_ACTION_PARTITION 0
void startWatchdogInUboot()
{
struct arm_smccc_res res;
u32 timeout=60000;
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_TIMEOUT_WDOG,
timeout, 0, 0, 0, 0, 0, &res);
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
0, 0, 0, 0, 0, 0, &res);
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_WDOG_ACT,
SC_TIMER_WDOG_ACTION_PARTITION,
0, 0, 0, 0, 0, &res);
}
this code activates the watchdog.
If we don't do anything on linux side, it reboots after 60 secs.
On Linux side, there is already a driver for the watchdog in IMX8qxp (imx_sc_wdt.c).
On linux side also everything works fine, if I don't start the watchdog in uboot: I can start/stop the watchdog.
But when I activate the watchdog on uboot, I have no access to scu and watchdog from linux.
echo V > /dev/watchdog0
or
echo L > /dev/watchdog0
ends with "Permission denied"
a deeper look shows in driver, that the checks after
arm_smccc_smc( ... )
the checks like
if (res.a0)
return -EACCES;
fail. The actuak value of res.a0 is 10, which.
Any ideas, what I am missing?
Thanks in advance