Debian Codegraph @

plat/imx/imx8m/include/imx_rdc.h

raw
1 /*
2 * Copyright (c) 2019-2022 NXP. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 #ifndef IMX_RDC_H
8 #define IMX_RDC_H
9
10 #include <lib/utils_def.h>
11
12 #include <imx_sec_def.h>
13 #include <platform_def.h>
14
15 #define MDAn(x) (IMX_RDC_BASE + 0x200 + (x) * 4)
16 #define PDAPn(x) (IMX_RDC_BASE + 0x400 + (x) * 4)
17 #define MRSAn(x) (IMX_RDC_BASE + 0x800 + (x) * 0x10)
18 #define MREAn(x) (IMX_RDC_BASE + 0x804 + (x) * 0x10)
19 #define MRCn(x) (IMX_RDC_BASE + 0x808 + (x) * 0x10)
20
21 #define LCK BIT(31)
22 #define SREQ BIT(30)
23 #define ENA BIT(30)
24
25 #define DID0 U(0x0)
26 #define DID1 U(0x1)
27 #define DID2 U(0x2)
28 #define DID3 U(0x3)
29
30 #define D3R BIT(7)
31 #define D3W BIT(6)
32 #define D2R BIT(5)
33 #define D2W BIT(4)
34 #define D1R BIT(3)
35 #define D1W BIT(2)
36 #define D0R BIT(1)
37 #define D0W BIT(0)
38
39 union rdc_setting {
40 uint32_t rdc_mda; /* Master Domain Assignment */
41 uint32_t rdc_pdap; /* Peripheral Domain Access Permissions */
42 uint32_t rdc_mem_region[3]; /* Memory Region Access Control */
43 };
44
45 enum rdc_type {
46 RDC_INVALID,
47 RDC_MDA,
48 RDC_PDAP,
49 RDC_MEM_REGION,
50 };
51
52 struct imx_rdc_cfg {
53 enum rdc_type type; /* config type Master, Peripheral or Memory region */
54 int index;
55 union rdc_setting setting;
56 };
57
58 #define RDC_MDAn(i, mda) \
59 {RDC_MDA, (i), .setting.rdc_mda = (mda), }
60 #define RDC_PDAPn(i, pdap) \
61 {RDC_PDAP, (i), .setting.rdc_pdap = (pdap), }
62
63 #define RDC_MEM_REGIONn(i, msa, mea, mrc) \
64 { RDC_MEM_REGION, (i), \
65 .setting.rdc_mem_region[0] = (msa), \
66 .setting.rdc_mem_region[1] = (mea), \
67 .setting.rdc_mem_region[2] = (mrc), \
68 }
69
70 void imx_rdc_init(struct imx_rdc_cfg *cfg, unsigned int console_base);
71
72 #endif /* IMX_RDC_H */
73