1 /*
2  * Copyright (C) 2016 Marvell International Ltd.
3  *
4  * SPDX-License-Identifier:	BSD-3-Clause
5  * https://spdx.org/licenses
6  */
7 
8 #ifndef PLAT_MARVELL_H
9 #define PLAT_MARVELL_H
10 
11 #include <stdint.h>
12 
13 #include <common/bl_common.h>
14 #include <lib/cassert.h>
15 #include <lib/el3_runtime/cpu_data.h>
16 #include <lib/xlat_tables/xlat_tables_v2.h>
17 
18 /*
19  * Extern declarations common to Marvell standard platforms
20  */
21 extern const mmap_region_t plat_marvell_mmap[];
22 
23 #define MARVELL_CASSERT_MMAP						\
24 	CASSERT((ARRAY_SIZE(plat_marvell_mmap) + MARVELL_BL_REGIONS)	\
25 		<= MAX_MMAP_REGIONS,					\
26 		assert_max_mmap_regions)
27 
28 /*
29  * Utility functions common to Marvell standard platforms
30  */
31 void marvell_setup_page_tables(uintptr_t total_base,
32 			       size_t total_size,
33 			       uintptr_t code_start,
34 			       uintptr_t code_limit,
35 			       uintptr_t rodata_start,
36 			       uintptr_t rodata_limit
37 #if USE_COHERENT_MEM
38 			     , uintptr_t coh_start,
39 			       uintptr_t coh_limit
40 #endif
41 );
42 
43 /* Console utility functions */
44 void marvell_console_boot_init(void);
45 void marvell_console_boot_end(void);
46 void marvell_console_runtime_init(void);
47 void marvell_console_runtime_end(void);
48 
49 /* IO storage utility functions */
50 void marvell_io_setup(void);
51 
52 /* Systimer utility function */
53 void marvell_configure_sys_timer(void);
54 
55 /* Topology utility function */
56 int marvell_check_mpidr(u_register_t mpidr);
57 
58 /* BL1 utility functions */
59 void marvell_bl1_early_platform_setup(void);
60 void marvell_bl1_platform_setup(void);
61 void marvell_bl1_plat_arch_setup(void);
62 
63 /* BL2 utility functions */
64 void marvell_bl2_early_platform_setup(meminfo_t *mem_layout);
65 void marvell_bl2_platform_setup(void);
66 void marvell_bl2_plat_arch_setup(void);
67 uint32_t marvell_get_spsr_for_bl32_entry(void);
68 uint32_t marvell_get_spsr_for_bl33_entry(void);
69 
70 /* BL31 utility functions */
71 void marvell_bl31_early_platform_setup(void *from_bl2,
72 				       uintptr_t soc_fw_config,
73 				       uintptr_t hw_config,
74 				       void *plat_params_from_bl2);
75 void marvell_bl31_platform_setup(void);
76 void marvell_bl31_plat_runtime_setup(void);
77 void marvell_bl31_plat_arch_setup(void);
78 
79 /* FIP TOC validity check */
80 int marvell_io_is_toc_valid(void);
81 
82 /*
83  * PSCI functionality
84  */
85 void marvell_psci_arch_init(int idx);
86 void plat_marvell_system_reset(void);
87 
88 /*
89  * Optional functions required in Marvell standard platforms
90  */
91 void plat_marvell_io_setup(void);
92 int plat_marvell_get_alt_image_source(
93 	unsigned int image_id,
94 	uintptr_t *dev_handle,
95 	uintptr_t *image_spec);
96 unsigned int plat_marvell_calc_core_pos(u_register_t mpidr);
97 
98 void plat_marvell_interconnect_init(void);
99 void plat_marvell_interconnect_enter_coherency(void);
100 
101 const mmap_region_t *plat_marvell_get_mmap(void);
102 
103 uint32_t get_ref_clk(void);
104 
105 #endif /* PLAT_MARVELL_H */
106