1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2019, 2021 NXP
4  *
5  * Brief   Specific Macro used to read/write value with a specific
6  *         format (BE/LE, 32/64 bits) to be updated for future platform
7  *         support.
8  */
9 
10 #ifndef __CAAM_IO_H__
11 #define __CAAM_IO_H__
12 
13 #include <io.h>
14 
15 #ifdef CFG_CAAM_BIG_ENDIAN
16 /* Big Endian 32 bits Registers access */
17 #define io_caam_read32(a)	TEE_U32_FROM_BIG_ENDIAN(io_read32(a))
18 #define io_caam_write32(a, val) io_write32(a, TEE_U32_TO_BIG_ENDIAN(val))
19 
20 /* Big Endian 32 bits Value access */
21 #define caam_read_val32(a)	get_be32(a)
22 #define caam_write_val32(a, v)	put_be32(a, v)
23 #else
24 /* Little Endian 32 bits Registers access */
25 #define io_caam_read32(a)	io_read32(a)
26 #define io_caam_write32(a, val) io_write32(a, val)
27 
28 /* Little Endian 32 bits Value access */
29 #define caam_read_val32(a)	get_le32(a)
30 #define caam_write_val32(a, v)	put_le32(a, v)
31 
32 #define caam_read_val64(a)     get_le64(a)
33 #define caam_write_val64(a, v) put_le64(a, v)
34 #endif
35 
36 #endif /* __CAAM_IO_H__ */
37