xref: /rk3399_ARM-atf/plat/imx/imx9/imx95/include/platform_def.h (revision b182f709847ff793e0df35c6f58210451bc1e270)
1 /*
2  * Copyright 2022-2025 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #ifndef PLATFORM_DEF_H
7 #define PLATFORM_DEF_H
8 
9 #include <lib/utils_def.h>
10 #include <lib/xlat_tables/xlat_tables_v2.h>
11 
12 #include <imx95_scmi_def.h>
13 
14 #define PLATFORM_LINKER_FORMAT		"elf64-littleaarch64"
15 #define PLATFORM_LINKER_ARCH		aarch64
16 
17 #define PLATFORM_STACK_SIZE		0xB00
18 #define CACHE_WRITEBACK_GRANULE		64
19 
20 #define PLAT_PRIMARY_CPU		U(0x0)
21 #define PLATFORM_MAX_CPU_PER_CLUSTER	U(6)
22 #define PLATFORM_CLUSTER_COUNT		U(1)
23 #define PLATFORM_CLUSTER0_CORE_COUNT	U(6)
24 #define PLATFORM_CORE_COUNT		U(6)
25 
26 #define IMX_PWR_LVL0			MPIDR_AFFLVL0
27 
28 #define PWR_DOMAIN_AT_MAX_LVL		U(1)
29 #define PLAT_MAX_PWR_LVL		U(2)
30 #define PLAT_MAX_OFF_STATE		U(4)
31 #define PLAT_MAX_RET_STATE		U(2)
32 
33 /* DDR region 256KB */
34 #define BL31_BASE			U(0x8A200000)
35 #define BL31_LIMIT			U(0x8A240000)
36 
37 /* non-secure uboot base */
38 /* TODO */
39 #define PLAT_NS_IMAGE_OFFSET		U(0x90200000)
40 
41 /* GICv4 base address */
42 #define PLAT_GICD_BASE			U(0x48000000)
43 #define PLAT_GICR_BASE			U(0x48060000)
44 #define PLAT_ARM_GICR_BASE		PLAT_GICR_BASE
45 #define PLAT_ARM_GICD_BASE		PLAT_GICD_BASE
46 
47 #define PLAT_VIRT_ADDR_SPACE_SIZE	(ULL(1) << 36)
48 #define PLAT_PHY_ADDR_SPACE_SIZE	(ULL(1) << 36)
49 
50 #ifdef SPD_trusty
51 #define MAX_XLAT_TABLES			17
52 #define MAX_MMAP_REGIONS		35
53 #else
54 #define MAX_XLAT_TABLES			14
55 #define MAX_MMAP_REGIONS		32
56 #endif
57 
58 #define IMX_LPUART_BASE			0x44380000
59 #define IMX_BOOT_UART_CLK_IN_HZ		24000000 /* Select 24MHz oscillator */
60 #define IMX_CONSOLE_BAUDRATE		115200
61 
62 #define AIPSx_SIZE			U(0x800000)
63 #define AIPS1_BASE			U(0x44000000)
64 #define AIPS2_BASE			U(0x42000000)
65 #define AIPS3_BASE			U(0x42800000)
66 #define AIPS4_BASE			U(0x49000000)
67 #define MU_SECURE_BASE			U(0x44220000)
68 #define GPIO1_BASE			U(0x47400000)
69 #define GPIO2_BASE			U(0x43810000)
70 #define GPIO3_BASE			U(0x43820000)
71 #define GPIO4_BASE			U(0x43840000)
72 #define GPIO5_BASE			U(0x43850000)
73 #define WDOG3_BASE			U(0x42490000)
74 #define WDOG4_BASE			U(0x424A0000)
75 
76 #define ELE_MU_BASE			U(0x47540000)
77 
78 #define SMT_BUFFER_BASE			U(0x8A246000)
79 #define SMT_BUFFER_SIZE			0x1000
80 
81 #define IMX9_SCMI_PAYLOAD_BASE		0x44221000
82 #define IMX9_MU1_BASE			0x44220000
83 #define MU_GCR_OFF			0x114
84 
85 /* Used for GIC_WAKER sync between AP and SM. */
86 #define SM_AP_SEMA_ADDR			0x442213F8
87 
88 #define GPIO_NUM			U(4)
89 #define PER_NUM				U(15)
90 #define WDOG_NUM			U(2)
91 
92 #define NETC_IREC_PCI_INT_X0		U(304)
93 
94 #define COUNTER_FREQUENCY		24000000
95 
96 #define TRUSTY_PARAMS_LEN_BYTES		(4096 * 2)
97 #define IMX_TRUSTY_STACK_SIZE		0x200
98 #define TRUSTY_SHARED_MEMORY_OBJ_SIZE	(12 * 1024)
99 
100 /*
101  * Define a list of Group 1 Secure and Group 0 interrupt properties
102  * as per GICv3 terminology.
103  */
104 #define PLAT_ARM_G1S_IRQ_PROPS(grp) \
105 	INTR_PROP_DESC(29U, GIC_HIGHEST_SEC_PRIORITY, grp,   \
106 		       GIC_INTR_CFG_LEVEL)
107 
108 #define PLAT_ARM_G0_IRQ_PROPS(grp) \
109 	INTR_PROP_DESC(8U, GIC_HIGHEST_SEC_PRIORITY, \
110 		       (grp), GIC_INTR_CFG_LEVEL)
111 
112 /* memory mapping  */
113 #define AIPS2_MAP	MAP_REGION_FLAT(AIPS2_BASE, AIPSx_SIZE, MT_DEVICE | MT_RW)
114 #define GIC_MAP		MAP_REGION_FLAT(PLAT_GICD_BASE, 0x200000, MT_DEVICE | MT_RW)
115 #define AIPS1_MAP	MAP_REGION_FLAT(AIPS1_BASE, AIPSx_SIZE, MT_DEVICE | MT_RW)
116 #define GPIO2_MAP	MAP_REGION_FLAT(GPIO2_BASE, 0x20000, MT_DEVICE | MT_RW)
117 #define GPIO4_MAP	MAP_REGION_FLAT(GPIO4_BASE, 0x20000, MT_DEVICE | MT_RW)
118 #define ELE_MAP		MAP_REGION_FLAT(ELE_MU_BASE, 0x10000, MT_DEVICE | MT_RW)
119 
120 #endif /* PLATFORM_DEF_H */
121