The watchdog could have been already started by a previous boot
stage (e.g. bootrom or secure OS). U-Boot has to start and kick
the watchdog even when CONFIG_WATCHDOG_AUTOSTART is not enabled
or when the DT property u-boot,noautostart is present.
Add the helper wdt_set_force_autostart() that can be called by the
driver's probe() when it detects that the watchdog has already
been started and is running.
Co-developed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
struct cyclic_info cyclic;
};
+int wdt_set_force_autostart(struct udevice *dev)
+{
+ struct wdt_priv *priv = dev_get_uclass_priv(dev);
+
+ priv->autostart = true;
+
+ return 0;
+}
+
static void wdt_cyclic(struct cyclic_info *c)
{
struct wdt_priv *priv = container_of(c, struct wdt_priv, cyclic);
* which typically include placing the system in a safe, known state.
*/
+/*
+ * Force watchdog start during init. Called by driver's probe when the watchdog
+ * is detected as already started.
+ *
+ * @dev: WDT Device
+ * @return: 0 if OK, -ve on error
+ */
+int wdt_set_force_autostart(struct udevice *dev);
+
/*
* Start the timer
*