xref: /arm-trusted-firmware/plat/brcm/board/stingray/src/topology.c (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*
2*91f16700Schasinglulu  * Copyright (c) 2019-2020, Broadcom
3*91f16700Schasinglulu  *
4*91f16700Schasinglulu  * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu  */
6*91f16700Schasinglulu #include <stdint.h>
7*91f16700Schasinglulu 
8*91f16700Schasinglulu #include <plat_brcm.h>
9*91f16700Schasinglulu #include <platform_def.h>
10*91f16700Schasinglulu 
11*91f16700Schasinglulu /*
12*91f16700Schasinglulu  * On Stingray, the system power level is the highest power level.
13*91f16700Schasinglulu  * The first entry in the power domain descriptor specifies the
14*91f16700Schasinglulu  * number of system power domains i.e. 1.
15*91f16700Schasinglulu  */
16*91f16700Schasinglulu #define SR_PWR_DOMAINS_AT_MAX_PWR_LVL	 1
17*91f16700Schasinglulu 
18*91f16700Schasinglulu /*
19*91f16700Schasinglulu  * The Stingray power domain tree descriptor. The cluster power domains
20*91f16700Schasinglulu  * are arranged so that when the PSCI generic code creates the power
21*91f16700Schasinglulu  * domain tree, the indices of the CPU power domain nodes it allocates
22*91f16700Schasinglulu  * match the linear indices returned by plat_core_pos_by_mpidr()
23*91f16700Schasinglulu  * i.e. CLUSTER0 CPUs are allocated indices from 0 to 1 and the higher
24*91f16700Schasinglulu  * indices for other Cluster CPUs.
25*91f16700Schasinglulu  */
26*91f16700Schasinglulu const unsigned char sr_power_domain_tree_desc[] = {
27*91f16700Schasinglulu 	/* No of root nodes */
28*91f16700Schasinglulu 	SR_PWR_DOMAINS_AT_MAX_PWR_LVL,
29*91f16700Schasinglulu 	/* No of children for the root node */
30*91f16700Schasinglulu 	BRCM_CLUSTER_COUNT,
31*91f16700Schasinglulu 	/* No of children for the first cluster node */
32*91f16700Schasinglulu 	PLATFORM_CLUSTER0_CORE_COUNT,
33*91f16700Schasinglulu 	/* No of children for the second cluster node */
34*91f16700Schasinglulu 	PLATFORM_CLUSTER1_CORE_COUNT,
35*91f16700Schasinglulu 	/* No of children for the third cluster node */
36*91f16700Schasinglulu 	PLATFORM_CLUSTER2_CORE_COUNT,
37*91f16700Schasinglulu 	/* No of children for the fourth cluster node */
38*91f16700Schasinglulu 	PLATFORM_CLUSTER3_CORE_COUNT,
39*91f16700Schasinglulu };
40*91f16700Schasinglulu 
41*91f16700Schasinglulu /*******************************************************************************
42*91f16700Schasinglulu  * This function returns the Stingray topology tree information.
43*91f16700Schasinglulu  ******************************************************************************/
44*91f16700Schasinglulu const unsigned char *plat_get_power_domain_tree_desc(void)
45*91f16700Schasinglulu {
46*91f16700Schasinglulu 	return sr_power_domain_tree_desc;
47*91f16700Schasinglulu }
48*91f16700Schasinglulu 
49*91f16700Schasinglulu int plat_core_pos_by_mpidr(u_register_t mpidr)
50*91f16700Schasinglulu {
51*91f16700Schasinglulu 	return plat_brcm_calc_core_pos(mpidr);
52*91f16700Schasinglulu }
53