xref: /rk3399_ARM-atf/plat/intel/soc/common/soc/socfpga_system_manager.c (revision 8c4ae764ffa50d48c289f394144b9bb16770d605)
1 /*
2  * Copyright (c) 2024-2025, Altera Corporation. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <assert.h>
8 #include <errno.h>
9 #include <common/debug.h>
10 #include <drivers/delay_timer.h>
11 #include <lib/mmio.h>
12 #include <platform_def.h>
13 
14 #include "socfpga_system_manager.h"
15 
intel_hps_get_jtag_id(void)16 uint32_t intel_hps_get_jtag_id(void)
17 {
18 	uint32_t jtag_id;
19 
20 	jtag_id = (mmio_read_32(SOCFPGA_SYSMGR(BOOT_SCRATCH_COLD_4)));
21 
22 	INFO("%s: JTAG ID: 0x%x\n", __func__, jtag_id);
23 
24 	return jtag_id;
25 }
26 
27 /* Check for Agilex5 SM4 */
is_agilex5_A5F0(void)28 bool is_agilex5_A5F0(void)
29 {
30 	return ((intel_hps_get_jtag_id() & JTAG_ID_MASK) == A5F0_JTAG_ID);
31 }
32 
33 /* Check for Agilex5 SM4 B0 */
is_agilex5_A5F4(void)34 bool is_agilex5_A5F4(void)
35 {
36 	return ((intel_hps_get_jtag_id() & JTAG_ID_MASK) == A5F4_JTAG_ID);
37 }
38