blob: d9c234fd5206a854ec7b67048c97ecbd519e7c68 [file] [log] [blame]
XiaoDong Huangdcf89f32023-06-26 16:43:30 +08001/*
2 * Copyright (c) 2024, Rockchip, Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SECURE_H
8#define SECURE_H
9
10/* DSUSGRF */
11#define DSU_SGRF_SOC_CON(i) ((i) * 4)
12#define DSUSGRF_SOC_CON(i) ((i) * 4)
13#define DSUSGRF_SOC_CON_CNT 13
14#define DSUSGRF_DDR_HASH_CON(i) (0x240 + (i) * 4)
15#define DSUSGRF_DDR_HASH_CON_CNT 8
16
17/* PMUSGRF */
18#define PMU1SGRF_SOC_CON(n) ((n) * 4)
19
20/* SGRF */
21#define SGRF_SOC_CON(i) ((i) * 4)
22#define SGRF_FIREWALL_CON(i) (0x240 + (i) * 4)
23#define SGRF_FIREWALL_CON_CNT 32
24
25/* ddr firewall */
26#define FIREWALL_DDR_RGN(i) ((i) * 0x4)
27#define FIREWALL_DDR_RGN_CNT 16
28#define FIREWALL_DDR_MST(i) (0x40 + (i) * 0x4)
29#define FIREWALL_DDR_MST_CNT 42
30#define FIREWALL_DDR_CON 0xf0
31
32#define FIREWALL_SYSMEM_RGN(i) ((i) * 0x4)
33#define FIREWALL_SYSMEM_RGN_CNT 8
34#define FIREWALL_SYSMEM_MST(i) (0x40 + (i) * 0x4)
35#define FIREWALL_SYSMEM_MST_CNT 43
36#define FIREWALL_SYSMEM_CON 0xf0
37
38#define FIREWALL_DSU_RGN(i) ((i) * 0x4)
39#define FIREWALL_DSU_RGN_CNT 16
40#define FIREWALL_DSU_MST(i) (0x40 + (i) * 0x4)
41#define FIREWALL_DSU_MST_CNT 2
42#define FIREWALL_DSU_CON(i) (0xf0 + (i) * 4)
43#define FIREWALL_DSU_CON_CNT 4
44
45#define PLAT_MAX_DDR_CAPACITY_MB 0x8000 /* for 32Gb */
46#define RG_MAP_SECURE(top, base) \
47 (((((top) - 1) & 0x7fff) << 16) | ((base) & 0x7fff))
48#define RG_MAP_SRAM_SECURE(top_kb, base_kb) \
49 (((((top_kb) / 4 - 1) & 0xff) << 16) | ((base_kb) / 4 & 0xff))
50
51void secure_timer_init(void);
52void sgrf_init(void);
53
54#endif /* SECURE_H */