From a1b1945ac5a44c3fa66b708c48943e04749efb04 Mon Sep 17 00:00:00 2001 From: Jacky Bai Date: Fri, 17 Apr 2020 11:24:16 +0800 Subject: MLK-23803 plat: imx8mq: Get the system counter freq from hw reg On i.Mx8MQ, the actual system counter freq is 8333333Hz, have some trailing part, so get the actual freq from the system counter module register. Signed-off-by: Jacky Bai Reviewed-by: Anson Huang --- plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 2 +- plat/imx/imx8m/imx8mq/include/platform_def.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c index 304dae3e..f627cfda 100644 --- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c @@ -231,7 +231,7 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(unsigned int type) unsigned int plat_get_syscnt_freq2(void) { - return COUNTER_FREQUENCY; + return mmio_read_32(IMX_SCTR_BASE + CNTFID0_OFF); } void bl31_plat_runtime_setup(void) diff --git a/plat/imx/imx8m/imx8mq/include/platform_def.h b/plat/imx/imx8m/imx8mq/include/platform_def.h index 494e689c..6d838fc3 100644 --- a/plat/imx/imx8m/imx8mq/include/platform_def.h +++ b/plat/imx/imx8m/imx8mq/include/platform_def.h @@ -145,6 +145,9 @@ #define OCRAM_S_SIZE U(0x8000) #define OCRAM_S_LIMIT (OCRAM_S_BASE + OCRAM_S_SIZE) +#define IMX_SCTR_BASE 0x306c0000 +#define CNTFID0_OFF U(0x20) +#define CNTFID1_OFF U(0x24) #define COUNTER_FREQUENCY 8000000 /* 8MHz */ #define DEBUG_CONSOLE 0 -- cgit v1.2.3