summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorAnson Huang <Anson.Huang@nxp.com>2020-09-22 22:46:55 +0800
committerAnson Huang <Anson.Huang@nxp.com>2020-09-23 00:01:28 +0800
commitc71292550b839884a36b4d81c757344f5018056e (patch)
tree6b40181d8557f69e04d01d1fd8e2f7cfe9a4fdef /arch/arm/mach-imx
parent339538500b30ff2b264602bea594fc380a15e81c (diff)
MLK-24824-3 ARM: imx: Refresh wdog1 to make sure it is NOT timeout before disabled
i.MX7ULP's wdog1 is enabled by default when it is out of reset, the default timeout value is 0x400 which is NOT safe enough to make sure NOT timeout before wdog driver resume, so need to refresh wdog1 to buy more time for wdog driver resume which will reconfigurate the wdog. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/pm-imx7ulp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/pm-imx7ulp.c b/arch/arm/mach-imx/pm-imx7ulp.c
index c821642317ec..d98c4a169ea2 100644
--- a/arch/arm/mach-imx/pm-imx7ulp.c
+++ b/arch/arm/mach-imx/pm-imx7ulp.c
@@ -127,6 +127,7 @@ static void __iomem *pcc2_base;
static void __iomem *pcc3_base;
static void __iomem *mu_base;
static void __iomem *scg1_base;
+static void __iomem *wdog1_base;
static void __iomem *gpio_base[4];
static void __iomem *suspend_ocram_base;
static void (*imx7ulp_suspend_in_ocram_fn)(void __iomem *sram_base);
@@ -462,6 +463,16 @@ static int imx7ulp_suspend_finish(unsigned long val)
return 0;
}
+static void imx7ulp_wdog_refresh(void)
+{
+ /*
+ * On revision 2.2, wdog2 is by default disabled when out of
+ * reset, so here, we ONLY refresh wdog1.
+ */
+ writel_relaxed(0xA602, wdog1_base + 0x4);
+ writel_relaxed(0xB480, wdog1_base + 0x4);
+}
+
static int imx7ulp_pm_enter(suspend_state_t state)
{
switch (state) {
@@ -515,6 +526,8 @@ static int imx7ulp_pm_enter(suspend_state_t state)
return -EINVAL;
}
+ imx7ulp_wdog_refresh();
+
return 0;
}
@@ -704,6 +717,10 @@ void __init imx7ulp_pm_common_init(const struct imx7ulp_pm_socdata
scg1_base = of_iomap(np, 0);
WARN_ON(!scg1_base);
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx7ulp-wdt");
+ wdog1_base = of_iomap(np, 0);
+ WARN_ON(!wdog1_base);
+
np = NULL;
for (i = 0; i < 4; i++) {
np = of_find_compatible_node(np, NULL, "fsl,vf610-gpio");