xref: /optee_os/core/drivers/crypto/caam/hal/common/registers/sm_regs.h (revision b7815eeda2ffa172aee1349aeec9ba746bc8082c)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2019 NXP
4  */
5 #ifndef __SM_REGS_H__
6 #define __SM_REGS_H__
7 
8 #include <util.h>
9 
10 /* Access Permission */
11 #define SM_SMAPR(prtn)			(0x0A04 + (prtn) * 16)
12 #define SM_SMAPR_GRP1(perm)		SHIFT_U32((perm) & 0xF, 0)
13 #define SM_SMAPR_GRP2(perm)		SHIFT_U32((perm) & 0xF, 4)
14 #define SM_SMAPR_CSP			BIT32(15)
15 #define SM_SMAPR_SMAP_LCK		BIT32(13)
16 #define SM_SMAPR_SMAG_LCK		BIT32(12)
17 
18 /* Access Group */
19 #define SM_SMAG2(prtn)			(0x0A08 + (prtn) * 16)
20 #define SM_SMAG1(prtn)			(0x0A0C + (prtn) * 16)
21 
22 /* Command */
23 #define SM_SMCR				0x0BE4
24 #define SM_SMCR_PAGE(page)		SHIFT_U32((page) & UINT16_MAX, 16)
25 #define SM_SMCR_PRTN(prtn)		SHIFT_U32((prtn) & 0xF, 8)
26 #define SM_SMCR_CMD(cmd)		SHIFT_U32((cmd) & 0xF, 0)
27 #define SM_SMCR_PAGE_ALLOC		0x1
28 #define SM_SMCR_PAGE_DEALLOC		0x2
29 #define SM_SMCR_PARTITION_DEALLOC	0x3
30 #define SM_SMCR_PAGE_INQ		0x5
31 
32 /* Command Status */
33 #define SM_SMCSR			0x0BEC
34 #define SM_SMCSR_CERR(val)		(((val) >> 14) & 0x3)
35 #define SM_SMCSR_CERR_NO_ERROR		0x0
36 #define SM_SMCSR_CERR_NOT_COMPLETED	0x1
37 #define SM_SMCSR_AERR(val)		(((val) >> 12) & 0x3)
38 #define SM_SMCSR_AERR_NO_ERROR		0x0
39 #define SM_SMCSR_PO(val)		(((val) >> 6) & 0x3)
40 #define SM_SMCSR_PO_AVAILABLE		0x0
41 #define SM_SMCSR_PO_UNKNOWN		0x1
42 #define SM_SMCSR_PO_OWNED_BY_OTHER	0x2
43 #define SM_SMCSR_PO_OWNED		0x3
44 #define SM_SMCSR_PRTN(val)		((val) & 0x3)
45 
46 /* Partition Owners */
47 #define SM_SMPO				0x0FBC
48 #define SM_SMPO_PART(prtn)		((prtn) * 2)
49 #define SM_SMPO_OWNER(val, prtn)	(((val) >> SM_SMPO_PART(prtn)) & 0x3)
50 #define SMPO_PO_AVAIL			0x0
51 #define SMPO_PO_OWNED			0x3
52 
53 #endif /* __SM_REGS_H__ */
54