2 * Copyright (C) 2012 Samsung Electronics
3 * Minkyu Kang <mk7.kang@samsung.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/arch/watchdog.h>
12 #define PRESCALER_VAL 255
16 struct s5p_watchdog *wdt =
17 (struct s5p_watchdog *)samsung_get_base_watchdog();
20 wtcon = readl(&wdt->wtcon);
21 wtcon &= ~(WTCON_EN | WTCON_INT | WTCON_RESET);
23 writel(wtcon, &wdt->wtcon);
26 void wdt_start(unsigned int timeout)
28 struct s5p_watchdog *wdt =
29 (struct s5p_watchdog *)samsung_get_base_watchdog();
34 wtcon = readl(&wdt->wtcon);
35 wtcon |= (WTCON_EN | WTCON_CLK(WTCON_CLK_128));
38 wtcon |= WTCON_PRESCALER(PRESCALER_VAL);
40 writel(timeout, &wdt->wtdat);
41 writel(timeout, &wdt->wtcnt);
42 writel(wtcon, &wdt->wtcon);