arm-trusted-firmware/plat/xilinx/common/plat_clkfunc.c
Maheedhar Bollapalli 16c611f8a6 fix(versal): add external declaration
This corrects the MISRA violation C2012-8.4:
A compatible declaration shall be visible when an object or
function with external linkage is defined.

Change-Id: I91817596c5de84b259a5dffcc01a7b1106a5b7a4
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
2024-11-05 08:10:17 +00:00

41 lines
853 B
C

/*
* Copyright (c) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <common/debug.h>
#include <lib/mmio.h>
#include <plat/common/platform.h>
#include <platform_def.h>
#include <plat_clkfunc.h>
#include <plat_private.h>
uint32_t plat_get_syscnt_freq2(void)
{
uint32_t counter_freq = 0;
uint32_t ret = 0;
counter_freq = mmio_read_32(IOU_SCNTRS_BASE +
IOU_SCNTRS_BASE_FREQ_OFFSET);
if (counter_freq != 0U) {
ret = counter_freq;
} else {
INFO("Indicates counter frequency %dHz setting to %dHz\n",
counter_freq, cpu_clock);
ret = cpu_clock;
}
return ret;
}
void set_cnt_freq(void)
{
uint64_t counter_freq;
/* Configure counter frequency */
counter_freq = read_cntfrq_el0();
if (counter_freq == 0U) {
write_cntfrq_el0(plat_get_syscnt_freq2());
}
}