1
0
Fork 0

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>
(cherry picked from commit c71292550b839884a36b4d81c757344f5018056e)
5.4-rM2-2.2.x-imx-squashed
Anson Huang 2020-09-22 22:46:55 +08:00
parent bad81140da
commit bba6ff64f0
1 changed files with 17 additions and 0 deletions

View File

@ -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");