arm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid

Since COUNTER_FREQUENCY is obselete, so set cntfrq_el0 if
CONFIG_COUNTER_FREQUENCY is valid

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
This commit is contained in:
Peng Fan
2022-04-13 17:47:22 +08:00
committed by Tom Rini
parent c5b9bf5518
commit 151a030063
9 changed files with 13 additions and 13 deletions

View File

@@ -202,14 +202,14 @@ int board_init(void)
* we avoid the risk of writing to it.
*/
asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r"(freq));
if (freq != COUNTER_FREQUENCY) {
if (freq != CONFIG_COUNTER_FREQUENCY) {
debug("arch timer frequency is %d Hz, should be %d, fixing ...\n",
freq, COUNTER_FREQUENCY);
freq, CONFIG_COUNTER_FREQUENCY);
#ifdef CONFIG_NON_SECURE
printf("arch timer frequency is wrong, but cannot adjust it\n");
#else
asm volatile("mcr p15, 0, %0, c14, c0, 0"
: : "r"(COUNTER_FREQUENCY));
: : "r"(CONFIG_COUNTER_FREQUENCY));
#endif
}
}