From 73680c230f8503a8e0f625834bc987b90e065b03 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Tue, 4 Jun 2019 18:06:34 +0200 Subject: stm32mp1: add watchdog support Introduce driver for STM32 IWDG peripheral (Independent Watchdog). It is configured according to device tree content and should be enabled from there. The watchdog is not started by default. It can be started after an HW reset if the dedicated OTP is fused. The watchdog also needs to be frozen if a debugger is attached. This is done by configuring the correct bits in DBGMCU. This configuration is allowed by checking BSEC properties. An increase of BL2 size is also required when adding this new code. Change-Id: Ide7535d717885ce2f9c387cf17afd8b5607f3e7f Signed-off-by: Yann Gautier Signed-off-by: Lionel Debieve Signed-off-by: Nicolas Le Bayon --- include/drivers/st/stm32_iwdg.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 include/drivers/st/stm32_iwdg.h (limited to 'include') diff --git a/include/drivers/st/stm32_iwdg.h b/include/drivers/st/stm32_iwdg.h new file mode 100644 index 00000000..bad25244 --- /dev/null +++ b/include/drivers/st/stm32_iwdg.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2018-2019, STMicroelectronics - All Rights Reserved + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef STM32_IWDG_H +#define STM32_IWDG_H + +#include + +#define IWDG_HW_ENABLED BIT(0) +#define IWDG_DISABLE_ON_STOP BIT(1) +#define IWDG_DISABLE_ON_STANDBY BIT(2) + +int stm32_iwdg_init(void); +void stm32_iwdg_refresh(void); + +#endif /* STM32_IWDG_H */ -- cgit v1.2.3