blob: 0bac9cc7dc0162bd3b7c83da6814ccc3f934b37e [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.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
Deepa Dinamani18e434d2014-12-10 15:23:47 -080022#include <console/console.h>
23#include <soc/iomap.h>
Daisuke Nojiri44885902014-11-12 14:37:25 -080024#include <reset.h>
25
Deepa Dinamani18e434d2014-12-10 15:23:47 -080026/* Watchdog bite time set to default reset value */
27#define RESET_WDT_BITE_TIME 0x31F3
28
29/* Watchdog bark time value is kept larger than the watchdog timeout
30 * of 0x31F3, effectively disabling the watchdog bark interrupt
31 */
32#define RESET_WDT_BARK_TIME (5 * RESET_WDT_BITE_TIME)
33
34static void wdog_reset(void)
35{
36 printk(BIOS_DEBUG, "\nResetting with watchdog!\n");
37
Julius Werner2f37bd62015-02-19 14:51:15 -080038 write32(APCS_WDT0_EN, 0);
39 write32(APCS_WDT0_RST, 1);
40 write32(APCS_WDT0_BARK_TIME, RESET_WDT_BARK_TIME);
41 write32(APCS_WDT0_BITE_TIME, RESET_WDT_BITE_TIME);
42 write32(APCS_WDT0_EN, 1);
43 write32(APCS_WDT0_CPU0_WDOG_EXPIRED_ENABLE, 1);
Deepa Dinamani18e434d2014-12-10 15:23:47 -080044
45 for (;;)
46 ;
47}
48
Daisuke Nojiri44885902014-11-12 14:37:25 -080049void hard_reset(void)
50{
Deepa Dinamani18e434d2014-12-10 15:23:47 -080051 wdog_reset();
Daisuke Nojiri44885902014-11-12 14:37:25 -080052}