blob: 4987eeb2fa9f11c60af5dbf85e16e31d89377a7b [file] [log] [blame]
Tony Xief6118cc2016-01-15 17:17:32 +08001/*
2 * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Tony Xief6118cc2016-01-15 17:17:32 +08005 */
6
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00007#include <platform_def.h>
8
Tony Xief6118cc2016-01-15 17:17:32 +08009#include <arch.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <lib/psci/psci.h>
11
Tony Xief6118cc2016-01-15 17:17:32 +080012#include <plat_private.h>
Tony Xief6118cc2016-01-15 17:17:32 +080013
14/*******************************************************************************
15 * This function returns the RockChip default topology tree information.
16 ******************************************************************************/
17const unsigned char *plat_get_power_domain_tree_desc(void)
18{
19 return rockchip_power_domain_tree_desc;
20}
21
22int plat_core_pos_by_mpidr(u_register_t mpidr)
23{
24 unsigned int cluster_id, cpu_id;
25
Tony Xie42e113e2016-07-16 11:16:51 +080026 cpu_id = mpidr & MPIDR_AFFLVL_MASK;
Heiko Stuebner9dc28332019-03-14 22:11:34 +010027#ifdef PLAT_RK_MPIDR_CLUSTER_MASK
28 cluster_id = mpidr & PLAT_RK_MPIDR_CLUSTER_MASK;
29#else
Tony Xie42e113e2016-07-16 11:16:51 +080030 cluster_id = mpidr & MPIDR_CLUSTER_MASK;
Heiko Stuebner9dc28332019-03-14 22:11:34 +010031#endif
Tony Xief6118cc2016-01-15 17:17:32 +080032
Tony Xie42e113e2016-07-16 11:16:51 +080033 cpu_id += (cluster_id >> PLAT_RK_CLST_TO_CPUID_SHIFT);
34
35 if (cpu_id >= PLATFORM_CORE_COUNT)
Tony Xief6118cc2016-01-15 17:17:32 +080036 return -1;
37
Tony Xie42e113e2016-07-16 11:16:51 +080038 return cpu_id;
Tony Xief6118cc2016-01-15 17:17:32 +080039}