1*9c92ab61SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 21a0f7ed3SChris Zhong /* 31a0f7ed3SChris Zhong * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd 41a0f7ed3SChris Zhong * Author: Chris Zhong <zyw@rock-chips.com> 51a0f7ed3SChris Zhong */ 61a0f7ed3SChris Zhong 71a0f7ed3SChris Zhong #ifndef _CDN_DP_REG_H 81a0f7ed3SChris Zhong #define _CDN_DP_REG_H 91a0f7ed3SChris Zhong 101a0f7ed3SChris Zhong #include <linux/bitops.h> 111a0f7ed3SChris Zhong 121a0f7ed3SChris Zhong #define ADDR_IMEM 0x10000 131a0f7ed3SChris Zhong #define ADDR_DMEM 0x20000 141a0f7ed3SChris Zhong 151a0f7ed3SChris Zhong /* APB CFG addr */ 161a0f7ed3SChris Zhong #define APB_CTRL 0 171a0f7ed3SChris Zhong #define XT_INT_CTRL 0x04 181a0f7ed3SChris Zhong #define MAILBOX_FULL_ADDR 0x08 191a0f7ed3SChris Zhong #define MAILBOX_EMPTY_ADDR 0x0c 201a0f7ed3SChris Zhong #define MAILBOX0_WR_DATA 0x10 211a0f7ed3SChris Zhong #define MAILBOX0_RD_DATA 0x14 221a0f7ed3SChris Zhong #define KEEP_ALIVE 0x18 231a0f7ed3SChris Zhong #define VER_L 0x1c 241a0f7ed3SChris Zhong #define VER_H 0x20 251a0f7ed3SChris Zhong #define VER_LIB_L_ADDR 0x24 261a0f7ed3SChris Zhong #define VER_LIB_H_ADDR 0x28 271a0f7ed3SChris Zhong #define SW_DEBUG_L 0x2c 281a0f7ed3SChris Zhong #define SW_DEBUG_H 0x30 291a0f7ed3SChris Zhong #define MAILBOX_INT_MASK 0x34 301a0f7ed3SChris Zhong #define MAILBOX_INT_STATUS 0x38 311a0f7ed3SChris Zhong #define SW_CLK_L 0x3c 321a0f7ed3SChris Zhong #define SW_CLK_H 0x40 331a0f7ed3SChris Zhong #define SW_EVENTS0 0x44 341a0f7ed3SChris Zhong #define SW_EVENTS1 0x48 351a0f7ed3SChris Zhong #define SW_EVENTS2 0x4c 361a0f7ed3SChris Zhong #define SW_EVENTS3 0x50 371a0f7ed3SChris Zhong #define XT_OCD_CTRL 0x60 381a0f7ed3SChris Zhong #define APB_INT_MASK 0x6c 391a0f7ed3SChris Zhong #define APB_STATUS_MASK 0x70 401a0f7ed3SChris Zhong 411a0f7ed3SChris Zhong /* audio decoder addr */ 421a0f7ed3SChris Zhong #define AUDIO_SRC_CNTL 0x30000 431a0f7ed3SChris Zhong #define AUDIO_SRC_CNFG 0x30004 441a0f7ed3SChris Zhong #define COM_CH_STTS_BITS 0x30008 451a0f7ed3SChris Zhong #define STTS_BIT_CH(x) (0x3000c + ((x) << 2)) 461a0f7ed3SChris Zhong #define SPDIF_CTRL_ADDR 0x3004c 471a0f7ed3SChris Zhong #define SPDIF_CH1_CS_3100_ADDR 0x30050 481a0f7ed3SChris Zhong #define SPDIF_CH1_CS_6332_ADDR 0x30054 491a0f7ed3SChris Zhong #define SPDIF_CH1_CS_9564_ADDR 0x30058 501a0f7ed3SChris Zhong #define SPDIF_CH1_CS_12796_ADDR 0x3005c 511a0f7ed3SChris Zhong #define SPDIF_CH1_CS_159128_ADDR 0x30060 521a0f7ed3SChris Zhong #define SPDIF_CH1_CS_191160_ADDR 0x30064 531a0f7ed3SChris Zhong #define SPDIF_CH2_CS_3100_ADDR 0x30068 541a0f7ed3SChris Zhong #define SPDIF_CH2_CS_6332_ADDR 0x3006c 551a0f7ed3SChris Zhong #define SPDIF_CH2_CS_9564_ADDR 0x30070 561a0f7ed3SChris Zhong #define SPDIF_CH2_CS_12796_ADDR 0x30074 571a0f7ed3SChris Zhong #define SPDIF_CH2_CS_159128_ADDR 0x30078 581a0f7ed3SChris Zhong #define SPDIF_CH2_CS_191160_ADDR 0x3007c 591a0f7ed3SChris Zhong #define SMPL2PKT_CNTL 0x30080 601a0f7ed3SChris Zhong #define SMPL2PKT_CNFG 0x30084 611a0f7ed3SChris Zhong #define FIFO_CNTL 0x30088 621a0f7ed3SChris Zhong #define FIFO_STTS 0x3008c 631a0f7ed3SChris Zhong 641a0f7ed3SChris Zhong /* source pif addr */ 651a0f7ed3SChris Zhong #define SOURCE_PIF_WR_ADDR 0x30800 661a0f7ed3SChris Zhong #define SOURCE_PIF_WR_REQ 0x30804 671a0f7ed3SChris Zhong #define SOURCE_PIF_RD_ADDR 0x30808 681a0f7ed3SChris Zhong #define SOURCE_PIF_RD_REQ 0x3080c 691a0f7ed3SChris Zhong #define SOURCE_PIF_DATA_WR 0x30810 701a0f7ed3SChris Zhong #define SOURCE_PIF_DATA_RD 0x30814 711a0f7ed3SChris Zhong #define SOURCE_PIF_FIFO1_FLUSH 0x30818 721a0f7ed3SChris Zhong #define SOURCE_PIF_FIFO2_FLUSH 0x3081c 731a0f7ed3SChris Zhong #define SOURCE_PIF_STATUS 0x30820 741a0f7ed3SChris Zhong #define SOURCE_PIF_INTERRUPT_SOURCE 0x30824 751a0f7ed3SChris Zhong #define SOURCE_PIF_INTERRUPT_MASK 0x30828 761a0f7ed3SChris Zhong #define SOURCE_PIF_PKT_ALLOC_REG 0x3082c 771a0f7ed3SChris Zhong #define SOURCE_PIF_PKT_ALLOC_WR_EN 0x30830 781a0f7ed3SChris Zhong #define SOURCE_PIF_SW_RESET 0x30834 791a0f7ed3SChris Zhong 801a0f7ed3SChris Zhong /* bellow registers need access by mailbox */ 811a0f7ed3SChris Zhong /* source car addr */ 821a0f7ed3SChris Zhong #define SOURCE_HDTX_CAR 0x0900 831a0f7ed3SChris Zhong #define SOURCE_DPTX_CAR 0x0904 841a0f7ed3SChris Zhong #define SOURCE_PHY_CAR 0x0908 851a0f7ed3SChris Zhong #define SOURCE_CEC_CAR 0x090c 861a0f7ed3SChris Zhong #define SOURCE_CBUS_CAR 0x0910 871a0f7ed3SChris Zhong #define SOURCE_PKT_CAR 0x0918 881a0f7ed3SChris Zhong #define SOURCE_AIF_CAR 0x091c 891a0f7ed3SChris Zhong #define SOURCE_CIPHER_CAR 0x0920 901a0f7ed3SChris Zhong #define SOURCE_CRYPTO_CAR 0x0924 911a0f7ed3SChris Zhong 921a0f7ed3SChris Zhong /* clock meters addr */ 931a0f7ed3SChris Zhong #define CM_CTRL 0x0a00 941a0f7ed3SChris Zhong #define CM_I2S_CTRL 0x0a04 951a0f7ed3SChris Zhong #define CM_SPDIF_CTRL 0x0a08 961a0f7ed3SChris Zhong #define CM_VID_CTRL 0x0a0c 971a0f7ed3SChris Zhong #define CM_LANE_CTRL 0x0a10 981a0f7ed3SChris Zhong #define I2S_NM_STABLE 0x0a14 991a0f7ed3SChris Zhong #define I2S_NCTS_STABLE 0x0a18 1001a0f7ed3SChris Zhong #define SPDIF_NM_STABLE 0x0a1c 1011a0f7ed3SChris Zhong #define SPDIF_NCTS_STABLE 0x0a20 1021a0f7ed3SChris Zhong #define NMVID_MEAS_STABLE 0x0a24 1031a0f7ed3SChris Zhong #define I2S_MEAS 0x0a40 1041a0f7ed3SChris Zhong #define SPDIF_MEAS 0x0a80 1051a0f7ed3SChris Zhong #define NMVID_MEAS 0x0ac0 1061a0f7ed3SChris Zhong 1071a0f7ed3SChris Zhong /* source vif addr */ 1081a0f7ed3SChris Zhong #define BND_HSYNC2VSYNC 0x0b00 1091a0f7ed3SChris Zhong #define HSYNC2VSYNC_F1_L1 0x0b04 1101a0f7ed3SChris Zhong #define HSYNC2VSYNC_F2_L1 0x0b08 1111a0f7ed3SChris Zhong #define HSYNC2VSYNC_STATUS 0x0b0c 1121a0f7ed3SChris Zhong #define HSYNC2VSYNC_POL_CTRL 0x0b10 1131a0f7ed3SChris Zhong 1141a0f7ed3SChris Zhong /* dptx phy addr */ 1151a0f7ed3SChris Zhong #define DP_TX_PHY_CONFIG_REG 0x2000 11605c00c2fSChris Zhong #define DP_TX_PHY_SW_RESET 0x2004 11705c00c2fSChris Zhong #define DP_TX_PHY_SCRAMBLER_SEED 0x2008 11805c00c2fSChris Zhong #define DP_TX_PHY_TRAINING_01_04 0x200c 11905c00c2fSChris Zhong #define DP_TX_PHY_TRAINING_05_08 0x2010 12005c00c2fSChris Zhong #define DP_TX_PHY_TRAINING_09_10 0x2014 1211a0f7ed3SChris Zhong #define TEST_COR 0x23fc 1221a0f7ed3SChris Zhong 1231a0f7ed3SChris Zhong /* dptx hpd addr */ 1241a0f7ed3SChris Zhong #define HPD_IRQ_DET_MIN_TIMER 0x2100 1251a0f7ed3SChris Zhong #define HPD_IRQ_DET_MAX_TIMER 0x2104 1261a0f7ed3SChris Zhong #define HPD_UNPLGED_DET_MIN_TIMER 0x2108 1271a0f7ed3SChris Zhong #define HPD_STABLE_TIMER 0x210c 1281a0f7ed3SChris Zhong #define HPD_FILTER_TIMER 0x2110 1291a0f7ed3SChris Zhong #define HPD_EVENT_MASK 0x211c 1301a0f7ed3SChris Zhong #define HPD_EVENT_DET 0x2120 1311a0f7ed3SChris Zhong 1321a0f7ed3SChris Zhong /* dpyx framer addr */ 1331a0f7ed3SChris Zhong #define DP_FRAMER_GLOBAL_CONFIG 0x2200 1341a0f7ed3SChris Zhong #define DP_SW_RESET 0x2204 1351a0f7ed3SChris Zhong #define DP_FRAMER_TU 0x2208 1361a0f7ed3SChris Zhong #define DP_FRAMER_PXL_REPR 0x220c 1371a0f7ed3SChris Zhong #define DP_FRAMER_SP 0x2210 1381a0f7ed3SChris Zhong #define AUDIO_PACK_CONTROL 0x2214 1391a0f7ed3SChris Zhong #define DP_VC_TABLE(x) (0x2218 + ((x) << 2)) 1401a0f7ed3SChris Zhong #define DP_VB_ID 0x2258 1411a0f7ed3SChris Zhong #define DP_MTPH_LVP_CONTROL 0x225c 1421a0f7ed3SChris Zhong #define DP_MTPH_SYMBOL_VALUES 0x2260 1431a0f7ed3SChris Zhong #define DP_MTPH_ECF_CONTROL 0x2264 1441a0f7ed3SChris Zhong #define DP_MTPH_ACT_CONTROL 0x2268 1451a0f7ed3SChris Zhong #define DP_MTPH_STATUS 0x226c 1461a0f7ed3SChris Zhong #define DP_INTERRUPT_SOURCE 0x2270 1471a0f7ed3SChris Zhong #define DP_INTERRUPT_MASK 0x2274 1481a0f7ed3SChris Zhong #define DP_FRONT_BACK_PORCH 0x2278 1491a0f7ed3SChris Zhong #define DP_BYTE_COUNT 0x227c 1501a0f7ed3SChris Zhong 1511a0f7ed3SChris Zhong /* dptx stream addr */ 1521a0f7ed3SChris Zhong #define MSA_HORIZONTAL_0 0x2280 1531a0f7ed3SChris Zhong #define MSA_HORIZONTAL_1 0x2284 1541a0f7ed3SChris Zhong #define MSA_VERTICAL_0 0x2288 1551a0f7ed3SChris Zhong #define MSA_VERTICAL_1 0x228c 1561a0f7ed3SChris Zhong #define MSA_MISC 0x2290 1571a0f7ed3SChris Zhong #define STREAM_CONFIG 0x2294 1581a0f7ed3SChris Zhong #define AUDIO_PACK_STATUS 0x2298 1591a0f7ed3SChris Zhong #define VIF_STATUS 0x229c 1601a0f7ed3SChris Zhong #define PCK_STUFF_STATUS_0 0x22a0 1611a0f7ed3SChris Zhong #define PCK_STUFF_STATUS_1 0x22a4 1621a0f7ed3SChris Zhong #define INFO_PACK_STATUS 0x22a8 1631a0f7ed3SChris Zhong #define RATE_GOVERNOR_STATUS 0x22ac 1641a0f7ed3SChris Zhong #define DP_HORIZONTAL 0x22b0 1651a0f7ed3SChris Zhong #define DP_VERTICAL_0 0x22b4 1661a0f7ed3SChris Zhong #define DP_VERTICAL_1 0x22b8 1671a0f7ed3SChris Zhong #define DP_BLOCK_SDP 0x22bc 1681a0f7ed3SChris Zhong 1691a0f7ed3SChris Zhong /* dptx glbl addr */ 1701a0f7ed3SChris Zhong #define DPTX_LANE_EN 0x2300 1711a0f7ed3SChris Zhong #define DPTX_ENHNCD 0x2304 1721a0f7ed3SChris Zhong #define DPTX_INT_MASK 0x2308 1731a0f7ed3SChris Zhong #define DPTX_INT_STATUS 0x230c 1741a0f7ed3SChris Zhong 1751a0f7ed3SChris Zhong /* dp aux addr */ 1761a0f7ed3SChris Zhong #define DP_AUX_HOST_CONTROL 0x2800 1771a0f7ed3SChris Zhong #define DP_AUX_INTERRUPT_SOURCE 0x2804 1781a0f7ed3SChris Zhong #define DP_AUX_INTERRUPT_MASK 0x2808 1791a0f7ed3SChris Zhong #define DP_AUX_SWAP_INVERSION_CONTROL 0x280c 1801a0f7ed3SChris Zhong #define DP_AUX_SEND_NACK_TRANSACTION 0x2810 1811a0f7ed3SChris Zhong #define DP_AUX_CLEAR_RX 0x2814 1821a0f7ed3SChris Zhong #define DP_AUX_CLEAR_TX 0x2818 1831a0f7ed3SChris Zhong #define DP_AUX_TIMER_STOP 0x281c 1841a0f7ed3SChris Zhong #define DP_AUX_TIMER_CLEAR 0x2820 1851a0f7ed3SChris Zhong #define DP_AUX_RESET_SW 0x2824 1861a0f7ed3SChris Zhong #define DP_AUX_DIVIDE_2M 0x2828 1871a0f7ed3SChris Zhong #define DP_AUX_TX_PREACHARGE_LENGTH 0x282c 1881a0f7ed3SChris Zhong #define DP_AUX_FREQUENCY_1M_MAX 0x2830 1891a0f7ed3SChris Zhong #define DP_AUX_FREQUENCY_1M_MIN 0x2834 1901a0f7ed3SChris Zhong #define DP_AUX_RX_PRE_MIN 0x2838 1911a0f7ed3SChris Zhong #define DP_AUX_RX_PRE_MAX 0x283c 1921a0f7ed3SChris Zhong #define DP_AUX_TIMER_PRESET 0x2840 1931a0f7ed3SChris Zhong #define DP_AUX_NACK_FORMAT 0x2844 1941a0f7ed3SChris Zhong #define DP_AUX_TX_DATA 0x2848 1951a0f7ed3SChris Zhong #define DP_AUX_RX_DATA 0x284c 1961a0f7ed3SChris Zhong #define DP_AUX_TX_STATUS 0x2850 1971a0f7ed3SChris Zhong #define DP_AUX_RX_STATUS 0x2854 1981a0f7ed3SChris Zhong #define DP_AUX_RX_CYCLE_COUNTER 0x2858 1991a0f7ed3SChris Zhong #define DP_AUX_MAIN_STATES 0x285c 2001a0f7ed3SChris Zhong #define DP_AUX_MAIN_TIMER 0x2860 2011a0f7ed3SChris Zhong #define DP_AUX_AFE_OUT 0x2864 2021a0f7ed3SChris Zhong 2031a0f7ed3SChris Zhong /* crypto addr */ 2041a0f7ed3SChris Zhong #define CRYPTO_HDCP_REVISION 0x5800 2051a0f7ed3SChris Zhong #define HDCP_CRYPTO_CONFIG 0x5804 2061a0f7ed3SChris Zhong #define CRYPTO_INTERRUPT_SOURCE 0x5808 2071a0f7ed3SChris Zhong #define CRYPTO_INTERRUPT_MASK 0x580c 2081a0f7ed3SChris Zhong #define CRYPTO22_CONFIG 0x5818 2091a0f7ed3SChris Zhong #define CRYPTO22_STATUS 0x581c 2101a0f7ed3SChris Zhong #define SHA_256_DATA_IN 0x583c 2111a0f7ed3SChris Zhong #define SHA_256_DATA_OUT_(x) (0x5850 + ((x) << 2)) 2121a0f7ed3SChris Zhong #define AES_32_KEY_(x) (0x5870 + ((x) << 2)) 2131a0f7ed3SChris Zhong #define AES_32_DATA_IN 0x5880 2141a0f7ed3SChris Zhong #define AES_32_DATA_OUT_(x) (0x5884 + ((x) << 2)) 2151a0f7ed3SChris Zhong #define CRYPTO14_CONFIG 0x58a0 2161a0f7ed3SChris Zhong #define CRYPTO14_STATUS 0x58a4 2171a0f7ed3SChris Zhong #define CRYPTO14_PRNM_OUT 0x58a8 2181a0f7ed3SChris Zhong #define CRYPTO14_KM_0 0x58ac 2191a0f7ed3SChris Zhong #define CRYPTO14_KM_1 0x58b0 2201a0f7ed3SChris Zhong #define CRYPTO14_AN_0 0x58b4 2211a0f7ed3SChris Zhong #define CRYPTO14_AN_1 0x58b8 2221a0f7ed3SChris Zhong #define CRYPTO14_YOUR_KSV_0 0x58bc 2231a0f7ed3SChris Zhong #define CRYPTO14_YOUR_KSV_1 0x58c0 2241a0f7ed3SChris Zhong #define CRYPTO14_MI_0 0x58c4 2251a0f7ed3SChris Zhong #define CRYPTO14_MI_1 0x58c8 2261a0f7ed3SChris Zhong #define CRYPTO14_TI_0 0x58cc 2271a0f7ed3SChris Zhong #define CRYPTO14_KI_0 0x58d0 2281a0f7ed3SChris Zhong #define CRYPTO14_KI_1 0x58d4 2291a0f7ed3SChris Zhong #define CRYPTO14_BLOCKS_NUM 0x58d8 2301a0f7ed3SChris Zhong #define CRYPTO14_KEY_MEM_DATA_0 0x58dc 2311a0f7ed3SChris Zhong #define CRYPTO14_KEY_MEM_DATA_1 0x58e0 2321a0f7ed3SChris Zhong #define CRYPTO14_SHA1_MSG_DATA 0x58e4 2331a0f7ed3SChris Zhong #define CRYPTO14_SHA1_V_VALUE_(x) (0x58e8 + ((x) << 2)) 2341a0f7ed3SChris Zhong #define TRNG_CTRL 0x58fc 2351a0f7ed3SChris Zhong #define TRNG_DATA_RDY 0x5900 2361a0f7ed3SChris Zhong #define TRNG_DATA 0x5904 2371a0f7ed3SChris Zhong 2381a0f7ed3SChris Zhong /* cipher addr */ 2391a0f7ed3SChris Zhong #define HDCP_REVISION 0x60000 2401a0f7ed3SChris Zhong #define INTERRUPT_SOURCE 0x60004 2411a0f7ed3SChris Zhong #define INTERRUPT_MASK 0x60008 2421a0f7ed3SChris Zhong #define HDCP_CIPHER_CONFIG 0x6000c 2431a0f7ed3SChris Zhong #define AES_128_KEY_0 0x60010 2441a0f7ed3SChris Zhong #define AES_128_KEY_1 0x60014 2451a0f7ed3SChris Zhong #define AES_128_KEY_2 0x60018 2461a0f7ed3SChris Zhong #define AES_128_KEY_3 0x6001c 2471a0f7ed3SChris Zhong #define AES_128_RANDOM_0 0x60020 2481a0f7ed3SChris Zhong #define AES_128_RANDOM_1 0x60024 2491a0f7ed3SChris Zhong #define CIPHER14_KM_0 0x60028 2501a0f7ed3SChris Zhong #define CIPHER14_KM_1 0x6002c 2511a0f7ed3SChris Zhong #define CIPHER14_STATUS 0x60030 2521a0f7ed3SChris Zhong #define CIPHER14_RI_PJ_STATUS 0x60034 2531a0f7ed3SChris Zhong #define CIPHER_MODE 0x60038 2541a0f7ed3SChris Zhong #define CIPHER14_AN_0 0x6003c 2551a0f7ed3SChris Zhong #define CIPHER14_AN_1 0x60040 2561a0f7ed3SChris Zhong #define CIPHER22_AUTH 0x60044 2571a0f7ed3SChris Zhong #define CIPHER14_R0_DP_STATUS 0x60048 2581a0f7ed3SChris Zhong #define CIPHER14_BOOTSTRAP 0x6004c 2591a0f7ed3SChris Zhong 2601a0f7ed3SChris Zhong #define DPTX_FRMR_DATA_CLK_RSTN_EN BIT(11) 2611a0f7ed3SChris Zhong #define DPTX_FRMR_DATA_CLK_EN BIT(10) 2621a0f7ed3SChris Zhong #define DPTX_PHY_DATA_RSTN_EN BIT(9) 2631a0f7ed3SChris Zhong #define DPTX_PHY_DATA_CLK_EN BIT(8) 2641a0f7ed3SChris Zhong #define DPTX_PHY_CHAR_RSTN_EN BIT(7) 2651a0f7ed3SChris Zhong #define DPTX_PHY_CHAR_CLK_EN BIT(6) 2661a0f7ed3SChris Zhong #define SOURCE_AUX_SYS_CLK_RSTN_EN BIT(5) 2671a0f7ed3SChris Zhong #define SOURCE_AUX_SYS_CLK_EN BIT(4) 2681a0f7ed3SChris Zhong #define DPTX_SYS_CLK_RSTN_EN BIT(3) 2691a0f7ed3SChris Zhong #define DPTX_SYS_CLK_EN BIT(2) 2701a0f7ed3SChris Zhong #define CFG_DPTX_VIF_CLK_RSTN_EN BIT(1) 2711a0f7ed3SChris Zhong #define CFG_DPTX_VIF_CLK_EN BIT(0) 2721a0f7ed3SChris Zhong 2731a0f7ed3SChris Zhong #define SOURCE_PHY_RSTN_EN BIT(1) 2741a0f7ed3SChris Zhong #define SOURCE_PHY_CLK_EN BIT(0) 2751a0f7ed3SChris Zhong 2761a0f7ed3SChris Zhong #define SOURCE_PKT_SYS_RSTN_EN BIT(3) 2771a0f7ed3SChris Zhong #define SOURCE_PKT_SYS_CLK_EN BIT(2) 2781a0f7ed3SChris Zhong #define SOURCE_PKT_DATA_RSTN_EN BIT(1) 2791a0f7ed3SChris Zhong #define SOURCE_PKT_DATA_CLK_EN BIT(0) 2801a0f7ed3SChris Zhong 2811a0f7ed3SChris Zhong #define SPDIF_CDR_CLK_RSTN_EN BIT(5) 2821a0f7ed3SChris Zhong #define SPDIF_CDR_CLK_EN BIT(4) 2831a0f7ed3SChris Zhong #define SOURCE_AIF_SYS_RSTN_EN BIT(3) 2841a0f7ed3SChris Zhong #define SOURCE_AIF_SYS_CLK_EN BIT(2) 2851a0f7ed3SChris Zhong #define SOURCE_AIF_CLK_RSTN_EN BIT(1) 2861a0f7ed3SChris Zhong #define SOURCE_AIF_CLK_EN BIT(0) 2871a0f7ed3SChris Zhong 2881a0f7ed3SChris Zhong #define SOURCE_CIPHER_SYSTEM_CLK_RSTN_EN BIT(3) 2891a0f7ed3SChris Zhong #define SOURCE_CIPHER_SYS_CLK_EN BIT(2) 2901a0f7ed3SChris Zhong #define SOURCE_CIPHER_CHAR_CLK_RSTN_EN BIT(1) 2911a0f7ed3SChris Zhong #define SOURCE_CIPHER_CHAR_CLK_EN BIT(0) 2921a0f7ed3SChris Zhong 2931a0f7ed3SChris Zhong #define SOURCE_CRYPTO_SYS_CLK_RSTN_EN BIT(1) 2941a0f7ed3SChris Zhong #define SOURCE_CRYPTO_SYS_CLK_EN BIT(0) 2951a0f7ed3SChris Zhong 2961a0f7ed3SChris Zhong #define APB_IRAM_PATH BIT(2) 2971a0f7ed3SChris Zhong #define APB_DRAM_PATH BIT(1) 2981a0f7ed3SChris Zhong #define APB_XT_RESET BIT(0) 2991a0f7ed3SChris Zhong 3001a0f7ed3SChris Zhong #define MAILBOX_INT_MASK_BIT BIT(1) 3011a0f7ed3SChris Zhong #define PIF_INT_MASK_BIT BIT(0) 3021a0f7ed3SChris Zhong #define ALL_INT_MASK 3 3031a0f7ed3SChris Zhong 3041a0f7ed3SChris Zhong /* mailbox */ 3051a0f7ed3SChris Zhong #define MB_OPCODE_ID 0 3061a0f7ed3SChris Zhong #define MB_MODULE_ID 1 3071a0f7ed3SChris Zhong #define MB_SIZE_MSB_ID 2 3081a0f7ed3SChris Zhong #define MB_SIZE_LSB_ID 3 3091a0f7ed3SChris Zhong #define MB_DATA_ID 4 3101a0f7ed3SChris Zhong 3111a0f7ed3SChris Zhong #define MB_MODULE_ID_DP_TX 0x01 3121a0f7ed3SChris Zhong #define MB_MODULE_ID_HDCP_TX 0x07 3131a0f7ed3SChris Zhong #define MB_MODULE_ID_HDCP_RX 0x08 3141a0f7ed3SChris Zhong #define MB_MODULE_ID_HDCP_GENERAL 0x09 3151a0f7ed3SChris Zhong #define MB_MODULE_ID_GENERAL 0x0a 3161a0f7ed3SChris Zhong 3171a0f7ed3SChris Zhong /* general opcode */ 3181a0f7ed3SChris Zhong #define GENERAL_MAIN_CONTROL 0x01 3191a0f7ed3SChris Zhong #define GENERAL_TEST_ECHO 0x02 3201a0f7ed3SChris Zhong #define GENERAL_BUS_SETTINGS 0x03 3211a0f7ed3SChris Zhong #define GENERAL_TEST_ACCESS 0x04 3221a0f7ed3SChris Zhong 3231a0f7ed3SChris Zhong #define DPTX_SET_POWER_MNG 0x00 3241a0f7ed3SChris Zhong #define DPTX_SET_HOST_CAPABILITIES 0x01 3251a0f7ed3SChris Zhong #define DPTX_GET_EDID 0x02 3261a0f7ed3SChris Zhong #define DPTX_READ_DPCD 0x03 3271a0f7ed3SChris Zhong #define DPTX_WRITE_DPCD 0x04 3281a0f7ed3SChris Zhong #define DPTX_ENABLE_EVENT 0x05 3291a0f7ed3SChris Zhong #define DPTX_WRITE_REGISTER 0x06 3301a0f7ed3SChris Zhong #define DPTX_READ_REGISTER 0x07 3311a0f7ed3SChris Zhong #define DPTX_WRITE_FIELD 0x08 3321a0f7ed3SChris Zhong #define DPTX_TRAINING_CONTROL 0x09 3331a0f7ed3SChris Zhong #define DPTX_READ_EVENT 0x0a 3341a0f7ed3SChris Zhong #define DPTX_READ_LINK_STAT 0x0b 3351a0f7ed3SChris Zhong #define DPTX_SET_VIDEO 0x0c 3361a0f7ed3SChris Zhong #define DPTX_SET_AUDIO 0x0d 3371a0f7ed3SChris Zhong #define DPTX_GET_LAST_AUX_STAUS 0x0e 3381a0f7ed3SChris Zhong #define DPTX_SET_LINK_BREAK_POINT 0x0f 3391a0f7ed3SChris Zhong #define DPTX_FORCE_LANES 0x10 3401a0f7ed3SChris Zhong #define DPTX_HPD_STATE 0x11 3411a0f7ed3SChris Zhong 3421a0f7ed3SChris Zhong #define FW_STANDBY 0 3431a0f7ed3SChris Zhong #define FW_ACTIVE 1 3441a0f7ed3SChris Zhong 3451a0f7ed3SChris Zhong #define DPTX_EVENT_ENABLE_HPD BIT(0) 3461a0f7ed3SChris Zhong #define DPTX_EVENT_ENABLE_TRAINING BIT(1) 3471a0f7ed3SChris Zhong 3481a0f7ed3SChris Zhong #define LINK_TRAINING_NOT_ACTIVE 0 3491a0f7ed3SChris Zhong #define LINK_TRAINING_RUN 1 3501a0f7ed3SChris Zhong #define LINK_TRAINING_RESTART 2 3511a0f7ed3SChris Zhong 3521a0f7ed3SChris Zhong #define CONTROL_VIDEO_IDLE 0 3531a0f7ed3SChris Zhong #define CONTROL_VIDEO_VALID 1 3541a0f7ed3SChris Zhong 3551a0f7ed3SChris Zhong #define TU_CNT_RST_EN BIT(15) 3561a0f7ed3SChris Zhong #define VIF_BYPASS_INTERLACE BIT(13) 3571a0f7ed3SChris Zhong #define INTERLACE_FMT_DET BIT(12) 3581a0f7ed3SChris Zhong #define INTERLACE_DTCT_WIN 0x20 3591a0f7ed3SChris Zhong 3601a0f7ed3SChris Zhong #define DP_FRAMER_SP_INTERLACE_EN BIT(2) 3611a0f7ed3SChris Zhong #define DP_FRAMER_SP_HSP BIT(1) 3621a0f7ed3SChris Zhong #define DP_FRAMER_SP_VSP BIT(0) 3631a0f7ed3SChris Zhong 3641a0f7ed3SChris Zhong /* capability */ 3651a0f7ed3SChris Zhong #define AUX_HOST_INVERT 3 3661a0f7ed3SChris Zhong #define FAST_LT_SUPPORT 1 3671a0f7ed3SChris Zhong #define FAST_LT_NOT_SUPPORT 0 3681a0f7ed3SChris Zhong #define LANE_MAPPING_NORMAL 0x1b 3691a0f7ed3SChris Zhong #define LANE_MAPPING_FLIPPED 0xe4 3701a0f7ed3SChris Zhong #define ENHANCED 1 3711a0f7ed3SChris Zhong #define SCRAMBLER_EN BIT(4) 3721a0f7ed3SChris Zhong 3731a0f7ed3SChris Zhong #define FULL_LT_STARTED BIT(0) 3741a0f7ed3SChris Zhong #define FASE_LT_STARTED BIT(1) 3751a0f7ed3SChris Zhong #define CLK_RECOVERY_FINISHED BIT(2) 3761a0f7ed3SChris Zhong #define EQ_PHASE_FINISHED BIT(3) 3771a0f7ed3SChris Zhong #define FASE_LT_START_FINISHED BIT(4) 3781a0f7ed3SChris Zhong #define CLK_RECOVERY_FAILED BIT(5) 3791a0f7ed3SChris Zhong #define EQ_PHASE_FAILED BIT(6) 3801a0f7ed3SChris Zhong #define FASE_LT_FAILED BIT(7) 3811a0f7ed3SChris Zhong 3821a0f7ed3SChris Zhong #define DPTX_HPD_EVENT BIT(0) 3831a0f7ed3SChris Zhong #define DPTX_TRAINING_EVENT BIT(1) 3841a0f7ed3SChris Zhong #define HDCP_TX_STATUS_EVENT BIT(4) 3851a0f7ed3SChris Zhong #define HDCP2_TX_IS_KM_STORED_EVENT BIT(5) 3861a0f7ed3SChris Zhong #define HDCP2_TX_STORE_KM_EVENT BIT(6) 3871a0f7ed3SChris Zhong #define HDCP_TX_IS_RECEIVER_ID_VALID_EVENT BIT(7) 3881a0f7ed3SChris Zhong 3891a0f7ed3SChris Zhong #define TU_SIZE 30 3901a0f7ed3SChris Zhong #define CDN_DP_MAX_LINK_RATE DP_LINK_BW_5_4 3911a0f7ed3SChris Zhong 3921a0f7ed3SChris Zhong /* audio */ 3931a0f7ed3SChris Zhong #define AUDIO_PACK_EN BIT(8) 3941a0f7ed3SChris Zhong #define SAMPLING_FREQ(x) (((x) & 0xf) << 16) 3951a0f7ed3SChris Zhong #define ORIGINAL_SAMP_FREQ(x) (((x) & 0xf) << 24) 3961a0f7ed3SChris Zhong #define SYNC_WR_TO_CH_ZERO BIT(1) 3971a0f7ed3SChris Zhong #define I2S_DEC_START BIT(1) 3981a0f7ed3SChris Zhong #define AUDIO_SW_RST BIT(0) 3991a0f7ed3SChris Zhong #define SMPL2PKT_EN BIT(1) 4001a0f7ed3SChris Zhong #define MAX_NUM_CH(x) (((x) & 0x1f) - 1) 4011a0f7ed3SChris Zhong #define NUM_OF_I2S_PORTS(x) ((((x) / 2 - 1) & 0x3) << 5) 4021a0f7ed3SChris Zhong #define AUDIO_TYPE_LPCM (2 << 7) 4031a0f7ed3SChris Zhong #define CFG_SUB_PCKT_NUM(x) ((((x) - 1) & 0x7) << 11) 4041a0f7ed3SChris Zhong #define AUDIO_CH_NUM(x) ((((x) - 1) & 0x1f) << 2) 4051a0f7ed3SChris Zhong #define TRANS_SMPL_WIDTH_16 0 4061a0f7ed3SChris Zhong #define TRANS_SMPL_WIDTH_24 BIT(11) 4071a0f7ed3SChris Zhong #define TRANS_SMPL_WIDTH_32 (2 << 11) 4081a0f7ed3SChris Zhong #define I2S_DEC_PORT_EN(x) (((x) & 0xf) << 17) 4091a0f7ed3SChris Zhong #define SPDIF_ENABLE BIT(21) 4101a0f7ed3SChris Zhong #define SPDIF_AVG_SEL BIT(20) 4111a0f7ed3SChris Zhong #define SPDIF_JITTER_BYPASS BIT(19) 4121a0f7ed3SChris Zhong #define SPDIF_FIFO_MID_RANGE(x) (((x) & 0xff) << 11) 4131a0f7ed3SChris Zhong #define SPDIF_JITTER_THRSH(x) (((x) & 0xff) << 3) 4141a0f7ed3SChris Zhong #define SPDIF_JITTER_AVG_WIN(x) ((x) & 0x7) 4151a0f7ed3SChris Zhong 4161a0f7ed3SChris Zhong /* Reference cycles when using lane clock as reference */ 4171a0f7ed3SChris Zhong #define LANE_REF_CYC 0x8000 4181a0f7ed3SChris Zhong 4191a0f7ed3SChris Zhong enum voltage_swing_level { 4201a0f7ed3SChris Zhong VOLTAGE_LEVEL_0, 4211a0f7ed3SChris Zhong VOLTAGE_LEVEL_1, 4221a0f7ed3SChris Zhong VOLTAGE_LEVEL_2, 4231a0f7ed3SChris Zhong VOLTAGE_LEVEL_3, 4241a0f7ed3SChris Zhong }; 4251a0f7ed3SChris Zhong 4261a0f7ed3SChris Zhong enum pre_emphasis_level { 4271a0f7ed3SChris Zhong PRE_EMPHASIS_LEVEL_0, 4281a0f7ed3SChris Zhong PRE_EMPHASIS_LEVEL_1, 4291a0f7ed3SChris Zhong PRE_EMPHASIS_LEVEL_2, 4301a0f7ed3SChris Zhong PRE_EMPHASIS_LEVEL_3, 4311a0f7ed3SChris Zhong }; 4321a0f7ed3SChris Zhong 4331a0f7ed3SChris Zhong enum pattern_set { 4341a0f7ed3SChris Zhong PTS1 = BIT(0), 4351a0f7ed3SChris Zhong PTS2 = BIT(1), 4361a0f7ed3SChris Zhong PTS3 = BIT(2), 4371a0f7ed3SChris Zhong PTS4 = BIT(3), 4381a0f7ed3SChris Zhong DP_NONE = BIT(4) 4391a0f7ed3SChris Zhong }; 4401a0f7ed3SChris Zhong 4411a0f7ed3SChris Zhong enum vic_color_depth { 4421a0f7ed3SChris Zhong BCS_6 = 0x1, 4431a0f7ed3SChris Zhong BCS_8 = 0x2, 4441a0f7ed3SChris Zhong BCS_10 = 0x4, 4451a0f7ed3SChris Zhong BCS_12 = 0x8, 4461a0f7ed3SChris Zhong BCS_16 = 0x10, 4471a0f7ed3SChris Zhong }; 4481a0f7ed3SChris Zhong 4491a0f7ed3SChris Zhong enum vic_bt_type { 4501a0f7ed3SChris Zhong BT_601 = 0x0, 4511a0f7ed3SChris Zhong BT_709 = 0x1, 4521a0f7ed3SChris Zhong }; 4531a0f7ed3SChris Zhong 4541a0f7ed3SChris Zhong void cdn_dp_clock_reset(struct cdn_dp_device *dp); 4551a0f7ed3SChris Zhong 456a68b5bb6SChris Zhong void cdn_dp_set_fw_clk(struct cdn_dp_device *dp, unsigned long clk); 4571a0f7ed3SChris Zhong int cdn_dp_load_firmware(struct cdn_dp_device *dp, const u32 *i_mem, 4581a0f7ed3SChris Zhong u32 i_size, const u32 *d_mem, u32 d_size); 4591a0f7ed3SChris Zhong int cdn_dp_set_firmware_active(struct cdn_dp_device *dp, bool enable); 4601a0f7ed3SChris Zhong int cdn_dp_set_host_cap(struct cdn_dp_device *dp, u8 lanes, bool flip); 4611a0f7ed3SChris Zhong int cdn_dp_event_config(struct cdn_dp_device *dp); 4621a0f7ed3SChris Zhong u32 cdn_dp_get_event(struct cdn_dp_device *dp); 4631a0f7ed3SChris Zhong int cdn_dp_get_hpd_status(struct cdn_dp_device *dp); 4641a0f7ed3SChris Zhong int cdn_dp_dpcd_write(struct cdn_dp_device *dp, u32 addr, u8 value); 4651a0f7ed3SChris Zhong int cdn_dp_dpcd_read(struct cdn_dp_device *dp, u32 addr, u8 *data, u16 len); 4661a0f7ed3SChris Zhong int cdn_dp_get_edid_block(void *dp, u8 *edid, 4671a0f7ed3SChris Zhong unsigned int block, size_t length); 4681a0f7ed3SChris Zhong int cdn_dp_train_link(struct cdn_dp_device *dp); 4691a0f7ed3SChris Zhong int cdn_dp_set_video_status(struct cdn_dp_device *dp, int active); 4701a0f7ed3SChris Zhong int cdn_dp_config_video(struct cdn_dp_device *dp); 4711a0f7ed3SChris Zhong int cdn_dp_audio_stop(struct cdn_dp_device *dp, struct audio_info *audio); 4721a0f7ed3SChris Zhong int cdn_dp_audio_mute(struct cdn_dp_device *dp, bool enable); 4731a0f7ed3SChris Zhong int cdn_dp_audio_config(struct cdn_dp_device *dp, struct audio_info *audio); 4741a0f7ed3SChris Zhong #endif /* _CDN_DP_REG_H */ 475