summaryrefslogtreecommitdiff
path: root/chip/stm32/system.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-05-18 15:56:30 -0700
committerRandall Spangler <rspangler@chromium.org>2012-05-21 09:17:43 -0700
commitb1bb8314bd852dea40bc7514486ce4e781e14f88 (patch)
treeb313282cf66c622fb7d008f51c9a7e27c721bb82 /chip/stm32/system.c
parent8407b93f6ddbd1533adc87a650913c4581a15f41 (diff)
downloadchrome-ec-b1bb8314bd852dea40bc7514486ce4e781e14f88.tar.gz
Add LM4 support for hard reset
(And add STM32 support for disabling interrupts before reset, which got missed before.) Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7470 TEST=from console, "reboot", then "reboot hard" Change-Id: Ib98792abc0c91a01e2230b419fc876052380655a
Diffstat (limited to 'chip/stm32/system.c')
-rw-r--r--chip/stm32/system.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/chip/stm32/system.c b/chip/stm32/system.c
index 8515a4bff3..1f7a66b5a7 100644
--- a/chip/stm32/system.c
+++ b/chip/stm32/system.c
@@ -8,35 +8,29 @@
#include "cpu.h"
#include "registers.h"
#include "system.h"
+#include "task.h"
#include "version.h"
static void check_reset_cause(void)
{
- enum system_image_copy_t copy = system_get_image_copy();
enum system_reset_cause_t reset_cause = SYSTEM_RESET_UNKNOWN;
uint32_t raw_cause = STM32_RCC_CSR;
/* Clear the hardware reset cause by setting the RMVF bit */
STM32_RCC_CSR |= 1 << 24;
- if (copy == SYSTEM_IMAGE_RW_A || copy == SYSTEM_IMAGE_RW_B) {
- /* If we're in image A or B, the only way we can get there is
- * via a warm reset. */
- reset_cause = SYSTEM_RESET_SOFT_WARM;
- } else if (raw_cause & 0x60000000) {
+ if (raw_cause & 0x60000000) {
/* IWDG pr WWDG */
reset_cause = SYSTEM_RESET_WATCHDOG;
} else if (raw_cause & 0x10000000) {
- reset_cause = SYSTEM_RESET_SOFT_COLD;
+ reset_cause = SYSTEM_RESET_SOFT;
} else if (raw_cause & 0x08000000) {
reset_cause = SYSTEM_RESET_POWER_ON;
} else if (raw_cause & 0x04000000) {
reset_cause = SYSTEM_RESET_RESET_PIN;
} else if (raw_cause & 0xFE000000) {
reset_cause = SYSTEM_RESET_OTHER;
- } else {
- reset_cause = SYSTEM_RESET_UNKNOWN;
}
system_set_reset_cause(reset_cause);
}
@@ -87,19 +81,18 @@ int system_pre_init(void)
}
-int system_reset(int is_cold)
+void system_reset(int is_hard)
{
- /* TODO: (crosbug.com/p/7470) support cold boot; this is a
- warm boot. */
+ /* Disable interrupts to avoid task swaps during reboot */
+ interrupt_disable();
+
+ /* TODO: (crosbug.com/p/7470) support hard boot; this is a
+ * soft boot. */
CPU_NVIC_APINT = 0x05fa0004;
/* Spin and wait for reboot; should never return */
- /* TODO: (crosbug.com/p/7471) should disable task swaps while
- waiting */
while (1)
;
-
- return EC_ERROR_UNKNOWN;
}