summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap/omap_generic.c
diff options
context:
space:
mode:
authorAlexander Shiyan <eagle.alexander923@gmail.com>2022-06-09 12:19:46 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2022-06-14 10:41:50 +0200
commit5a4d742347441327951981ca8d803091d2f4643d (patch)
tree3261273441f56648c9b4f981f2331fb047496742 /arch/arm/mach-omap/omap_generic.c
parent11a1f28cbf22f662665681b389a428db1e35c719 (diff)
downloadbarebox-5a4d742347441327951981ca8d803091d2f4643d.tar.gz
barebox-5a4d742347441327951981ca8d803091d2f4643d.tar.xz
ARM: OMAP: Rework watchdog code
This patch introduces the omap_watchdog_disable() function, since the WDT core is the same for different OMAP variants, it can be used for all supported SOCs. Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220609091946.20028-1-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap/omap_generic.c')
-rw-r--r--arch/arm/mach-omap/omap_generic.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
index a1c0aeb595..6bb26a6ef0 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -70,6 +70,24 @@ void __noreturn omap_start_barebox(void *barebox)
hang();
}
+#define OMAP_WDT_WWPS 0x34
+#define OMAP_WDT_WSPR 0x48
+#define WDT_DISABLE_CODE1 0xaaaa
+#define WDT_DISABLE_CODE2 0x5555
+
+void omap_watchdog_disable(const void __iomem *wdt)
+{
+ /* WDT is already running when the bootloader gets control
+ * Disable it to avoid "random" resets
+ */
+ __raw_writel(WDT_DISABLE_CODE1, wdt + OMAP_WDT_WSPR);
+
+ do {
+ } while (__raw_readl(wdt + OMAP_WDT_WWPS));
+
+ __raw_writel(WDT_DISABLE_CODE2, wdt + OMAP_WDT_WSPR);
+}
+
#ifdef CONFIG_BOOTM
static int do_bootm_omap_barebox(struct image_data *data)
{