diff options
author | Jett Rink <jettrink@chromium.org> | 2020-02-19 09:33:09 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-25 02:28:20 +0000 |
commit | 7a9b2d8a7c83c087e40ddd9461408490b80ae400 (patch) | |
tree | c0c5af68ca33228003bad59bb606d309dabb933c /chip/stm32 | |
parent | 6331dd76feaa4dfeb5f66635f8b570b884380cb7 (diff) | |
download | chrome-ec-7a9b2d8a7c83c087e40ddd9461408490b80ae400.tar.gz |
cleanup: move voltage rail detection to common
Single source the VDD rail sagging reset interrupt
Add VDD detection to C2D2 as well.
BRANCH=servo
BUG=none
TEST=builds
Change-Id: Iceac7d9fa7a9bde5a3c23c36e63b6d635d8812a3
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2064593
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'chip/stm32')
-rw-r--r-- | chip/stm32/system.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/chip/stm32/system.c b/chip/stm32/system.c index 559de04197..5056b7e219 100644 --- a/chip/stm32/system.c +++ b/chip/stm32/system.c @@ -11,9 +11,10 @@ #include "cpu.h" #include "flash.h" #include "gpio_chip.h" +#include "hooks.h" #include "host_command.h" -#include "registers.h" #include "panic.h" +#include "registers.h" #include "system.h" #include "task.h" #include "util.h" @@ -179,7 +180,10 @@ void chip_pre_init(void) } #ifdef CONFIG_PVD -/* Configures the programmable voltage detector to monitor for brown out conditions. */ +/****************************************************************************** + * Detects sagging Vdd voltage and resets the system via the programmable + * voltage detector interrupt. + */ static void configure_pvd(void) { /* Clear Interrupt Enable Mask Register. */ @@ -208,7 +212,17 @@ static void configure_pvd(void) /* Enable the PVD Output. */ STM32_PWR_CR |= STM32_PWR_PVDE; } -#endif + +void pvd_interrupt(void) +{ + /* Clear Pending Register */ + STM32_EXTI_PR = EXTI_PVD_EVENT; + /* Handle recovery by rebooting the system */ + system_reset(0); +} +DECLARE_IRQ(STM32_IRQ_PVD, pvd_interrupt, HOOK_PRIO_FIRST); + +#endif /* CONFIG_PVD */ void system_pre_init(void) { |