blob: d7de9822d031ee0a2eba26530043fe5db94ec389 [file] [log] [blame]
Xiubo Li54de0652014-11-21 17:40:58 +08001/*
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
11void 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}