1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2012 Samsung Electronics
4 * Minkyu Kang <mk7.kang@samsung.com>
9 #include <asm/arch/watchdog.h>
11 #define PRESCALER_VAL 255
15 struct s5p_watchdog *wdt =
16 (struct s5p_watchdog *)samsung_get_base_watchdog();
19 wtcon = readl(&wdt->wtcon);
20 wtcon &= ~(WTCON_EN | WTCON_INT | WTCON_RESET);
22 writel(wtcon, &wdt->wtcon);
25 void wdt_start(unsigned int timeout)
27 struct s5p_watchdog *wdt =
28 (struct s5p_watchdog *)samsung_get_base_watchdog();
33 wtcon = readl(&wdt->wtcon);
34 wtcon |= (WTCON_EN | WTCON_CLK(WTCON_CLK_128));
37 wtcon |= WTCON_PRESCALER(PRESCALER_VAL);
39 writel(timeout, &wdt->wtdat);
40 writel(timeout, &wdt->wtcnt);
41 writel(wtcon, &wdt->wtcon);