From 0ecd869fd6f85fabf8e68b50e4b3f0bf20d2f705 Mon Sep 17 00:00:00 2001 From: Siva Durga Prasad Paladugu Date: Thu, 7 Dec 2017 15:05:30 +0530 Subject: [PATCH] zynqmp: Access timestamp_ref_ctrl register only if running in el3 Access the timestamp ref ctrl register only if runinng at el3 level otherwise just return. This change fixes the issue when CRL APB is marked as secure and accessing when not in el3 causes exception. Signed-off-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 107a3e494e..ff776f7deb 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -278,10 +278,13 @@ int board_early_init_r(void) { u32 val; + if (current_el() != 3) + return 0; + val = readl(&crlapb_base->timestamp_ref_ctrl); val &= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT; - if (current_el() == 3 && !val) { + if (!val) { val = readl(&crlapb_base->timestamp_ref_ctrl); val |= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT; writel(val, &crlapb_base->timestamp_ref_ctrl);