Ambroise Vincent | fa42c9e | 2019-07-04 14:58:45 +0100 | [diff] [blame] | 1 | /* |
Manish V Badarkhe | 56808e4 | 2021-05-23 13:16:46 +0100 | [diff] [blame] | 2 | * Copyright (c) 2019-2021, Arm Limited. All rights reserved. |
Ambroise Vincent | fa42c9e | 2019-07-04 14:58:45 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <errno.h> |
| 8 | |
| 9 | #include <common/debug.h> |
| 10 | #include <drivers/arm/sp805.h> |
| 11 | #include <drivers/cfi/v2m_flash.h> |
Manish V Badarkhe | 56808e4 | 2021-05-23 13:16:46 +0100 | [diff] [blame] | 12 | #include <lib/mmio.h> |
Ambroise Vincent | fa42c9e | 2019-07-04 14:58:45 +0100 | [diff] [blame] | 13 | #include <plat/arm/common/plat_arm.h> |
Ambroise Vincent | fa42c9e | 2019-07-04 14:58:45 +0100 | [diff] [blame] | 14 | #include <platform_def.h> |
| 15 | |
| 16 | /* |
| 17 | * FVP error handler |
| 18 | */ |
| 19 | __dead2 void plat_arm_error_handler(int err) |
| 20 | { |
Manish V Badarkhe | 56808e4 | 2021-05-23 13:16:46 +0100 | [diff] [blame] | 21 | /* Propagate the err code in the NV-flags register */ |
| 22 | mmio_write_32(V2M_SYS_NVFLAGS_ADDR, (uint32_t)err); |
Ambroise Vincent | fa42c9e | 2019-07-04 14:58:45 +0100 | [diff] [blame] | 23 | |
Jimmy Brisson | 39f9eee | 2020-08-05 13:44:05 -0500 | [diff] [blame] | 24 | console_flush(); |
Ambroise Vincent | fa42c9e | 2019-07-04 14:58:45 +0100 | [diff] [blame] | 25 | |
| 26 | /* Setup the watchdog to reset the system as soon as possible */ |
| 27 | sp805_refresh(ARM_SP805_TWDG_BASE, 1U); |
| 28 | |
| 29 | for (;;) |
| 30 | wfi(); |
| 31 | } |
Manish V Badarkhe | fcfe431 | 2022-07-12 21:48:04 +0100 | [diff] [blame] | 32 | |
| 33 | void __dead2 plat_arm_system_reset(void) |
| 34 | { |
| 35 | /* Write the System Configuration Control Register */ |
| 36 | mmio_write_32(V2M_SYSREGS_BASE + V2M_SYS_CFGCTRL, |
| 37 | V2M_CFGCTRL_START | |
| 38 | V2M_CFGCTRL_RW | |
| 39 | V2M_CFGCTRL_FUNC(V2M_FUNC_REBOOT)); |
| 40 | wfi(); |
| 41 | ERROR("FVP System Reset: operation not handled.\n"); |
| 42 | panic(); |
| 43 | } |