162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd 462306a36Sopenharmony_ci * Author: Chris Zhong <zyw@rock-chips.com> 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _CDN_DP_REG_H 862306a36Sopenharmony_ci#define _CDN_DP_REG_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include <linux/bitops.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#define ADDR_IMEM 0x10000 1362306a36Sopenharmony_ci#define ADDR_DMEM 0x20000 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* APB CFG addr */ 1662306a36Sopenharmony_ci#define APB_CTRL 0 1762306a36Sopenharmony_ci#define XT_INT_CTRL 0x04 1862306a36Sopenharmony_ci#define MAILBOX_FULL_ADDR 0x08 1962306a36Sopenharmony_ci#define MAILBOX_EMPTY_ADDR 0x0c 2062306a36Sopenharmony_ci#define MAILBOX0_WR_DATA 0x10 2162306a36Sopenharmony_ci#define MAILBOX0_RD_DATA 0x14 2262306a36Sopenharmony_ci#define KEEP_ALIVE 0x18 2362306a36Sopenharmony_ci#define VER_L 0x1c 2462306a36Sopenharmony_ci#define VER_H 0x20 2562306a36Sopenharmony_ci#define VER_LIB_L_ADDR 0x24 2662306a36Sopenharmony_ci#define VER_LIB_H_ADDR 0x28 2762306a36Sopenharmony_ci#define SW_DEBUG_L 0x2c 2862306a36Sopenharmony_ci#define SW_DEBUG_H 0x30 2962306a36Sopenharmony_ci#define MAILBOX_INT_MASK 0x34 3062306a36Sopenharmony_ci#define MAILBOX_INT_STATUS 0x38 3162306a36Sopenharmony_ci#define SW_CLK_L 0x3c 3262306a36Sopenharmony_ci#define SW_CLK_H 0x40 3362306a36Sopenharmony_ci#define SW_EVENTS0 0x44 3462306a36Sopenharmony_ci#define SW_EVENTS1 0x48 3562306a36Sopenharmony_ci#define SW_EVENTS2 0x4c 3662306a36Sopenharmony_ci#define SW_EVENTS3 0x50 3762306a36Sopenharmony_ci#define XT_OCD_CTRL 0x60 3862306a36Sopenharmony_ci#define APB_INT_MASK 0x6c 3962306a36Sopenharmony_ci#define APB_STATUS_MASK 0x70 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* audio decoder addr */ 4262306a36Sopenharmony_ci#define AUDIO_SRC_CNTL 0x30000 4362306a36Sopenharmony_ci#define AUDIO_SRC_CNFG 0x30004 4462306a36Sopenharmony_ci#define COM_CH_STTS_BITS 0x30008 4562306a36Sopenharmony_ci#define STTS_BIT_CH(x) (0x3000c + ((x) << 2)) 4662306a36Sopenharmony_ci#define SPDIF_CTRL_ADDR 0x3004c 4762306a36Sopenharmony_ci#define SPDIF_CH1_CS_3100_ADDR 0x30050 4862306a36Sopenharmony_ci#define SPDIF_CH1_CS_6332_ADDR 0x30054 4962306a36Sopenharmony_ci#define SPDIF_CH1_CS_9564_ADDR 0x30058 5062306a36Sopenharmony_ci#define SPDIF_CH1_CS_12796_ADDR 0x3005c 5162306a36Sopenharmony_ci#define SPDIF_CH1_CS_159128_ADDR 0x30060 5262306a36Sopenharmony_ci#define SPDIF_CH1_CS_191160_ADDR 0x30064 5362306a36Sopenharmony_ci#define SPDIF_CH2_CS_3100_ADDR 0x30068 5462306a36Sopenharmony_ci#define SPDIF_CH2_CS_6332_ADDR 0x3006c 5562306a36Sopenharmony_ci#define SPDIF_CH2_CS_9564_ADDR 0x30070 5662306a36Sopenharmony_ci#define SPDIF_CH2_CS_12796_ADDR 0x30074 5762306a36Sopenharmony_ci#define SPDIF_CH2_CS_159128_ADDR 0x30078 5862306a36Sopenharmony_ci#define SPDIF_CH2_CS_191160_ADDR 0x3007c 5962306a36Sopenharmony_ci#define SMPL2PKT_CNTL 0x30080 6062306a36Sopenharmony_ci#define SMPL2PKT_CNFG 0x30084 6162306a36Sopenharmony_ci#define FIFO_CNTL 0x30088 6262306a36Sopenharmony_ci#define FIFO_STTS 0x3008c 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci/* source pif addr */ 6562306a36Sopenharmony_ci#define SOURCE_PIF_WR_ADDR 0x30800 6662306a36Sopenharmony_ci#define SOURCE_PIF_WR_REQ 0x30804 6762306a36Sopenharmony_ci#define SOURCE_PIF_RD_ADDR 0x30808 6862306a36Sopenharmony_ci#define SOURCE_PIF_RD_REQ 0x3080c 6962306a36Sopenharmony_ci#define SOURCE_PIF_DATA_WR 0x30810 7062306a36Sopenharmony_ci#define SOURCE_PIF_DATA_RD 0x30814 7162306a36Sopenharmony_ci#define SOURCE_PIF_FIFO1_FLUSH 0x30818 7262306a36Sopenharmony_ci#define SOURCE_PIF_FIFO2_FLUSH 0x3081c 7362306a36Sopenharmony_ci#define SOURCE_PIF_STATUS 0x30820 7462306a36Sopenharmony_ci#define SOURCE_PIF_INTERRUPT_SOURCE 0x30824 7562306a36Sopenharmony_ci#define SOURCE_PIF_INTERRUPT_MASK 0x30828 7662306a36Sopenharmony_ci#define SOURCE_PIF_PKT_ALLOC_REG 0x3082c 7762306a36Sopenharmony_ci#define SOURCE_PIF_PKT_ALLOC_WR_EN 0x30830 7862306a36Sopenharmony_ci#define SOURCE_PIF_SW_RESET 0x30834 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci/* bellow registers need access by mailbox */ 8162306a36Sopenharmony_ci/* source car addr */ 8262306a36Sopenharmony_ci#define SOURCE_HDTX_CAR 0x0900 8362306a36Sopenharmony_ci#define SOURCE_DPTX_CAR 0x0904 8462306a36Sopenharmony_ci#define SOURCE_PHY_CAR 0x0908 8562306a36Sopenharmony_ci#define SOURCE_CEC_CAR 0x090c 8662306a36Sopenharmony_ci#define SOURCE_CBUS_CAR 0x0910 8762306a36Sopenharmony_ci#define SOURCE_PKT_CAR 0x0918 8862306a36Sopenharmony_ci#define SOURCE_AIF_CAR 0x091c 8962306a36Sopenharmony_ci#define SOURCE_CIPHER_CAR 0x0920 9062306a36Sopenharmony_ci#define SOURCE_CRYPTO_CAR 0x0924 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci/* clock meters addr */ 9362306a36Sopenharmony_ci#define CM_CTRL 0x0a00 9462306a36Sopenharmony_ci#define CM_I2S_CTRL 0x0a04 9562306a36Sopenharmony_ci#define CM_SPDIF_CTRL 0x0a08 9662306a36Sopenharmony_ci#define CM_VID_CTRL 0x0a0c 9762306a36Sopenharmony_ci#define CM_LANE_CTRL 0x0a10 9862306a36Sopenharmony_ci#define I2S_NM_STABLE 0x0a14 9962306a36Sopenharmony_ci#define I2S_NCTS_STABLE 0x0a18 10062306a36Sopenharmony_ci#define SPDIF_NM_STABLE 0x0a1c 10162306a36Sopenharmony_ci#define SPDIF_NCTS_STABLE 0x0a20 10262306a36Sopenharmony_ci#define NMVID_MEAS_STABLE 0x0a24 10362306a36Sopenharmony_ci#define I2S_MEAS 0x0a40 10462306a36Sopenharmony_ci#define SPDIF_MEAS 0x0a80 10562306a36Sopenharmony_ci#define NMVID_MEAS 0x0ac0 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci/* source vif addr */ 10862306a36Sopenharmony_ci#define BND_HSYNC2VSYNC 0x0b00 10962306a36Sopenharmony_ci#define HSYNC2VSYNC_F1_L1 0x0b04 11062306a36Sopenharmony_ci#define HSYNC2VSYNC_F2_L1 0x0b08 11162306a36Sopenharmony_ci#define HSYNC2VSYNC_STATUS 0x0b0c 11262306a36Sopenharmony_ci#define HSYNC2VSYNC_POL_CTRL 0x0b10 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci/* dptx phy addr */ 11562306a36Sopenharmony_ci#define DP_TX_PHY_CONFIG_REG 0x2000 11662306a36Sopenharmony_ci#define DP_TX_PHY_SW_RESET 0x2004 11762306a36Sopenharmony_ci#define DP_TX_PHY_SCRAMBLER_SEED 0x2008 11862306a36Sopenharmony_ci#define DP_TX_PHY_TRAINING_01_04 0x200c 11962306a36Sopenharmony_ci#define DP_TX_PHY_TRAINING_05_08 0x2010 12062306a36Sopenharmony_ci#define DP_TX_PHY_TRAINING_09_10 0x2014 12162306a36Sopenharmony_ci#define TEST_COR 0x23fc 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci/* dptx hpd addr */ 12462306a36Sopenharmony_ci#define HPD_IRQ_DET_MIN_TIMER 0x2100 12562306a36Sopenharmony_ci#define HPD_IRQ_DET_MAX_TIMER 0x2104 12662306a36Sopenharmony_ci#define HPD_UNPLGED_DET_MIN_TIMER 0x2108 12762306a36Sopenharmony_ci#define HPD_STABLE_TIMER 0x210c 12862306a36Sopenharmony_ci#define HPD_FILTER_TIMER 0x2110 12962306a36Sopenharmony_ci#define HPD_EVENT_MASK 0x211c 13062306a36Sopenharmony_ci#define HPD_EVENT_DET 0x2120 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci/* dpyx framer addr */ 13362306a36Sopenharmony_ci#define DP_FRAMER_GLOBAL_CONFIG 0x2200 13462306a36Sopenharmony_ci#define DP_SW_RESET 0x2204 13562306a36Sopenharmony_ci#define DP_FRAMER_TU 0x2208 13662306a36Sopenharmony_ci#define DP_FRAMER_PXL_REPR 0x220c 13762306a36Sopenharmony_ci#define DP_FRAMER_SP 0x2210 13862306a36Sopenharmony_ci#define AUDIO_PACK_CONTROL 0x2214 13962306a36Sopenharmony_ci#define DP_VC_TABLE(x) (0x2218 + ((x) << 2)) 14062306a36Sopenharmony_ci#define DP_VB_ID 0x2258 14162306a36Sopenharmony_ci#define DP_MTPH_LVP_CONTROL 0x225c 14262306a36Sopenharmony_ci#define DP_MTPH_SYMBOL_VALUES 0x2260 14362306a36Sopenharmony_ci#define DP_MTPH_ECF_CONTROL 0x2264 14462306a36Sopenharmony_ci#define DP_MTPH_ACT_CONTROL 0x2268 14562306a36Sopenharmony_ci#define DP_MTPH_STATUS 0x226c 14662306a36Sopenharmony_ci#define DP_INTERRUPT_SOURCE 0x2270 14762306a36Sopenharmony_ci#define DP_INTERRUPT_MASK 0x2274 14862306a36Sopenharmony_ci#define DP_FRONT_BACK_PORCH 0x2278 14962306a36Sopenharmony_ci#define DP_BYTE_COUNT 0x227c 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci/* dptx stream addr */ 15262306a36Sopenharmony_ci#define MSA_HORIZONTAL_0 0x2280 15362306a36Sopenharmony_ci#define MSA_HORIZONTAL_1 0x2284 15462306a36Sopenharmony_ci#define MSA_VERTICAL_0 0x2288 15562306a36Sopenharmony_ci#define MSA_VERTICAL_1 0x228c 15662306a36Sopenharmony_ci#define MSA_MISC 0x2290 15762306a36Sopenharmony_ci#define STREAM_CONFIG 0x2294 15862306a36Sopenharmony_ci#define AUDIO_PACK_STATUS 0x2298 15962306a36Sopenharmony_ci#define VIF_STATUS 0x229c 16062306a36Sopenharmony_ci#define PCK_STUFF_STATUS_0 0x22a0 16162306a36Sopenharmony_ci#define PCK_STUFF_STATUS_1 0x22a4 16262306a36Sopenharmony_ci#define INFO_PACK_STATUS 0x22a8 16362306a36Sopenharmony_ci#define RATE_GOVERNOR_STATUS 0x22ac 16462306a36Sopenharmony_ci#define DP_HORIZONTAL 0x22b0 16562306a36Sopenharmony_ci#define DP_VERTICAL_0 0x22b4 16662306a36Sopenharmony_ci#define DP_VERTICAL_1 0x22b8 16762306a36Sopenharmony_ci#define DP_BLOCK_SDP 0x22bc 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci/* dptx glbl addr */ 17062306a36Sopenharmony_ci#define DPTX_LANE_EN 0x2300 17162306a36Sopenharmony_ci#define DPTX_ENHNCD 0x2304 17262306a36Sopenharmony_ci#define DPTX_INT_MASK 0x2308 17362306a36Sopenharmony_ci#define DPTX_INT_STATUS 0x230c 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci/* dp aux addr */ 17662306a36Sopenharmony_ci#define DP_AUX_HOST_CONTROL 0x2800 17762306a36Sopenharmony_ci#define DP_AUX_INTERRUPT_SOURCE 0x2804 17862306a36Sopenharmony_ci#define DP_AUX_INTERRUPT_MASK 0x2808 17962306a36Sopenharmony_ci#define DP_AUX_SWAP_INVERSION_CONTROL 0x280c 18062306a36Sopenharmony_ci#define DP_AUX_SEND_NACK_TRANSACTION 0x2810 18162306a36Sopenharmony_ci#define DP_AUX_CLEAR_RX 0x2814 18262306a36Sopenharmony_ci#define DP_AUX_CLEAR_TX 0x2818 18362306a36Sopenharmony_ci#define DP_AUX_TIMER_STOP 0x281c 18462306a36Sopenharmony_ci#define DP_AUX_TIMER_CLEAR 0x2820 18562306a36Sopenharmony_ci#define DP_AUX_RESET_SW 0x2824 18662306a36Sopenharmony_ci#define DP_AUX_DIVIDE_2M 0x2828 18762306a36Sopenharmony_ci#define DP_AUX_TX_PREACHARGE_LENGTH 0x282c 18862306a36Sopenharmony_ci#define DP_AUX_FREQUENCY_1M_MAX 0x2830 18962306a36Sopenharmony_ci#define DP_AUX_FREQUENCY_1M_MIN 0x2834 19062306a36Sopenharmony_ci#define DP_AUX_RX_PRE_MIN 0x2838 19162306a36Sopenharmony_ci#define DP_AUX_RX_PRE_MAX 0x283c 19262306a36Sopenharmony_ci#define DP_AUX_TIMER_PRESET 0x2840 19362306a36Sopenharmony_ci#define DP_AUX_NACK_FORMAT 0x2844 19462306a36Sopenharmony_ci#define DP_AUX_TX_DATA 0x2848 19562306a36Sopenharmony_ci#define DP_AUX_RX_DATA 0x284c 19662306a36Sopenharmony_ci#define DP_AUX_TX_STATUS 0x2850 19762306a36Sopenharmony_ci#define DP_AUX_RX_STATUS 0x2854 19862306a36Sopenharmony_ci#define DP_AUX_RX_CYCLE_COUNTER 0x2858 19962306a36Sopenharmony_ci#define DP_AUX_MAIN_STATES 0x285c 20062306a36Sopenharmony_ci#define DP_AUX_MAIN_TIMER 0x2860 20162306a36Sopenharmony_ci#define DP_AUX_AFE_OUT 0x2864 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci/* crypto addr */ 20462306a36Sopenharmony_ci#define CRYPTO_HDCP_REVISION 0x5800 20562306a36Sopenharmony_ci#define HDCP_CRYPTO_CONFIG 0x5804 20662306a36Sopenharmony_ci#define CRYPTO_INTERRUPT_SOURCE 0x5808 20762306a36Sopenharmony_ci#define CRYPTO_INTERRUPT_MASK 0x580c 20862306a36Sopenharmony_ci#define CRYPTO22_CONFIG 0x5818 20962306a36Sopenharmony_ci#define CRYPTO22_STATUS 0x581c 21062306a36Sopenharmony_ci#define SHA_256_DATA_IN 0x583c 21162306a36Sopenharmony_ci#define SHA_256_DATA_OUT_(x) (0x5850 + ((x) << 2)) 21262306a36Sopenharmony_ci#define AES_32_KEY_(x) (0x5870 + ((x) << 2)) 21362306a36Sopenharmony_ci#define AES_32_DATA_IN 0x5880 21462306a36Sopenharmony_ci#define AES_32_DATA_OUT_(x) (0x5884 + ((x) << 2)) 21562306a36Sopenharmony_ci#define CRYPTO14_CONFIG 0x58a0 21662306a36Sopenharmony_ci#define CRYPTO14_STATUS 0x58a4 21762306a36Sopenharmony_ci#define CRYPTO14_PRNM_OUT 0x58a8 21862306a36Sopenharmony_ci#define CRYPTO14_KM_0 0x58ac 21962306a36Sopenharmony_ci#define CRYPTO14_KM_1 0x58b0 22062306a36Sopenharmony_ci#define CRYPTO14_AN_0 0x58b4 22162306a36Sopenharmony_ci#define CRYPTO14_AN_1 0x58b8 22262306a36Sopenharmony_ci#define CRYPTO14_YOUR_KSV_0 0x58bc 22362306a36Sopenharmony_ci#define CRYPTO14_YOUR_KSV_1 0x58c0 22462306a36Sopenharmony_ci#define CRYPTO14_MI_0 0x58c4 22562306a36Sopenharmony_ci#define CRYPTO14_MI_1 0x58c8 22662306a36Sopenharmony_ci#define CRYPTO14_TI_0 0x58cc 22762306a36Sopenharmony_ci#define CRYPTO14_KI_0 0x58d0 22862306a36Sopenharmony_ci#define CRYPTO14_KI_1 0x58d4 22962306a36Sopenharmony_ci#define CRYPTO14_BLOCKS_NUM 0x58d8 23062306a36Sopenharmony_ci#define CRYPTO14_KEY_MEM_DATA_0 0x58dc 23162306a36Sopenharmony_ci#define CRYPTO14_KEY_MEM_DATA_1 0x58e0 23262306a36Sopenharmony_ci#define CRYPTO14_SHA1_MSG_DATA 0x58e4 23362306a36Sopenharmony_ci#define CRYPTO14_SHA1_V_VALUE_(x) (0x58e8 + ((x) << 2)) 23462306a36Sopenharmony_ci#define TRNG_CTRL 0x58fc 23562306a36Sopenharmony_ci#define TRNG_DATA_RDY 0x5900 23662306a36Sopenharmony_ci#define TRNG_DATA 0x5904 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci/* cipher addr */ 23962306a36Sopenharmony_ci#define HDCP_REVISION 0x60000 24062306a36Sopenharmony_ci#define INTERRUPT_SOURCE 0x60004 24162306a36Sopenharmony_ci#define INTERRUPT_MASK 0x60008 24262306a36Sopenharmony_ci#define HDCP_CIPHER_CONFIG 0x6000c 24362306a36Sopenharmony_ci#define AES_128_KEY_0 0x60010 24462306a36Sopenharmony_ci#define AES_128_KEY_1 0x60014 24562306a36Sopenharmony_ci#define AES_128_KEY_2 0x60018 24662306a36Sopenharmony_ci#define AES_128_KEY_3 0x6001c 24762306a36Sopenharmony_ci#define AES_128_RANDOM_0 0x60020 24862306a36Sopenharmony_ci#define AES_128_RANDOM_1 0x60024 24962306a36Sopenharmony_ci#define CIPHER14_KM_0 0x60028 25062306a36Sopenharmony_ci#define CIPHER14_KM_1 0x6002c 25162306a36Sopenharmony_ci#define CIPHER14_STATUS 0x60030 25262306a36Sopenharmony_ci#define CIPHER14_RI_PJ_STATUS 0x60034 25362306a36Sopenharmony_ci#define CIPHER_MODE 0x60038 25462306a36Sopenharmony_ci#define CIPHER14_AN_0 0x6003c 25562306a36Sopenharmony_ci#define CIPHER14_AN_1 0x60040 25662306a36Sopenharmony_ci#define CIPHER22_AUTH 0x60044 25762306a36Sopenharmony_ci#define CIPHER14_R0_DP_STATUS 0x60048 25862306a36Sopenharmony_ci#define CIPHER14_BOOTSTRAP 0x6004c 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ci#define DPTX_FRMR_DATA_CLK_RSTN_EN BIT(11) 26162306a36Sopenharmony_ci#define DPTX_FRMR_DATA_CLK_EN BIT(10) 26262306a36Sopenharmony_ci#define DPTX_PHY_DATA_RSTN_EN BIT(9) 26362306a36Sopenharmony_ci#define DPTX_PHY_DATA_CLK_EN BIT(8) 26462306a36Sopenharmony_ci#define DPTX_PHY_CHAR_RSTN_EN BIT(7) 26562306a36Sopenharmony_ci#define DPTX_PHY_CHAR_CLK_EN BIT(6) 26662306a36Sopenharmony_ci#define SOURCE_AUX_SYS_CLK_RSTN_EN BIT(5) 26762306a36Sopenharmony_ci#define SOURCE_AUX_SYS_CLK_EN BIT(4) 26862306a36Sopenharmony_ci#define DPTX_SYS_CLK_RSTN_EN BIT(3) 26962306a36Sopenharmony_ci#define DPTX_SYS_CLK_EN BIT(2) 27062306a36Sopenharmony_ci#define CFG_DPTX_VIF_CLK_RSTN_EN BIT(1) 27162306a36Sopenharmony_ci#define CFG_DPTX_VIF_CLK_EN BIT(0) 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci#define SOURCE_PHY_RSTN_EN BIT(1) 27462306a36Sopenharmony_ci#define SOURCE_PHY_CLK_EN BIT(0) 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_ci#define SOURCE_PKT_SYS_RSTN_EN BIT(3) 27762306a36Sopenharmony_ci#define SOURCE_PKT_SYS_CLK_EN BIT(2) 27862306a36Sopenharmony_ci#define SOURCE_PKT_DATA_RSTN_EN BIT(1) 27962306a36Sopenharmony_ci#define SOURCE_PKT_DATA_CLK_EN BIT(0) 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci#define SPDIF_CDR_CLK_RSTN_EN BIT(5) 28262306a36Sopenharmony_ci#define SPDIF_CDR_CLK_EN BIT(4) 28362306a36Sopenharmony_ci#define SOURCE_AIF_SYS_RSTN_EN BIT(3) 28462306a36Sopenharmony_ci#define SOURCE_AIF_SYS_CLK_EN BIT(2) 28562306a36Sopenharmony_ci#define SOURCE_AIF_CLK_RSTN_EN BIT(1) 28662306a36Sopenharmony_ci#define SOURCE_AIF_CLK_EN BIT(0) 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci#define SOURCE_CIPHER_SYSTEM_CLK_RSTN_EN BIT(3) 28962306a36Sopenharmony_ci#define SOURCE_CIPHER_SYS_CLK_EN BIT(2) 29062306a36Sopenharmony_ci#define SOURCE_CIPHER_CHAR_CLK_RSTN_EN BIT(1) 29162306a36Sopenharmony_ci#define SOURCE_CIPHER_CHAR_CLK_EN BIT(0) 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci#define SOURCE_CRYPTO_SYS_CLK_RSTN_EN BIT(1) 29462306a36Sopenharmony_ci#define SOURCE_CRYPTO_SYS_CLK_EN BIT(0) 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ci#define APB_IRAM_PATH BIT(2) 29762306a36Sopenharmony_ci#define APB_DRAM_PATH BIT(1) 29862306a36Sopenharmony_ci#define APB_XT_RESET BIT(0) 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_ci#define MAILBOX_INT_MASK_BIT BIT(1) 30162306a36Sopenharmony_ci#define PIF_INT_MASK_BIT BIT(0) 30262306a36Sopenharmony_ci#define ALL_INT_MASK 3 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_ci/* mailbox */ 30562306a36Sopenharmony_ci#define MB_OPCODE_ID 0 30662306a36Sopenharmony_ci#define MB_MODULE_ID 1 30762306a36Sopenharmony_ci#define MB_SIZE_MSB_ID 2 30862306a36Sopenharmony_ci#define MB_SIZE_LSB_ID 3 30962306a36Sopenharmony_ci#define MB_DATA_ID 4 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci#define MB_MODULE_ID_DP_TX 0x01 31262306a36Sopenharmony_ci#define MB_MODULE_ID_HDCP_TX 0x07 31362306a36Sopenharmony_ci#define MB_MODULE_ID_HDCP_RX 0x08 31462306a36Sopenharmony_ci#define MB_MODULE_ID_HDCP_GENERAL 0x09 31562306a36Sopenharmony_ci#define MB_MODULE_ID_GENERAL 0x0a 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci/* general opcode */ 31862306a36Sopenharmony_ci#define GENERAL_MAIN_CONTROL 0x01 31962306a36Sopenharmony_ci#define GENERAL_TEST_ECHO 0x02 32062306a36Sopenharmony_ci#define GENERAL_BUS_SETTINGS 0x03 32162306a36Sopenharmony_ci#define GENERAL_TEST_ACCESS 0x04 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_ci#define DPTX_SET_POWER_MNG 0x00 32462306a36Sopenharmony_ci#define DPTX_SET_HOST_CAPABILITIES 0x01 32562306a36Sopenharmony_ci#define DPTX_GET_EDID 0x02 32662306a36Sopenharmony_ci#define DPTX_READ_DPCD 0x03 32762306a36Sopenharmony_ci#define DPTX_WRITE_DPCD 0x04 32862306a36Sopenharmony_ci#define DPTX_ENABLE_EVENT 0x05 32962306a36Sopenharmony_ci#define DPTX_WRITE_REGISTER 0x06 33062306a36Sopenharmony_ci#define DPTX_READ_REGISTER 0x07 33162306a36Sopenharmony_ci#define DPTX_WRITE_FIELD 0x08 33262306a36Sopenharmony_ci#define DPTX_TRAINING_CONTROL 0x09 33362306a36Sopenharmony_ci#define DPTX_READ_EVENT 0x0a 33462306a36Sopenharmony_ci#define DPTX_READ_LINK_STAT 0x0b 33562306a36Sopenharmony_ci#define DPTX_SET_VIDEO 0x0c 33662306a36Sopenharmony_ci#define DPTX_SET_AUDIO 0x0d 33762306a36Sopenharmony_ci#define DPTX_GET_LAST_AUX_STAUS 0x0e 33862306a36Sopenharmony_ci#define DPTX_SET_LINK_BREAK_POINT 0x0f 33962306a36Sopenharmony_ci#define DPTX_FORCE_LANES 0x10 34062306a36Sopenharmony_ci#define DPTX_HPD_STATE 0x11 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci#define FW_STANDBY 0 34362306a36Sopenharmony_ci#define FW_ACTIVE 1 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ci#define DPTX_EVENT_ENABLE_HPD BIT(0) 34662306a36Sopenharmony_ci#define DPTX_EVENT_ENABLE_TRAINING BIT(1) 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_ci#define LINK_TRAINING_NOT_ACTIVE 0 34962306a36Sopenharmony_ci#define LINK_TRAINING_RUN 1 35062306a36Sopenharmony_ci#define LINK_TRAINING_RESTART 2 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci#define CONTROL_VIDEO_IDLE 0 35362306a36Sopenharmony_ci#define CONTROL_VIDEO_VALID 1 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci#define TU_CNT_RST_EN BIT(15) 35662306a36Sopenharmony_ci#define VIF_BYPASS_INTERLACE BIT(13) 35762306a36Sopenharmony_ci#define INTERLACE_FMT_DET BIT(12) 35862306a36Sopenharmony_ci#define INTERLACE_DTCT_WIN 0x20 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_ci#define DP_FRAMER_SP_INTERLACE_EN BIT(2) 36162306a36Sopenharmony_ci#define DP_FRAMER_SP_HSP BIT(1) 36262306a36Sopenharmony_ci#define DP_FRAMER_SP_VSP BIT(0) 36362306a36Sopenharmony_ci 36462306a36Sopenharmony_ci/* capability */ 36562306a36Sopenharmony_ci#define AUX_HOST_INVERT 3 36662306a36Sopenharmony_ci#define FAST_LT_SUPPORT 1 36762306a36Sopenharmony_ci#define FAST_LT_NOT_SUPPORT 0 36862306a36Sopenharmony_ci#define LANE_MAPPING_NORMAL 0x1b 36962306a36Sopenharmony_ci#define LANE_MAPPING_FLIPPED 0xe4 37062306a36Sopenharmony_ci#define ENHANCED 1 37162306a36Sopenharmony_ci#define SCRAMBLER_EN BIT(4) 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci#define FULL_LT_STARTED BIT(0) 37462306a36Sopenharmony_ci#define FASE_LT_STARTED BIT(1) 37562306a36Sopenharmony_ci#define CLK_RECOVERY_FINISHED BIT(2) 37662306a36Sopenharmony_ci#define EQ_PHASE_FINISHED BIT(3) 37762306a36Sopenharmony_ci#define FASE_LT_START_FINISHED BIT(4) 37862306a36Sopenharmony_ci#define CLK_RECOVERY_FAILED BIT(5) 37962306a36Sopenharmony_ci#define EQ_PHASE_FAILED BIT(6) 38062306a36Sopenharmony_ci#define FASE_LT_FAILED BIT(7) 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci#define DPTX_HPD_EVENT BIT(0) 38362306a36Sopenharmony_ci#define DPTX_TRAINING_EVENT BIT(1) 38462306a36Sopenharmony_ci#define HDCP_TX_STATUS_EVENT BIT(4) 38562306a36Sopenharmony_ci#define HDCP2_TX_IS_KM_STORED_EVENT BIT(5) 38662306a36Sopenharmony_ci#define HDCP2_TX_STORE_KM_EVENT BIT(6) 38762306a36Sopenharmony_ci#define HDCP_TX_IS_RECEIVER_ID_VALID_EVENT BIT(7) 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_ci#define TU_SIZE 30 39062306a36Sopenharmony_ci#define CDN_DP_MAX_LINK_RATE DP_LINK_BW_5_4 39162306a36Sopenharmony_ci 39262306a36Sopenharmony_ci/* audio */ 39362306a36Sopenharmony_ci#define AUDIO_PACK_EN BIT(8) 39462306a36Sopenharmony_ci#define SAMPLING_FREQ(x) (((x) & 0xf) << 16) 39562306a36Sopenharmony_ci#define ORIGINAL_SAMP_FREQ(x) (((x) & 0xf) << 24) 39662306a36Sopenharmony_ci#define SYNC_WR_TO_CH_ZERO BIT(1) 39762306a36Sopenharmony_ci#define I2S_DEC_START BIT(1) 39862306a36Sopenharmony_ci#define AUDIO_SW_RST BIT(0) 39962306a36Sopenharmony_ci#define SMPL2PKT_EN BIT(1) 40062306a36Sopenharmony_ci#define MAX_NUM_CH(x) (((x) & 0x1f) - 1) 40162306a36Sopenharmony_ci#define NUM_OF_I2S_PORTS(x) ((((x) / 2 - 1) & 0x3) << 5) 40262306a36Sopenharmony_ci#define AUDIO_TYPE_LPCM (2 << 7) 40362306a36Sopenharmony_ci#define CFG_SUB_PCKT_NUM(x) ((((x) - 1) & 0x7) << 11) 40462306a36Sopenharmony_ci#define AUDIO_CH_NUM(x) ((((x) - 1) & 0x1f) << 2) 40562306a36Sopenharmony_ci#define TRANS_SMPL_WIDTH_16 0 40662306a36Sopenharmony_ci#define TRANS_SMPL_WIDTH_24 BIT(11) 40762306a36Sopenharmony_ci#define TRANS_SMPL_WIDTH_32 (2 << 11) 40862306a36Sopenharmony_ci#define I2S_DEC_PORT_EN(x) (((x) & 0xf) << 17) 40962306a36Sopenharmony_ci#define SPDIF_ENABLE BIT(21) 41062306a36Sopenharmony_ci#define SPDIF_AVG_SEL BIT(20) 41162306a36Sopenharmony_ci#define SPDIF_JITTER_BYPASS BIT(19) 41262306a36Sopenharmony_ci#define SPDIF_FIFO_MID_RANGE(x) (((x) & 0xff) << 11) 41362306a36Sopenharmony_ci#define SPDIF_JITTER_THRSH(x) (((x) & 0xff) << 3) 41462306a36Sopenharmony_ci#define SPDIF_JITTER_AVG_WIN(x) ((x) & 0x7) 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci/* Reference cycles when using lane clock as reference */ 41762306a36Sopenharmony_ci#define LANE_REF_CYC 0x8000 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_cienum voltage_swing_level { 42062306a36Sopenharmony_ci VOLTAGE_LEVEL_0, 42162306a36Sopenharmony_ci VOLTAGE_LEVEL_1, 42262306a36Sopenharmony_ci VOLTAGE_LEVEL_2, 42362306a36Sopenharmony_ci VOLTAGE_LEVEL_3, 42462306a36Sopenharmony_ci}; 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_cienum pre_emphasis_level { 42762306a36Sopenharmony_ci PRE_EMPHASIS_LEVEL_0, 42862306a36Sopenharmony_ci PRE_EMPHASIS_LEVEL_1, 42962306a36Sopenharmony_ci PRE_EMPHASIS_LEVEL_2, 43062306a36Sopenharmony_ci PRE_EMPHASIS_LEVEL_3, 43162306a36Sopenharmony_ci}; 43262306a36Sopenharmony_ci 43362306a36Sopenharmony_cienum pattern_set { 43462306a36Sopenharmony_ci PTS1 = BIT(0), 43562306a36Sopenharmony_ci PTS2 = BIT(1), 43662306a36Sopenharmony_ci PTS3 = BIT(2), 43762306a36Sopenharmony_ci PTS4 = BIT(3), 43862306a36Sopenharmony_ci DP_NONE = BIT(4) 43962306a36Sopenharmony_ci}; 44062306a36Sopenharmony_ci 44162306a36Sopenharmony_cienum vic_color_depth { 44262306a36Sopenharmony_ci BCS_6 = 0x1, 44362306a36Sopenharmony_ci BCS_8 = 0x2, 44462306a36Sopenharmony_ci BCS_10 = 0x4, 44562306a36Sopenharmony_ci BCS_12 = 0x8, 44662306a36Sopenharmony_ci BCS_16 = 0x10, 44762306a36Sopenharmony_ci}; 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_cienum vic_bt_type { 45062306a36Sopenharmony_ci BT_601 = 0x0, 45162306a36Sopenharmony_ci BT_709 = 0x1, 45262306a36Sopenharmony_ci}; 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_civoid cdn_dp_clock_reset(struct cdn_dp_device *dp); 45562306a36Sopenharmony_ci 45662306a36Sopenharmony_civoid cdn_dp_set_fw_clk(struct cdn_dp_device *dp, unsigned long clk); 45762306a36Sopenharmony_ciint cdn_dp_load_firmware(struct cdn_dp_device *dp, const u32 *i_mem, 45862306a36Sopenharmony_ci u32 i_size, const u32 *d_mem, u32 d_size); 45962306a36Sopenharmony_ciint cdn_dp_set_firmware_active(struct cdn_dp_device *dp, bool enable); 46062306a36Sopenharmony_ciint cdn_dp_set_host_cap(struct cdn_dp_device *dp, u8 lanes, bool flip); 46162306a36Sopenharmony_ciint cdn_dp_event_config(struct cdn_dp_device *dp); 46262306a36Sopenharmony_ciu32 cdn_dp_get_event(struct cdn_dp_device *dp); 46362306a36Sopenharmony_ciint cdn_dp_get_hpd_status(struct cdn_dp_device *dp); 46462306a36Sopenharmony_ciint cdn_dp_dpcd_write(struct cdn_dp_device *dp, u32 addr, u8 value); 46562306a36Sopenharmony_ciint cdn_dp_dpcd_read(struct cdn_dp_device *dp, u32 addr, u8 *data, u16 len); 46662306a36Sopenharmony_ciint cdn_dp_get_edid_block(void *dp, u8 *edid, 46762306a36Sopenharmony_ci unsigned int block, size_t length); 46862306a36Sopenharmony_ciint cdn_dp_train_link(struct cdn_dp_device *dp); 46962306a36Sopenharmony_ciint cdn_dp_set_video_status(struct cdn_dp_device *dp, int active); 47062306a36Sopenharmony_ciint cdn_dp_config_video(struct cdn_dp_device *dp); 47162306a36Sopenharmony_ciint cdn_dp_audio_stop(struct cdn_dp_device *dp, struct audio_info *audio); 47262306a36Sopenharmony_ciint cdn_dp_audio_mute(struct cdn_dp_device *dp, bool enable); 47362306a36Sopenharmony_ciint cdn_dp_audio_config(struct cdn_dp_device *dp, struct audio_info *audio); 47462306a36Sopenharmony_ci#endif /* _CDN_DP_REG_H */ 475