blob: 3473d98831ccbbdc4f8fd13eb7184a4c54ef1db6 [file] [log] [blame]
Jiafei Pan46367ad2018-03-02 07:23:30 +00001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <cci.h>
8#include <debug.h>
9#include "plat_ls.h"
10#include "fsl_csu.h"
11
12/* slave interfaces according to the RM */
13static const int cci_map[] = {
14 4,
15};
16
17void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
18 u_register_t arg2, u_register_t arg3)
19{
20#ifdef LS_BL2_IN_OCRAM
21 unsigned long romem_base = (unsigned long)(&__TEXT_START__);
22 unsigned long romem_size = (unsigned long)(&__RODATA_END__)
23 - romem_base;
24
25 /* Check the Text and RO-Data region size */
26 if (romem_size > BL31_TEXT_RODATA_SIZE) {
27 ERROR("BL31 Text and RO-Data region size exceed reserved memory size\n");
28 panic();
29 }
30#endif
31
32 /*
33 * Initialize system level generic timer for Layerscape Socs.
34 */
35 ls_delay_timer_init();
36
37 ls_bl31_early_platform_setup((void *)arg0, (void *)arg3);
38
39 /*
40 * Initialize the correct interconnect for this cluster during cold
41 * boot. No need for locks as no other CPU is active.
42 */
43 cci_init(PLAT_LS1043_CCI_BASE, cci_map, ARRAY_SIZE(cci_map));
44
45 /*
46 * Enable coherency in interconnect for the primary CPU's cluster.
47 * Earlier bootloader stages might already do this (e.g. Trusted
48 * Firmware's BL1 does it) but we can't assume so. There is no harm in
49 * executing this code twice anyway.
50 */
51 cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr()));
52
53 /* Init CSU to enable non-secure access to peripherals */
54 enable_layerscape_ns_access();
55}