xref: /openbmc/linux/drivers/gpu/drm/rockchip/cdn-dp-reg.h (revision 1a0f7ed3abe29cff8e652c69a8ad89aec2c40f00)
1*1a0f7ed3SChris Zhong /*
2*1a0f7ed3SChris Zhong  * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
3*1a0f7ed3SChris Zhong  * Author: Chris Zhong <zyw@rock-chips.com>
4*1a0f7ed3SChris Zhong  *
5*1a0f7ed3SChris Zhong  * This software is licensed under the terms of the GNU General Public
6*1a0f7ed3SChris Zhong  * License version 2, as published by the Free Software Foundation, and
7*1a0f7ed3SChris Zhong  * may be copied, distributed, and modified under those terms.
8*1a0f7ed3SChris Zhong  *
9*1a0f7ed3SChris Zhong  * This program is distributed in the hope that it will be useful,
10*1a0f7ed3SChris Zhong  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*1a0f7ed3SChris Zhong  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*1a0f7ed3SChris Zhong  * GNU General Public License for more details.
13*1a0f7ed3SChris Zhong  */
14*1a0f7ed3SChris Zhong 
15*1a0f7ed3SChris Zhong #ifndef _CDN_DP_REG_H
16*1a0f7ed3SChris Zhong #define _CDN_DP_REG_H
17*1a0f7ed3SChris Zhong 
18*1a0f7ed3SChris Zhong #include <linux/bitops.h>
19*1a0f7ed3SChris Zhong 
20*1a0f7ed3SChris Zhong #define ADDR_IMEM		0x10000
21*1a0f7ed3SChris Zhong #define ADDR_DMEM		0x20000
22*1a0f7ed3SChris Zhong 
23*1a0f7ed3SChris Zhong /* APB CFG addr */
24*1a0f7ed3SChris Zhong #define APB_CTRL			0
25*1a0f7ed3SChris Zhong #define XT_INT_CTRL			0x04
26*1a0f7ed3SChris Zhong #define MAILBOX_FULL_ADDR		0x08
27*1a0f7ed3SChris Zhong #define MAILBOX_EMPTY_ADDR		0x0c
28*1a0f7ed3SChris Zhong #define MAILBOX0_WR_DATA		0x10
29*1a0f7ed3SChris Zhong #define MAILBOX0_RD_DATA		0x14
30*1a0f7ed3SChris Zhong #define KEEP_ALIVE			0x18
31*1a0f7ed3SChris Zhong #define VER_L				0x1c
32*1a0f7ed3SChris Zhong #define VER_H				0x20
33*1a0f7ed3SChris Zhong #define VER_LIB_L_ADDR			0x24
34*1a0f7ed3SChris Zhong #define VER_LIB_H_ADDR			0x28
35*1a0f7ed3SChris Zhong #define SW_DEBUG_L			0x2c
36*1a0f7ed3SChris Zhong #define SW_DEBUG_H			0x30
37*1a0f7ed3SChris Zhong #define MAILBOX_INT_MASK		0x34
38*1a0f7ed3SChris Zhong #define MAILBOX_INT_STATUS		0x38
39*1a0f7ed3SChris Zhong #define SW_CLK_L			0x3c
40*1a0f7ed3SChris Zhong #define SW_CLK_H			0x40
41*1a0f7ed3SChris Zhong #define SW_EVENTS0			0x44
42*1a0f7ed3SChris Zhong #define SW_EVENTS1			0x48
43*1a0f7ed3SChris Zhong #define SW_EVENTS2			0x4c
44*1a0f7ed3SChris Zhong #define SW_EVENTS3			0x50
45*1a0f7ed3SChris Zhong #define XT_OCD_CTRL			0x60
46*1a0f7ed3SChris Zhong #define APB_INT_MASK			0x6c
47*1a0f7ed3SChris Zhong #define APB_STATUS_MASK			0x70
48*1a0f7ed3SChris Zhong 
49*1a0f7ed3SChris Zhong /* audio decoder addr */
50*1a0f7ed3SChris Zhong #define AUDIO_SRC_CNTL			0x30000
51*1a0f7ed3SChris Zhong #define AUDIO_SRC_CNFG			0x30004
52*1a0f7ed3SChris Zhong #define COM_CH_STTS_BITS		0x30008
53*1a0f7ed3SChris Zhong #define STTS_BIT_CH(x)			(0x3000c + ((x) << 2))
54*1a0f7ed3SChris Zhong #define SPDIF_CTRL_ADDR			0x3004c
55*1a0f7ed3SChris Zhong #define SPDIF_CH1_CS_3100_ADDR		0x30050
56*1a0f7ed3SChris Zhong #define SPDIF_CH1_CS_6332_ADDR		0x30054
57*1a0f7ed3SChris Zhong #define SPDIF_CH1_CS_9564_ADDR		0x30058
58*1a0f7ed3SChris Zhong #define SPDIF_CH1_CS_12796_ADDR		0x3005c
59*1a0f7ed3SChris Zhong #define SPDIF_CH1_CS_159128_ADDR	0x30060
60*1a0f7ed3SChris Zhong #define SPDIF_CH1_CS_191160_ADDR	0x30064
61*1a0f7ed3SChris Zhong #define SPDIF_CH2_CS_3100_ADDR		0x30068
62*1a0f7ed3SChris Zhong #define SPDIF_CH2_CS_6332_ADDR		0x3006c
63*1a0f7ed3SChris Zhong #define SPDIF_CH2_CS_9564_ADDR		0x30070
64*1a0f7ed3SChris Zhong #define SPDIF_CH2_CS_12796_ADDR		0x30074
65*1a0f7ed3SChris Zhong #define SPDIF_CH2_CS_159128_ADDR	0x30078
66*1a0f7ed3SChris Zhong #define SPDIF_CH2_CS_191160_ADDR	0x3007c
67*1a0f7ed3SChris Zhong #define SMPL2PKT_CNTL			0x30080
68*1a0f7ed3SChris Zhong #define SMPL2PKT_CNFG			0x30084
69*1a0f7ed3SChris Zhong #define FIFO_CNTL			0x30088
70*1a0f7ed3SChris Zhong #define FIFO_STTS			0x3008c
71*1a0f7ed3SChris Zhong 
72*1a0f7ed3SChris Zhong /* source pif addr */
73*1a0f7ed3SChris Zhong #define SOURCE_PIF_WR_ADDR		0x30800
74*1a0f7ed3SChris Zhong #define SOURCE_PIF_WR_REQ		0x30804
75*1a0f7ed3SChris Zhong #define SOURCE_PIF_RD_ADDR		0x30808
76*1a0f7ed3SChris Zhong #define SOURCE_PIF_RD_REQ		0x3080c
77*1a0f7ed3SChris Zhong #define SOURCE_PIF_DATA_WR		0x30810
78*1a0f7ed3SChris Zhong #define SOURCE_PIF_DATA_RD		0x30814
79*1a0f7ed3SChris Zhong #define SOURCE_PIF_FIFO1_FLUSH		0x30818
80*1a0f7ed3SChris Zhong #define SOURCE_PIF_FIFO2_FLUSH		0x3081c
81*1a0f7ed3SChris Zhong #define SOURCE_PIF_STATUS		0x30820
82*1a0f7ed3SChris Zhong #define SOURCE_PIF_INTERRUPT_SOURCE	0x30824
83*1a0f7ed3SChris Zhong #define SOURCE_PIF_INTERRUPT_MASK	0x30828
84*1a0f7ed3SChris Zhong #define SOURCE_PIF_PKT_ALLOC_REG	0x3082c
85*1a0f7ed3SChris Zhong #define SOURCE_PIF_PKT_ALLOC_WR_EN	0x30830
86*1a0f7ed3SChris Zhong #define SOURCE_PIF_SW_RESET		0x30834
87*1a0f7ed3SChris Zhong 
88*1a0f7ed3SChris Zhong /* bellow registers need access by mailbox */
89*1a0f7ed3SChris Zhong /* source car addr */
90*1a0f7ed3SChris Zhong #define SOURCE_HDTX_CAR			0x0900
91*1a0f7ed3SChris Zhong #define SOURCE_DPTX_CAR			0x0904
92*1a0f7ed3SChris Zhong #define SOURCE_PHY_CAR			0x0908
93*1a0f7ed3SChris Zhong #define SOURCE_CEC_CAR			0x090c
94*1a0f7ed3SChris Zhong #define SOURCE_CBUS_CAR			0x0910
95*1a0f7ed3SChris Zhong #define SOURCE_PKT_CAR			0x0918
96*1a0f7ed3SChris Zhong #define SOURCE_AIF_CAR			0x091c
97*1a0f7ed3SChris Zhong #define SOURCE_CIPHER_CAR		0x0920
98*1a0f7ed3SChris Zhong #define SOURCE_CRYPTO_CAR		0x0924
99*1a0f7ed3SChris Zhong 
100*1a0f7ed3SChris Zhong /* clock meters addr */
101*1a0f7ed3SChris Zhong #define CM_CTRL				0x0a00
102*1a0f7ed3SChris Zhong #define CM_I2S_CTRL			0x0a04
103*1a0f7ed3SChris Zhong #define CM_SPDIF_CTRL			0x0a08
104*1a0f7ed3SChris Zhong #define CM_VID_CTRL			0x0a0c
105*1a0f7ed3SChris Zhong #define CM_LANE_CTRL			0x0a10
106*1a0f7ed3SChris Zhong #define I2S_NM_STABLE			0x0a14
107*1a0f7ed3SChris Zhong #define I2S_NCTS_STABLE			0x0a18
108*1a0f7ed3SChris Zhong #define SPDIF_NM_STABLE			0x0a1c
109*1a0f7ed3SChris Zhong #define SPDIF_NCTS_STABLE		0x0a20
110*1a0f7ed3SChris Zhong #define NMVID_MEAS_STABLE		0x0a24
111*1a0f7ed3SChris Zhong #define I2S_MEAS			0x0a40
112*1a0f7ed3SChris Zhong #define SPDIF_MEAS			0x0a80
113*1a0f7ed3SChris Zhong #define NMVID_MEAS			0x0ac0
114*1a0f7ed3SChris Zhong 
115*1a0f7ed3SChris Zhong /* source vif addr */
116*1a0f7ed3SChris Zhong #define BND_HSYNC2VSYNC			0x0b00
117*1a0f7ed3SChris Zhong #define HSYNC2VSYNC_F1_L1		0x0b04
118*1a0f7ed3SChris Zhong #define HSYNC2VSYNC_F2_L1		0x0b08
119*1a0f7ed3SChris Zhong #define HSYNC2VSYNC_STATUS		0x0b0c
120*1a0f7ed3SChris Zhong #define HSYNC2VSYNC_POL_CTRL		0x0b10
121*1a0f7ed3SChris Zhong 
122*1a0f7ed3SChris Zhong /* dptx phy addr */
123*1a0f7ed3SChris Zhong #define DP_TX_PHY_CONFIG_REG		0x2000
124*1a0f7ed3SChris Zhong #define DP_TX_PHY_STATUS_REG		0x2004
125*1a0f7ed3SChris Zhong #define DP_TX_PHY_SW_RESET		0x2008
126*1a0f7ed3SChris Zhong #define DP_TX_PHY_SCRAMBLER_SEED	0x200c
127*1a0f7ed3SChris Zhong #define DP_TX_PHY_TRAINING_01_04	0x2010
128*1a0f7ed3SChris Zhong #define DP_TX_PHY_TRAINING_05_08	0x2014
129*1a0f7ed3SChris Zhong #define DP_TX_PHY_TRAINING_09_10	0x2018
130*1a0f7ed3SChris Zhong #define TEST_COR			0x23fc
131*1a0f7ed3SChris Zhong 
132*1a0f7ed3SChris Zhong /* dptx hpd addr */
133*1a0f7ed3SChris Zhong #define HPD_IRQ_DET_MIN_TIMER		0x2100
134*1a0f7ed3SChris Zhong #define HPD_IRQ_DET_MAX_TIMER		0x2104
135*1a0f7ed3SChris Zhong #define HPD_UNPLGED_DET_MIN_TIMER	0x2108
136*1a0f7ed3SChris Zhong #define HPD_STABLE_TIMER		0x210c
137*1a0f7ed3SChris Zhong #define HPD_FILTER_TIMER		0x2110
138*1a0f7ed3SChris Zhong #define HPD_EVENT_MASK			0x211c
139*1a0f7ed3SChris Zhong #define HPD_EVENT_DET			0x2120
140*1a0f7ed3SChris Zhong 
141*1a0f7ed3SChris Zhong /* dpyx framer addr */
142*1a0f7ed3SChris Zhong #define DP_FRAMER_GLOBAL_CONFIG		0x2200
143*1a0f7ed3SChris Zhong #define DP_SW_RESET			0x2204
144*1a0f7ed3SChris Zhong #define DP_FRAMER_TU			0x2208
145*1a0f7ed3SChris Zhong #define DP_FRAMER_PXL_REPR		0x220c
146*1a0f7ed3SChris Zhong #define DP_FRAMER_SP			0x2210
147*1a0f7ed3SChris Zhong #define AUDIO_PACK_CONTROL		0x2214
148*1a0f7ed3SChris Zhong #define DP_VC_TABLE(x)			(0x2218 + ((x) << 2))
149*1a0f7ed3SChris Zhong #define DP_VB_ID			0x2258
150*1a0f7ed3SChris Zhong #define DP_MTPH_LVP_CONTROL		0x225c
151*1a0f7ed3SChris Zhong #define DP_MTPH_SYMBOL_VALUES		0x2260
152*1a0f7ed3SChris Zhong #define DP_MTPH_ECF_CONTROL		0x2264
153*1a0f7ed3SChris Zhong #define DP_MTPH_ACT_CONTROL		0x2268
154*1a0f7ed3SChris Zhong #define DP_MTPH_STATUS			0x226c
155*1a0f7ed3SChris Zhong #define DP_INTERRUPT_SOURCE		0x2270
156*1a0f7ed3SChris Zhong #define DP_INTERRUPT_MASK		0x2274
157*1a0f7ed3SChris Zhong #define DP_FRONT_BACK_PORCH		0x2278
158*1a0f7ed3SChris Zhong #define DP_BYTE_COUNT			0x227c
159*1a0f7ed3SChris Zhong 
160*1a0f7ed3SChris Zhong /* dptx stream addr */
161*1a0f7ed3SChris Zhong #define MSA_HORIZONTAL_0		0x2280
162*1a0f7ed3SChris Zhong #define MSA_HORIZONTAL_1		0x2284
163*1a0f7ed3SChris Zhong #define MSA_VERTICAL_0			0x2288
164*1a0f7ed3SChris Zhong #define MSA_VERTICAL_1			0x228c
165*1a0f7ed3SChris Zhong #define MSA_MISC			0x2290
166*1a0f7ed3SChris Zhong #define STREAM_CONFIG			0x2294
167*1a0f7ed3SChris Zhong #define AUDIO_PACK_STATUS		0x2298
168*1a0f7ed3SChris Zhong #define VIF_STATUS			0x229c
169*1a0f7ed3SChris Zhong #define PCK_STUFF_STATUS_0		0x22a0
170*1a0f7ed3SChris Zhong #define PCK_STUFF_STATUS_1		0x22a4
171*1a0f7ed3SChris Zhong #define INFO_PACK_STATUS		0x22a8
172*1a0f7ed3SChris Zhong #define RATE_GOVERNOR_STATUS		0x22ac
173*1a0f7ed3SChris Zhong #define DP_HORIZONTAL			0x22b0
174*1a0f7ed3SChris Zhong #define DP_VERTICAL_0			0x22b4
175*1a0f7ed3SChris Zhong #define DP_VERTICAL_1			0x22b8
176*1a0f7ed3SChris Zhong #define DP_BLOCK_SDP			0x22bc
177*1a0f7ed3SChris Zhong 
178*1a0f7ed3SChris Zhong /* dptx glbl addr */
179*1a0f7ed3SChris Zhong #define DPTX_LANE_EN			0x2300
180*1a0f7ed3SChris Zhong #define DPTX_ENHNCD			0x2304
181*1a0f7ed3SChris Zhong #define DPTX_INT_MASK			0x2308
182*1a0f7ed3SChris Zhong #define DPTX_INT_STATUS			0x230c
183*1a0f7ed3SChris Zhong 
184*1a0f7ed3SChris Zhong /* dp aux addr */
185*1a0f7ed3SChris Zhong #define DP_AUX_HOST_CONTROL		0x2800
186*1a0f7ed3SChris Zhong #define DP_AUX_INTERRUPT_SOURCE		0x2804
187*1a0f7ed3SChris Zhong #define DP_AUX_INTERRUPT_MASK		0x2808
188*1a0f7ed3SChris Zhong #define DP_AUX_SWAP_INVERSION_CONTROL	0x280c
189*1a0f7ed3SChris Zhong #define DP_AUX_SEND_NACK_TRANSACTION	0x2810
190*1a0f7ed3SChris Zhong #define DP_AUX_CLEAR_RX			0x2814
191*1a0f7ed3SChris Zhong #define DP_AUX_CLEAR_TX			0x2818
192*1a0f7ed3SChris Zhong #define DP_AUX_TIMER_STOP		0x281c
193*1a0f7ed3SChris Zhong #define DP_AUX_TIMER_CLEAR		0x2820
194*1a0f7ed3SChris Zhong #define DP_AUX_RESET_SW			0x2824
195*1a0f7ed3SChris Zhong #define DP_AUX_DIVIDE_2M		0x2828
196*1a0f7ed3SChris Zhong #define DP_AUX_TX_PREACHARGE_LENGTH	0x282c
197*1a0f7ed3SChris Zhong #define DP_AUX_FREQUENCY_1M_MAX		0x2830
198*1a0f7ed3SChris Zhong #define DP_AUX_FREQUENCY_1M_MIN		0x2834
199*1a0f7ed3SChris Zhong #define DP_AUX_RX_PRE_MIN		0x2838
200*1a0f7ed3SChris Zhong #define DP_AUX_RX_PRE_MAX		0x283c
201*1a0f7ed3SChris Zhong #define DP_AUX_TIMER_PRESET		0x2840
202*1a0f7ed3SChris Zhong #define DP_AUX_NACK_FORMAT		0x2844
203*1a0f7ed3SChris Zhong #define DP_AUX_TX_DATA			0x2848
204*1a0f7ed3SChris Zhong #define DP_AUX_RX_DATA			0x284c
205*1a0f7ed3SChris Zhong #define DP_AUX_TX_STATUS		0x2850
206*1a0f7ed3SChris Zhong #define DP_AUX_RX_STATUS		0x2854
207*1a0f7ed3SChris Zhong #define DP_AUX_RX_CYCLE_COUNTER		0x2858
208*1a0f7ed3SChris Zhong #define DP_AUX_MAIN_STATES		0x285c
209*1a0f7ed3SChris Zhong #define DP_AUX_MAIN_TIMER		0x2860
210*1a0f7ed3SChris Zhong #define DP_AUX_AFE_OUT			0x2864
211*1a0f7ed3SChris Zhong 
212*1a0f7ed3SChris Zhong /* crypto addr */
213*1a0f7ed3SChris Zhong #define CRYPTO_HDCP_REVISION		0x5800
214*1a0f7ed3SChris Zhong #define HDCP_CRYPTO_CONFIG		0x5804
215*1a0f7ed3SChris Zhong #define CRYPTO_INTERRUPT_SOURCE		0x5808
216*1a0f7ed3SChris Zhong #define CRYPTO_INTERRUPT_MASK		0x580c
217*1a0f7ed3SChris Zhong #define CRYPTO22_CONFIG			0x5818
218*1a0f7ed3SChris Zhong #define CRYPTO22_STATUS			0x581c
219*1a0f7ed3SChris Zhong #define SHA_256_DATA_IN			0x583c
220*1a0f7ed3SChris Zhong #define SHA_256_DATA_OUT_(x)		(0x5850 + ((x) << 2))
221*1a0f7ed3SChris Zhong #define AES_32_KEY_(x)			(0x5870 + ((x) << 2))
222*1a0f7ed3SChris Zhong #define AES_32_DATA_IN			0x5880
223*1a0f7ed3SChris Zhong #define AES_32_DATA_OUT_(x)		(0x5884 + ((x) << 2))
224*1a0f7ed3SChris Zhong #define CRYPTO14_CONFIG			0x58a0
225*1a0f7ed3SChris Zhong #define CRYPTO14_STATUS			0x58a4
226*1a0f7ed3SChris Zhong #define CRYPTO14_PRNM_OUT		0x58a8
227*1a0f7ed3SChris Zhong #define CRYPTO14_KM_0			0x58ac
228*1a0f7ed3SChris Zhong #define CRYPTO14_KM_1			0x58b0
229*1a0f7ed3SChris Zhong #define CRYPTO14_AN_0			0x58b4
230*1a0f7ed3SChris Zhong #define CRYPTO14_AN_1			0x58b8
231*1a0f7ed3SChris Zhong #define CRYPTO14_YOUR_KSV_0		0x58bc
232*1a0f7ed3SChris Zhong #define CRYPTO14_YOUR_KSV_1		0x58c0
233*1a0f7ed3SChris Zhong #define CRYPTO14_MI_0			0x58c4
234*1a0f7ed3SChris Zhong #define CRYPTO14_MI_1			0x58c8
235*1a0f7ed3SChris Zhong #define CRYPTO14_TI_0			0x58cc
236*1a0f7ed3SChris Zhong #define CRYPTO14_KI_0			0x58d0
237*1a0f7ed3SChris Zhong #define CRYPTO14_KI_1			0x58d4
238*1a0f7ed3SChris Zhong #define CRYPTO14_BLOCKS_NUM		0x58d8
239*1a0f7ed3SChris Zhong #define CRYPTO14_KEY_MEM_DATA_0		0x58dc
240*1a0f7ed3SChris Zhong #define CRYPTO14_KEY_MEM_DATA_1		0x58e0
241*1a0f7ed3SChris Zhong #define CRYPTO14_SHA1_MSG_DATA		0x58e4
242*1a0f7ed3SChris Zhong #define CRYPTO14_SHA1_V_VALUE_(x)	(0x58e8 + ((x) << 2))
243*1a0f7ed3SChris Zhong #define TRNG_CTRL			0x58fc
244*1a0f7ed3SChris Zhong #define TRNG_DATA_RDY			0x5900
245*1a0f7ed3SChris Zhong #define TRNG_DATA			0x5904
246*1a0f7ed3SChris Zhong 
247*1a0f7ed3SChris Zhong /* cipher addr */
248*1a0f7ed3SChris Zhong #define HDCP_REVISION			0x60000
249*1a0f7ed3SChris Zhong #define INTERRUPT_SOURCE		0x60004
250*1a0f7ed3SChris Zhong #define INTERRUPT_MASK			0x60008
251*1a0f7ed3SChris Zhong #define HDCP_CIPHER_CONFIG		0x6000c
252*1a0f7ed3SChris Zhong #define AES_128_KEY_0			0x60010
253*1a0f7ed3SChris Zhong #define AES_128_KEY_1			0x60014
254*1a0f7ed3SChris Zhong #define AES_128_KEY_2			0x60018
255*1a0f7ed3SChris Zhong #define AES_128_KEY_3			0x6001c
256*1a0f7ed3SChris Zhong #define AES_128_RANDOM_0		0x60020
257*1a0f7ed3SChris Zhong #define AES_128_RANDOM_1		0x60024
258*1a0f7ed3SChris Zhong #define CIPHER14_KM_0			0x60028
259*1a0f7ed3SChris Zhong #define CIPHER14_KM_1			0x6002c
260*1a0f7ed3SChris Zhong #define CIPHER14_STATUS			0x60030
261*1a0f7ed3SChris Zhong #define CIPHER14_RI_PJ_STATUS		0x60034
262*1a0f7ed3SChris Zhong #define CIPHER_MODE			0x60038
263*1a0f7ed3SChris Zhong #define CIPHER14_AN_0			0x6003c
264*1a0f7ed3SChris Zhong #define CIPHER14_AN_1			0x60040
265*1a0f7ed3SChris Zhong #define CIPHER22_AUTH			0x60044
266*1a0f7ed3SChris Zhong #define CIPHER14_R0_DP_STATUS		0x60048
267*1a0f7ed3SChris Zhong #define CIPHER14_BOOTSTRAP		0x6004c
268*1a0f7ed3SChris Zhong 
269*1a0f7ed3SChris Zhong #define DPTX_FRMR_DATA_CLK_RSTN_EN	BIT(11)
270*1a0f7ed3SChris Zhong #define DPTX_FRMR_DATA_CLK_EN		BIT(10)
271*1a0f7ed3SChris Zhong #define DPTX_PHY_DATA_RSTN_EN		BIT(9)
272*1a0f7ed3SChris Zhong #define DPTX_PHY_DATA_CLK_EN		BIT(8)
273*1a0f7ed3SChris Zhong #define DPTX_PHY_CHAR_RSTN_EN		BIT(7)
274*1a0f7ed3SChris Zhong #define DPTX_PHY_CHAR_CLK_EN		BIT(6)
275*1a0f7ed3SChris Zhong #define SOURCE_AUX_SYS_CLK_RSTN_EN	BIT(5)
276*1a0f7ed3SChris Zhong #define SOURCE_AUX_SYS_CLK_EN		BIT(4)
277*1a0f7ed3SChris Zhong #define DPTX_SYS_CLK_RSTN_EN		BIT(3)
278*1a0f7ed3SChris Zhong #define DPTX_SYS_CLK_EN			BIT(2)
279*1a0f7ed3SChris Zhong #define CFG_DPTX_VIF_CLK_RSTN_EN	BIT(1)
280*1a0f7ed3SChris Zhong #define CFG_DPTX_VIF_CLK_EN		BIT(0)
281*1a0f7ed3SChris Zhong 
282*1a0f7ed3SChris Zhong #define SOURCE_PHY_RSTN_EN		BIT(1)
283*1a0f7ed3SChris Zhong #define SOURCE_PHY_CLK_EN		BIT(0)
284*1a0f7ed3SChris Zhong 
285*1a0f7ed3SChris Zhong #define SOURCE_PKT_SYS_RSTN_EN		BIT(3)
286*1a0f7ed3SChris Zhong #define SOURCE_PKT_SYS_CLK_EN		BIT(2)
287*1a0f7ed3SChris Zhong #define SOURCE_PKT_DATA_RSTN_EN		BIT(1)
288*1a0f7ed3SChris Zhong #define SOURCE_PKT_DATA_CLK_EN		BIT(0)
289*1a0f7ed3SChris Zhong 
290*1a0f7ed3SChris Zhong #define SPDIF_CDR_CLK_RSTN_EN		BIT(5)
291*1a0f7ed3SChris Zhong #define SPDIF_CDR_CLK_EN		BIT(4)
292*1a0f7ed3SChris Zhong #define SOURCE_AIF_SYS_RSTN_EN		BIT(3)
293*1a0f7ed3SChris Zhong #define SOURCE_AIF_SYS_CLK_EN		BIT(2)
294*1a0f7ed3SChris Zhong #define SOURCE_AIF_CLK_RSTN_EN		BIT(1)
295*1a0f7ed3SChris Zhong #define SOURCE_AIF_CLK_EN		BIT(0)
296*1a0f7ed3SChris Zhong 
297*1a0f7ed3SChris Zhong #define SOURCE_CIPHER_SYSTEM_CLK_RSTN_EN	BIT(3)
298*1a0f7ed3SChris Zhong #define SOURCE_CIPHER_SYS_CLK_EN		BIT(2)
299*1a0f7ed3SChris Zhong #define SOURCE_CIPHER_CHAR_CLK_RSTN_EN		BIT(1)
300*1a0f7ed3SChris Zhong #define SOURCE_CIPHER_CHAR_CLK_EN		BIT(0)
301*1a0f7ed3SChris Zhong 
302*1a0f7ed3SChris Zhong #define SOURCE_CRYPTO_SYS_CLK_RSTN_EN	BIT(1)
303*1a0f7ed3SChris Zhong #define SOURCE_CRYPTO_SYS_CLK_EN	BIT(0)
304*1a0f7ed3SChris Zhong 
305*1a0f7ed3SChris Zhong #define APB_IRAM_PATH			BIT(2)
306*1a0f7ed3SChris Zhong #define APB_DRAM_PATH			BIT(1)
307*1a0f7ed3SChris Zhong #define APB_XT_RESET			BIT(0)
308*1a0f7ed3SChris Zhong 
309*1a0f7ed3SChris Zhong #define MAILBOX_INT_MASK_BIT		BIT(1)
310*1a0f7ed3SChris Zhong #define PIF_INT_MASK_BIT		BIT(0)
311*1a0f7ed3SChris Zhong #define ALL_INT_MASK			3
312*1a0f7ed3SChris Zhong 
313*1a0f7ed3SChris Zhong /* mailbox */
314*1a0f7ed3SChris Zhong #define MB_OPCODE_ID			0
315*1a0f7ed3SChris Zhong #define MB_MODULE_ID			1
316*1a0f7ed3SChris Zhong #define MB_SIZE_MSB_ID			2
317*1a0f7ed3SChris Zhong #define MB_SIZE_LSB_ID			3
318*1a0f7ed3SChris Zhong #define MB_DATA_ID			4
319*1a0f7ed3SChris Zhong 
320*1a0f7ed3SChris Zhong #define MB_MODULE_ID_DP_TX		0x01
321*1a0f7ed3SChris Zhong #define MB_MODULE_ID_HDCP_TX		0x07
322*1a0f7ed3SChris Zhong #define MB_MODULE_ID_HDCP_RX		0x08
323*1a0f7ed3SChris Zhong #define MB_MODULE_ID_HDCP_GENERAL	0x09
324*1a0f7ed3SChris Zhong #define MB_MODULE_ID_GENERAL		0x0a
325*1a0f7ed3SChris Zhong 
326*1a0f7ed3SChris Zhong /* general opcode */
327*1a0f7ed3SChris Zhong #define GENERAL_MAIN_CONTROL            0x01
328*1a0f7ed3SChris Zhong #define GENERAL_TEST_ECHO               0x02
329*1a0f7ed3SChris Zhong #define GENERAL_BUS_SETTINGS            0x03
330*1a0f7ed3SChris Zhong #define GENERAL_TEST_ACCESS             0x04
331*1a0f7ed3SChris Zhong 
332*1a0f7ed3SChris Zhong #define DPTX_SET_POWER_MNG			0x00
333*1a0f7ed3SChris Zhong #define DPTX_SET_HOST_CAPABILITIES		0x01
334*1a0f7ed3SChris Zhong #define DPTX_GET_EDID				0x02
335*1a0f7ed3SChris Zhong #define DPTX_READ_DPCD				0x03
336*1a0f7ed3SChris Zhong #define DPTX_WRITE_DPCD				0x04
337*1a0f7ed3SChris Zhong #define DPTX_ENABLE_EVENT			0x05
338*1a0f7ed3SChris Zhong #define DPTX_WRITE_REGISTER			0x06
339*1a0f7ed3SChris Zhong #define DPTX_READ_REGISTER			0x07
340*1a0f7ed3SChris Zhong #define DPTX_WRITE_FIELD			0x08
341*1a0f7ed3SChris Zhong #define DPTX_TRAINING_CONTROL			0x09
342*1a0f7ed3SChris Zhong #define DPTX_READ_EVENT				0x0a
343*1a0f7ed3SChris Zhong #define DPTX_READ_LINK_STAT			0x0b
344*1a0f7ed3SChris Zhong #define DPTX_SET_VIDEO				0x0c
345*1a0f7ed3SChris Zhong #define DPTX_SET_AUDIO				0x0d
346*1a0f7ed3SChris Zhong #define DPTX_GET_LAST_AUX_STAUS			0x0e
347*1a0f7ed3SChris Zhong #define DPTX_SET_LINK_BREAK_POINT		0x0f
348*1a0f7ed3SChris Zhong #define DPTX_FORCE_LANES			0x10
349*1a0f7ed3SChris Zhong #define DPTX_HPD_STATE				0x11
350*1a0f7ed3SChris Zhong 
351*1a0f7ed3SChris Zhong #define FW_STANDBY				0
352*1a0f7ed3SChris Zhong #define FW_ACTIVE				1
353*1a0f7ed3SChris Zhong 
354*1a0f7ed3SChris Zhong #define DPTX_EVENT_ENABLE_HPD			BIT(0)
355*1a0f7ed3SChris Zhong #define DPTX_EVENT_ENABLE_TRAINING		BIT(1)
356*1a0f7ed3SChris Zhong 
357*1a0f7ed3SChris Zhong #define LINK_TRAINING_NOT_ACTIVE		0
358*1a0f7ed3SChris Zhong #define LINK_TRAINING_RUN			1
359*1a0f7ed3SChris Zhong #define LINK_TRAINING_RESTART			2
360*1a0f7ed3SChris Zhong 
361*1a0f7ed3SChris Zhong #define CONTROL_VIDEO_IDLE			0
362*1a0f7ed3SChris Zhong #define CONTROL_VIDEO_VALID			1
363*1a0f7ed3SChris Zhong 
364*1a0f7ed3SChris Zhong #define TU_CNT_RST_EN				BIT(15)
365*1a0f7ed3SChris Zhong #define VIF_BYPASS_INTERLACE			BIT(13)
366*1a0f7ed3SChris Zhong #define INTERLACE_FMT_DET			BIT(12)
367*1a0f7ed3SChris Zhong #define INTERLACE_DTCT_WIN			0x20
368*1a0f7ed3SChris Zhong 
369*1a0f7ed3SChris Zhong #define DP_FRAMER_SP_INTERLACE_EN		BIT(2)
370*1a0f7ed3SChris Zhong #define DP_FRAMER_SP_HSP			BIT(1)
371*1a0f7ed3SChris Zhong #define DP_FRAMER_SP_VSP			BIT(0)
372*1a0f7ed3SChris Zhong 
373*1a0f7ed3SChris Zhong /* capability */
374*1a0f7ed3SChris Zhong #define AUX_HOST_INVERT				3
375*1a0f7ed3SChris Zhong #define	FAST_LT_SUPPORT				1
376*1a0f7ed3SChris Zhong #define FAST_LT_NOT_SUPPORT			0
377*1a0f7ed3SChris Zhong #define LANE_MAPPING_NORMAL			0x1b
378*1a0f7ed3SChris Zhong #define LANE_MAPPING_FLIPPED			0xe4
379*1a0f7ed3SChris Zhong #define ENHANCED				1
380*1a0f7ed3SChris Zhong #define SCRAMBLER_EN				BIT(4)
381*1a0f7ed3SChris Zhong 
382*1a0f7ed3SChris Zhong #define	FULL_LT_STARTED				BIT(0)
383*1a0f7ed3SChris Zhong #define FASE_LT_STARTED				BIT(1)
384*1a0f7ed3SChris Zhong #define CLK_RECOVERY_FINISHED			BIT(2)
385*1a0f7ed3SChris Zhong #define EQ_PHASE_FINISHED			BIT(3)
386*1a0f7ed3SChris Zhong #define FASE_LT_START_FINISHED			BIT(4)
387*1a0f7ed3SChris Zhong #define CLK_RECOVERY_FAILED			BIT(5)
388*1a0f7ed3SChris Zhong #define EQ_PHASE_FAILED				BIT(6)
389*1a0f7ed3SChris Zhong #define FASE_LT_FAILED				BIT(7)
390*1a0f7ed3SChris Zhong 
391*1a0f7ed3SChris Zhong #define DPTX_HPD_EVENT				BIT(0)
392*1a0f7ed3SChris Zhong #define DPTX_TRAINING_EVENT			BIT(1)
393*1a0f7ed3SChris Zhong #define HDCP_TX_STATUS_EVENT			BIT(4)
394*1a0f7ed3SChris Zhong #define HDCP2_TX_IS_KM_STORED_EVENT		BIT(5)
395*1a0f7ed3SChris Zhong #define HDCP2_TX_STORE_KM_EVENT			BIT(6)
396*1a0f7ed3SChris Zhong #define HDCP_TX_IS_RECEIVER_ID_VALID_EVENT	BIT(7)
397*1a0f7ed3SChris Zhong 
398*1a0f7ed3SChris Zhong #define TU_SIZE					30
399*1a0f7ed3SChris Zhong #define CDN_DP_MAX_LINK_RATE			DP_LINK_BW_5_4
400*1a0f7ed3SChris Zhong 
401*1a0f7ed3SChris Zhong /* audio */
402*1a0f7ed3SChris Zhong #define AUDIO_PACK_EN				BIT(8)
403*1a0f7ed3SChris Zhong #define SAMPLING_FREQ(x)			(((x) & 0xf) << 16)
404*1a0f7ed3SChris Zhong #define ORIGINAL_SAMP_FREQ(x)			(((x) & 0xf) << 24)
405*1a0f7ed3SChris Zhong #define SYNC_WR_TO_CH_ZERO			BIT(1)
406*1a0f7ed3SChris Zhong #define I2S_DEC_START				BIT(1)
407*1a0f7ed3SChris Zhong #define AUDIO_SW_RST				BIT(0)
408*1a0f7ed3SChris Zhong #define SMPL2PKT_EN				BIT(1)
409*1a0f7ed3SChris Zhong #define MAX_NUM_CH(x)				(((x) & 0x1f) - 1)
410*1a0f7ed3SChris Zhong #define NUM_OF_I2S_PORTS(x)			((((x) / 2 - 1) & 0x3) << 5)
411*1a0f7ed3SChris Zhong #define AUDIO_TYPE_LPCM				(2 << 7)
412*1a0f7ed3SChris Zhong #define CFG_SUB_PCKT_NUM(x)			((((x) - 1) & 0x7) << 11)
413*1a0f7ed3SChris Zhong #define AUDIO_CH_NUM(x)				((((x) - 1) & 0x1f) << 2)
414*1a0f7ed3SChris Zhong #define TRANS_SMPL_WIDTH_16			0
415*1a0f7ed3SChris Zhong #define TRANS_SMPL_WIDTH_24			BIT(11)
416*1a0f7ed3SChris Zhong #define TRANS_SMPL_WIDTH_32			(2 << 11)
417*1a0f7ed3SChris Zhong #define I2S_DEC_PORT_EN(x)			(((x) & 0xf) << 17)
418*1a0f7ed3SChris Zhong #define SPDIF_ENABLE				BIT(21)
419*1a0f7ed3SChris Zhong #define SPDIF_AVG_SEL				BIT(20)
420*1a0f7ed3SChris Zhong #define SPDIF_JITTER_BYPASS			BIT(19)
421*1a0f7ed3SChris Zhong #define SPDIF_FIFO_MID_RANGE(x)			(((x) & 0xff) << 11)
422*1a0f7ed3SChris Zhong #define SPDIF_JITTER_THRSH(x)			(((x) & 0xff) << 3)
423*1a0f7ed3SChris Zhong #define SPDIF_JITTER_AVG_WIN(x)			((x) & 0x7)
424*1a0f7ed3SChris Zhong 
425*1a0f7ed3SChris Zhong /* Reference cycles when using lane clock as reference */
426*1a0f7ed3SChris Zhong #define LANE_REF_CYC				0x8000
427*1a0f7ed3SChris Zhong 
428*1a0f7ed3SChris Zhong enum voltage_swing_level {
429*1a0f7ed3SChris Zhong 	VOLTAGE_LEVEL_0,
430*1a0f7ed3SChris Zhong 	VOLTAGE_LEVEL_1,
431*1a0f7ed3SChris Zhong 	VOLTAGE_LEVEL_2,
432*1a0f7ed3SChris Zhong 	VOLTAGE_LEVEL_3,
433*1a0f7ed3SChris Zhong };
434*1a0f7ed3SChris Zhong 
435*1a0f7ed3SChris Zhong enum pre_emphasis_level {
436*1a0f7ed3SChris Zhong 	PRE_EMPHASIS_LEVEL_0,
437*1a0f7ed3SChris Zhong 	PRE_EMPHASIS_LEVEL_1,
438*1a0f7ed3SChris Zhong 	PRE_EMPHASIS_LEVEL_2,
439*1a0f7ed3SChris Zhong 	PRE_EMPHASIS_LEVEL_3,
440*1a0f7ed3SChris Zhong };
441*1a0f7ed3SChris Zhong 
442*1a0f7ed3SChris Zhong enum pattern_set {
443*1a0f7ed3SChris Zhong 	PTS1		= BIT(0),
444*1a0f7ed3SChris Zhong 	PTS2		= BIT(1),
445*1a0f7ed3SChris Zhong 	PTS3		= BIT(2),
446*1a0f7ed3SChris Zhong 	PTS4		= BIT(3),
447*1a0f7ed3SChris Zhong 	DP_NONE		= BIT(4)
448*1a0f7ed3SChris Zhong };
449*1a0f7ed3SChris Zhong 
450*1a0f7ed3SChris Zhong enum vic_color_depth {
451*1a0f7ed3SChris Zhong 	BCS_6 = 0x1,
452*1a0f7ed3SChris Zhong 	BCS_8 = 0x2,
453*1a0f7ed3SChris Zhong 	BCS_10 = 0x4,
454*1a0f7ed3SChris Zhong 	BCS_12 = 0x8,
455*1a0f7ed3SChris Zhong 	BCS_16 = 0x10,
456*1a0f7ed3SChris Zhong };
457*1a0f7ed3SChris Zhong 
458*1a0f7ed3SChris Zhong enum vic_bt_type {
459*1a0f7ed3SChris Zhong 	BT_601 = 0x0,
460*1a0f7ed3SChris Zhong 	BT_709 = 0x1,
461*1a0f7ed3SChris Zhong };
462*1a0f7ed3SChris Zhong 
463*1a0f7ed3SChris Zhong void cdn_dp_clock_reset(struct cdn_dp_device *dp);
464*1a0f7ed3SChris Zhong 
465*1a0f7ed3SChris Zhong void cdn_dp_set_fw_clk(struct cdn_dp_device *dp, u32 clk);
466*1a0f7ed3SChris Zhong int cdn_dp_load_firmware(struct cdn_dp_device *dp, const u32 *i_mem,
467*1a0f7ed3SChris Zhong 			 u32 i_size, const u32 *d_mem, u32 d_size);
468*1a0f7ed3SChris Zhong int cdn_dp_set_firmware_active(struct cdn_dp_device *dp, bool enable);
469*1a0f7ed3SChris Zhong int cdn_dp_set_host_cap(struct cdn_dp_device *dp, u8 lanes, bool flip);
470*1a0f7ed3SChris Zhong int cdn_dp_event_config(struct cdn_dp_device *dp);
471*1a0f7ed3SChris Zhong u32 cdn_dp_get_event(struct cdn_dp_device *dp);
472*1a0f7ed3SChris Zhong int cdn_dp_get_hpd_status(struct cdn_dp_device *dp);
473*1a0f7ed3SChris Zhong int cdn_dp_dpcd_write(struct cdn_dp_device *dp, u32 addr, u8 value);
474*1a0f7ed3SChris Zhong int cdn_dp_dpcd_read(struct cdn_dp_device *dp, u32 addr, u8 *data, u16 len);
475*1a0f7ed3SChris Zhong int cdn_dp_get_edid_block(void *dp, u8 *edid,
476*1a0f7ed3SChris Zhong 			  unsigned int block, size_t length);
477*1a0f7ed3SChris Zhong int cdn_dp_train_link(struct cdn_dp_device *dp);
478*1a0f7ed3SChris Zhong int cdn_dp_set_video_status(struct cdn_dp_device *dp, int active);
479*1a0f7ed3SChris Zhong int cdn_dp_config_video(struct cdn_dp_device *dp);
480*1a0f7ed3SChris Zhong int cdn_dp_audio_stop(struct cdn_dp_device *dp, struct audio_info *audio);
481*1a0f7ed3SChris Zhong int cdn_dp_audio_mute(struct cdn_dp_device *dp, bool enable);
482*1a0f7ed3SChris Zhong int cdn_dp_audio_config(struct cdn_dp_device *dp, struct audio_info *audio);
483*1a0f7ed3SChris Zhong #endif /* _CDN_DP_REG_H */
484