]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/freescale/common/ns_access.c
Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriq
[karo-tx-uboot.git] / board / freescale / common / ns_access.c
1 /*
2  * Copyright 2014 Freescale Semiconductor
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <asm/io.h>
9 #include <asm/arch/ns_access.h>
10
11 void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
12 {
13         u32 *base = (u32 *)CONFIG_SYS_FSL_CSU_ADDR;
14         u32 *reg;
15         uint32_t val;
16         int i;
17
18         for (i = 0; i < num; i++) {
19                 reg = base + ns_dev[i].ind / 2;
20                 val = in_be32(reg);
21                 if (ns_dev[i].ind % 2 == 0) {
22                         val &= 0x0000ffff;
23                         val |= ns_dev[i].val << 16;
24                 } else {
25                         val &= 0xffff0000;
26                         val |= ns_dev[i].val;
27                 }
28                 out_be32(reg, val);
29         }
30 }