summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2021-08-07 11:00:49 +0300
committerStefano Babic <sbabic@denx.de>2021-08-09 15:46:51 +0300
commit3a01f723ab028a09b2c750de43b0ccb024ff0b4f (patch)
treec46ef320a7ec9408e801f36243b31ba1e4e8ef73 /arch/arm/mach-imx
parent610083e547d19e87b567849b299187d66b643fb9 (diff)
downloadu-boot-3a01f723ab028a09b2c750de43b0ccb024ff0b4f.tar.xz
arm: imx8ulp: disable wdog3
Disable wdog3 which is configured by ROM Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/imx8ulp/soc.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c
index 33aec228e3..051dec1a5a 100644
--- a/arch/arm/mach-imx/imx8ulp/soc.c
+++ b/arch/arm/mach-imx/imx8ulp/soc.c
@@ -144,9 +144,43 @@ int print_cpuinfo(void)
}
#endif
+#define UNLOCK_WORD0 0xC520 /* 1st unlock word */
+#define UNLOCK_WORD1 0xD928 /* 2nd unlock word */
+#define REFRESH_WORD0 0xA602 /* 1st refresh word */
+#define REFRESH_WORD1 0xB480 /* 2nd refresh word */
+
+static void disable_wdog(void __iomem *wdog_base)
+{
+ u32 val_cs = readl(wdog_base + 0x00);
+
+ if (!(val_cs & 0x80))
+ return;
+
+ dmb();
+ __raw_writel(REFRESH_WORD0, (wdog_base + 0x04)); /* Refresh the CNT */
+ __raw_writel(REFRESH_WORD1, (wdog_base + 0x04));
+ dmb();
+
+ if (!(val_cs & 800)) {
+ dmb();
+ __raw_writel(UNLOCK_WORD0, (wdog_base + 0x04));
+ __raw_writel(UNLOCK_WORD1, (wdog_base + 0x04));
+ dmb();
+
+ while (!(readl(wdog_base + 0x00) & 0x800))
+ ;
+ }
+ writel(0x0, (wdog_base + 0x0C)); /* Set WIN to 0 */
+ writel(0x400, (wdog_base + 0x08)); /* Set timeout to default 0x400 */
+ writel(0x120, (wdog_base + 0x00)); /* Disable it and set update */
+
+ while (!(readl(wdog_base + 0x00) & 0x400))
+ ;
+}
+
void init_wdog(void)
{
- /* TODO */
+ disable_wdog((void __iomem *)WDG3_RBASE);
}
static struct mm_region imx8ulp_arm64_mem_map[] = {