1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2019-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *      Workaround for the PLL lock error emitted by the motherboard, seen if
9  *      the SCP fails to lock the system PLLs within a certain (very short)
10  *      timeframe.
11  */
12 
13 #include "juno_scc.h"
14 
15 #include <fwk_noreturn.h>
16 
17 #ifdef __ARMCC_VERSION
18 #    define __wrap_arch_exception_reset $Sub$$arch_exception_reset
19 #    define __real_arch_exception_reset $Super$$arch_exception_reset
20 #endif
21 
22 /*
23  * These PLLs must be released from reset very shortly after the SCP is released
24  * from reset, otherwise the motherboard microcontroller will kill the SCP and
25  * error out. We do this at the earliest possible point in time in order to
26  * ensure nothing delays it from happening.
27  */
__wrap_arch_exception_reset(void)28 noreturn void __wrap_arch_exception_reset(void)
29 {
30     extern noreturn void __real_arch_exception_reset(void);
31 
32     unsigned int pll_idx;
33 
34     /* Release All system PLLs from reset */
35     for (pll_idx = 0; pll_idx < PLL_IDX_COUNT; pll_idx++) {
36         SCC->PLL[pll_idx].REG0 &= ~PLL_REG0_PLL_RESET;
37     }
38 
39     __real_arch_exception_reset();
40 }
41