aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorHou Zhiqiang2016-08-02 19:03:24 +0800
committerYork Sun2016-09-14 14:07:02 -0700
commitc37fdbdbb0dd65cb4aa147c9cf9352901014be3b (patch)
tree5ed57352e2252152ed5770370bc37b995139d926 /board
parent341238fd135dc61cd387546c77901a3eac478a36 (diff)
fsl: csu: add an API to set individual device access permission
Add this API to make the individual device is able to be set to the specified permission. Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'board')
-rw-r--r--board/freescale/common/ns_access.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/board/freescale/common/ns_access.c b/board/freescale/common/ns_access.c
index d8d16c520f8..c3d7a5e9076 100644
--- a/board/freescale/common/ns_access.c
+++ b/board/freescale/common/ns_access.c
@@ -9,25 +9,31 @@
#include <fsl_csu.h>
#include <asm/arch/ns_access.h>
-static void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
+void set_devices_ns_access(struct csu_ns_dev *ns_dev, u16 val)
{
u32 *base = (u32 *)CONFIG_SYS_FSL_CSU_ADDR;
u32 *reg;
- uint32_t val;
- int i;
+ uint32_t tmp;
- for (i = 0; i < num; i++) {
- reg = base + ns_dev[i].ind / 2;
- val = in_be32(reg);
- if (ns_dev[i].ind % 2 == 0) {
- val &= 0x0000ffff;
- val |= ns_dev[i].val << 16;
- } else {
- val &= 0xffff0000;
- val |= ns_dev[i].val;
- }
- out_be32(reg, val);
+ reg = base + ns_dev->ind / 2;
+ tmp = in_be32(reg);
+ if (ns_dev->ind % 2 == 0) {
+ tmp &= 0x0000ffff;
+ tmp |= val << 16;
+ } else {
+ tmp &= 0xffff0000;
+ tmp |= val;
}
+
+ out_be32(reg, tmp);
+}
+
+static void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
+{
+ int i;
+
+ for (i = 0; i < num; i++)
+ set_devices_ns_access(ns_dev + i, ns_dev[i].val);
}
void enable_layerscape_ns_access(void)