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. |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 16 | */ |
| 17 | |
Deepa Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 18 | #include <console/console.h> |
| 19 | #include <soc/iomap.h> |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 20 | #include <reset.h> |
| 21 | |
Deepa Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 22 | /* 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 | |
| 30 | static void wdog_reset(void) |
| 31 | { |
| 32 | printk(BIOS_DEBUG, "\nResetting with watchdog!\n"); |
| 33 | |
Julius Werner | 2f37bd6 | 2015-02-19 14:51:15 -0800 | [diff] [blame] | 34 | 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 Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 40 | |
| 41 | for (;;) |
| 42 | ; |
| 43 | } |
| 44 | |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 45 | void hard_reset(void) |
| 46 | { |
Deepa Dinamani | 18e434d | 2014-12-10 15:23:47 -0800 | [diff] [blame] | 47 | wdog_reset(); |
Daisuke Nojiri | 4488590 | 2014-11-12 14:37:25 -0800 | [diff] [blame] | 48 | } |