18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd 48c2ecf20Sopenharmony_ci * Author: Chris Zhong <zyw@rock-chips.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef _CDN_DP_REG_H 88c2ecf20Sopenharmony_ci#define _CDN_DP_REG_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/bitops.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define ADDR_IMEM 0x10000 138c2ecf20Sopenharmony_ci#define ADDR_DMEM 0x20000 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* APB CFG addr */ 168c2ecf20Sopenharmony_ci#define APB_CTRL 0 178c2ecf20Sopenharmony_ci#define XT_INT_CTRL 0x04 188c2ecf20Sopenharmony_ci#define MAILBOX_FULL_ADDR 0x08 198c2ecf20Sopenharmony_ci#define MAILBOX_EMPTY_ADDR 0x0c 208c2ecf20Sopenharmony_ci#define MAILBOX0_WR_DATA 0x10 218c2ecf20Sopenharmony_ci#define MAILBOX0_RD_DATA 0x14 228c2ecf20Sopenharmony_ci#define KEEP_ALIVE 0x18 238c2ecf20Sopenharmony_ci#define VER_L 0x1c 248c2ecf20Sopenharmony_ci#define VER_H 0x20 258c2ecf20Sopenharmony_ci#define VER_LIB_L_ADDR 0x24 268c2ecf20Sopenharmony_ci#define VER_LIB_H_ADDR 0x28 278c2ecf20Sopenharmony_ci#define SW_DEBUG_L 0x2c 288c2ecf20Sopenharmony_ci#define SW_DEBUG_H 0x30 298c2ecf20Sopenharmony_ci#define MAILBOX_INT_MASK 0x34 308c2ecf20Sopenharmony_ci#define MAILBOX_INT_STATUS 0x38 318c2ecf20Sopenharmony_ci#define SW_CLK_L 0x3c 328c2ecf20Sopenharmony_ci#define SW_CLK_H 0x40 338c2ecf20Sopenharmony_ci#define SW_EVENTS0 0x44 348c2ecf20Sopenharmony_ci#define SW_EVENTS1 0x48 358c2ecf20Sopenharmony_ci#define SW_EVENTS2 0x4c 368c2ecf20Sopenharmony_ci#define SW_EVENTS3 0x50 378c2ecf20Sopenharmony_ci#define XT_OCD_CTRL 0x60 388c2ecf20Sopenharmony_ci#define APB_INT_MASK 0x6c 398c2ecf20Sopenharmony_ci#define APB_STATUS_MASK 0x70 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* audio decoder addr */ 428c2ecf20Sopenharmony_ci#define AUDIO_SRC_CNTL 0x30000 438c2ecf20Sopenharmony_ci#define AUDIO_SRC_CNFG 0x30004 448c2ecf20Sopenharmony_ci#define COM_CH_STTS_BITS 0x30008 458c2ecf20Sopenharmony_ci#define STTS_BIT_CH(x) (0x3000c + ((x) << 2)) 468c2ecf20Sopenharmony_ci#define SPDIF_CTRL_ADDR 0x3004c 478c2ecf20Sopenharmony_ci#define SPDIF_CH1_CS_3100_ADDR 0x30050 488c2ecf20Sopenharmony_ci#define SPDIF_CH1_CS_6332_ADDR 0x30054 498c2ecf20Sopenharmony_ci#define SPDIF_CH1_CS_9564_ADDR 0x30058 508c2ecf20Sopenharmony_ci#define SPDIF_CH1_CS_12796_ADDR 0x3005c 518c2ecf20Sopenharmony_ci#define SPDIF_CH1_CS_159128_ADDR 0x30060 528c2ecf20Sopenharmony_ci#define SPDIF_CH1_CS_191160_ADDR 0x30064 538c2ecf20Sopenharmony_ci#define SPDIF_CH2_CS_3100_ADDR 0x30068 548c2ecf20Sopenharmony_ci#define SPDIF_CH2_CS_6332_ADDR 0x3006c 558c2ecf20Sopenharmony_ci#define SPDIF_CH2_CS_9564_ADDR 0x30070 568c2ecf20Sopenharmony_ci#define SPDIF_CH2_CS_12796_ADDR 0x30074 578c2ecf20Sopenharmony_ci#define SPDIF_CH2_CS_159128_ADDR 0x30078 588c2ecf20Sopenharmony_ci#define SPDIF_CH2_CS_191160_ADDR 0x3007c 598c2ecf20Sopenharmony_ci#define SMPL2PKT_CNTL 0x30080 608c2ecf20Sopenharmony_ci#define SMPL2PKT_CNFG 0x30084 618c2ecf20Sopenharmony_ci#define FIFO_CNTL 0x30088 628c2ecf20Sopenharmony_ci#define FIFO_STTS 0x3008c 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* source pif addr */ 658c2ecf20Sopenharmony_ci#define SOURCE_PIF_WR_ADDR 0x30800 668c2ecf20Sopenharmony_ci#define SOURCE_PIF_WR_REQ 0x30804 678c2ecf20Sopenharmony_ci#define SOURCE_PIF_RD_ADDR 0x30808 688c2ecf20Sopenharmony_ci#define SOURCE_PIF_RD_REQ 0x3080c 698c2ecf20Sopenharmony_ci#define SOURCE_PIF_DATA_WR 0x30810 708c2ecf20Sopenharmony_ci#define SOURCE_PIF_DATA_RD 0x30814 718c2ecf20Sopenharmony_ci#define SOURCE_PIF_FIFO1_FLUSH 0x30818 728c2ecf20Sopenharmony_ci#define SOURCE_PIF_FIFO2_FLUSH 0x3081c 738c2ecf20Sopenharmony_ci#define SOURCE_PIF_STATUS 0x30820 748c2ecf20Sopenharmony_ci#define SOURCE_PIF_INTERRUPT_SOURCE 0x30824 758c2ecf20Sopenharmony_ci#define SOURCE_PIF_INTERRUPT_MASK 0x30828 768c2ecf20Sopenharmony_ci#define SOURCE_PIF_PKT_ALLOC_REG 0x3082c 778c2ecf20Sopenharmony_ci#define SOURCE_PIF_PKT_ALLOC_WR_EN 0x30830 788c2ecf20Sopenharmony_ci#define SOURCE_PIF_SW_RESET 0x30834 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci/* bellow registers need access by mailbox */ 818c2ecf20Sopenharmony_ci/* source car addr */ 828c2ecf20Sopenharmony_ci#define SOURCE_HDTX_CAR 0x0900 838c2ecf20Sopenharmony_ci#define SOURCE_DPTX_CAR 0x0904 848c2ecf20Sopenharmony_ci#define SOURCE_PHY_CAR 0x0908 858c2ecf20Sopenharmony_ci#define SOURCE_CEC_CAR 0x090c 868c2ecf20Sopenharmony_ci#define SOURCE_CBUS_CAR 0x0910 878c2ecf20Sopenharmony_ci#define SOURCE_PKT_CAR 0x0918 888c2ecf20Sopenharmony_ci#define SOURCE_AIF_CAR 0x091c 898c2ecf20Sopenharmony_ci#define SOURCE_CIPHER_CAR 0x0920 908c2ecf20Sopenharmony_ci#define SOURCE_CRYPTO_CAR 0x0924 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci/* clock meters addr */ 938c2ecf20Sopenharmony_ci#define CM_CTRL 0x0a00 948c2ecf20Sopenharmony_ci#define CM_I2S_CTRL 0x0a04 958c2ecf20Sopenharmony_ci#define CM_SPDIF_CTRL 0x0a08 968c2ecf20Sopenharmony_ci#define CM_VID_CTRL 0x0a0c 978c2ecf20Sopenharmony_ci#define CM_LANE_CTRL 0x0a10 988c2ecf20Sopenharmony_ci#define I2S_NM_STABLE 0x0a14 998c2ecf20Sopenharmony_ci#define I2S_NCTS_STABLE 0x0a18 1008c2ecf20Sopenharmony_ci#define SPDIF_NM_STABLE 0x0a1c 1018c2ecf20Sopenharmony_ci#define SPDIF_NCTS_STABLE 0x0a20 1028c2ecf20Sopenharmony_ci#define NMVID_MEAS_STABLE 0x0a24 1038c2ecf20Sopenharmony_ci#define I2S_MEAS 0x0a40 1048c2ecf20Sopenharmony_ci#define SPDIF_MEAS 0x0a80 1058c2ecf20Sopenharmony_ci#define NMVID_MEAS 0x0ac0 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/* source vif addr */ 1088c2ecf20Sopenharmony_ci#define BND_HSYNC2VSYNC 0x0b00 1098c2ecf20Sopenharmony_ci#define HSYNC2VSYNC_F1_L1 0x0b04 1108c2ecf20Sopenharmony_ci#define HSYNC2VSYNC_F2_L1 0x0b08 1118c2ecf20Sopenharmony_ci#define HSYNC2VSYNC_STATUS 0x0b0c 1128c2ecf20Sopenharmony_ci#define HSYNC2VSYNC_POL_CTRL 0x0b10 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/* dptx phy addr */ 1158c2ecf20Sopenharmony_ci#define DP_TX_PHY_CONFIG_REG 0x2000 1168c2ecf20Sopenharmony_ci#define DP_TX_PHY_SW_RESET 0x2004 1178c2ecf20Sopenharmony_ci#define DP_TX_PHY_SCRAMBLER_SEED 0x2008 1188c2ecf20Sopenharmony_ci#define DP_TX_PHY_TRAINING_01_04 0x200c 1198c2ecf20Sopenharmony_ci#define DP_TX_PHY_TRAINING_05_08 0x2010 1208c2ecf20Sopenharmony_ci#define DP_TX_PHY_TRAINING_09_10 0x2014 1218c2ecf20Sopenharmony_ci#define TEST_COR 0x23fc 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci/* dptx hpd addr */ 1248c2ecf20Sopenharmony_ci#define HPD_IRQ_DET_MIN_TIMER 0x2100 1258c2ecf20Sopenharmony_ci#define HPD_IRQ_DET_MAX_TIMER 0x2104 1268c2ecf20Sopenharmony_ci#define HPD_UNPLGED_DET_MIN_TIMER 0x2108 1278c2ecf20Sopenharmony_ci#define HPD_STABLE_TIMER 0x210c 1288c2ecf20Sopenharmony_ci#define HPD_FILTER_TIMER 0x2110 1298c2ecf20Sopenharmony_ci#define HPD_EVENT_MASK 0x211c 1308c2ecf20Sopenharmony_ci#define HPD_EVENT_DET 0x2120 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci/* dpyx framer addr */ 1338c2ecf20Sopenharmony_ci#define DP_FRAMER_GLOBAL_CONFIG 0x2200 1348c2ecf20Sopenharmony_ci#define DP_SW_RESET 0x2204 1358c2ecf20Sopenharmony_ci#define DP_FRAMER_TU 0x2208 1368c2ecf20Sopenharmony_ci#define DP_FRAMER_PXL_REPR 0x220c 1378c2ecf20Sopenharmony_ci#define DP_FRAMER_SP 0x2210 1388c2ecf20Sopenharmony_ci#define AUDIO_PACK_CONTROL 0x2214 1398c2ecf20Sopenharmony_ci#define DP_VC_TABLE(x) (0x2218 + ((x) << 2)) 1408c2ecf20Sopenharmony_ci#define DP_VB_ID 0x2258 1418c2ecf20Sopenharmony_ci#define DP_MTPH_LVP_CONTROL 0x225c 1428c2ecf20Sopenharmony_ci#define DP_MTPH_SYMBOL_VALUES 0x2260 1438c2ecf20Sopenharmony_ci#define DP_MTPH_ECF_CONTROL 0x2264 1448c2ecf20Sopenharmony_ci#define DP_MTPH_ACT_CONTROL 0x2268 1458c2ecf20Sopenharmony_ci#define DP_MTPH_STATUS 0x226c 1468c2ecf20Sopenharmony_ci#define DP_INTERRUPT_SOURCE 0x2270 1478c2ecf20Sopenharmony_ci#define DP_INTERRUPT_MASK 0x2274 1488c2ecf20Sopenharmony_ci#define DP_FRONT_BACK_PORCH 0x2278 1498c2ecf20Sopenharmony_ci#define DP_BYTE_COUNT 0x227c 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci/* dptx stream addr */ 1528c2ecf20Sopenharmony_ci#define MSA_HORIZONTAL_0 0x2280 1538c2ecf20Sopenharmony_ci#define MSA_HORIZONTAL_1 0x2284 1548c2ecf20Sopenharmony_ci#define MSA_VERTICAL_0 0x2288 1558c2ecf20Sopenharmony_ci#define MSA_VERTICAL_1 0x228c 1568c2ecf20Sopenharmony_ci#define MSA_MISC 0x2290 1578c2ecf20Sopenharmony_ci#define STREAM_CONFIG 0x2294 1588c2ecf20Sopenharmony_ci#define AUDIO_PACK_STATUS 0x2298 1598c2ecf20Sopenharmony_ci#define VIF_STATUS 0x229c 1608c2ecf20Sopenharmony_ci#define PCK_STUFF_STATUS_0 0x22a0 1618c2ecf20Sopenharmony_ci#define PCK_STUFF_STATUS_1 0x22a4 1628c2ecf20Sopenharmony_ci#define INFO_PACK_STATUS 0x22a8 1638c2ecf20Sopenharmony_ci#define RATE_GOVERNOR_STATUS 0x22ac 1648c2ecf20Sopenharmony_ci#define DP_HORIZONTAL 0x22b0 1658c2ecf20Sopenharmony_ci#define DP_VERTICAL_0 0x22b4 1668c2ecf20Sopenharmony_ci#define DP_VERTICAL_1 0x22b8 1678c2ecf20Sopenharmony_ci#define DP_BLOCK_SDP 0x22bc 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci/* dptx glbl addr */ 1708c2ecf20Sopenharmony_ci#define DPTX_LANE_EN 0x2300 1718c2ecf20Sopenharmony_ci#define DPTX_ENHNCD 0x2304 1728c2ecf20Sopenharmony_ci#define DPTX_INT_MASK 0x2308 1738c2ecf20Sopenharmony_ci#define DPTX_INT_STATUS 0x230c 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci/* dp aux addr */ 1768c2ecf20Sopenharmony_ci#define DP_AUX_HOST_CONTROL 0x2800 1778c2ecf20Sopenharmony_ci#define DP_AUX_INTERRUPT_SOURCE 0x2804 1788c2ecf20Sopenharmony_ci#define DP_AUX_INTERRUPT_MASK 0x2808 1798c2ecf20Sopenharmony_ci#define DP_AUX_SWAP_INVERSION_CONTROL 0x280c 1808c2ecf20Sopenharmony_ci#define DP_AUX_SEND_NACK_TRANSACTION 0x2810 1818c2ecf20Sopenharmony_ci#define DP_AUX_CLEAR_RX 0x2814 1828c2ecf20Sopenharmony_ci#define DP_AUX_CLEAR_TX 0x2818 1838c2ecf20Sopenharmony_ci#define DP_AUX_TIMER_STOP 0x281c 1848c2ecf20Sopenharmony_ci#define DP_AUX_TIMER_CLEAR 0x2820 1858c2ecf20Sopenharmony_ci#define DP_AUX_RESET_SW 0x2824 1868c2ecf20Sopenharmony_ci#define DP_AUX_DIVIDE_2M 0x2828 1878c2ecf20Sopenharmony_ci#define DP_AUX_TX_PREACHARGE_LENGTH 0x282c 1888c2ecf20Sopenharmony_ci#define DP_AUX_FREQUENCY_1M_MAX 0x2830 1898c2ecf20Sopenharmony_ci#define DP_AUX_FREQUENCY_1M_MIN 0x2834 1908c2ecf20Sopenharmony_ci#define DP_AUX_RX_PRE_MIN 0x2838 1918c2ecf20Sopenharmony_ci#define DP_AUX_RX_PRE_MAX 0x283c 1928c2ecf20Sopenharmony_ci#define DP_AUX_TIMER_PRESET 0x2840 1938c2ecf20Sopenharmony_ci#define DP_AUX_NACK_FORMAT 0x2844 1948c2ecf20Sopenharmony_ci#define DP_AUX_TX_DATA 0x2848 1958c2ecf20Sopenharmony_ci#define DP_AUX_RX_DATA 0x284c 1968c2ecf20Sopenharmony_ci#define DP_AUX_TX_STATUS 0x2850 1978c2ecf20Sopenharmony_ci#define DP_AUX_RX_STATUS 0x2854 1988c2ecf20Sopenharmony_ci#define DP_AUX_RX_CYCLE_COUNTER 0x2858 1998c2ecf20Sopenharmony_ci#define DP_AUX_MAIN_STATES 0x285c 2008c2ecf20Sopenharmony_ci#define DP_AUX_MAIN_TIMER 0x2860 2018c2ecf20Sopenharmony_ci#define DP_AUX_AFE_OUT 0x2864 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci/* crypto addr */ 2048c2ecf20Sopenharmony_ci#define CRYPTO_HDCP_REVISION 0x5800 2058c2ecf20Sopenharmony_ci#define HDCP_CRYPTO_CONFIG 0x5804 2068c2ecf20Sopenharmony_ci#define CRYPTO_INTERRUPT_SOURCE 0x5808 2078c2ecf20Sopenharmony_ci#define CRYPTO_INTERRUPT_MASK 0x580c 2088c2ecf20Sopenharmony_ci#define CRYPTO22_CONFIG 0x5818 2098c2ecf20Sopenharmony_ci#define CRYPTO22_STATUS 0x581c 2108c2ecf20Sopenharmony_ci#define SHA_256_DATA_IN 0x583c 2118c2ecf20Sopenharmony_ci#define SHA_256_DATA_OUT_(x) (0x5850 + ((x) << 2)) 2128c2ecf20Sopenharmony_ci#define AES_32_KEY_(x) (0x5870 + ((x) << 2)) 2138c2ecf20Sopenharmony_ci#define AES_32_DATA_IN 0x5880 2148c2ecf20Sopenharmony_ci#define AES_32_DATA_OUT_(x) (0x5884 + ((x) << 2)) 2158c2ecf20Sopenharmony_ci#define CRYPTO14_CONFIG 0x58a0 2168c2ecf20Sopenharmony_ci#define CRYPTO14_STATUS 0x58a4 2178c2ecf20Sopenharmony_ci#define CRYPTO14_PRNM_OUT 0x58a8 2188c2ecf20Sopenharmony_ci#define CRYPTO14_KM_0 0x58ac 2198c2ecf20Sopenharmony_ci#define CRYPTO14_KM_1 0x58b0 2208c2ecf20Sopenharmony_ci#define CRYPTO14_AN_0 0x58b4 2218c2ecf20Sopenharmony_ci#define CRYPTO14_AN_1 0x58b8 2228c2ecf20Sopenharmony_ci#define CRYPTO14_YOUR_KSV_0 0x58bc 2238c2ecf20Sopenharmony_ci#define CRYPTO14_YOUR_KSV_1 0x58c0 2248c2ecf20Sopenharmony_ci#define CRYPTO14_MI_0 0x58c4 2258c2ecf20Sopenharmony_ci#define CRYPTO14_MI_1 0x58c8 2268c2ecf20Sopenharmony_ci#define CRYPTO14_TI_0 0x58cc 2278c2ecf20Sopenharmony_ci#define CRYPTO14_KI_0 0x58d0 2288c2ecf20Sopenharmony_ci#define CRYPTO14_KI_1 0x58d4 2298c2ecf20Sopenharmony_ci#define CRYPTO14_BLOCKS_NUM 0x58d8 2308c2ecf20Sopenharmony_ci#define CRYPTO14_KEY_MEM_DATA_0 0x58dc 2318c2ecf20Sopenharmony_ci#define CRYPTO14_KEY_MEM_DATA_1 0x58e0 2328c2ecf20Sopenharmony_ci#define CRYPTO14_SHA1_MSG_DATA 0x58e4 2338c2ecf20Sopenharmony_ci#define CRYPTO14_SHA1_V_VALUE_(x) (0x58e8 + ((x) << 2)) 2348c2ecf20Sopenharmony_ci#define TRNG_CTRL 0x58fc 2358c2ecf20Sopenharmony_ci#define TRNG_DATA_RDY 0x5900 2368c2ecf20Sopenharmony_ci#define TRNG_DATA 0x5904 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci/* cipher addr */ 2398c2ecf20Sopenharmony_ci#define HDCP_REVISION 0x60000 2408c2ecf20Sopenharmony_ci#define INTERRUPT_SOURCE 0x60004 2418c2ecf20Sopenharmony_ci#define INTERRUPT_MASK 0x60008 2428c2ecf20Sopenharmony_ci#define HDCP_CIPHER_CONFIG 0x6000c 2438c2ecf20Sopenharmony_ci#define AES_128_KEY_0 0x60010 2448c2ecf20Sopenharmony_ci#define AES_128_KEY_1 0x60014 2458c2ecf20Sopenharmony_ci#define AES_128_KEY_2 0x60018 2468c2ecf20Sopenharmony_ci#define AES_128_KEY_3 0x6001c 2478c2ecf20Sopenharmony_ci#define AES_128_RANDOM_0 0x60020 2488c2ecf20Sopenharmony_ci#define AES_128_RANDOM_1 0x60024 2498c2ecf20Sopenharmony_ci#define CIPHER14_KM_0 0x60028 2508c2ecf20Sopenharmony_ci#define CIPHER14_KM_1 0x6002c 2518c2ecf20Sopenharmony_ci#define CIPHER14_STATUS 0x60030 2528c2ecf20Sopenharmony_ci#define CIPHER14_RI_PJ_STATUS 0x60034 2538c2ecf20Sopenharmony_ci#define CIPHER_MODE 0x60038 2548c2ecf20Sopenharmony_ci#define CIPHER14_AN_0 0x6003c 2558c2ecf20Sopenharmony_ci#define CIPHER14_AN_1 0x60040 2568c2ecf20Sopenharmony_ci#define CIPHER22_AUTH 0x60044 2578c2ecf20Sopenharmony_ci#define CIPHER14_R0_DP_STATUS 0x60048 2588c2ecf20Sopenharmony_ci#define CIPHER14_BOOTSTRAP 0x6004c 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci#define DPTX_FRMR_DATA_CLK_RSTN_EN BIT(11) 2618c2ecf20Sopenharmony_ci#define DPTX_FRMR_DATA_CLK_EN BIT(10) 2628c2ecf20Sopenharmony_ci#define DPTX_PHY_DATA_RSTN_EN BIT(9) 2638c2ecf20Sopenharmony_ci#define DPTX_PHY_DATA_CLK_EN BIT(8) 2648c2ecf20Sopenharmony_ci#define DPTX_PHY_CHAR_RSTN_EN BIT(7) 2658c2ecf20Sopenharmony_ci#define DPTX_PHY_CHAR_CLK_EN BIT(6) 2668c2ecf20Sopenharmony_ci#define SOURCE_AUX_SYS_CLK_RSTN_EN BIT(5) 2678c2ecf20Sopenharmony_ci#define SOURCE_AUX_SYS_CLK_EN BIT(4) 2688c2ecf20Sopenharmony_ci#define DPTX_SYS_CLK_RSTN_EN BIT(3) 2698c2ecf20Sopenharmony_ci#define DPTX_SYS_CLK_EN BIT(2) 2708c2ecf20Sopenharmony_ci#define CFG_DPTX_VIF_CLK_RSTN_EN BIT(1) 2718c2ecf20Sopenharmony_ci#define CFG_DPTX_VIF_CLK_EN BIT(0) 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci#define SOURCE_PHY_RSTN_EN BIT(1) 2748c2ecf20Sopenharmony_ci#define SOURCE_PHY_CLK_EN BIT(0) 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci#define SOURCE_PKT_SYS_RSTN_EN BIT(3) 2778c2ecf20Sopenharmony_ci#define SOURCE_PKT_SYS_CLK_EN BIT(2) 2788c2ecf20Sopenharmony_ci#define SOURCE_PKT_DATA_RSTN_EN BIT(1) 2798c2ecf20Sopenharmony_ci#define SOURCE_PKT_DATA_CLK_EN BIT(0) 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci#define SPDIF_CDR_CLK_RSTN_EN BIT(5) 2828c2ecf20Sopenharmony_ci#define SPDIF_CDR_CLK_EN BIT(4) 2838c2ecf20Sopenharmony_ci#define SOURCE_AIF_SYS_RSTN_EN BIT(3) 2848c2ecf20Sopenharmony_ci#define SOURCE_AIF_SYS_CLK_EN BIT(2) 2858c2ecf20Sopenharmony_ci#define SOURCE_AIF_CLK_RSTN_EN BIT(1) 2868c2ecf20Sopenharmony_ci#define SOURCE_AIF_CLK_EN BIT(0) 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci#define SOURCE_CIPHER_SYSTEM_CLK_RSTN_EN BIT(3) 2898c2ecf20Sopenharmony_ci#define SOURCE_CIPHER_SYS_CLK_EN BIT(2) 2908c2ecf20Sopenharmony_ci#define SOURCE_CIPHER_CHAR_CLK_RSTN_EN BIT(1) 2918c2ecf20Sopenharmony_ci#define SOURCE_CIPHER_CHAR_CLK_EN BIT(0) 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci#define SOURCE_CRYPTO_SYS_CLK_RSTN_EN BIT(1) 2948c2ecf20Sopenharmony_ci#define SOURCE_CRYPTO_SYS_CLK_EN BIT(0) 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci#define APB_IRAM_PATH BIT(2) 2978c2ecf20Sopenharmony_ci#define APB_DRAM_PATH BIT(1) 2988c2ecf20Sopenharmony_ci#define APB_XT_RESET BIT(0) 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci#define MAILBOX_INT_MASK_BIT BIT(1) 3018c2ecf20Sopenharmony_ci#define PIF_INT_MASK_BIT BIT(0) 3028c2ecf20Sopenharmony_ci#define ALL_INT_MASK 3 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci/* mailbox */ 3058c2ecf20Sopenharmony_ci#define MB_OPCODE_ID 0 3068c2ecf20Sopenharmony_ci#define MB_MODULE_ID 1 3078c2ecf20Sopenharmony_ci#define MB_SIZE_MSB_ID 2 3088c2ecf20Sopenharmony_ci#define MB_SIZE_LSB_ID 3 3098c2ecf20Sopenharmony_ci#define MB_DATA_ID 4 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci#define MB_MODULE_ID_DP_TX 0x01 3128c2ecf20Sopenharmony_ci#define MB_MODULE_ID_HDCP_TX 0x07 3138c2ecf20Sopenharmony_ci#define MB_MODULE_ID_HDCP_RX 0x08 3148c2ecf20Sopenharmony_ci#define MB_MODULE_ID_HDCP_GENERAL 0x09 3158c2ecf20Sopenharmony_ci#define MB_MODULE_ID_GENERAL 0x0a 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci/* general opcode */ 3188c2ecf20Sopenharmony_ci#define GENERAL_MAIN_CONTROL 0x01 3198c2ecf20Sopenharmony_ci#define GENERAL_TEST_ECHO 0x02 3208c2ecf20Sopenharmony_ci#define GENERAL_BUS_SETTINGS 0x03 3218c2ecf20Sopenharmony_ci#define GENERAL_TEST_ACCESS 0x04 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci#define DPTX_SET_POWER_MNG 0x00 3248c2ecf20Sopenharmony_ci#define DPTX_SET_HOST_CAPABILITIES 0x01 3258c2ecf20Sopenharmony_ci#define DPTX_GET_EDID 0x02 3268c2ecf20Sopenharmony_ci#define DPTX_READ_DPCD 0x03 3278c2ecf20Sopenharmony_ci#define DPTX_WRITE_DPCD 0x04 3288c2ecf20Sopenharmony_ci#define DPTX_ENABLE_EVENT 0x05 3298c2ecf20Sopenharmony_ci#define DPTX_WRITE_REGISTER 0x06 3308c2ecf20Sopenharmony_ci#define DPTX_READ_REGISTER 0x07 3318c2ecf20Sopenharmony_ci#define DPTX_WRITE_FIELD 0x08 3328c2ecf20Sopenharmony_ci#define DPTX_TRAINING_CONTROL 0x09 3338c2ecf20Sopenharmony_ci#define DPTX_READ_EVENT 0x0a 3348c2ecf20Sopenharmony_ci#define DPTX_READ_LINK_STAT 0x0b 3358c2ecf20Sopenharmony_ci#define DPTX_SET_VIDEO 0x0c 3368c2ecf20Sopenharmony_ci#define DPTX_SET_AUDIO 0x0d 3378c2ecf20Sopenharmony_ci#define DPTX_GET_LAST_AUX_STAUS 0x0e 3388c2ecf20Sopenharmony_ci#define DPTX_SET_LINK_BREAK_POINT 0x0f 3398c2ecf20Sopenharmony_ci#define DPTX_FORCE_LANES 0x10 3408c2ecf20Sopenharmony_ci#define DPTX_HPD_STATE 0x11 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci#define FW_STANDBY 0 3438c2ecf20Sopenharmony_ci#define FW_ACTIVE 1 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci#define DPTX_EVENT_ENABLE_HPD BIT(0) 3468c2ecf20Sopenharmony_ci#define DPTX_EVENT_ENABLE_TRAINING BIT(1) 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci#define LINK_TRAINING_NOT_ACTIVE 0 3498c2ecf20Sopenharmony_ci#define LINK_TRAINING_RUN 1 3508c2ecf20Sopenharmony_ci#define LINK_TRAINING_RESTART 2 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ci#define CONTROL_VIDEO_IDLE 0 3538c2ecf20Sopenharmony_ci#define CONTROL_VIDEO_VALID 1 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci#define TU_CNT_RST_EN BIT(15) 3568c2ecf20Sopenharmony_ci#define VIF_BYPASS_INTERLACE BIT(13) 3578c2ecf20Sopenharmony_ci#define INTERLACE_FMT_DET BIT(12) 3588c2ecf20Sopenharmony_ci#define INTERLACE_DTCT_WIN 0x20 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci#define DP_FRAMER_SP_INTERLACE_EN BIT(2) 3618c2ecf20Sopenharmony_ci#define DP_FRAMER_SP_HSP BIT(1) 3628c2ecf20Sopenharmony_ci#define DP_FRAMER_SP_VSP BIT(0) 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci/* capability */ 3658c2ecf20Sopenharmony_ci#define AUX_HOST_INVERT 3 3668c2ecf20Sopenharmony_ci#define FAST_LT_SUPPORT 1 3678c2ecf20Sopenharmony_ci#define FAST_LT_NOT_SUPPORT 0 3688c2ecf20Sopenharmony_ci#define LANE_MAPPING_NORMAL 0x1b 3698c2ecf20Sopenharmony_ci#define LANE_MAPPING_FLIPPED 0xe4 3708c2ecf20Sopenharmony_ci#define ENHANCED 1 3718c2ecf20Sopenharmony_ci#define SCRAMBLER_EN BIT(4) 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci#define FULL_LT_STARTED BIT(0) 3748c2ecf20Sopenharmony_ci#define FASE_LT_STARTED BIT(1) 3758c2ecf20Sopenharmony_ci#define CLK_RECOVERY_FINISHED BIT(2) 3768c2ecf20Sopenharmony_ci#define EQ_PHASE_FINISHED BIT(3) 3778c2ecf20Sopenharmony_ci#define FASE_LT_START_FINISHED BIT(4) 3788c2ecf20Sopenharmony_ci#define CLK_RECOVERY_FAILED BIT(5) 3798c2ecf20Sopenharmony_ci#define EQ_PHASE_FAILED BIT(6) 3808c2ecf20Sopenharmony_ci#define FASE_LT_FAILED BIT(7) 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci#define DPTX_HPD_EVENT BIT(0) 3838c2ecf20Sopenharmony_ci#define DPTX_TRAINING_EVENT BIT(1) 3848c2ecf20Sopenharmony_ci#define HDCP_TX_STATUS_EVENT BIT(4) 3858c2ecf20Sopenharmony_ci#define HDCP2_TX_IS_KM_STORED_EVENT BIT(5) 3868c2ecf20Sopenharmony_ci#define HDCP2_TX_STORE_KM_EVENT BIT(6) 3878c2ecf20Sopenharmony_ci#define HDCP_TX_IS_RECEIVER_ID_VALID_EVENT BIT(7) 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci#define TU_SIZE 30 3908c2ecf20Sopenharmony_ci#define CDN_DP_MAX_LINK_RATE DP_LINK_BW_5_4 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci/* audio */ 3938c2ecf20Sopenharmony_ci#define AUDIO_PACK_EN BIT(8) 3948c2ecf20Sopenharmony_ci#define SAMPLING_FREQ(x) (((x) & 0xf) << 16) 3958c2ecf20Sopenharmony_ci#define ORIGINAL_SAMP_FREQ(x) (((x) & 0xf) << 24) 3968c2ecf20Sopenharmony_ci#define SYNC_WR_TO_CH_ZERO BIT(1) 3978c2ecf20Sopenharmony_ci#define I2S_DEC_START BIT(1) 3988c2ecf20Sopenharmony_ci#define AUDIO_SW_RST BIT(0) 3998c2ecf20Sopenharmony_ci#define SMPL2PKT_EN BIT(1) 4008c2ecf20Sopenharmony_ci#define MAX_NUM_CH(x) (((x) & 0x1f) - 1) 4018c2ecf20Sopenharmony_ci#define NUM_OF_I2S_PORTS(x) ((((x) / 2 - 1) & 0x3) << 5) 4028c2ecf20Sopenharmony_ci#define AUDIO_TYPE_LPCM (2 << 7) 4038c2ecf20Sopenharmony_ci#define CFG_SUB_PCKT_NUM(x) ((((x) - 1) & 0x7) << 11) 4048c2ecf20Sopenharmony_ci#define AUDIO_CH_NUM(x) ((((x) - 1) & 0x1f) << 2) 4058c2ecf20Sopenharmony_ci#define TRANS_SMPL_WIDTH_16 0 4068c2ecf20Sopenharmony_ci#define TRANS_SMPL_WIDTH_24 BIT(11) 4078c2ecf20Sopenharmony_ci#define TRANS_SMPL_WIDTH_32 (2 << 11) 4088c2ecf20Sopenharmony_ci#define I2S_DEC_PORT_EN(x) (((x) & 0xf) << 17) 4098c2ecf20Sopenharmony_ci#define SPDIF_ENABLE BIT(21) 4108c2ecf20Sopenharmony_ci#define SPDIF_AVG_SEL BIT(20) 4118c2ecf20Sopenharmony_ci#define SPDIF_JITTER_BYPASS BIT(19) 4128c2ecf20Sopenharmony_ci#define SPDIF_FIFO_MID_RANGE(x) (((x) & 0xff) << 11) 4138c2ecf20Sopenharmony_ci#define SPDIF_JITTER_THRSH(x) (((x) & 0xff) << 3) 4148c2ecf20Sopenharmony_ci#define SPDIF_JITTER_AVG_WIN(x) ((x) & 0x7) 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci/* Reference cycles when using lane clock as reference */ 4178c2ecf20Sopenharmony_ci#define LANE_REF_CYC 0x8000 4188c2ecf20Sopenharmony_ci 4198c2ecf20Sopenharmony_cienum voltage_swing_level { 4208c2ecf20Sopenharmony_ci VOLTAGE_LEVEL_0, 4218c2ecf20Sopenharmony_ci VOLTAGE_LEVEL_1, 4228c2ecf20Sopenharmony_ci VOLTAGE_LEVEL_2, 4238c2ecf20Sopenharmony_ci VOLTAGE_LEVEL_3, 4248c2ecf20Sopenharmony_ci}; 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_cienum pre_emphasis_level { 4278c2ecf20Sopenharmony_ci PRE_EMPHASIS_LEVEL_0, 4288c2ecf20Sopenharmony_ci PRE_EMPHASIS_LEVEL_1, 4298c2ecf20Sopenharmony_ci PRE_EMPHASIS_LEVEL_2, 4308c2ecf20Sopenharmony_ci PRE_EMPHASIS_LEVEL_3, 4318c2ecf20Sopenharmony_ci}; 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_cienum pattern_set { 4348c2ecf20Sopenharmony_ci PTS1 = BIT(0), 4358c2ecf20Sopenharmony_ci PTS2 = BIT(1), 4368c2ecf20Sopenharmony_ci PTS3 = BIT(2), 4378c2ecf20Sopenharmony_ci PTS4 = BIT(3), 4388c2ecf20Sopenharmony_ci DP_NONE = BIT(4) 4398c2ecf20Sopenharmony_ci}; 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_cienum vic_color_depth { 4428c2ecf20Sopenharmony_ci BCS_6 = 0x1, 4438c2ecf20Sopenharmony_ci BCS_8 = 0x2, 4448c2ecf20Sopenharmony_ci BCS_10 = 0x4, 4458c2ecf20Sopenharmony_ci BCS_12 = 0x8, 4468c2ecf20Sopenharmony_ci BCS_16 = 0x10, 4478c2ecf20Sopenharmony_ci}; 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_cienum vic_bt_type { 4508c2ecf20Sopenharmony_ci BT_601 = 0x0, 4518c2ecf20Sopenharmony_ci BT_709 = 0x1, 4528c2ecf20Sopenharmony_ci}; 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_civoid cdn_dp_clock_reset(struct cdn_dp_device *dp); 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_civoid cdn_dp_set_fw_clk(struct cdn_dp_device *dp, unsigned long clk); 4578c2ecf20Sopenharmony_ciint cdn_dp_load_firmware(struct cdn_dp_device *dp, const u32 *i_mem, 4588c2ecf20Sopenharmony_ci u32 i_size, const u32 *d_mem, u32 d_size); 4598c2ecf20Sopenharmony_ciint cdn_dp_set_firmware_active(struct cdn_dp_device *dp, bool enable); 4608c2ecf20Sopenharmony_ciint cdn_dp_set_host_cap(struct cdn_dp_device *dp, u8 lanes, bool flip); 4618c2ecf20Sopenharmony_ciint cdn_dp_event_config(struct cdn_dp_device *dp); 4628c2ecf20Sopenharmony_ciu32 cdn_dp_get_event(struct cdn_dp_device *dp); 4638c2ecf20Sopenharmony_ciint cdn_dp_get_hpd_status(struct cdn_dp_device *dp); 4648c2ecf20Sopenharmony_ciint cdn_dp_dpcd_write(struct cdn_dp_device *dp, u32 addr, u8 value); 4658c2ecf20Sopenharmony_ciint cdn_dp_dpcd_read(struct cdn_dp_device *dp, u32 addr, u8 *data, u16 len); 4668c2ecf20Sopenharmony_ciint cdn_dp_get_edid_block(void *dp, u8 *edid, 4678c2ecf20Sopenharmony_ci unsigned int block, size_t length); 4688c2ecf20Sopenharmony_ciint cdn_dp_train_link(struct cdn_dp_device *dp); 4698c2ecf20Sopenharmony_ciint cdn_dp_set_video_status(struct cdn_dp_device *dp, int active); 4708c2ecf20Sopenharmony_ciint cdn_dp_config_video(struct cdn_dp_device *dp); 4718c2ecf20Sopenharmony_ciint cdn_dp_audio_stop(struct cdn_dp_device *dp, struct audio_info *audio); 4728c2ecf20Sopenharmony_ciint cdn_dp_audio_mute(struct cdn_dp_device *dp, bool enable); 4738c2ecf20Sopenharmony_ciint cdn_dp_audio_config(struct cdn_dp_device *dp, struct audio_info *audio); 4748c2ecf20Sopenharmony_ci#endif /* _CDN_DP_REG_H */ 475