blob: 94dcd4befd14b460a3083c59a38afe62ee608b8d [file] [log] [blame]
Daisuke Nojiri44885902014-11-12 14:37:25 -08001/*
Deepa Dinamani18e434d2014-12-10 15:23:47 -08002 *
Daisuke Nojiri44885902014-11-12 14:37:25 -08003 * This file is part of the coreboot project.
4 *
Deepa Dinamani18e434d2014-12-10 15:23:47 -08005 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
Daisuke Nojiri44885902014-11-12 14:37:25 -08006 * Copyright 2014 Google Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Daisuke Nojiri44885902014-11-12 14:37:25 -080016 */
17
Deepa Dinamani18e434d2014-12-10 15:23:47 -080018#include <console/console.h>
19#include <soc/iomap.h>
Daisuke Nojiri44885902014-11-12 14:37:25 -080020#include <reset.h>
21
Deepa Dinamani18e434d2014-12-10 15:23:47 -080022/* Watchdog bite time set to default reset value */
23#define RESET_WDT_BITE_TIME 0x31F3
24
25/* Watchdog bark time value is kept larger than the watchdog timeout
26 * of 0x31F3, effectively disabling the watchdog bark interrupt
27 */
28#define RESET_WDT_BARK_TIME (5 * RESET_WDT_BITE_TIME)
29
30static void wdog_reset(void)
31{
32 printk(BIOS_DEBUG, "\nResetting with watchdog!\n");
33
Julius Werner2f37bd62015-02-19 14:51:15 -080034 write32(APCS_WDT0_EN, 0);
35 write32(APCS_WDT0_RST, 1);
36 write32(APCS_WDT0_BARK_TIME, RESET_WDT_BARK_TIME);
37 write32(APCS_WDT0_BITE_TIME, RESET_WDT_BITE_TIME);
38 write32(APCS_WDT0_EN, 1);
39 write32(APCS_WDT0_CPU0_WDOG_EXPIRED_ENABLE, 1);
Deepa Dinamani18e434d2014-12-10 15:23:47 -080040
41 for (;;)
42 ;
43}
44
Daisuke Nojiri44885902014-11-12 14:37:25 -080045void hard_reset(void)
46{
Deepa Dinamani18e434d2014-12-10 15:23:47 -080047 wdog_reset();
Daisuke Nojiri44885902014-11-12 14:37:25 -080048}