diff mbox series

[4/5] freescale: ls1043aqds: enable secure system counter

Message ID 20200701094330.27091-4-biwen.li@oss.nxp.com
State Superseded
Headers show
Series [1/5] i2c: mxc: move i2c_early_init_f to common function | expand

Commit Message

Biwen Li (OSS) July 1, 2020, 9:43 a.m. UTC
From: Biwen Li <biwen.li at nxp.com>

Enable secure system counter in board_early_init_f for udelay()
to fix a bug that always return 0 by timer_read_counter()
when boot from qspi(No TFA)

Signed-off-by: Biwen Li <biwen.li at nxp.com>
---
 board/freescale/ls1043aqds/ls1043aqds.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/board/freescale/ls1043aqds/ls1043aqds.c b/board/freescale/ls1043aqds/ls1043aqds.c
index 2d4b18c..5e4b030 100644
--- a/board/freescale/ls1043aqds/ls1043aqds.c
+++ b/board/freescale/ls1043aqds/ls1043aqds.c
@@ -1,7 +1,7 @@ 
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2015 Freescale Semiconductor, Inc.
- * Copyright 2019 NXP
+ * Copyright 2019-2020 NXP
  */
 
 #include <common.h>
@@ -451,6 +451,7 @@  void board_retimer_init(void)
 
 int board_early_init_f(void)
 {
+	u32 __iomem *cntcr = (u32 *)CONFIG_SYS_FSL_TIMER_ADDR;
 #ifdef CONFIG_HAS_FSL_XHCI_USB
 	struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR;
 	u32 usb_pwrfault;
@@ -459,6 +460,11 @@  int board_early_init_f(void)
 	u8 uart;
 #endif
 
+	/*
+	 * Enable secure system counter for timer
+	 */
+	out_le32(cntcr, 0x1);
+
 #ifdef CONFIG_SYS_I2C
 #ifdef CONFIG_SYS_I2C_EARLY_INIT
 	i2c_early_init_f();