aboutsummaryrefslogtreecommitdiff
path: root/plat/imx/common
diff options
context:
space:
mode:
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>2018-05-25 16:52:03 +0100
committerBryan O'Donoghue <bryan.odonoghue@linaro.org>2018-09-04 13:36:23 +0100
commitf7ea6d52234102b8f67d2d030a860b7a119d8450 (patch)
tree831b5211bea866700d9b5dfb3258a29b3de15cf3 /plat/imx/common
parenta60ca3b4d5b0b8c13b2ccde8b49396b3d52d9272 (diff)
downloadtrusted-firmware-a-f7ea6d52234102b8f67d2d030a860b7a119d8450.tar.gz
imx: imx_snvs: Add an SNVS core functionality
This patch adds snvs.c with a imx_snvs_init() function. imx_snvs_init() sets up permissions of the RTC via the SNVS HPCOMR. During previous work with OPTEE on the i.MX7 part we discovered that prior to switching from secure-world to normal-world it is required to apply more permissive permissions than are defaulted to in order for Linux to be able to access the RTC and CAAM functionality in general. This patch pertains to fixing the RTC permissions by way of the HPCOMR.NPSWA_EN bit. Once set non-privileged code aka Linux-kernel code has permissions to access the SNVS where the RTC resides. Perform that permissions fix in imx_snvs_init() now, with a later patch making the call from our platform setup code. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Diffstat (limited to 'plat/imx/common')
-rw-r--r--plat/imx/common/imx_snvs.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/plat/imx/common/imx_snvs.c b/plat/imx/common/imx_snvs.c
new file mode 100644
index 0000000000..4a2a7d7250
--- /dev/null
+++ b/plat/imx/common/imx_snvs.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <mmio.h>
+#include <imx_regs.h>
+#include <imx_snvs.h>
+
+void imx_snvs_init(void)
+{
+ struct snvs *snvs = (struct snvs *)SNVS_BASE;
+ uintptr_t addr;
+ uint32_t val;
+
+ addr = (uintptr_t)&snvs->hpcomr;
+ val = mmio_read_32(addr);
+ val |= HPCOMR_NPSWA_EN;
+ mmio_write_32(addr, val);
+}