18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * linux/drivers/media/platform/coda/coda_regs.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2012 Vista Silicon SL
68c2ecf20Sopenharmony_ci *    Javier Martin <javier.martin@vista-silicon.com>
78c2ecf20Sopenharmony_ci *    Xavier Duret
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef _REGS_CODA_H_
118c2ecf20Sopenharmony_ci#define _REGS_CODA_H_
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* HW registers */
148c2ecf20Sopenharmony_ci#define CODA_REG_BIT_CODE_RUN			0x000
158c2ecf20Sopenharmony_ci#define		CODA_REG_RUN_ENABLE		(1 << 0)
168c2ecf20Sopenharmony_ci#define CODA_REG_BIT_CODE_DOWN			0x004
178c2ecf20Sopenharmony_ci#define		CODA_DOWN_ADDRESS_SET(x)	(((x) & 0xffff) << 16)
188c2ecf20Sopenharmony_ci#define		CODA_DOWN_DATA_SET(x)		((x) & 0xffff)
198c2ecf20Sopenharmony_ci#define CODA_REG_BIT_HOST_IN_REQ		0x008
208c2ecf20Sopenharmony_ci#define CODA_REG_BIT_INT_CLEAR			0x00c
218c2ecf20Sopenharmony_ci#define		CODA_REG_BIT_INT_CLEAR_SET	0x1
228c2ecf20Sopenharmony_ci#define CODA_REG_BIT_INT_STATUS		0x010
238c2ecf20Sopenharmony_ci#define CODA_REG_BIT_CODE_RESET		0x014
248c2ecf20Sopenharmony_ci#define		CODA_REG_RESET_ENABLE		(1 << 0)
258c2ecf20Sopenharmony_ci#define CODA_REG_BIT_CUR_PC			0x018
268c2ecf20Sopenharmony_ci#define CODA9_REG_BIT_SW_RESET			0x024
278c2ecf20Sopenharmony_ci#define		CODA9_SW_RESET_BPU_CORE   0x008
288c2ecf20Sopenharmony_ci#define		CODA9_SW_RESET_BPU_BUS    0x010
298c2ecf20Sopenharmony_ci#define		CODA9_SW_RESET_VCE_CORE   0x020
308c2ecf20Sopenharmony_ci#define		CODA9_SW_RESET_VCE_BUS    0x040
318c2ecf20Sopenharmony_ci#define		CODA9_SW_RESET_GDI_CORE   0x080
328c2ecf20Sopenharmony_ci#define		CODA9_SW_RESET_GDI_BUS    0x100
338c2ecf20Sopenharmony_ci#define CODA9_REG_BIT_SW_RESET_STATUS		0x034
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/* Static SW registers */
368c2ecf20Sopenharmony_ci#define CODA_REG_BIT_CODE_BUF_ADDR		0x100
378c2ecf20Sopenharmony_ci#define CODA_REG_BIT_WORK_BUF_ADDR		0x104
388c2ecf20Sopenharmony_ci#define CODA_REG_BIT_PARA_BUF_ADDR		0x108
398c2ecf20Sopenharmony_ci#define CODA_REG_BIT_STREAM_CTRL		0x10c
408c2ecf20Sopenharmony_ci#define		CODA7_STREAM_BUF_PIC_RESET	(1 << 4)
418c2ecf20Sopenharmony_ci#define		CODADX6_STREAM_BUF_PIC_RESET	(1 << 3)
428c2ecf20Sopenharmony_ci#define		CODA7_STREAM_BUF_PIC_FLUSH	(1 << 3)
438c2ecf20Sopenharmony_ci#define		CODADX6_STREAM_BUF_PIC_FLUSH	(1 << 2)
448c2ecf20Sopenharmony_ci#define		CODA7_STREAM_BUF_DYNALLOC_EN	(1 << 5)
458c2ecf20Sopenharmony_ci#define		CODADX6_STREAM_BUF_DYNALLOC_EN	(1 << 4)
468c2ecf20Sopenharmony_ci#define		CODADX6_STREAM_CHKDIS_OFFSET	(1 << 1)
478c2ecf20Sopenharmony_ci#define		CODA7_STREAM_SEL_64BITS_ENDIAN	(1 << 1)
488c2ecf20Sopenharmony_ci#define		CODA_STREAM_ENDIAN_SELECT	(1 << 0)
498c2ecf20Sopenharmony_ci#define CODA_REG_BIT_FRAME_MEM_CTRL		0x110
508c2ecf20Sopenharmony_ci#define		CODA9_FRAME_ENABLE_BWB		(1 << 12)
518c2ecf20Sopenharmony_ci#define		CODA9_FRAME_TILED2LINEAR	(1 << 11)
528c2ecf20Sopenharmony_ci#define		CODA_FRAME_CHROMA_INTERLEAVE	(1 << 2)
538c2ecf20Sopenharmony_ci#define		CODA_IMAGE_ENDIAN_SELECT	(1 << 0)
548c2ecf20Sopenharmony_ci#define CODA_REG_BIT_BIT_STREAM_PARAM		0x114
558c2ecf20Sopenharmony_ci#define		CODA_BIT_STREAM_END_FLAG	(1 << 2)
568c2ecf20Sopenharmony_ci#define		CODA_BIT_DEC_SEQ_INIT_ESCAPE	(1 << 0)
578c2ecf20Sopenharmony_ci#define CODA_REG_BIT_TEMP_BUF_ADDR		0x118
588c2ecf20Sopenharmony_ci#define CODA_REG_BIT_RD_PTR(x)			(0x120 + 8 * (x))
598c2ecf20Sopenharmony_ci#define CODA_REG_BIT_WR_PTR(x)			(0x124 + 8 * (x))
608c2ecf20Sopenharmony_ci#define CODA_REG_BIT_FRM_DIS_FLG(x)		(0x150 + 4 * (x))
618c2ecf20Sopenharmony_ci#define CODADX6_REG_BIT_SEARCH_RAM_BASE_ADDR	0x140
628c2ecf20Sopenharmony_ci#define CODA7_REG_BIT_AXI_SRAM_USE		0x140
638c2ecf20Sopenharmony_ci#define		CODA9_USE_HOST_BTP_ENABLE	(1 << 13)
648c2ecf20Sopenharmony_ci#define		CODA9_USE_HOST_OVL_ENABLE	(1 << 12)
658c2ecf20Sopenharmony_ci#define		CODA7_USE_HOST_ME_ENABLE	(1 << 11)
668c2ecf20Sopenharmony_ci#define		CODA9_USE_HOST_DBK_ENABLE	(3 << 10)
678c2ecf20Sopenharmony_ci#define		CODA7_USE_HOST_OVL_ENABLE	(1 << 10)
688c2ecf20Sopenharmony_ci#define		CODA7_USE_HOST_DBK_ENABLE	(1 << 9)
698c2ecf20Sopenharmony_ci#define		CODA9_USE_HOST_IP_ENABLE	(1 << 9)
708c2ecf20Sopenharmony_ci#define		CODA7_USE_HOST_IP_ENABLE	(1 << 8)
718c2ecf20Sopenharmony_ci#define		CODA9_USE_HOST_BIT_ENABLE	(1 << 8)
728c2ecf20Sopenharmony_ci#define		CODA7_USE_HOST_BIT_ENABLE	(1 << 7)
738c2ecf20Sopenharmony_ci#define		CODA9_USE_BTP_ENABLE		(1 << 5)
748c2ecf20Sopenharmony_ci#define		CODA7_USE_ME_ENABLE		(1 << 4)
758c2ecf20Sopenharmony_ci#define		CODA9_USE_OVL_ENABLE		(1 << 4)
768c2ecf20Sopenharmony_ci#define		CODA7_USE_OVL_ENABLE		(1 << 3)
778c2ecf20Sopenharmony_ci#define		CODA9_USE_DBK_ENABLE		(3 << 2)
788c2ecf20Sopenharmony_ci#define		CODA7_USE_DBK_ENABLE		(1 << 2)
798c2ecf20Sopenharmony_ci#define		CODA7_USE_IP_ENABLE		(1 << 1)
808c2ecf20Sopenharmony_ci#define		CODA7_USE_BIT_ENABLE		(1 << 0)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define CODA_REG_BIT_BUSY			0x160
838c2ecf20Sopenharmony_ci#define		CODA_REG_BIT_BUSY_FLAG		1
848c2ecf20Sopenharmony_ci#define CODA_REG_BIT_RUN_COMMAND		0x164
858c2ecf20Sopenharmony_ci#define		CODA_COMMAND_SEQ_INIT		1
868c2ecf20Sopenharmony_ci#define		CODA_COMMAND_SEQ_END		2
878c2ecf20Sopenharmony_ci#define		CODA_COMMAND_PIC_RUN		3
888c2ecf20Sopenharmony_ci#define		CODA_COMMAND_SET_FRAME_BUF	4
898c2ecf20Sopenharmony_ci#define		CODA_COMMAND_ENCODE_HEADER	5
908c2ecf20Sopenharmony_ci#define		CODA_COMMAND_ENC_PARA_SET	6
918c2ecf20Sopenharmony_ci#define		CODA_COMMAND_DEC_PARA_SET	7
928c2ecf20Sopenharmony_ci#define		CODA_COMMAND_DEC_BUF_FLUSH	8
938c2ecf20Sopenharmony_ci#define		CODA_COMMAND_RC_CHANGE_PARAMETER 9
948c2ecf20Sopenharmony_ci#define		CODA_COMMAND_FIRMWARE_GET	0xf
958c2ecf20Sopenharmony_ci#define CODA_REG_BIT_RUN_INDEX			0x168
968c2ecf20Sopenharmony_ci#define		CODA_INDEX_SET(x)		((x) & 0x3)
978c2ecf20Sopenharmony_ci#define CODA_REG_BIT_RUN_COD_STD		0x16c
988c2ecf20Sopenharmony_ci#define		CODADX6_MODE_DECODE_MP4		0
998c2ecf20Sopenharmony_ci#define		CODADX6_MODE_ENCODE_MP4		1
1008c2ecf20Sopenharmony_ci#define		CODADX6_MODE_DECODE_H264	2
1018c2ecf20Sopenharmony_ci#define		CODADX6_MODE_ENCODE_H264	3
1028c2ecf20Sopenharmony_ci#define		CODA7_MODE_DECODE_H264		0
1038c2ecf20Sopenharmony_ci#define		CODA7_MODE_DECODE_VC1		1
1048c2ecf20Sopenharmony_ci#define		CODA7_MODE_DECODE_MP2		2
1058c2ecf20Sopenharmony_ci#define		CODA7_MODE_DECODE_MP4		3
1068c2ecf20Sopenharmony_ci#define		CODA7_MODE_DECODE_DV3		3
1078c2ecf20Sopenharmony_ci#define		CODA7_MODE_DECODE_RV		4
1088c2ecf20Sopenharmony_ci#define		CODA7_MODE_DECODE_MJPG		5
1098c2ecf20Sopenharmony_ci#define		CODA7_MODE_ENCODE_H264		8
1108c2ecf20Sopenharmony_ci#define		CODA7_MODE_ENCODE_MP4		11
1118c2ecf20Sopenharmony_ci#define		CODA7_MODE_ENCODE_MJPG		13
1128c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_H264		0
1138c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_VC1		1
1148c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_MP2		2
1158c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_MP4		3
1168c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_DV3		3
1178c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_RV		4
1188c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_AVS		5
1198c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_MJPG		6
1208c2ecf20Sopenharmony_ci#define		CODA9_MODE_DECODE_VPX		7
1218c2ecf20Sopenharmony_ci#define		CODA9_MODE_ENCODE_H264		8
1228c2ecf20Sopenharmony_ci#define		CODA9_MODE_ENCODE_MP4		11
1238c2ecf20Sopenharmony_ci#define		CODA9_MODE_ENCODE_MJPG		13
1248c2ecf20Sopenharmony_ci#define		CODA_MODE_INVALID		0xffff
1258c2ecf20Sopenharmony_ci#define CODA_REG_BIT_INT_ENABLE		0x170
1268c2ecf20Sopenharmony_ci#define		CODA_INT_INTERRUPT_ENABLE	(1 << 3)
1278c2ecf20Sopenharmony_ci#define CODA_REG_BIT_INT_REASON			0x174
1288c2ecf20Sopenharmony_ci#define CODA7_REG_BIT_RUN_AUX_STD		0x178
1298c2ecf20Sopenharmony_ci#define		CODA_MP4_AUX_MPEG4		0
1308c2ecf20Sopenharmony_ci#define		CODA_MP4_AUX_DIVX3		1
1318c2ecf20Sopenharmony_ci#define		CODA_VPX_AUX_THO		0
1328c2ecf20Sopenharmony_ci#define		CODA_VPX_AUX_VP6		1
1338c2ecf20Sopenharmony_ci#define		CODA_VPX_AUX_VP8		2
1348c2ecf20Sopenharmony_ci#define		CODA_H264_AUX_AVC		0
1358c2ecf20Sopenharmony_ci#define		CODA_H264_AUX_MVC		1
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/*
1388c2ecf20Sopenharmony_ci * Commands' mailbox:
1398c2ecf20Sopenharmony_ci * registers with offsets in the range 0x180-0x1d0
1408c2ecf20Sopenharmony_ci * have different meaning depending on the command being
1418c2ecf20Sopenharmony_ci * issued.
1428c2ecf20Sopenharmony_ci */
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci/* Decoder Sequence Initialization */
1458c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_BB_START		0x180
1468c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_BB_SIZE		0x184
1478c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_OPTION			0x188
1488c2ecf20Sopenharmony_ci#define		CODA_NO_INT_ENABLE			(1 << 10)
1498c2ecf20Sopenharmony_ci#define		CODA_REORDER_ENABLE			(1 << 1)
1508c2ecf20Sopenharmony_ci#define		CODADX6_QP_REPORT			(1 << 0)
1518c2ecf20Sopenharmony_ci#define		CODA7_MP4_DEBLK_ENABLE			(1 << 0)
1528c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_SRC_SIZE		0x18c
1538c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_START_BYTE		0x190
1548c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_PS_BB_START		0x194
1558c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_PS_BB_SIZE		0x198
1568c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_JPG_THUMB_EN		0x19c
1578c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_MP4_ASP_CLASS		0x19c
1588c2ecf20Sopenharmony_ci#define		CODA_MP4_CLASS_MPEG4			0
1598c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_X264_MV_EN		0x19c
1608c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_SEQ_SPP_CHUNK_SIZE		0x1a0
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci#define CODA7_RET_DEC_SEQ_ASPECT		0x1b0
1638c2ecf20Sopenharmony_ci#define CODA9_RET_DEC_SEQ_BITRATE		0x1b4
1648c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_SUCCESS		0x1c0
1658c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_SRC_FMT		0x1c4 /* SRC_SIZE on CODA7 */
1668c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_SRC_SIZE		0x1c4
1678c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_SRC_F_RATE		0x1c8
1688c2ecf20Sopenharmony_ci#define CODA9_RET_DEC_SEQ_ASPECT		0x1c8
1698c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_FRAME_NEED		0x1cc
1708c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_FRAME_DELAY		0x1d0
1718c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_INFO			0x1d4
1728c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_CROP_LEFT_RIGHT	0x1d8
1738c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_CROP_TOP_BOTTOM	0x1dc
1748c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_NEXT_FRAME_NUM		0x1e0
1758c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_ERR_REASON		0x1e0
1768c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_FRATE_NR		0x1e4
1778c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_FRATE_DR		0x1e8
1788c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_JPG_PARA		0x1e4
1798c2ecf20Sopenharmony_ci#define CODA_RET_DEC_SEQ_JPG_THUMB_IND		0x1e8
1808c2ecf20Sopenharmony_ci#define CODA7_RET_DEC_SEQ_HEADER_REPORT		0x1ec
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci/* Decoder Picture Run */
1838c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_MODE		0x180
1848c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_ADDR_Y		0x184
1858c2ecf20Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_INDEX		0x184
1868c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_ADDR_CB		0x188
1878c2ecf20Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_ADDR_Y		0x188
1888c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_ADDR_CR		0x18c
1898c2ecf20Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_ADDR_CB		0x18c
1908c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_ROT_STRIDE		0x190
1918c2ecf20Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_ADDR_CR		0x190
1928c2ecf20Sopenharmony_ci#define CODA9_CMD_DEC_PIC_ROT_STRIDE		0x1b8
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_OPTION			0x194
1958c2ecf20Sopenharmony_ci#define		CODA_PRE_SCAN_EN			(1 << 0)
1968c2ecf20Sopenharmony_ci#define		CODA_PRE_SCAN_MODE_DECODE		(0 << 1)
1978c2ecf20Sopenharmony_ci#define		CODA_PRE_SCAN_MODE_RETURN		(1 << 1)
1988c2ecf20Sopenharmony_ci#define		CODA_IFRAME_SEARCH_EN			(1 << 2)
1998c2ecf20Sopenharmony_ci#define		CODA_SKIP_FRAME_MODE			(0x3 << 3)
2008c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_SKIP_NUM		0x198
2018c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_CHUNK_SIZE		0x19c
2028c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_BB_START		0x1a0
2038c2ecf20Sopenharmony_ci#define CODA_CMD_DEC_PIC_START_BYTE		0x1a4
2048c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_SIZE			0x1bc
2058c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_FRAME_NUM		0x1c0
2068c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_FRAME_IDX		0x1c4
2078c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_ERR_MB			0x1c8
2088c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_TYPE			0x1cc
2098c2ecf20Sopenharmony_ci#define		CODA_PIC_TYPE_MASK			0x7
2108c2ecf20Sopenharmony_ci#define		CODA_PIC_TYPE_MASK_VC1			0x3f
2118c2ecf20Sopenharmony_ci#define		CODA9_PIC_TYPE_FIRST_MASK		(0x7 << 3)
2128c2ecf20Sopenharmony_ci#define		CODA9_PIC_TYPE_IDR_MASK			(0x3 << 6)
2138c2ecf20Sopenharmony_ci#define		CODA7_PIC_TYPE_H264_NPF_MASK		(0x3 << 16)
2148c2ecf20Sopenharmony_ci#define		CODA7_PIC_TYPE_INTERLACED		(1 << 18)
2158c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_POST			0x1d0
2168c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_MVC_REPORT		0x1d0
2178c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_OPTION			0x1d4
2188c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_SUCCESS		0x1d8
2198c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_CUR_IDX		0x1dc
2208c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_CROP_LEFT_RIGHT	0x1e0
2218c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_CROP_TOP_BOTTOM	0x1e4
2228c2ecf20Sopenharmony_ci#define CODA_RET_DEC_PIC_FRAME_NEED		0x1ec
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#define CODA9_RET_DEC_PIC_VP8_PIC_REPORT	0x1e8
2258c2ecf20Sopenharmony_ci#define CODA9_RET_DEC_PIC_ASPECT		0x1f0
2268c2ecf20Sopenharmony_ci#define CODA9_RET_DEC_PIC_VP8_SCALE_INFO	0x1f0
2278c2ecf20Sopenharmony_ci#define CODA9_RET_DEC_PIC_FRATE_NR		0x1f4
2288c2ecf20Sopenharmony_ci#define CODA9_RET_DEC_PIC_FRATE_DR		0x1f8
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci/* Encoder Sequence Initialization */
2318c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_BB_START				0x180
2328c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_BB_SIZE				0x184
2338c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_OPTION				0x188
2348c2ecf20Sopenharmony_ci#define		CODA7_OPTION_AVCINTRA16X16ONLY_OFFSET		9
2358c2ecf20Sopenharmony_ci#define		CODA9_OPTION_MVC_PREFIX_NAL_OFFSET		9
2368c2ecf20Sopenharmony_ci#define		CODA7_OPTION_GAMMA_OFFSET			8
2378c2ecf20Sopenharmony_ci#define		CODA9_OPTION_MVC_PARASET_REFRESH_OFFSET		8
2388c2ecf20Sopenharmony_ci#define		CODA7_OPTION_RCQPMAX_OFFSET			7
2398c2ecf20Sopenharmony_ci#define		CODA9_OPTION_GAMMA_OFFSET			7
2408c2ecf20Sopenharmony_ci#define		CODADX6_OPTION_GAMMA_OFFSET			7
2418c2ecf20Sopenharmony_ci#define		CODA7_OPTION_RCQPMIN_OFFSET			6
2428c2ecf20Sopenharmony_ci#define		CODA9_OPTION_RCQPMAX_OFFSET			6
2438c2ecf20Sopenharmony_ci#define		CODA_OPTION_LIMITQP_OFFSET			6
2448c2ecf20Sopenharmony_ci#define		CODA_OPTION_RCINTRAQP_OFFSET			5
2458c2ecf20Sopenharmony_ci#define		CODA_OPTION_FMO_OFFSET				4
2468c2ecf20Sopenharmony_ci#define		CODA9_OPTION_MVC_INTERVIEW_OFFSET		4
2478c2ecf20Sopenharmony_ci#define		CODA_OPTION_AVC_AUD_OFFSET			2
2488c2ecf20Sopenharmony_ci#define		CODA_OPTION_SLICEREPORT_OFFSET			1
2498c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_COD_STD				0x18c
2508c2ecf20Sopenharmony_ci#define		CODA_STD_MPEG4					0
2518c2ecf20Sopenharmony_ci#define		CODA9_STD_H264					0
2528c2ecf20Sopenharmony_ci#define		CODA_STD_H263					1
2538c2ecf20Sopenharmony_ci#define		CODA_STD_H264					2
2548c2ecf20Sopenharmony_ci#define		CODA9_STD_MPEG4					3
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_SRC_SIZE				0x190
2578c2ecf20Sopenharmony_ci#define		CODA7_PICWIDTH_OFFSET				16
2588c2ecf20Sopenharmony_ci#define		CODA7_PICWIDTH_MASK				0xffff
2598c2ecf20Sopenharmony_ci#define		CODADX6_PICWIDTH_OFFSET				10
2608c2ecf20Sopenharmony_ci#define		CODADX6_PICWIDTH_MASK				0x3ff
2618c2ecf20Sopenharmony_ci#define		CODA_PICHEIGHT_OFFSET				0
2628c2ecf20Sopenharmony_ci#define		CODADX6_PICHEIGHT_MASK				0x3ff
2638c2ecf20Sopenharmony_ci#define		CODA7_PICHEIGHT_MASK				0xffff
2648c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_SRC_F_RATE				0x194
2658c2ecf20Sopenharmony_ci#define		CODA_FRATE_RES_OFFSET				0
2668c2ecf20Sopenharmony_ci#define		CODA_FRATE_RES_MASK				0xffff
2678c2ecf20Sopenharmony_ci#define		CODA_FRATE_DIV_OFFSET				16
2688c2ecf20Sopenharmony_ci#define		CODA_FRATE_DIV_MASK				0xffff
2698c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_MP4_PARA				0x198
2708c2ecf20Sopenharmony_ci#define		CODA_MP4PARAM_VERID_OFFSET			6
2718c2ecf20Sopenharmony_ci#define		CODA_MP4PARAM_VERID_MASK			0x01
2728c2ecf20Sopenharmony_ci#define		CODA_MP4PARAM_INTRADCVLCTHR_OFFSET		2
2738c2ecf20Sopenharmony_ci#define		CODA_MP4PARAM_INTRADCVLCTHR_MASK		0x07
2748c2ecf20Sopenharmony_ci#define		CODA_MP4PARAM_REVERSIBLEVLCENABLE_OFFSET	1
2758c2ecf20Sopenharmony_ci#define		CODA_MP4PARAM_REVERSIBLEVLCENABLE_MASK		0x01
2768c2ecf20Sopenharmony_ci#define		CODA_MP4PARAM_DATAPARTITIONENABLE_OFFSET	0
2778c2ecf20Sopenharmony_ci#define		CODA_MP4PARAM_DATAPARTITIONENABLE_MASK		0x01
2788c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_263_PARA				0x19c
2798c2ecf20Sopenharmony_ci#define		CODA_263PARAM_ANNEXJENABLE_OFFSET		2
2808c2ecf20Sopenharmony_ci#define		CODA_263PARAM_ANNEXJENABLE_MASK		0x01
2818c2ecf20Sopenharmony_ci#define		CODA_263PARAM_ANNEXKENABLE_OFFSET		1
2828c2ecf20Sopenharmony_ci#define		CODA_263PARAM_ANNEXKENABLE_MASK		0x01
2838c2ecf20Sopenharmony_ci#define		CODA_263PARAM_ANNEXTENABLE_OFFSET		0
2848c2ecf20Sopenharmony_ci#define		CODA_263PARAM_ANNEXTENABLE_MASK		0x01
2858c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_264_PARA				0x1a0
2868c2ecf20Sopenharmony_ci#define		CODA_264PARAM_DEBLKFILTEROFFSETBETA_OFFSET	12
2878c2ecf20Sopenharmony_ci#define		CODA_264PARAM_DEBLKFILTEROFFSETBETA_MASK	0x0f
2888c2ecf20Sopenharmony_ci#define		CODA_264PARAM_DEBLKFILTEROFFSETALPHA_OFFSET	8
2898c2ecf20Sopenharmony_ci#define		CODA_264PARAM_DEBLKFILTEROFFSETALPHA_MASK	0x0f
2908c2ecf20Sopenharmony_ci#define		CODA_264PARAM_DISABLEDEBLK_OFFSET		6
2918c2ecf20Sopenharmony_ci#define		CODA_264PARAM_DISABLEDEBLK_MASK		0x03
2928c2ecf20Sopenharmony_ci#define		CODA_264PARAM_CONSTRAINEDINTRAPREDFLAG_OFFSET	5
2938c2ecf20Sopenharmony_ci#define		CODA_264PARAM_CONSTRAINEDINTRAPREDFLAG_MASK	0x01
2948c2ecf20Sopenharmony_ci#define		CODA_264PARAM_CHROMAQPOFFSET_OFFSET		0
2958c2ecf20Sopenharmony_ci#define		CODA_264PARAM_CHROMAQPOFFSET_MASK		0x1f
2968c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_SLICE_MODE				0x1a4
2978c2ecf20Sopenharmony_ci#define		CODA_SLICING_SIZE_OFFSET			2
2988c2ecf20Sopenharmony_ci#define		CODA_SLICING_SIZE_MASK				0x3fffffff
2998c2ecf20Sopenharmony_ci#define		CODA_SLICING_UNIT_OFFSET			1
3008c2ecf20Sopenharmony_ci#define		CODA_SLICING_UNIT_MASK				0x01
3018c2ecf20Sopenharmony_ci#define		CODA_SLICING_MODE_OFFSET			0
3028c2ecf20Sopenharmony_ci#define		CODA_SLICING_MODE_MASK				0x01
3038c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_GOP_SIZE				0x1a8
3048c2ecf20Sopenharmony_ci#define		CODA_GOP_SIZE_OFFSET				0
3058c2ecf20Sopenharmony_ci#define		CODA_GOP_SIZE_MASK				0x3f
3068c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_PARA				0x1ac
3078c2ecf20Sopenharmony_ci#define		CODA_RATECONTROL_AUTOSKIP_OFFSET		31
3088c2ecf20Sopenharmony_ci#define		CODA_RATECONTROL_AUTOSKIP_MASK			0x01
3098c2ecf20Sopenharmony_ci#define		CODA_RATECONTROL_INITIALDELAY_OFFSET		16
3108c2ecf20Sopenharmony_ci#define		CODA_RATECONTROL_INITIALDELAY_MASK		0x7fff
3118c2ecf20Sopenharmony_ci#define		CODA_RATECONTROL_BITRATE_OFFSET		1
3128c2ecf20Sopenharmony_ci#define		CODA_RATECONTROL_BITRATE_MASK			0x7fff
3138c2ecf20Sopenharmony_ci#define		CODA_RATECONTROL_ENABLE_OFFSET			0
3148c2ecf20Sopenharmony_ci#define		CODA_RATECONTROL_ENABLE_MASK			0x01
3158c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_BUF_SIZE				0x1b0
3168c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_INTRA_REFRESH				0x1b4
3178c2ecf20Sopenharmony_ci#define CODADX6_CMD_ENC_SEQ_FMO					0x1b8
3188c2ecf20Sopenharmony_ci#define		CODA_FMOPARAM_TYPE_OFFSET			4
3198c2ecf20Sopenharmony_ci#define		CODA_FMOPARAM_TYPE_MASK				1
3208c2ecf20Sopenharmony_ci#define		CODA_FMOPARAM_SLICENUM_OFFSET			0
3218c2ecf20Sopenharmony_ci#define		CODA_FMOPARAM_SLICENUM_MASK			0x0f
3228c2ecf20Sopenharmony_ci#define CODADX6_CMD_ENC_SEQ_INTRA_QP				0x1bc
3238c2ecf20Sopenharmony_ci#define CODA7_CMD_ENC_SEQ_SEARCH_BASE				0x1b8
3248c2ecf20Sopenharmony_ci#define CODA7_CMD_ENC_SEQ_SEARCH_SIZE				0x1bc
3258c2ecf20Sopenharmony_ci#define CODA7_CMD_ENC_SEQ_INTRA_QP				0x1c4
3268c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_QP_MIN_MAX				0x1c8
3278c2ecf20Sopenharmony_ci#define		CODA_QPMIN_OFFSET				8
3288c2ecf20Sopenharmony_ci#define		CODA_QPMIN_MASK					0x3f
3298c2ecf20Sopenharmony_ci#define		CODA_QPMAX_OFFSET				0
3308c2ecf20Sopenharmony_ci#define		CODA_QPMAX_MASK					0x3f
3318c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_GAMMA				0x1cc
3328c2ecf20Sopenharmony_ci#define		CODA_GAMMA_OFFSET				0
3338c2ecf20Sopenharmony_ci#define		CODA_GAMMA_MASK					0xffff
3348c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_RC_INTERVAL_MODE			0x1d0
3358c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_SEQ_INTRA_WEIGHT				0x1d4
3368c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_SEQ_ME_OPTION				0x1d8
3378c2ecf20Sopenharmony_ci#define CODA_RET_ENC_SEQ_SUCCESS				0x1c0
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_PARA				0x198
3408c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_RST_INTERVAL			0x19C
3418c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_THUMB_EN				0x1a0
3428c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_THUMB_SIZE				0x1a4
3438c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_SEQ_JPG_THUMB_OFFSET			0x1a8
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci/* Encoder Parameter Change */
3468c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PARAM_CHANGE_ENABLE	0x180
3478c2ecf20Sopenharmony_ci#define		CODA_PARAM_CHANGE_RC_GOP			BIT(0)
3488c2ecf20Sopenharmony_ci#define		CODA_PARAM_CHANGE_RC_INTRA_QP			BIT(1)
3498c2ecf20Sopenharmony_ci#define		CODA_PARAM_CHANGE_RC_BITRATE			BIT(2)
3508c2ecf20Sopenharmony_ci#define		CODA_PARAM_CHANGE_RC_FRAME_RATE			BIT(3)
3518c2ecf20Sopenharmony_ci#define		CODA_PARAM_CHANGE_INTRA_MB_NUM			BIT(4)
3528c2ecf20Sopenharmony_ci#define		CODA_PARAM_CHANGE_SLICE_MODE			BIT(5)
3538c2ecf20Sopenharmony_ci#define		CODA_PARAM_CHANGE_HEC_MODE			BIT(6)
3548c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PARAM_RC_GOP		0x184
3558c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PARAM_RC_INTRA_QP		0x188
3568c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PARAM_RC_BITRATE		0x18c
3578c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PARAM_RC_FRAME_RATE	0x190
3588c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PARAM_INTRA_MB_NUM		0x194
3598c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PARAM_SLICE_MODE		0x198
3608c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PARAM_HEC_MODE		0x19c
3618c2ecf20Sopenharmony_ci#define CODA_RET_ENC_PARAM_CHANGE_SUCCESS	0x1c0
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci/* Encoder Picture Run */
3648c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_INDEX		0x180
3658c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_STRIDE		0x184
3668c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SUB_FRAME_SYNC	0x1a4
3678c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_ADDR_Y		0x1a8
3688c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_ADDR_CB		0x1ac
3698c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_PIC_SRC_ADDR_CR		0x1b0
3708c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PIC_SRC_ADDR_Y	0x180
3718c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PIC_SRC_ADDR_CB	0x184
3728c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PIC_SRC_ADDR_CR	0x188
3738c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PIC_QS		0x18c
3748c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PIC_ROT_MODE	0x190
3758c2ecf20Sopenharmony_ci#define		CODA_ROT_MIR_ENABLE				(1 << 4)
3768c2ecf20Sopenharmony_ci#define		CODA_ROT_0					(0x0 << 0)
3778c2ecf20Sopenharmony_ci#define		CODA_ROT_90					(0x1 << 0)
3788c2ecf20Sopenharmony_ci#define		CODA_ROT_180					(0x2 << 0)
3798c2ecf20Sopenharmony_ci#define		CODA_ROT_270					(0x3 << 0)
3808c2ecf20Sopenharmony_ci#define		CODA_MIR_NONE					(0x0 << 2)
3818c2ecf20Sopenharmony_ci#define		CODA_MIR_VER					(0x1 << 2)
3828c2ecf20Sopenharmony_ci#define		CODA_MIR_HOR					(0x2 << 2)
3838c2ecf20Sopenharmony_ci#define		CODA_MIR_VER_HOR				(0x3 << 2)
3848c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PIC_OPTION		0x194
3858c2ecf20Sopenharmony_ci#define		CODA_FORCE_IPICTURE				BIT(1)
3868c2ecf20Sopenharmony_ci#define		CODA_REPORT_MB_INFO				BIT(3)
3878c2ecf20Sopenharmony_ci#define		CODA_REPORT_MV_INFO				BIT(4)
3888c2ecf20Sopenharmony_ci#define		CODA_REPORT_SLICE_INFO				BIT(5)
3898c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PIC_BB_START	0x198
3908c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_PIC_BB_SIZE	0x19c
3918c2ecf20Sopenharmony_ci#define CODA_RET_ENC_FRAME_NUM		0x1c0
3928c2ecf20Sopenharmony_ci#define CODA_RET_ENC_PIC_TYPE		0x1c4
3938c2ecf20Sopenharmony_ci#define CODA_RET_ENC_PIC_FRAME_IDX	0x1c8
3948c2ecf20Sopenharmony_ci#define CODA_RET_ENC_PIC_SLICE_NUM	0x1cc
3958c2ecf20Sopenharmony_ci#define CODA_RET_ENC_PIC_FLAG		0x1d0
3968c2ecf20Sopenharmony_ci#define CODA_RET_ENC_PIC_SUCCESS	0x1d8
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci/* Set Frame Buffer */
3998c2ecf20Sopenharmony_ci#define CODA_CMD_SET_FRAME_BUF_NUM		0x180
4008c2ecf20Sopenharmony_ci#define CODA_CMD_SET_FRAME_BUF_STRIDE		0x184
4018c2ecf20Sopenharmony_ci#define CODA_CMD_SET_FRAME_SLICE_BB_START	0x188
4028c2ecf20Sopenharmony_ci#define CODA_CMD_SET_FRAME_SLICE_BB_SIZE	0x18c
4038c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_SUBSAMP_A		0x188
4048c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_SUBSAMP_B		0x18c
4058c2ecf20Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_BIT_ADDR	0x190
4068c2ecf20Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_IPACDC_ADDR	0x194
4078c2ecf20Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_DBKY_ADDR	0x198
4088c2ecf20Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_DBKC_ADDR	0x19c
4098c2ecf20Sopenharmony_ci#define CODA7_CMD_SET_FRAME_AXI_OVL_ADDR	0x1a0
4108c2ecf20Sopenharmony_ci#define CODA7_CMD_SET_FRAME_MAX_DEC_SIZE	0x1a4
4118c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_AXI_BTP_ADDR	0x1a4
4128c2ecf20Sopenharmony_ci#define CODA7_CMD_SET_FRAME_SOURCE_BUF_STRIDE	0x1a8
4138c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_CACHE_SIZE		0x1a8
4148c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_CACHE_CONFIG	0x1ac
4158c2ecf20Sopenharmony_ci#define		CODA9_CACHE_BYPASS_OFFSET		28
4168c2ecf20Sopenharmony_ci#define		CODA9_CACHE_DUALCONF_OFFSET		26
4178c2ecf20Sopenharmony_ci#define		CODA9_CACHE_PAGEMERGE_OFFSET		24
4188c2ecf20Sopenharmony_ci#define		CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET	16
4198c2ecf20Sopenharmony_ci#define		CODA9_CACHE_CB_BUFFER_SIZE_OFFSET	8
4208c2ecf20Sopenharmony_ci#define		CODA9_CACHE_CR_BUFFER_SIZE_OFFSET	0
4218c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_SUBSAMP_A_MVC	0x1b0
4228c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_SUBSAMP_B_MVC	0x1b4
4238c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_DP_BUF_BASE		0x1b0
4248c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_DP_BUF_SIZE		0x1b4
4258c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_MAX_DEC_SIZE	0x1b8
4268c2ecf20Sopenharmony_ci#define CODA9_CMD_SET_FRAME_DELAY		0x1bc
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_ci/* Encoder Header */
4298c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_HEADER_CODE	0x180
4308c2ecf20Sopenharmony_ci#define		CODA_GAMMA_OFFSET	0
4318c2ecf20Sopenharmony_ci#define		CODA_HEADER_H264_SPS	0
4328c2ecf20Sopenharmony_ci#define		CODA_HEADER_H264_PPS	1
4338c2ecf20Sopenharmony_ci#define		CODA_HEADER_MP4V_VOL	0
4348c2ecf20Sopenharmony_ci#define		CODA_HEADER_MP4V_VOS	1
4358c2ecf20Sopenharmony_ci#define		CODA_HEADER_MP4V_VIS	2
4368c2ecf20Sopenharmony_ci#define		CODA9_HEADER_FRAME_CROP	(1 << 3)
4378c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_HEADER_BB_START	0x184
4388c2ecf20Sopenharmony_ci#define CODA_CMD_ENC_HEADER_BB_SIZE	0x188
4398c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_HEADER_FRAME_CROP_H	0x18c
4408c2ecf20Sopenharmony_ci#define CODA9_CMD_ENC_HEADER_FRAME_CROP_V	0x190
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci/* Get Version */
4438c2ecf20Sopenharmony_ci#define CODA_CMD_FIRMWARE_VERNUM		0x1c0
4448c2ecf20Sopenharmony_ci#define		CODA_FIRMWARE_PRODUCT(x)	(((x) >> 16) & 0xffff)
4458c2ecf20Sopenharmony_ci#define		CODA_FIRMWARE_MAJOR(x)		(((x) >> 12) & 0x0f)
4468c2ecf20Sopenharmony_ci#define		CODA_FIRMWARE_MINOR(x)		(((x) >> 8) & 0x0f)
4478c2ecf20Sopenharmony_ci#define		CODA_FIRMWARE_RELEASE(x)	((x) & 0xff)
4488c2ecf20Sopenharmony_ci#define		CODA_FIRMWARE_VERNUM(product, major, minor, release)	\
4498c2ecf20Sopenharmony_ci			((product) << 16 | ((major) << 12) |		\
4508c2ecf20Sopenharmony_ci			((minor) << 8) | (release))
4518c2ecf20Sopenharmony_ci#define CODA9_CMD_FIRMWARE_CODE_REV		0x1c4
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci#define CODA9_GDMA_BASE				0x1000
4548c2ecf20Sopenharmony_ci#define CODA9_GDI_CONTROL			(CODA9_GDMA_BASE + 0x034)
4558c2ecf20Sopenharmony_ci#define CODA9_GDI_PIC_INIT_HOST			(CODA9_GDMA_BASE + 0x038)
4568c2ecf20Sopenharmony_ci#define CODA9_GDI_STATUS			(CODA9_GDMA_BASE + 0x080)
4578c2ecf20Sopenharmony_ci#define CODA9_GDI_WPROT_ERR_CLR			(CODA9_GDMA_BASE + 0x0a0)
4588c2ecf20Sopenharmony_ci#define CODA9_GDI_WPROT_RGN_EN			(CODA9_GDMA_BASE + 0x0ac)
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci#define CODA9_GDI_BUS_CTRL			(CODA9_GDMA_BASE + 0x0f0)
4618c2ecf20Sopenharmony_ci#define CODA9_GDI_BUS_STATUS			(CODA9_GDMA_BASE + 0x0f4)
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci#define CODA9_GDI_INFO_CONTROL			(CODA9_GDMA_BASE + 0x400)
4648c2ecf20Sopenharmony_ci#define CODA9_GDI_INFO_PIC_SIZE			(CODA9_GDMA_BASE + 0x404)
4658c2ecf20Sopenharmony_ci#define CODA9_GDI_INFO_BASE_Y			(CODA9_GDMA_BASE + 0x408)
4668c2ecf20Sopenharmony_ci#define CODA9_GDI_INFO_BASE_CB			(CODA9_GDMA_BASE + 0x40c)
4678c2ecf20Sopenharmony_ci#define CODA9_GDI_INFO_BASE_CR			(CODA9_GDMA_BASE + 0x410)
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_CAS_0			(CODA9_GDMA_BASE + 0x800)
4708c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_CAS_F			(CODA9_GDMA_BASE + 0x83c)
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_BA_0			(CODA9_GDMA_BASE + 0x840)
4738c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_BA_1			(CODA9_GDMA_BASE + 0x844)
4748c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_BA_2			(CODA9_GDMA_BASE + 0x848)
4758c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_BA_3			(CODA9_GDMA_BASE + 0x84c)
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_RAS_0			(CODA9_GDMA_BASE + 0x850)
4788c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_RAS_F			(CODA9_GDMA_BASE + 0x88c)
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ci#define CODA9_GDI_XY2_RBC_CONFIG		(CODA9_GDMA_BASE + 0x890)
4818c2ecf20Sopenharmony_ci#define		CODA9_XY2RBC_SEPARATE_MAP		BIT(19)
4828c2ecf20Sopenharmony_ci#define		CODA9_XY2RBC_TOP_BOT_SPLIT		BIT(18)
4838c2ecf20Sopenharmony_ci#define		CODA9_XY2RBC_TILED_MAP			BIT(17)
4848c2ecf20Sopenharmony_ci#define		CODA9_XY2RBC_CA_INC_HOR			BIT(16)
4858c2ecf20Sopenharmony_ci#define CODA9_GDI_RBC2_AXI_0			(CODA9_GDMA_BASE + 0x8a0)
4868c2ecf20Sopenharmony_ci#define CODA9_GDI_RBC2_AXI_1F			(CODA9_GDMA_BASE + 0x91c)
4878c2ecf20Sopenharmony_ci#define	CODA9_GDI_TILEDBUF_BASE			(CODA9_GDMA_BASE + 0x920)
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci#define CODA9_JPEG_BASE				0x3000
4908c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_PIC_START		(CODA9_JPEG_BASE + 0x000)
4918c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_PIC_STATUS		(CODA9_JPEG_BASE + 0x004)
4928c2ecf20Sopenharmony_ci#define		CODA9_JPEG_STATUS_OVERFLOW		BIT(3)
4938c2ecf20Sopenharmony_ci#define		CODA9_JPEG_STATUS_BBC_INT		BIT(2)
4948c2ecf20Sopenharmony_ci#define		CODA9_JPEG_STATUS_ERROR			BIT(1)
4958c2ecf20Sopenharmony_ci#define		CODA9_JPEG_STATUS_DONE			BIT(0)
4968c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_PIC_ERRMB		(CODA9_JPEG_BASE + 0x008)
4978c2ecf20Sopenharmony_ci#define		CODA9_JPEG_ERRMB_RESTART_IDX_MASK	(0xf << 24)
4988c2ecf20Sopenharmony_ci#define		CODA9_JPEG_ERRMB_MCU_POS_X_MASK		(0xfff << 12)
4998c2ecf20Sopenharmony_ci#define		CODA9_JPEG_ERRMB_MCU_POS_Y_MASK		0xfff
5008c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_PIC_CTRL			(CODA9_JPEG_BASE + 0x010)
5018c2ecf20Sopenharmony_ci#define		CODA9_JPEG_PIC_CTRL_USER_HUFFMAN_EN	BIT(6)
5028c2ecf20Sopenharmony_ci#define		CODA9_JPEG_PIC_CTRL_TC_DIRECTION	BIT(4)
5038c2ecf20Sopenharmony_ci#define		CODA9_JPEG_PIC_CTRL_ENCODER_EN		BIT(3)
5048c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_PIC_SIZE			(CODA9_JPEG_BASE + 0x014)
5058c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_MCU_INFO			(CODA9_JPEG_BASE + 0x018)
5068c2ecf20Sopenharmony_ci#define		CODA9_JPEG_MCU_BLOCK_NUM_OFFSET		16
5078c2ecf20Sopenharmony_ci#define		CODA9_JPEG_COMP_NUM_OFFSET		12
5088c2ecf20Sopenharmony_ci#define		CODA9_JPEG_COMP0_INFO_OFFSET		8
5098c2ecf20Sopenharmony_ci#define		CODA9_JPEG_COMP1_INFO_OFFSET		4
5108c2ecf20Sopenharmony_ci#define		CODA9_JPEG_COMP2_INFO_OFFSET		0
5118c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_ROT_INFO			(CODA9_JPEG_BASE + 0x01c)
5128c2ecf20Sopenharmony_ci#define		CODA9_JPEG_ROT_MIR_ENABLE		BIT(4)
5138c2ecf20Sopenharmony_ci#define		CODA9_JPEG_ROT_MIR_MODE_MASK		0xf
5148c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_SCL_INFO			(CODA9_JPEG_BASE + 0x020)
5158c2ecf20Sopenharmony_ci#define		CODA9_JPEG_SCL_ENABLE			BIT(4)
5168c2ecf20Sopenharmony_ci#define		CODA9_JPEG_SCL_HOR_MODE_MASK		(0x3 << 2)
5178c2ecf20Sopenharmony_ci#define		CODA9_JPEG_SCL_VER_MODE_MASK		(0x3 << 0)
5188c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_IF_INFO			(CODA9_JPEG_BASE + 0x024)
5198c2ecf20Sopenharmony_ci#define		CODA9_JPEG_SENS_IF_CLR			BIT(1)
5208c2ecf20Sopenharmony_ci#define		CODA9_JPEG_DISP_IF_CLR			BIT(0)
5218c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_OP_INFO			(CODA9_JPEG_BASE + 0x02c)
5228c2ecf20Sopenharmony_ci#define		CODA9_JPEG_BUS_REQ_NUM_OFFSET		0
5238c2ecf20Sopenharmony_ci#define		CODA9_JPEG_BUS_REQ_NUM_MASK		0x7
5248c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_DPB_CONFIG		(CODA9_JPEG_BASE + 0x030)
5258c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_DPB_BASE00		(CODA9_JPEG_BASE + 0x040)
5268c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_HUFF_CTRL		(CODA9_JPEG_BASE + 0x080)
5278c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_HUFF_ADDR		(CODA9_JPEG_BASE + 0x084)
5288c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_HUFF_DATA		(CODA9_JPEG_BASE + 0x088)
5298c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_QMAT_CTRL		(CODA9_JPEG_BASE + 0x090)
5308c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_QMAT_ADDR		(CODA9_JPEG_BASE + 0x094)
5318c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_QMAT_DATA		(CODA9_JPEG_BASE + 0x098)
5328c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_RST_INTVAL		(CODA9_JPEG_BASE + 0x0b0)
5338c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_RST_INDEX		(CODA9_JPEG_BASE + 0x0b4)
5348c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_RST_COUNT		(CODA9_JPEG_BASE + 0x0b8)
5358c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_DPCM_DIFF_Y		(CODA9_JPEG_BASE + 0x0f0)
5368c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_DPCM_DIFF_CB		(CODA9_JPEG_BASE + 0x0f4)
5378c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_DPCM_DIFF_CR		(CODA9_JPEG_BASE + 0x0f8)
5388c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_CTRL			(CODA9_JPEG_BASE + 0x100)
5398c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BT_PTR		(CODA9_JPEG_BASE + 0x110)
5408c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_WD_PTR		(CODA9_JPEG_BASE + 0x114)
5418c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_TT_CNT		(CODA9_JPEG_BASE + 0x118)
5428c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BBSR			(CODA9_JPEG_BASE + 0x140)
5438c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BBER			(CODA9_JPEG_BASE + 0x144)
5448c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BBIR			(CODA9_JPEG_BASE + 0x148)
5458c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BBHR			(CODA9_JPEG_BASE + 0x14c)
5468c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_BCNT			(CODA9_JPEG_BASE + 0x158)
5478c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_FF_RPTR		(CODA9_JPEG_BASE + 0x160)
5488c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_GBU_FF_WPTR		(CODA9_JPEG_BASE + 0x164)
5498c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_END_ADDR		(CODA9_JPEG_BASE + 0x208)
5508c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_WR_PTR		(CODA9_JPEG_BASE + 0x20c)
5518c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_RD_PTR		(CODA9_JPEG_BASE + 0x210)
5528c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_EXT_ADDR		(CODA9_JPEG_BASE + 0x214)
5538c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_INT_ADDR		(CODA9_JPEG_BASE + 0x218)
5548c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_DATA_CNT		(CODA9_JPEG_BASE + 0x21c)
5558c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_COMMAND		(CODA9_JPEG_BASE + 0x220)
5568c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_BUSY			(CODA9_JPEG_BASE + 0x224)
5578c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_CTRL			(CODA9_JPEG_BASE + 0x228)
5588c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_CUR_POS		(CODA9_JPEG_BASE + 0x22c)
5598c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_BAS_ADDR		(CODA9_JPEG_BASE + 0x230)
5608c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_STRM_CTRL		(CODA9_JPEG_BASE + 0x234)
5618c2ecf20Sopenharmony_ci#define CODA9_REG_JPEG_BBC_FLUSH_CMD		(CODA9_JPEG_BASE + 0x238)
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci#endif
564