diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:13:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:13:47 +0000 |
commit | 102b0d2daa97dae68d3eed54d8fe37a9cc38a892 (patch) | |
tree | bcf648efac40ca6139842707f0eba5a4496a6dd2 /drivers/nxp/csu/csu.c | |
parent | Initial commit. (diff) | |
download | arm-trusted-firmware-102b0d2daa97dae68d3eed54d8fe37a9cc38a892.tar.xz arm-trusted-firmware-102b0d2daa97dae68d3eed54d8fe37a9cc38a892.zip |
Adding upstream version 2.8.0+dfsg.upstream/2.8.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/nxp/csu/csu.c')
-rw-r--r-- | drivers/nxp/csu/csu.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/nxp/csu/csu.c b/drivers/nxp/csu/csu.c new file mode 100644 index 0000000..9f90fe0 --- /dev/null +++ b/drivers/nxp/csu/csu.c @@ -0,0 +1,34 @@ +/* + * 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)); + } +} |