mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-05 04:36:13 +02:00
watchdog: arm_smc_wdt: get wdt status through SMCWD_GET_TIMELEFT
The optional SMCWD_GET_TIMELEFT command can be used to detect if the watchdog has already been started. See the implementation in OP-TEE secure OS [1]. At probe time, check if the watchdog is already started and then call wdt_set_force_autostart(). This will keep U-Boot pinging the watchdog even when the property 'u-boot,noautostart' is present. Link: https://github.com/OP-TEE/optee_os/commit/a7f2d4bd8632 [1] Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
This commit is contained in:
parent
091303c788
commit
6319fabe32
@ -46,6 +46,8 @@ static int smcwd_call(struct udevice *dev, enum smcwd_call call,
|
||||
return -ENODEV;
|
||||
if (res->a0 == PSCI_RET_INVALID_PARAMS)
|
||||
return -EINVAL;
|
||||
if (res->a0 == PSCI_RET_DISABLED)
|
||||
return -ENODATA;
|
||||
if (res->a0 != PSCI_RET_SUCCESS)
|
||||
return -EIO;
|
||||
|
||||
@ -99,6 +101,21 @@ static int smcwd_probe(struct udevice *dev)
|
||||
priv->min_timeout = res.a1;
|
||||
priv->max_timeout = res.a2;
|
||||
|
||||
/* If already started, then force u-boot to use it */
|
||||
err = smcwd_call(dev, SMCWD_GET_TIMELEFT, 0, NULL);
|
||||
switch (err) {
|
||||
case 0:
|
||||
dev_dbg(dev, "Already started\n");
|
||||
wdt_set_force_autostart(dev);
|
||||
break;
|
||||
case -ENODATA:
|
||||
dev_dbg(dev, "Not already started\n");
|
||||
break;
|
||||
default:
|
||||
/* Optional SMCWD_GET_TIMELEFT not implemented */
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user