xref: /rk3399_ARM-atf/plat/ti/k3/common/soc.c (revision 383c821c76e05b64fc641cf59541793d29185859)
1 /*
2  * Copyright (c) 2025-2026, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <lib/mmio.h>
8 #include <lib/utils_def.h>
9 #include <plat/common/platform.h>
10 #include <platform_def.h>
11 #include <soc.h>
12 
get_soc_part_no(void)13 uint32_t get_soc_part_no(void)
14 {
15 	uint32_t part_no, jtag_id_reg;
16 
17 	jtag_id_reg = mmio_read_32(CTRLMMR_WKUP_JTAG_ID);
18 	part_no = EXTRACT(JTAG_ID_PARTNO, jtag_id_reg);
19 
20 	return part_no;
21 }
22 
get_plat_cluster_start_id(void)23 uint32_t get_plat_cluster_start_id(void)
24 {
25 	static uint32_t cluster_id;
26 	uint32_t part_no;
27 
28 	if (cluster_id) {
29 		return cluster_id;
30 	}
31 
32 	part_no = get_soc_part_no();
33 	if (part_no == JTAG_ID_PARTNO_AM65X)
34 		cluster_id = CLUSTER_DEVICE_START_ID_AM65X;
35 	else
36 		cluster_id = PLAT_CLUSTER_DEVICE_START_ID;
37 
38 	return cluster_id;
39 }
40