xref: /rk3399_ARM-atf/plat/arm/board/juno/juno_bl31_setup.c (revision d9712f9cae10fdeb8696ffcd3ca35d58666ea9dd)
1 /*
2  * Copyright (c) 2021-2025, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <assert.h>
8 
9 #include <common/debug.h>
10 #include <lib/fconf/fconf.h>
11 #include <lib/fconf/fconf_dyn_cfg_getter.h>
12 
13 #include <plat/arm/common/plat_arm.h>
14 #include <platform_def.h>
15 
16 void __init bl31_early_platform_setup2(u_register_t arg0,
17 		u_register_t arg1, u_register_t arg2, u_register_t arg3)
18 {
19 	const struct dyn_cfg_dtb_info_t *soc_fw_config_info;
20 
21 	INFO("BL31 FCONF: FW_CONFIG address = %lx\n", (uintptr_t)arg1);
22 
23 	/* Fill the properties struct with the info from the config dtb */
24 	fconf_populate("FW_CONFIG", arg1);
25 
26 	soc_fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, SOC_FW_CONFIG_ID);
27 	if (soc_fw_config_info != NULL) {
28 		arg1 = soc_fw_config_info->config_addr;
29 	}
30 
31 	arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
32 
33 	/*
34 	 * Initialize Interconnect for this cluster during cold boot.
35 	 * No need for locks as no other CPU is active.
36 	 */
37 	plat_arm_interconnect_init();
38 
39 	/*
40 	 * Enable Interconnect coherency for the primary CPU's cluster.
41 	 * Earlier bootloader stages might already do this (e.g. Trusted
42 	 * Firmware's BL1 does it) but we can't assume so. There is no harm in
43 	 * executing this code twice anyway.
44 	 * Platform specific PSCI code will enable coherency for other
45 	 * clusters.
46 	 */
47 	plat_arm_interconnect_enter_coherency();
48 }
49 
50 void __init bl31_plat_arch_setup(void)
51 {
52 	arm_bl31_plat_arch_setup();
53 
54 	/* HW_CONFIG was also loaded by BL2 */
55 	const struct dyn_cfg_dtb_info_t *hw_config_info;
56 
57 	hw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, HW_CONFIG_ID);
58 	assert(hw_config_info != NULL);
59 
60 	fconf_populate("HW_CONFIG", hw_config_info->config_addr);
61 }
62