mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-25 06:19:56 +00:00

NXP Central Security Unit(CSU) for NXP SoC. CSU is used for: - Access permissions for peripheral that donot have their own access control. - Locking of individual CSU settings until the next POR - General purpose security related control bits Refer NXP SoC manuals fro more details. Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com> Change-Id: I07a4729c79c5e2597f8b2a782e87e09f7f30c2ca
34 lines
691 B
C
34 lines
691 B
C
/*
|
|
* Copyright 2020 NXP
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*
|
|
*/
|
|
|
|
#include <endian.h>
|
|
|
|
#include <common/debug.h>
|
|
#include <csu.h>
|
|
#include <lib/mmio.h>
|
|
|
|
void enable_layerscape_ns_access(struct csu_ns_dev_st *csu_ns_dev,
|
|
uint32_t num, uintptr_t nxp_csu_addr)
|
|
{
|
|
uint32_t *base = (uint32_t *)nxp_csu_addr;
|
|
uint32_t *reg;
|
|
uint32_t val;
|
|
int i;
|
|
|
|
for (i = 0; i < num; i++) {
|
|
reg = base + csu_ns_dev[i].ind / 2U;
|
|
val = be32toh(mmio_read_32((uintptr_t)reg));
|
|
if (csu_ns_dev[i].ind % 2U == 0U) {
|
|
val &= 0x0000ffffU;
|
|
val |= csu_ns_dev[i].val << 16U;
|
|
} else {
|
|
val &= 0xffff0000U;
|
|
val |= csu_ns_dev[i].val;
|
|
}
|
|
mmio_write_32((uintptr_t)reg, htobe32(val));
|
|
}
|
|
}
|