Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 1 | /* |
Deepa Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 2 | * |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 3 | * This file is part of the coreboot project. |
| 4 | * |
Deepa Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 5 | * Copyright (c) 2014, The Linux Foundation. All rights reserved. |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 6 | * 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 Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 22 | #include <console/console.h> |
| 23 | #include <soc/iomap.h> |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 24 | #include <reset.h> |
| 25 | |
Deepa Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 26 | /* 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 | |
| 34 | static void wdog_reset(void) |
| 35 | { |
| 36 | printk(BIOS_DEBUG, "\nResetting with watchdog!\n"); |
| 37 | |
Julius Werner | 2f37bd6 | 2015-02-19 14:51:15 -0800 | [diff] [blame^] | 38 | 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 Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 44 | |
| 45 | for (;;) |
| 46 | ; |
| 47 | } |
| 48 | |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 49 | void hard_reset(void) |
| 50 | { |
Deepa Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 51 | wdog_reset(); |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 52 | } |