xref: /rk3399_ARM-atf/drivers/arm/mhu/mhu_v3_x_private.h (revision bc174764f0daa82128bf60163653fc20db9a7e87)
1*bc174764SAziz IDOMAR /*
2*bc174764SAziz IDOMAR  * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
3*bc174764SAziz IDOMAR  *
4*bc174764SAziz IDOMAR  * SPDX-License-Identifier: BSD-3-Clause
5*bc174764SAziz IDOMAR  */
6*bc174764SAziz IDOMAR 
7*bc174764SAziz IDOMAR #ifndef MHU_V3_X_PRIVATE_H
8*bc174764SAziz IDOMAR #define MHU_V3_X_PRIVATE_H
9*bc174764SAziz IDOMAR 
10*bc174764SAziz IDOMAR #include <stdint.h>
11*bc174764SAziz IDOMAR 
12*bc174764SAziz IDOMAR /* Flag for PDBCW Interrupt Transfer Acknowledgment  */
13*bc174764SAziz IDOMAR #define MHU_V3_X_PDBCW_INT_X_TFR_ACK 0x1
14*bc174764SAziz IDOMAR 
15*bc174764SAziz IDOMAR /* Flag for PDBCW CTRL Postbox combined interrupts enable */
16*bc174764SAziz IDOMAR #define MHU_V3_X_PDBCW_CTRL_PBX_COMB_EN 0x1
17*bc174764SAziz IDOMAR 
18*bc174764SAziz IDOMAR /* Flag for MDBCW CTRL Mailbox combined interrupts enable */
19*bc174764SAziz IDOMAR #define MHU_V3_X_MDBCW_CTRL_MBX_COMB_EN 0x1
20*bc174764SAziz IDOMAR 
21*bc174764SAziz IDOMAR /**
22*bc174764SAziz IDOMAR  * Postbox control page structure
23*bc174764SAziz IDOMAR  */
24*bc174764SAziz IDOMAR struct _mhu_v3_x_pbx_ctrl_reg_t {
25*bc174764SAziz IDOMAR 	/* Offset: 0x000 (R/ ) Postbox Block Identifier */
26*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_blk_id;
27*bc174764SAziz IDOMAR 	/* Offset: 0x004 (R/ ) Reserved */
28*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_0[0x10 - 0x04];
29*bc174764SAziz IDOMAR 	/* Offset: 0x010 (R/ ) Postbox Feature Support 0 */
30*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_feat_spt0;
31*bc174764SAziz IDOMAR 	/* Offset: 0x014 (R/ ) Postbox Feature Support 1 */
32*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_feat_spt1;
33*bc174764SAziz IDOMAR 	/* Offset: 0x018 (R/ ) Reserved */
34*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_1[0x20 - 0x18];
35*bc174764SAziz IDOMAR 	/* Offset: 0x020 (R/ ) Postbox Doorbell Channel Configuration 0 */
36*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_dbch_cfg0;
37*bc174764SAziz IDOMAR 	/* Offset: 0x024 (R/ ) Reserved */
38*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_2[0x30 - 0x24];
39*bc174764SAziz IDOMAR 	/* Offset: 0x030 (R/ ) Postbox FIFO Channel Configuration 0 */
40*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_ffch_cfg0;
41*bc174764SAziz IDOMAR 	/* Offset: 0x034 (R/ ) Reserved */
42*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_3[0x40 - 0x34];
43*bc174764SAziz IDOMAR 	/* Offset: 0x040 (R/ ) Postbox Fast Channel Configuration 0 */
44*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_fch_cfg0;
45*bc174764SAziz IDOMAR 	/* Offset: 0x044 (R/ ) Reserved */
46*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_4[0x100 - 0x44];
47*bc174764SAziz IDOMAR 	/* Offset: 0x100 (R/W) Postbox control */
48*bc174764SAziz IDOMAR 	volatile uint32_t pbx_ctrl;
49*bc174764SAziz IDOMAR 	/* Offset: 0x164 (R/ ) Reserved */
50*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_5[0x400 - 0x104];
51*bc174764SAziz IDOMAR 	/*
52*bc174764SAziz IDOMAR 	 * Offset: 0x400 (R/ ) Postbox Doorbell Channel Interrupt Status n,
53*bc174764SAziz IDOMAR 	 * where n is 0 - 3.
54*bc174764SAziz IDOMAR 	 */
55*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_dbch_int_st[4];
56*bc174764SAziz IDOMAR 	/*
57*bc174764SAziz IDOMAR 	 * Offset: 0x410 (R/ ) Postbox FIFO Channel <n> Interrupt Status n,
58*bc174764SAziz IDOMAR 	 * where n is 0 - 1.
59*bc174764SAziz IDOMAR 	 */
60*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_ffch_int_st[2];
61*bc174764SAziz IDOMAR 	/* Offset: 0x418 (R/ ) Reserved */
62*bc174764SAziz IDOMAR 	const uint8_t reserved_6[0xFC8 - 0x418];
63*bc174764SAziz IDOMAR 	/* Offset: 0xFC8 (R/ ) Postbox Implementer Identification Register */
64*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_iidr;
65*bc174764SAziz IDOMAR 	/* Offset: 0xFCC (R/ ) Postbox Architecture Identification Register */
66*bc174764SAziz IDOMAR 	const volatile uint32_t pbx_aidr;
67*bc174764SAziz IDOMAR 	/*
68*bc174764SAziz IDOMAR 	 * Offset: 0xFD0 (R/ ) Postbox Implementation Defined Identification
69*bc174764SAziz IDOMAR 	 * Register n, where n is 0 - 11.
70*bc174764SAziz IDOMAR 	 */
71*bc174764SAziz IDOMAR 	const volatile uint32_t impl_def_id[12];
72*bc174764SAziz IDOMAR };
73*bc174764SAziz IDOMAR 
74*bc174764SAziz IDOMAR /**
75*bc174764SAziz IDOMAR  * Postbox doorbell channel window page structure
76*bc174764SAziz IDOMAR  */
77*bc174764SAziz IDOMAR struct _mhu_v3_x_pdbcw_reg_t {
78*bc174764SAziz IDOMAR 	/* Offset: 0x000 (R/ ) Postbox Doorbell Channel Window Status */
79*bc174764SAziz IDOMAR 	const volatile uint32_t pdbcw_st;
80*bc174764SAziz IDOMAR 	/* Offset: 0x004 (R/ ) Reserved */
81*bc174764SAziz IDOMAR 	const uint8_t reserved_0[0xC - 0x4];
82*bc174764SAziz IDOMAR 	/* Offset: 0x00C ( /W) Postbox Doorbell Channel Window Set */
83*bc174764SAziz IDOMAR 	volatile uint32_t pdbcw_set;
84*bc174764SAziz IDOMAR 	/*
85*bc174764SAziz IDOMAR 	 * Offset: 0x010 (R/ ) Postbox Doorbell Channel Window Interrupt Status
86*bc174764SAziz IDOMAR 	 */
87*bc174764SAziz IDOMAR 	const volatile uint32_t pdbcw_int_st;
88*bc174764SAziz IDOMAR 	/*
89*bc174764SAziz IDOMAR 	 * Offset: 0x014 ( /W) Postbox Doorbell Channel Window Interrupt Clear
90*bc174764SAziz IDOMAR 	 */
91*bc174764SAziz IDOMAR 	volatile uint32_t pdbcw_int_clr;
92*bc174764SAziz IDOMAR 	/*
93*bc174764SAziz IDOMAR 	 * Offset: 0x018 (R/W) Postbox Doorbell Channel Window Interrupt Enable
94*bc174764SAziz IDOMAR 	 */
95*bc174764SAziz IDOMAR 	volatile uint32_t pdbcw_int_en;
96*bc174764SAziz IDOMAR 	/* Offset: 0x01C (R/W) Postbox Doorbell Channel Window Control */
97*bc174764SAziz IDOMAR 	volatile uint32_t pdbcw_ctrl;
98*bc174764SAziz IDOMAR };
99*bc174764SAziz IDOMAR 
100*bc174764SAziz IDOMAR /**
101*bc174764SAziz IDOMAR  * Postbox structure
102*bc174764SAziz IDOMAR  */
103*bc174764SAziz IDOMAR struct _mhu_v3_x_pbx {
104*bc174764SAziz IDOMAR 	/* Postbox Control */
105*bc174764SAziz IDOMAR 	struct _mhu_v3_x_pbx_ctrl_reg_t pbx_ctrl_page;
106*bc174764SAziz IDOMAR 	/* Postbox Doorbell Channel Window */
107*bc174764SAziz IDOMAR 	struct _mhu_v3_x_pdbcw_reg_t pdbcw_page;
108*bc174764SAziz IDOMAR };
109*bc174764SAziz IDOMAR 
110*bc174764SAziz IDOMAR /**
111*bc174764SAziz IDOMAR  * Mailbox control page structure
112*bc174764SAziz IDOMAR  */
113*bc174764SAziz IDOMAR struct _mhu_v3_x_mbx_ctrl_reg_t {
114*bc174764SAziz IDOMAR 	/* Offset: 0x000 (R/ ) Mailbox Block Identifier */
115*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_blk_id;
116*bc174764SAziz IDOMAR 	/* Offset: 0x004 (R/ ) Reserved */
117*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_0[0x10 - 0x04];
118*bc174764SAziz IDOMAR 	/* Offset: 0x010 (R/ ) Mailbox Feature Support 0 */
119*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_feat_spt0;
120*bc174764SAziz IDOMAR 	/* Offset: 0x014 (R/ ) Mailbox Feature Support 1 */
121*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_feat_spt1;
122*bc174764SAziz IDOMAR 	/* Offset: 0x018 (R/ ) Reserved */
123*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_1[0x20 - 0x18];
124*bc174764SAziz IDOMAR 	/* Offset: 0x020 (R/ ) Mailbox Doorbell Channel Configuration 0 */
125*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_dbch_cfg0;
126*bc174764SAziz IDOMAR 	/* Offset: 0x024 (R/ ) Reserved */
127*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_2[0x30 - 0x24];
128*bc174764SAziz IDOMAR 	/* Offset: 0x030 (R/ ) Mailbox FIFO Channel Configuration 0 */
129*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_ffch_cfg0;
130*bc174764SAziz IDOMAR 	/* Offset: 0x034 (R/ ) Reserved */
131*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_4[0x40 - 0x34];
132*bc174764SAziz IDOMAR 	/* Offset: 0x040 (R/ ) Mailbox Fast Channel Configuration 0 */
133*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_fch_cfg0;
134*bc174764SAziz IDOMAR 	/* Offset: 0x044 (R/ ) Reserved */
135*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_5[0x100 - 0x44];
136*bc174764SAziz IDOMAR 	/* Offset: 0x100 (R/W) Mailbox control */
137*bc174764SAziz IDOMAR 	volatile uint32_t mbx_ctrl;
138*bc174764SAziz IDOMAR 	/* Offset: 0x104 (R/ ) Reserved */
139*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_6[0x140 - 0x104];
140*bc174764SAziz IDOMAR 	/* Offset: 0x140 (R/W) Mailbox Fast Channel control */
141*bc174764SAziz IDOMAR 	volatile uint32_t mbx_fch_ctrl;
142*bc174764SAziz IDOMAR 	/* Offset: 0x144 (R/W) Mailbox Fast Channel Group Interrupt Enable */
143*bc174764SAziz IDOMAR 	volatile uint32_t mbx_fcg_int_en;
144*bc174764SAziz IDOMAR 	/* Offset: 0x148 (R/ ) Reserved */
145*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_7[0x400 - 0x148];
146*bc174764SAziz IDOMAR 	/*
147*bc174764SAziz IDOMAR 	 * Offset: 0x400 (R/ ) Mailbox Doorbell Channel Interrupt Status n,
148*bc174764SAziz IDOMAR 	 * where n = 0 - 3.
149*bc174764SAziz IDOMAR 	 */
150*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_dbch_int_st[4];
151*bc174764SAziz IDOMAR 	/*
152*bc174764SAziz IDOMAR 	 * Offset: 0x410 (R/ ) Mailbox FIFO Channel Interrupt Status n, where
153*bc174764SAziz IDOMAR 	 * n = 0 - 1.
154*bc174764SAziz IDOMAR 	 */
155*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_ffch_int_st[2];
156*bc174764SAziz IDOMAR 	/* Offset: 0x418 (R/ ) Reserved */
157*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_8[0x470 - 0x418];
158*bc174764SAziz IDOMAR 	/* Offset: 0x470 (R/ ) Mailbox Fast Channel Group Interrupt Status */
159*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_fcg_int_st;
160*bc174764SAziz IDOMAR 	/* Offset: 0x474 (R/ ) Reserved */
161*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_9[0x480 - 0x474];
162*bc174764SAziz IDOMAR 	/*
163*bc174764SAziz IDOMAR 	 * Offset: 0x480 (R/ ) Mailbox Fast Channel Group <n> Interrupt Status,
164*bc174764SAziz IDOMAR 	 * where n = 0 - 31.
165*bc174764SAziz IDOMAR 	 */
166*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_fch_grp_int_st[32];
167*bc174764SAziz IDOMAR 	/* Offset: 0x500 (R/ ) Reserved */
168*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_10[0xFC8 - 0x500];
169*bc174764SAziz IDOMAR 	/* Offset: 0xFC8 (R/ ) Mailbox Implementer Identification Register */
170*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_iidr;
171*bc174764SAziz IDOMAR 	/* Offset: 0xFCC (R/ ) Mailbox Architecture Identification Register */
172*bc174764SAziz IDOMAR 	const volatile uint32_t mbx_aidr;
173*bc174764SAziz IDOMAR 	/*
174*bc174764SAziz IDOMAR 	 * Offset: 0xFD0 (R/ ) Mailbox Implementation Defined Identification
175*bc174764SAziz IDOMAR 	 * Register n, where n is 0 - 11.
176*bc174764SAziz IDOMAR 	 */
177*bc174764SAziz IDOMAR 	const volatile uint32_t impl_def_id[12];
178*bc174764SAziz IDOMAR };
179*bc174764SAziz IDOMAR 
180*bc174764SAziz IDOMAR /**
181*bc174764SAziz IDOMAR  * Mailbox doorbell channel window page structure
182*bc174764SAziz IDOMAR  */
183*bc174764SAziz IDOMAR struct _mhu_v3_x_mdbcw_reg_t {
184*bc174764SAziz IDOMAR 	/* Offset: 0x000 (R/ ) Mailbox Doorbell Channel Window Status */
185*bc174764SAziz IDOMAR 	const volatile uint32_t mdbcw_st;
186*bc174764SAziz IDOMAR 	/* Offset: 0x004 (R/ ) Mailbox Doorbell Channel Window Status Masked */
187*bc174764SAziz IDOMAR 	const volatile uint32_t mdbcw_st_msk;
188*bc174764SAziz IDOMAR 	/* Offset: 0x008 ( /W) Mailbox Doorbell Channel Window Clear */
189*bc174764SAziz IDOMAR 	volatile uint32_t mdbcw_clr;
190*bc174764SAziz IDOMAR 	/* Offset: 0x00C (R/ ) Reserved */
191*bc174764SAziz IDOMAR 	const volatile uint8_t reserved_0[0x10 - 0x0C];
192*bc174764SAziz IDOMAR 	/* Offset: 0x010 (R/ ) Mailbox Doorbell Channel Window Mask Status */
193*bc174764SAziz IDOMAR 	const volatile uint32_t mdbcw_msk_st;
194*bc174764SAziz IDOMAR 	/* Offset: 0x014 ( /W) Mailbox Doorbell Channel Window Mask Set */
195*bc174764SAziz IDOMAR 	volatile uint32_t mdbcw_msk_set;
196*bc174764SAziz IDOMAR 	/* Offset: 0x018 ( /W) Mailbox Doorbell Channel Window Mask Clear */
197*bc174764SAziz IDOMAR 	volatile uint32_t mdbcw_msk_clr;
198*bc174764SAziz IDOMAR 	/* Offset: 0x01C (R/W) Mailbox Doorbell Channel Window Control */
199*bc174764SAziz IDOMAR 	volatile uint32_t mdbcw_ctrl;
200*bc174764SAziz IDOMAR };
201*bc174764SAziz IDOMAR 
202*bc174764SAziz IDOMAR /**
203*bc174764SAziz IDOMAR  * Mailbox structure
204*bc174764SAziz IDOMAR  */
205*bc174764SAziz IDOMAR struct _mhu_v3_x_mbx {
206*bc174764SAziz IDOMAR 	/* Mailbox control */
207*bc174764SAziz IDOMAR 	struct _mhu_v3_x_mbx_ctrl_reg_t mbx_ctrl_page;
208*bc174764SAziz IDOMAR 	/* Mailbox Doorbell Channel Window */
209*bc174764SAziz IDOMAR 	struct _mhu_v3_x_mdbcw_reg_t mdbcw_page;
210*bc174764SAziz IDOMAR };
211*bc174764SAziz IDOMAR 
212*bc174764SAziz IDOMAR /**
213*bc174764SAziz IDOMAR  * MHUv3 frame type
214*bc174764SAziz IDOMAR  */
215*bc174764SAziz IDOMAR union _mhu_v3_x_frame_t {
216*bc174764SAziz IDOMAR 	/* Postbox Frame */
217*bc174764SAziz IDOMAR 	struct _mhu_v3_x_pbx pbx_frame;
218*bc174764SAziz IDOMAR 	/* Mailbox Frame */
219*bc174764SAziz IDOMAR 	struct _mhu_v3_x_mbx mbx_frame;
220*bc174764SAziz IDOMAR };
221*bc174764SAziz IDOMAR 
222*bc174764SAziz IDOMAR #endif /* MHU_V3_X_PRIVATE_H */
223