162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * linux/drivers/media/platform/chips-media/coda_regs.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2012 Vista Silicon SL
662306a36Sopenharmony_ci *    Javier Martin <javier.martin@vista-silicon.com>
762306a36Sopenharmony_ci *    Xavier Duret
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef _REGS_CODA_H_
1162306a36Sopenharmony_ci#define _REGS_CODA_H_
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/* HW registers */
1462306a36Sopenharmony_ci#define CODA_REG_BIT_CODE_RUN			0x000
1562306a36Sopenharmony_ci#define		CODA_REG_RUN_ENABLE		(1 << 0)
1662306a36Sopenharmony_ci#define CODA_REG_BIT_CODE_DOWN			0x004
1762306a36Sopenharmony_ci#define		CODA_DOWN_ADDRESS_SET(x)	(((x) & 0xffff) << 16)
1862306a36Sopenharmony_ci#define		CODA_DOWN_DATA_SET(x)		((x) & 0xffff)
1962306a36Sopenharmony_ci#define CODA_REG_BIT_HOST_IN_REQ		0x008
2062306a36Sopenharmony_ci#define CODA_REG_BIT_INT_CLEAR			0x00c
2162306a36Sopenharmony_ci#define		CODA_REG_BIT_INT_CLEAR_SET	0x1
2262306a36Sopenharmony_ci#define CODA_REG_BIT_INT_STATUS		0x010
2362306a36Sopenharmony_ci#define CODA_REG_BIT_CODE_RESET		0x014
2462306a36Sopenharmony_ci#define		CODA_REG_RESET_ENABLE		(1 << 0)
2562306a36Sopenharmony_ci#define CODA_REG_BIT_CUR_PC			0x018
2662306a36Sopenharmony_ci#define CODA9_REG_BIT_SW_RESET			0x024
2762306a36Sopenharmony_ci#define		CODA9_SW_RESET_BPU_CORE   0x008
2862306a36Sopenharmony_ci#define		CODA9_SW_RESET_BPU_BUS    0x010
2962306a36Sopenharmony_ci#define		CODA9_SW_RESET_VCE_CORE   0x020
3062306a36Sopenharmony_ci#define		CODA9_SW_RESET_VCE_BUS    0x040
3162306a36Sopenharmony_ci#define		CODA9_SW_RESET_GDI_CORE   0x080
3262306a36Sopenharmony_ci#define		CODA9_SW_RESET_GDI_BUS    0x100
3362306a36Sopenharmony_ci#define CODA9_REG_BIT_SW_RESET_STATUS		0x034
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/* Static SW registers */
3662306a36Sopenharmony_ci#define CODA_REG_BIT_CODE_BUF_ADDR		0x100
3762306a36Sopenharmony_ci#define CODA_REG_BIT_WORK_BUF_ADDR		0x104
3862306a36Sopenharmony_ci#define CODA_REG_BIT_PARA_BUF_ADDR		0x108
3962306a36Sopenharmony_ci#define CODA_REG_BIT_STREAM_CTRL		0x10c
4062306a36Sopenharmony_ci#define		CODA7_STREAM_BUF_PIC_RESET	(1 << 4)
4162306a36Sopenharmony_ci#define		CODADX6_STREAM_BUF_PIC_RESET	(1 << 3)
4262306a36Sopenharmony_ci#define		CODA7_STREAM_BUF_PIC_FLUSH	(1 << 3)
4362306a36Sopenharmony_ci#define		CODADX6_STREAM_BUF_PIC_FLUSH	(1 << 2)
4462306a36Sopenharmony_ci#define		CODA7_STREAM_BUF_DYNALLOC_EN	(1 << 5)
4562306a36Sopenharmony_ci#define		CODADX6_STREAM_BUF_DYNALLOC_EN	(1 << 4)
4662306a36Sopenharmony_ci#define		CODADX6_STREAM_CHKDIS_OFFSET	(1 << 1)
4762306a36Sopenharmony_ci#define		CODA7_STREAM_SEL_64BITS_ENDIAN	(1 << 1)
4862306a36Sopenharmony_ci#define		CODA_STREAM_ENDIAN_SELECT	(1 << 0)
4962306a36Sopenharmony_ci#define CODA_REG_BIT_FRAME_MEM_CTRL		0x110
5062306a36Sopenharmony_ci#define		CODA9_FRAME_ENABLE_BWB		(1 << 12)
5162306a36Sopenharmony_ci#define		CODA9_FRAME_TILED2LINEAR	(1 << 11)
5262306a36Sopenharmony_ci#define		CODA_FRAME_CHROMA_INTERLEAVE	(1 << 2)
5362306a36Sopenharmony_ci#define		CODA_IMAGE_ENDIAN_SELECT	(1 << 0)
5462306a36Sopenharmony_ci#define CODA_REG_BIT_BIT_STREAM_PARAM		0x114
5562306a36Sopenharmony_ci#define		CODA_BIT_STREAM_END_FLAG	(1 << 2)
5662306a36Sopenharmony_ci#define		CODA_BIT_DEC_SEQ_INIT_ESCAPE	(1 << 0)
5762306a36Sopenharmony_ci#define CODA_REG_BIT_TEMP_BUF_ADDR		0x118
5862306a36Sopenharmony_ci#define CODA_REG_BIT_RD_PTR(x)			(0x120 + 8 * (x))
5962306a36Sopenharmony_ci#define CODA_REG_BIT_WR_PTR(x)			(0x124 + 8 * (x))
6062306a36Sopenharmony_ci#define CODA_REG_BIT_FRM_DIS_FLG(x)		(0x150 + 4 * (x))
6162306a36Sopenharmony_ci#define CODADX6_REG_BIT_SEARCH_RAM_BASE_ADDR	0x140
6262306a36Sopenharmony_ci#define CODA7_REG_BIT_AXI_SRAM_USE		0x140
6362306a36Sopenharmony_ci#define		CODA9_USE_HOST_BTP_ENABLE	(1 << 13)
6462306a36Sopenharmony_ci#define		CODA9_USE_HOST_OVL_ENABLE	(1 << 12)
6562306a36Sopenharmony_ci#define		CODA7_USE_HOST_ME_ENABLE	(1 << 11)
6662306a36Sopenharmony_ci#define		CODA9_USE_HOST_DBK_ENABLE	(3 << 10)
6762306a36Sopenharmony_ci#define		CODA7_USE_HOST_OVL_ENABLE	(1 << 10)
6862306a36Sopenharmony_ci#define		CODA7_USE_HOST_DBK_ENABLE	(1 << 9)
6962306a36Sopenharmony_ci#define		CODA9_USE_HOST_IP_ENABLE	(1 << 9)
7062306a36Sopenharmony_ci#define		CODA7_USE_HOST_IP_ENABLE	(1 << 8)
7162306a36Sopenharmony_ci#define		CODA9_USE_HOST_BIT_ENABLE	(1 << 8)
7262306a36Sopenharmony_ci#define		CODA7_USE_HOST_BIT_ENABLE	(1 << 7)
7362306a36Sopenharmony_ci#define		CODA9_USE_BTP_ENABLE		(1 << 5)
7462306a36Sopenharmony_ci#define		CODA7_USE_ME_ENABLE		(1 << 4)
7562306a36Sopenharmony_ci#define		CODA9_USE_OVL_ENABLE		(1 << 4)
7662306a36Sopenharmony_ci#define		CODA7_USE_OVL_ENABLE		(1 << 3)
7762306a36Sopenharmony_ci#define		CODA9_USE_DBK_ENABLE		(3 << 2)
7862306a36Sopenharmony_ci#define		CODA7_USE_DBK_ENABLE		(1 << 2)
7962306a36Sopenharmony_ci#define		CODA7_USE_IP_ENABLE		(1 << 1)
8062306a36Sopenharmony_ci#define		CODA7_USE_BIT_ENABLE		(1 << 0)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define CODA_REG_BIT_BUSY			0x160
8362306a36Sopenharmony_ci#define		CODA_REG_BIT_BUSY_FLAG		1
8462306a36Sopenharmony_ci#define CODA_REG_BIT_RUN_COMMAND		0x164
8562306a36Sopenharmony_ci#define		CODA_COMMAND_SEQ_INIT		1
8662306a36Sopenharmony_ci#define		CODA_COMMAND_SEQ_END		2
8762306a36Sopenharmony_ci#define		CODA_COMMAND_PIC_RUN		3
8862306a36Sopenharmony_ci#define		CODA_COMMAND_SET_FRAME_BUF	4
8962306a36Sopenharmony_ci#define		CODA_COMMAND_ENCODE_HEADER	5
9062306a36Sopenharmony_ci#define		CODA_COMMAND_ENC_PARA_SET	6
9162306a36Sopenharmony_ci#define		CODA_COMMAND_DEC_PARA_SET	7
9262306a36Sopenharmony_ci#define		CODA_COMMAND_DEC_BUF_FLUSH	8
9362306a36Sopenharmony_ci#define		CODA_COMMAND_RC_CHANGE_PARAMETER 9
9462306a36Sopenharmony_ci#define		CODA_COMMAND_FIRMWARE_GET	0xf
9562306a36Sopenharmony_ci#define CODA_REG_BIT_RUN_INDEX			0x168
9662306a36Sopenharmony_ci#define		CODA_INDEX_SET(x)		((x) & 0x3)
9762306a36Sopenharmony_ci#define CODA_REG_BIT_RUN_COD_STD		0x16c
9862306a36Sopenharmony_ci#define		CODADX6_MODE_DECODE_MP4		0
9962306a36Sopenharmony_ci#define		CODADX6_MODE_ENCODE_MP4		1
10062306a36Sopenharmony_ci#define		CODADX6_MODE_DECODE_H264	2
10162306a36Sopenharmony_ci#define		CODADX6_MODE_ENCODE_H264	3
10262306a36Sopenharmony_ci#define		CODA7_MODE_DECODE_H264		0
10362306a36Sopenharmony_ci#define		CODA7_MODE_DECODE_VC1		1
10462306a36Sopenharmony_ci#define		CODA7_MODE_DECODE_MP2		2
10562306a36Sopenharmony_ci#define		CODA7_MODE_DECODE_MP4		3
10662306a36Sopenharmony_ci#define		CODA7_MODE_DECODE_DV3		3
10762306a36Sopenharmony_ci#define		CODA7_MODE_DECODE_RV		4
10862306a36Sopenharmony_ci#define		CODA7_MODE_DECODE_MJPG		5
10962306a36Sopenharmony_ci#define		CODA7_MODE_ENCODE_H264		8
11062306a36Sopenharmony_ci#define		CODA7_MODE_ENCODE_MP4		11
11162306a36Sopenharmony_ci#define		CODA7_MODE_ENCODE_MJPG		13
11262306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_H264		0
11362306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_VC1		1
11462306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_MP2		2
11562306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_MP4		3
11662306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_DV3		3
11762306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_RV		4
11862306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_AVS		5
11962306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_MJPG		6
12062306a36Sopenharmony_ci#define		CODA9_MODE_DECODE_VPX		7
12162306a36Sopenharmony_ci#define		CODA9_MODE_ENCODE_H264		8
12262306a36Sopenharmony_ci#define		CODA9_MODE_ENCODE_MP4		11
12362306a36Sopenharmony_ci#define		CODA9_MODE_ENCODE_MJPG		13
12462306a36Sopenharmony_ci#define		CODA_MODE_INVALID		0xffff
12562306a36Sopenharmony_ci#define CODA_REG_BIT_INT_ENABLE		0x170
12662306a36Sopenharmony_ci#define		CODA_INT_INTERRUPT_ENABLE	(1 << 3)
12762306a36Sopenharmony_ci#define CODA_REG_BIT_INT_REASON			0x174
12862306a36Sopenharmony_ci#define CODA7_REG_BIT_RUN_AUX_STD		0x178
12962306a36Sopenharmony_ci#define		CODA_MP4_AUX_MPEG4		0
13062306a36Sopenharmony_ci#define		CODA_MP4_AUX_DIVX3		1
13162306a36Sopenharmony_ci#define		CODA_VPX_AUX_THO		0
13262306a36Sopenharmony_ci#define		CODA_VPX_AUX_VP6		1
13362306a36Sopenharmony_ci#define		CODA_VPX_AUX_VP8		2
13462306a36Sopenharmony_ci#define		CODA_H264_AUX_AVC		0
13562306a36Sopenharmony_ci#define		CODA_H264_AUX_MVC		1
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci/*
13862306a36Sopenharmony_ci * Commands' mailbox:
13962306a36Sopenharmony_ci * registers with offsets in the range 0x180-0x1d0
14062306a36Sopenharmony_ci * have different meaning depending on the command being
14162306a36Sopenharmony_ci * issued.
14262306a36Sopenharmony_ci */
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci/* Decoder Sequence Initialization */
14562306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_BB_START		0x180
14662306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_BB_SIZE		0x184
14762306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_OPTION			0x188
14862306a36Sopenharmony_ci#define		CODA_NO_INT_ENABLE			(1 << 10)
14962306a36Sopenharmony_ci#define		CODA_REORDER_ENABLE			(1 << 1)
15062306a36Sopenharmony_ci#define		CODADX6_QP_REPORT			(1 << 0)
15162306a36Sopenharmony_ci#define		CODA7_MP4_DEBLK_ENABLE			(1 << 0)
15262306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_SRC_SIZE		0x18c
15362306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_START_BYTE		0x190
15462306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_PS_BB_START		0x194
15562306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_PS_BB_SIZE		0x198
15662306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_JPG_THUMB_EN		0x19c
15762306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_MP4_ASP_CLASS		0x19c
15862306a36Sopenharmony_ci#define		CODA_MP4_CLASS_MPEG4			0
15962306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_X264_MV_EN		0x19c
16062306a36Sopenharmony_ci#define CODA_CMD_DEC_SEQ_SPP_CHUNK_SIZE		0x1a0
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#define CODA7_RET_DEC_SEQ_ASPECT		0x1b0
16362306a36Sopenharmony_ci#define CODA9_RET_DEC_SEQ_BITRATE		0x1b4
16462306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_SUCCESS		0x1c0
16562306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_SRC_FMT		0x1c4 /* SRC_SIZE on CODA7 */
16662306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_SRC_SIZE		0x1c4
16762306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_SRC_F_RATE		0x1c8
16862306a36Sopenharmony_ci#define CODA9_RET_DEC_SEQ_ASPECT		0x1c8
16962306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_FRAME_NEED		0x1cc
17062306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_FRAME_DELAY		0x1d0
17162306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_INFO			0x1d4
17262306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_CROP_LEFT_RIGHT	0x1d8
17362306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_CROP_TOP_BOTTOM	0x1dc
17462306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_NEXT_FRAME_NUM		0x1e0
17562306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_ERR_REASON		0x1e0
17662306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_FRATE_NR		0x1e4
17762306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_FRATE_DR		0x1e8
17862306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_JPG_PARA		0x1e4
17962306a36Sopenharmony_ci#define CODA_RET_DEC_SEQ_JPG_THUMB_IND		0x1e8
18062306a36Sopenharmony_ci#define CODA7_RET_DEC_SEQ_HEADER_REPORT		0x1ec
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci/* Decoder Picture Run */
18362306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_MODE		0x180
18462306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_ADDR_Y		0x184
18562306a36Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_INDEX		0x184
18662306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_ADDR_CB		0x188
18762306a36Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_ADDR_Y		0x188
18862306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_ADDR_CR		0x18c
18962306a36Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_ADDR_CB		0x18c
19062306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_STRIDE		0x190
19162306a36Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_ADDR_CR		0x190
19262306a36Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_STRIDE		0x1b8
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_OPTION			0x194
19562306a36Sopenharmony_ci#define		CODA_PRE_SCAN_EN			(1 << 0)
19662306a36Sopenharmony_ci#define		CODA_PRE_SCAN_MODE_DECODE		(0 << 1)
19762306a36Sopenharmony_ci#define		CODA_PRE_SCAN_MODE_RETURN		(1 << 1)
19862306a36Sopenharmony_ci#define		CODA_IFRAME_SEARCH_EN			(1 << 2)
19962306a36Sopenharmony_ci#define		CODA_SKIP_FRAME_MODE			(0x3 << 3)
20062306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_SKIP_NUM		0x198
20162306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_CHUNK_SIZE		0x19c
20262306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_BB_START		0x1a0
20362306a36Sopenharmony_ci#define CODA_CMD_DEC_PIC_START_BYTE		0x1a4
20462306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_SIZE			0x1bc
20562306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_FRAME_NUM		0x1c0
20662306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_FRAME_IDX		0x1c4
20762306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_ERR_MB			0x1c8
20862306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_TYPE			0x1cc
20962306a36Sopenharmony_ci#define		CODA_PIC_TYPE_MASK			0x7
21062306a36Sopenharmony_ci#define		CODA_PIC_TYPE_MASK_VC1			0x3f
21162306a36Sopenharmony_ci#define		CODA9_PIC_TYPE_FIRST_MASK		(0x7 << 3)
21262306a36Sopenharmony_ci#define		CODA9_PIC_TYPE_IDR_MASK			(0x3 << 6)
21362306a36Sopenharmony_ci#define		CODA7_PIC_TYPE_H264_NPF_MASK		(0x3 << 16)
21462306a36Sopenharmony_ci#define		CODA7_PIC_TYPE_INTERLACED		(1 << 18)
21562306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_POST			0x1d0
21662306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_MVC_REPORT		0x1d0
21762306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_OPTION			0x1d4
21862306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_SUCCESS		0x1d8
21962306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_CUR_IDX		0x1dc
22062306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_CROP_LEFT_RIGHT	0x1e0
22162306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_CROP_TOP_BOTTOM	0x1e4
22262306a36Sopenharmony_ci#define CODA_RET_DEC_PIC_FRAME_NEED		0x1ec
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci#define CODA9_RET_DEC_PIC_VP8_PIC_REPORT	0x1e8
22562306a36Sopenharmony_ci#define CODA9_RET_DEC_PIC_ASPECT		0x1f0
22662306a36Sopenharmony_ci#define CODA9_RET_DEC_PIC_VP8_SCALE_INFO	0x1f0
22762306a36Sopenharmony_ci#define CODA9_RET_DEC_PIC_FRATE_NR		0x1f4
22862306a36Sopenharmony_ci#define CODA9_RET_DEC_PIC_FRATE_DR		0x1f8
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci/* Encoder Sequence Initialization */
23162306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_BB_START				0x180
23262306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_BB_SIZE				0x184
23362306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_OPTION				0x188
23462306a36Sopenharmony_ci#define		CODA7_OPTION_AVCINTRA16X16ONLY_OFFSET		9
23562306a36Sopenharmony_ci#define		CODA9_OPTION_MVC_PREFIX_NAL_OFFSET		9
23662306a36Sopenharmony_ci#define		CODA7_OPTION_GAMMA_OFFSET			8
23762306a36Sopenharmony_ci#define		CODA9_OPTION_MVC_PARASET_REFRESH_OFFSET		8
23862306a36Sopenharmony_ci#define		CODA7_OPTION_RCQPMAX_OFFSET			7
23962306a36Sopenharmony_ci#define		CODA9_OPTION_GAMMA_OFFSET			7
24062306a36Sopenharmony_ci#define		CODADX6_OPTION_GAMMA_OFFSET			7
24162306a36Sopenharmony_ci#define		CODA7_OPTION_RCQPMIN_OFFSET			6
24262306a36Sopenharmony_ci#define		CODA9_OPTION_RCQPMAX_OFFSET			6
24362306a36Sopenharmony_ci#define		CODA_OPTION_LIMITQP_OFFSET			6
24462306a36Sopenharmony_ci#define		CODA_OPTION_RCINTRAQP_OFFSET			5
24562306a36Sopenharmony_ci#define		CODA_OPTION_FMO_OFFSET				4
24662306a36Sopenharmony_ci#define		CODA9_OPTION_MVC_INTERVIEW_OFFSET		4
24762306a36Sopenharmony_ci#define		CODA_OPTION_AVC_AUD_OFFSET			2
24862306a36Sopenharmony_ci#define		CODA_OPTION_SLICEREPORT_OFFSET			1
24962306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_COD_STD				0x18c
25062306a36Sopenharmony_ci#define		CODA_STD_MPEG4					0
25162306a36Sopenharmony_ci#define		CODA9_STD_H264					0
25262306a36Sopenharmony_ci#define		CODA_STD_H263					1
25362306a36Sopenharmony_ci#define		CODA_STD_H264					2
25462306a36Sopenharmony_ci#define		CODA9_STD_MPEG4					3
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_SRC_SIZE				0x190
25762306a36Sopenharmony_ci#define		CODA7_PICWIDTH_OFFSET				16
25862306a36Sopenharmony_ci#define		CODA7_PICWIDTH_MASK				0xffff
25962306a36Sopenharmony_ci#define		CODADX6_PICWIDTH_OFFSET				10
26062306a36Sopenharmony_ci#define		CODADX6_PICWIDTH_MASK				0x3ff
26162306a36Sopenharmony_ci#define		CODA_PICHEIGHT_OFFSET				0
26262306a36Sopenharmony_ci#define		CODADX6_PICHEIGHT_MASK				0x3ff
26362306a36Sopenharmony_ci#define		CODA7_PICHEIGHT_MASK				0xffff
26462306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_SRC_F_RATE				0x194
26562306a36Sopenharmony_ci#define		CODA_FRATE_RES_OFFSET				0
26662306a36Sopenharmony_ci#define		CODA_FRATE_RES_MASK				0xffff
26762306a36Sopenharmony_ci#define		CODA_FRATE_DIV_OFFSET				16
26862306a36Sopenharmony_ci#define		CODA_FRATE_DIV_MASK				0xffff
26962306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_MP4_PARA				0x198
27062306a36Sopenharmony_ci#define		CODA_MP4PARAM_VERID_OFFSET			6
27162306a36Sopenharmony_ci#define		CODA_MP4PARAM_VERID_MASK			0x01
27262306a36Sopenharmony_ci#define		CODA_MP4PARAM_INTRADCVLCTHR_OFFSET		2
27362306a36Sopenharmony_ci#define		CODA_MP4PARAM_INTRADCVLCTHR_MASK		0x07
27462306a36Sopenharmony_ci#define		CODA_MP4PARAM_REVERSIBLEVLCENABLE_OFFSET	1
27562306a36Sopenharmony_ci#define		CODA_MP4PARAM_REVERSIBLEVLCENABLE_MASK		0x01
27662306a36Sopenharmony_ci#define		CODA_MP4PARAM_DATAPARTITIONENABLE_OFFSET	0
27762306a36Sopenharmony_ci#define		CODA_MP4PARAM_DATAPARTITIONENABLE_MASK		0x01
27862306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_263_PARA				0x19c
27962306a36Sopenharmony_ci#define		CODA_263PARAM_ANNEXJENABLE_OFFSET		2
28062306a36Sopenharmony_ci#define		CODA_263PARAM_ANNEXJENABLE_MASK		0x01
28162306a36Sopenharmony_ci#define		CODA_263PARAM_ANNEXKENABLE_OFFSET		1
28262306a36Sopenharmony_ci#define		CODA_263PARAM_ANNEXKENABLE_MASK		0x01
28362306a36Sopenharmony_ci#define		CODA_263PARAM_ANNEXTENABLE_OFFSET		0
28462306a36Sopenharmony_ci#define		CODA_263PARAM_ANNEXTENABLE_MASK		0x01
28562306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_264_PARA				0x1a0
28662306a36Sopenharmony_ci#define		CODA_264PARAM_DEBLKFILTEROFFSETBETA_OFFSET	12
28762306a36Sopenharmony_ci#define		CODA_264PARAM_DEBLKFILTEROFFSETBETA_MASK	0x0f
28862306a36Sopenharmony_ci#define		CODA_264PARAM_DEBLKFILTEROFFSETALPHA_OFFSET	8
28962306a36Sopenharmony_ci#define		CODA_264PARAM_DEBLKFILTEROFFSETALPHA_MASK	0x0f
29062306a36Sopenharmony_ci#define		CODA_264PARAM_DISABLEDEBLK_OFFSET		6
29162306a36Sopenharmony_ci#define		CODA_264PARAM_DISABLEDEBLK_MASK		0x03
29262306a36Sopenharmony_ci#define		CODA_264PARAM_CONSTRAINEDINTRAPREDFLAG_OFFSET	5
29362306a36Sopenharmony_ci#define		CODA_264PARAM_CONSTRAINEDINTRAPREDFLAG_MASK	0x01
29462306a36Sopenharmony_ci#define		CODA_264PARAM_CHROMAQPOFFSET_OFFSET		0
29562306a36Sopenharmony_ci#define		CODA_264PARAM_CHROMAQPOFFSET_MASK		0x1f
29662306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_SLICE_MODE				0x1a4
29762306a36Sopenharmony_ci#define		CODA_SLICING_SIZE_OFFSET			2
29862306a36Sopenharmony_ci#define		CODA_SLICING_SIZE_MASK				0x3fffffff
29962306a36Sopenharmony_ci#define		CODA_SLICING_UNIT_OFFSET			1
30062306a36Sopenharmony_ci#define		CODA_SLICING_UNIT_MASK				0x01
30162306a36Sopenharmony_ci#define		CODA_SLICING_MODE_OFFSET			0
30262306a36Sopenharmony_ci#define		CODA_SLICING_MODE_MASK				0x01
30362306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_GOP_SIZE				0x1a8
30462306a36Sopenharmony_ci#define		CODA_GOP_SIZE_OFFSET				0
30562306a36Sopenharmony_ci#define		CODA_GOP_SIZE_MASK				0x3f
30662306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_PARA				0x1ac
30762306a36Sopenharmony_ci#define		CODA_RATECONTROL_AUTOSKIP_OFFSET		31
30862306a36Sopenharmony_ci#define		CODA_RATECONTROL_AUTOSKIP_MASK			0x01
30962306a36Sopenharmony_ci#define		CODA_RATECONTROL_INITIALDELAY_OFFSET		16
31062306a36Sopenharmony_ci#define		CODA_RATECONTROL_INITIALDELAY_MASK		0x7fff
31162306a36Sopenharmony_ci#define		CODA_RATECONTROL_BITRATE_OFFSET		1
31262306a36Sopenharmony_ci#define		CODA_RATECONTROL_BITRATE_MASK			0x7fff
31362306a36Sopenharmony_ci#define		CODA_RATECONTROL_ENABLE_OFFSET			0
31462306a36Sopenharmony_ci#define		CODA_RATECONTROL_ENABLE_MASK			0x01
31562306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_BUF_SIZE				0x1b0
31662306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_INTRA_REFRESH				0x1b4
31762306a36Sopenharmony_ci#define CODADX6_CMD_ENC_SEQ_FMO					0x1b8
31862306a36Sopenharmony_ci#define		CODA_FMOPARAM_TYPE_OFFSET			4
31962306a36Sopenharmony_ci#define		CODA_FMOPARAM_TYPE_MASK				1
32062306a36Sopenharmony_ci#define		CODA_FMOPARAM_SLICENUM_OFFSET			0
32162306a36Sopenharmony_ci#define		CODA_FMOPARAM_SLICENUM_MASK			0x0f
32262306a36Sopenharmony_ci#define CODADX6_CMD_ENC_SEQ_INTRA_QP				0x1bc
32362306a36Sopenharmony_ci#define CODA7_CMD_ENC_SEQ_SEARCH_BASE				0x1b8
32462306a36Sopenharmony_ci#define CODA7_CMD_ENC_SEQ_SEARCH_SIZE				0x1bc
32562306a36Sopenharmony_ci#define CODA7_CMD_ENC_SEQ_INTRA_QP				0x1c4
32662306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_QP_MIN_MAX				0x1c8
32762306a36Sopenharmony_ci#define		CODA_QPMIN_OFFSET				8
32862306a36Sopenharmony_ci#define		CODA_QPMIN_MASK					0x3f
32962306a36Sopenharmony_ci#define		CODA_QPMAX_OFFSET				0
33062306a36Sopenharmony_ci#define		CODA_QPMAX_MASK					0x3f
33162306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_GAMMA				0x1cc
33262306a36Sopenharmony_ci#define		CODA_GAMMA_OFFSET				0
33362306a36Sopenharmony_ci#define		CODA_GAMMA_MASK					0xffff
33462306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_INTERVAL_MODE			0x1d0
33562306a36Sopenharmony_ci#define CODA9_CMD_ENC_SEQ_INTRA_WEIGHT				0x1d4
33662306a36Sopenharmony_ci#define CODA9_CMD_ENC_SEQ_ME_OPTION				0x1d8
33762306a36Sopenharmony_ci#define CODA_RET_ENC_SEQ_SUCCESS				0x1c0
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_PARA				0x198
34062306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_RST_INTERVAL			0x19C
34162306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_THUMB_EN				0x1a0
34262306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_THUMB_SIZE				0x1a4
34362306a36Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_THUMB_OFFSET			0x1a8
34462306a36Sopenharmony_ci
34562306a36Sopenharmony_ci/* Encoder Parameter Change */
34662306a36Sopenharmony_ci#define CODA_CMD_ENC_PARAM_CHANGE_ENABLE	0x180
34762306a36Sopenharmony_ci#define		CODA_PARAM_CHANGE_RC_GOP			BIT(0)
34862306a36Sopenharmony_ci#define		CODA_PARAM_CHANGE_RC_INTRA_QP			BIT(1)
34962306a36Sopenharmony_ci#define		CODA_PARAM_CHANGE_RC_BITRATE			BIT(2)
35062306a36Sopenharmony_ci#define		CODA_PARAM_CHANGE_RC_FRAME_RATE			BIT(3)
35162306a36Sopenharmony_ci#define		CODA_PARAM_CHANGE_INTRA_MB_NUM			BIT(4)
35262306a36Sopenharmony_ci#define		CODA_PARAM_CHANGE_SLICE_MODE			BIT(5)
35362306a36Sopenharmony_ci#define		CODA_PARAM_CHANGE_HEC_MODE			BIT(6)
35462306a36Sopenharmony_ci#define CODA_CMD_ENC_PARAM_RC_GOP		0x184
35562306a36Sopenharmony_ci#define CODA_CMD_ENC_PARAM_RC_INTRA_QP		0x188
35662306a36Sopenharmony_ci#define CODA_CMD_ENC_PARAM_RC_BITRATE		0x18c
35762306a36Sopenharmony_ci#define CODA_CMD_ENC_PARAM_RC_FRAME_RATE	0x190
35862306a36Sopenharmony_ci#define CODA_CMD_ENC_PARAM_INTRA_MB_NUM		0x194
35962306a36Sopenharmony_ci#define CODA_CMD_ENC_PARAM_SLICE_MODE		0x198
36062306a36Sopenharmony_ci#define CODA_CMD_ENC_PARAM_HEC_MODE		0x19c
36162306a36Sopenharmony_ci#define CODA_RET_ENC_PARAM_CHANGE_SUCCESS	0x1c0
36262306a36Sopenharmony_ci
36362306a36Sopenharmony_ci/* Encoder Picture Run */
36462306a36Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_INDEX		0x180
36562306a36Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_STRIDE		0x184
36662306a36Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SUB_FRAME_SYNC	0x1a4
36762306a36Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_ADDR_Y		0x1a8
36862306a36Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_ADDR_CB		0x1ac
36962306a36Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_ADDR_CR		0x1b0
37062306a36Sopenharmony_ci#define CODA_CMD_ENC_PIC_SRC_ADDR_Y	0x180
37162306a36Sopenharmony_ci#define CODA_CMD_ENC_PIC_SRC_ADDR_CB	0x184
37262306a36Sopenharmony_ci#define CODA_CMD_ENC_PIC_SRC_ADDR_CR	0x188
37362306a36Sopenharmony_ci#define CODA_CMD_ENC_PIC_QS		0x18c
37462306a36Sopenharmony_ci#define CODA_CMD_ENC_PIC_ROT_MODE	0x190
37562306a36Sopenharmony_ci#define		CODA_ROT_MIR_ENABLE				(1 << 4)
37662306a36Sopenharmony_ci#define		CODA_ROT_0					(0x0 << 0)
37762306a36Sopenharmony_ci#define		CODA_ROT_90					(0x1 << 0)
37862306a36Sopenharmony_ci#define		CODA_ROT_180					(0x2 << 0)
37962306a36Sopenharmony_ci#define		CODA_ROT_270					(0x3 << 0)
38062306a36Sopenharmony_ci#define		CODA_MIR_NONE					(0x0 << 2)
38162306a36Sopenharmony_ci#define		CODA_MIR_VER					(0x1 << 2)
38262306a36Sopenharmony_ci#define		CODA_MIR_HOR					(0x2 << 2)
38362306a36Sopenharmony_ci#define		CODA_MIR_VER_HOR				(0x3 << 2)
38462306a36Sopenharmony_ci#define CODA_CMD_ENC_PIC_OPTION		0x194
38562306a36Sopenharmony_ci#define		CODA_FORCE_IPICTURE				BIT(1)
38662306a36Sopenharmony_ci#define		CODA_REPORT_MB_INFO				BIT(3)
38762306a36Sopenharmony_ci#define		CODA_REPORT_MV_INFO				BIT(4)
38862306a36Sopenharmony_ci#define		CODA_REPORT_SLICE_INFO				BIT(5)
38962306a36Sopenharmony_ci#define CODA_CMD_ENC_PIC_BB_START	0x198
39062306a36Sopenharmony_ci#define CODA_CMD_ENC_PIC_BB_SIZE	0x19c
39162306a36Sopenharmony_ci#define CODA_RET_ENC_FRAME_NUM		0x1c0
39262306a36Sopenharmony_ci#define CODA_RET_ENC_PIC_TYPE		0x1c4
39362306a36Sopenharmony_ci#define CODA_RET_ENC_PIC_FRAME_IDX	0x1c8
39462306a36Sopenharmony_ci#define CODA_RET_ENC_PIC_SLICE_NUM	0x1cc
39562306a36Sopenharmony_ci#define CODA_RET_ENC_PIC_FLAG		0x1d0
39662306a36Sopenharmony_ci#define CODA_RET_ENC_PIC_SUCCESS	0x1d8
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ci/* Set Frame Buffer */
39962306a36Sopenharmony_ci#define CODA_CMD_SET_FRAME_BUF_NUM		0x180
40062306a36Sopenharmony_ci#define CODA_CMD_SET_FRAME_BUF_STRIDE		0x184
40162306a36Sopenharmony_ci#define CODA_CMD_SET_FRAME_SLICE_BB_START	0x188
40262306a36Sopenharmony_ci#define CODA_CMD_SET_FRAME_SLICE_BB_SIZE	0x18c
40362306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_SUBSAMP_A		0x188
40462306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_SUBSAMP_B		0x18c
40562306a36Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_BIT_ADDR	0x190
40662306a36Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_IPACDC_ADDR	0x194
40762306a36Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_DBKY_ADDR	0x198
40862306a36Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_DBKC_ADDR	0x19c
40962306a36Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_OVL_ADDR	0x1a0
41062306a36Sopenharmony_ci#define CODA7_CMD_SET_FRAME_MAX_DEC_SIZE	0x1a4
41162306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_AXI_BTP_ADDR	0x1a4
41262306a36Sopenharmony_ci#define CODA7_CMD_SET_FRAME_SOURCE_BUF_STRIDE	0x1a8
41362306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_CACHE_SIZE		0x1a8
41462306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_CACHE_CONFIG	0x1ac
41562306a36Sopenharmony_ci#define		CODA9_CACHE_BYPASS_OFFSET		28
41662306a36Sopenharmony_ci#define		CODA9_CACHE_DUALCONF_OFFSET		26
41762306a36Sopenharmony_ci#define		CODA9_CACHE_PAGEMERGE_OFFSET		24
41862306a36Sopenharmony_ci#define		CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET	16
41962306a36Sopenharmony_ci#define		CODA9_CACHE_CB_BUFFER_SIZE_OFFSET	8
42062306a36Sopenharmony_ci#define		CODA9_CACHE_CR_BUFFER_SIZE_OFFSET	0
42162306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_SUBSAMP_A_MVC	0x1b0
42262306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_SUBSAMP_B_MVC	0x1b4
42362306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_DP_BUF_BASE		0x1b0
42462306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_DP_BUF_SIZE		0x1b4
42562306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_MAX_DEC_SIZE	0x1b8
42662306a36Sopenharmony_ci#define CODA9_CMD_SET_FRAME_DELAY		0x1bc
42762306a36Sopenharmony_ci
42862306a36Sopenharmony_ci/* Encoder Header */
42962306a36Sopenharmony_ci#define CODA_CMD_ENC_HEADER_CODE	0x180
43062306a36Sopenharmony_ci#define		CODA_GAMMA_OFFSET	0
43162306a36Sopenharmony_ci#define		CODA_HEADER_H264_SPS	0
43262306a36Sopenharmony_ci#define		CODA_HEADER_H264_PPS	1
43362306a36Sopenharmony_ci#define		CODA_HEADER_MP4V_VOL	0
43462306a36Sopenharmony_ci#define		CODA_HEADER_MP4V_VOS	1
43562306a36Sopenharmony_ci#define		CODA_HEADER_MP4V_VIS	2
43662306a36Sopenharmony_ci#define		CODA9_HEADER_FRAME_CROP	(1 << 3)
43762306a36Sopenharmony_ci#define CODA_CMD_ENC_HEADER_BB_START	0x184
43862306a36Sopenharmony_ci#define CODA_CMD_ENC_HEADER_BB_SIZE	0x188
43962306a36Sopenharmony_ci#define CODA9_CMD_ENC_HEADER_FRAME_CROP_H	0x18c
44062306a36Sopenharmony_ci#define CODA9_CMD_ENC_HEADER_FRAME_CROP_V	0x190
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ci/* Get Version */
44362306a36Sopenharmony_ci#define CODA_CMD_FIRMWARE_VERNUM		0x1c0
44462306a36Sopenharmony_ci#define		CODA_FIRMWARE_PRODUCT(x)	(((x) >> 16) & 0xffff)
44562306a36Sopenharmony_ci#define		CODA_FIRMWARE_MAJOR(x)		(((x) >> 12) & 0x0f)
44662306a36Sopenharmony_ci#define		CODA_FIRMWARE_MINOR(x)		(((x) >> 8) & 0x0f)
44762306a36Sopenharmony_ci#define		CODA_FIRMWARE_RELEASE(x)	((x) & 0xff)
44862306a36Sopenharmony_ci#define		CODA_FIRMWARE_VERNUM(product, major, minor, release)	\
44962306a36Sopenharmony_ci			((product) << 16 | ((major) << 12) |		\
45062306a36Sopenharmony_ci			((minor) << 8) | (release))
45162306a36Sopenharmony_ci#define CODA9_CMD_FIRMWARE_CODE_REV		0x1c4
45262306a36Sopenharmony_ci
45362306a36Sopenharmony_ci#define CODA9_GDMA_BASE				0x1000
45462306a36Sopenharmony_ci#define CODA9_GDI_CONTROL			(CODA9_GDMA_BASE + 0x034)
45562306a36Sopenharmony_ci#define CODA9_GDI_PIC_INIT_HOST			(CODA9_GDMA_BASE + 0x038)
45662306a36Sopenharmony_ci#define CODA9_GDI_STATUS			(CODA9_GDMA_BASE + 0x080)
45762306a36Sopenharmony_ci#define CODA9_GDI_WPROT_ERR_CLR			(CODA9_GDMA_BASE + 0x0a0)
45862306a36Sopenharmony_ci#define CODA9_GDI_WPROT_RGN_EN			(CODA9_GDMA_BASE + 0x0ac)
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci#define CODA9_GDI_BUS_CTRL			(CODA9_GDMA_BASE + 0x0f0)
46162306a36Sopenharmony_ci#define CODA9_GDI_BUS_STATUS			(CODA9_GDMA_BASE + 0x0f4)
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci#define CODA9_GDI_INFO_CONTROL			(CODA9_GDMA_BASE + 0x400)
46462306a36Sopenharmony_ci#define CODA9_GDI_INFO_PIC_SIZE			(CODA9_GDMA_BASE + 0x404)
46562306a36Sopenharmony_ci#define CODA9_GDI_INFO_BASE_Y			(CODA9_GDMA_BASE + 0x408)
46662306a36Sopenharmony_ci#define CODA9_GDI_INFO_BASE_CB			(CODA9_GDMA_BASE + 0x40c)
46762306a36Sopenharmony_ci#define CODA9_GDI_INFO_BASE_CR			(CODA9_GDMA_BASE + 0x410)
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ci#define CODA9_GDI_XY2_CAS_0			(CODA9_GDMA_BASE + 0x800)
47062306a36Sopenharmony_ci#define CODA9_GDI_XY2_CAS_F			(CODA9_GDMA_BASE + 0x83c)
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ci#define CODA9_GDI_XY2_BA_0			(CODA9_GDMA_BASE + 0x840)
47362306a36Sopenharmony_ci#define CODA9_GDI_XY2_BA_1			(CODA9_GDMA_BASE + 0x844)
47462306a36Sopenharmony_ci#define CODA9_GDI_XY2_BA_2			(CODA9_GDMA_BASE + 0x848)
47562306a36Sopenharmony_ci#define CODA9_GDI_XY2_BA_3			(CODA9_GDMA_BASE + 0x84c)
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_ci#define CODA9_GDI_XY2_RAS_0			(CODA9_GDMA_BASE + 0x850)
47862306a36Sopenharmony_ci#define CODA9_GDI_XY2_RAS_F			(CODA9_GDMA_BASE + 0x88c)
47962306a36Sopenharmony_ci
48062306a36Sopenharmony_ci#define CODA9_GDI_XY2_RBC_CONFIG		(CODA9_GDMA_BASE + 0x890)
48162306a36Sopenharmony_ci#define		CODA9_XY2RBC_SEPARATE_MAP		BIT(19)
48262306a36Sopenharmony_ci#define		CODA9_XY2RBC_TOP_BOT_SPLIT		BIT(18)
48362306a36Sopenharmony_ci#define		CODA9_XY2RBC_TILED_MAP			BIT(17)
48462306a36Sopenharmony_ci#define		CODA9_XY2RBC_CA_INC_HOR			BIT(16)
48562306a36Sopenharmony_ci#define CODA9_GDI_RBC2_AXI_0			(CODA9_GDMA_BASE + 0x8a0)
48662306a36Sopenharmony_ci#define CODA9_GDI_RBC2_AXI_1F			(CODA9_GDMA_BASE + 0x91c)
48762306a36Sopenharmony_ci#define	CODA9_GDI_TILEDBUF_BASE			(CODA9_GDMA_BASE + 0x920)
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci#define CODA9_JPEG_BASE				0x3000
49062306a36Sopenharmony_ci#define CODA9_REG_JPEG_PIC_START		(CODA9_JPEG_BASE + 0x000)
49162306a36Sopenharmony_ci#define CODA9_REG_JPEG_PIC_STATUS		(CODA9_JPEG_BASE + 0x004)
49262306a36Sopenharmony_ci#define		CODA9_JPEG_STATUS_OVERFLOW		BIT(3)
49362306a36Sopenharmony_ci#define		CODA9_JPEG_STATUS_BBC_INT		BIT(2)
49462306a36Sopenharmony_ci#define		CODA9_JPEG_STATUS_ERROR			BIT(1)
49562306a36Sopenharmony_ci#define		CODA9_JPEG_STATUS_DONE			BIT(0)
49662306a36Sopenharmony_ci#define CODA9_REG_JPEG_PIC_ERRMB		(CODA9_JPEG_BASE + 0x008)
49762306a36Sopenharmony_ci#define		CODA9_JPEG_ERRMB_RESTART_IDX_MASK	(0xf << 24)
49862306a36Sopenharmony_ci#define		CODA9_JPEG_ERRMB_MCU_POS_X_MASK		(0xfff << 12)
49962306a36Sopenharmony_ci#define		CODA9_JPEG_ERRMB_MCU_POS_Y_MASK		0xfff
50062306a36Sopenharmony_ci#define CODA9_REG_JPEG_PIC_CTRL			(CODA9_JPEG_BASE + 0x010)
50162306a36Sopenharmony_ci#define		CODA9_JPEG_PIC_CTRL_USER_HUFFMAN_EN	BIT(6)
50262306a36Sopenharmony_ci#define		CODA9_JPEG_PIC_CTRL_TC_DIRECTION	BIT(4)
50362306a36Sopenharmony_ci#define		CODA9_JPEG_PIC_CTRL_ENCODER_EN		BIT(3)
50462306a36Sopenharmony_ci#define CODA9_REG_JPEG_PIC_SIZE			(CODA9_JPEG_BASE + 0x014)
50562306a36Sopenharmony_ci#define CODA9_REG_JPEG_MCU_INFO			(CODA9_JPEG_BASE + 0x018)
50662306a36Sopenharmony_ci#define		CODA9_JPEG_MCU_BLOCK_NUM_OFFSET		16
50762306a36Sopenharmony_ci#define		CODA9_JPEG_COMP_NUM_OFFSET		12
50862306a36Sopenharmony_ci#define		CODA9_JPEG_COMP0_INFO_OFFSET		8
50962306a36Sopenharmony_ci#define		CODA9_JPEG_COMP1_INFO_OFFSET		4
51062306a36Sopenharmony_ci#define		CODA9_JPEG_COMP2_INFO_OFFSET		0
51162306a36Sopenharmony_ci#define CODA9_REG_JPEG_ROT_INFO			(CODA9_JPEG_BASE + 0x01c)
51262306a36Sopenharmony_ci#define		CODA9_JPEG_ROT_MIR_ENABLE		BIT(4)
51362306a36Sopenharmony_ci#define		CODA9_JPEG_ROT_MIR_MODE_MASK		0xf
51462306a36Sopenharmony_ci#define CODA9_REG_JPEG_SCL_INFO			(CODA9_JPEG_BASE + 0x020)
51562306a36Sopenharmony_ci#define		CODA9_JPEG_SCL_ENABLE			BIT(4)
51662306a36Sopenharmony_ci#define		CODA9_JPEG_SCL_HOR_MODE_MASK		(0x3 << 2)
51762306a36Sopenharmony_ci#define		CODA9_JPEG_SCL_VER_MODE_MASK		(0x3 << 0)
51862306a36Sopenharmony_ci#define CODA9_REG_JPEG_IF_INFO			(CODA9_JPEG_BASE + 0x024)
51962306a36Sopenharmony_ci#define		CODA9_JPEG_SENS_IF_CLR			BIT(1)
52062306a36Sopenharmony_ci#define		CODA9_JPEG_DISP_IF_CLR			BIT(0)
52162306a36Sopenharmony_ci#define CODA9_REG_JPEG_OP_INFO			(CODA9_JPEG_BASE + 0x02c)
52262306a36Sopenharmony_ci#define		CODA9_JPEG_BUS_REQ_NUM_OFFSET		0
52362306a36Sopenharmony_ci#define		CODA9_JPEG_BUS_REQ_NUM_MASK		0x7
52462306a36Sopenharmony_ci#define CODA9_REG_JPEG_DPB_CONFIG		(CODA9_JPEG_BASE + 0x030)
52562306a36Sopenharmony_ci#define CODA9_REG_JPEG_DPB_BASE00		(CODA9_JPEG_BASE + 0x040)
52662306a36Sopenharmony_ci#define CODA9_REG_JPEG_HUFF_CTRL		(CODA9_JPEG_BASE + 0x080)
52762306a36Sopenharmony_ci#define CODA9_REG_JPEG_HUFF_ADDR		(CODA9_JPEG_BASE + 0x084)
52862306a36Sopenharmony_ci#define CODA9_REG_JPEG_HUFF_DATA		(CODA9_JPEG_BASE + 0x088)
52962306a36Sopenharmony_ci#define CODA9_REG_JPEG_QMAT_CTRL		(CODA9_JPEG_BASE + 0x090)
53062306a36Sopenharmony_ci#define CODA9_REG_JPEG_QMAT_ADDR		(CODA9_JPEG_BASE + 0x094)
53162306a36Sopenharmony_ci#define CODA9_REG_JPEG_QMAT_DATA		(CODA9_JPEG_BASE + 0x098)
53262306a36Sopenharmony_ci#define CODA9_REG_JPEG_RST_INTVAL		(CODA9_JPEG_BASE + 0x0b0)
53362306a36Sopenharmony_ci#define CODA9_REG_JPEG_RST_INDEX		(CODA9_JPEG_BASE + 0x0b4)
53462306a36Sopenharmony_ci#define CODA9_REG_JPEG_RST_COUNT		(CODA9_JPEG_BASE + 0x0b8)
53562306a36Sopenharmony_ci#define CODA9_REG_JPEG_DPCM_DIFF_Y		(CODA9_JPEG_BASE + 0x0f0)
53662306a36Sopenharmony_ci#define CODA9_REG_JPEG_DPCM_DIFF_CB		(CODA9_JPEG_BASE + 0x0f4)
53762306a36Sopenharmony_ci#define CODA9_REG_JPEG_DPCM_DIFF_CR		(CODA9_JPEG_BASE + 0x0f8)
53862306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_CTRL			(CODA9_JPEG_BASE + 0x100)
53962306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BT_PTR		(CODA9_JPEG_BASE + 0x110)
54062306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_WD_PTR		(CODA9_JPEG_BASE + 0x114)
54162306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_TT_CNT		(CODA9_JPEG_BASE + 0x118)
54262306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BBSR			(CODA9_JPEG_BASE + 0x140)
54362306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BBER			(CODA9_JPEG_BASE + 0x144)
54462306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BBIR			(CODA9_JPEG_BASE + 0x148)
54562306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BBHR			(CODA9_JPEG_BASE + 0x14c)
54662306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BCNT			(CODA9_JPEG_BASE + 0x158)
54762306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_FF_RPTR		(CODA9_JPEG_BASE + 0x160)
54862306a36Sopenharmony_ci#define CODA9_REG_JPEG_GBU_FF_WPTR		(CODA9_JPEG_BASE + 0x164)
54962306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_END_ADDR		(CODA9_JPEG_BASE + 0x208)
55062306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_WR_PTR		(CODA9_JPEG_BASE + 0x20c)
55162306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_RD_PTR		(CODA9_JPEG_BASE + 0x210)
55262306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_EXT_ADDR		(CODA9_JPEG_BASE + 0x214)
55362306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_INT_ADDR		(CODA9_JPEG_BASE + 0x218)
55462306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_DATA_CNT		(CODA9_JPEG_BASE + 0x21c)
55562306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_COMMAND		(CODA9_JPEG_BASE + 0x220)
55662306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_BUSY			(CODA9_JPEG_BASE + 0x224)
55762306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_CTRL			(CODA9_JPEG_BASE + 0x228)
55862306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_CUR_POS		(CODA9_JPEG_BASE + 0x22c)
55962306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_BAS_ADDR		(CODA9_JPEG_BASE + 0x230)
56062306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_STRM_CTRL		(CODA9_JPEG_BASE + 0x234)
56162306a36Sopenharmony_ci#define CODA9_REG_JPEG_BBC_FLUSH_CMD		(CODA9_JPEG_BASE + 0x238)
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci#endif
564