]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
zynqmp: Access timestamp_ref_ctrl register only if running in el3
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Thu, 7 Dec 2017 09:35:30 +0000 (15:05 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 4 Jan 2018 15:19:12 +0000 (16:19 +0100)
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 <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynqmp/zynqmp.c

index 107a3e494e8d91616f687841d9aa265ac9e46f54..ff776f7deb6f56e20b7dacd17e713ca0e750fc8e 100644 (file)
@@ -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);