regs-mfc.h revision 8f532a7fec5ee872a65d2096f846f76afd9ede6f
1/*
2 * Register definition file for Samsung MFC V5.1 Interface (FIMV) driver
3 *
4 * Kamil Debski, Copyright (c) 2010 Samsung Electronics
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef _REGS_FIMV_H
13#define _REGS_FIMV_H
14
15#include <linux/kernel.h>
16#include <linux/sizes.h>
17
18#define S5P_FIMV_REG_SIZE	(S5P_FIMV_END_ADDR - S5P_FIMV_START_ADDR)
19#define S5P_FIMV_REG_COUNT	((S5P_FIMV_END_ADDR - S5P_FIMV_START_ADDR) / 4)
20
21/* Number of bits that the buffer address should be shifted for particular
22 * MFC buffers.  */
23#define S5P_FIMV_START_ADDR		0x0000
24#define S5P_FIMV_END_ADDR		0xe008
25
26#define S5P_FIMV_SW_RESET		0x0000
27#define S5P_FIMV_RISC_HOST_INT		0x0008
28
29/* Command from HOST to RISC */
30#define S5P_FIMV_HOST2RISC_CMD		0x0030
31#define S5P_FIMV_HOST2RISC_ARG1		0x0034
32#define S5P_FIMV_HOST2RISC_ARG2		0x0038
33#define S5P_FIMV_HOST2RISC_ARG3		0x003c
34#define S5P_FIMV_HOST2RISC_ARG4		0x0040
35
36/* Command from RISC to HOST */
37#define S5P_FIMV_RISC2HOST_CMD		0x0044
38#define S5P_FIMV_RISC2HOST_CMD_MASK	0x1FFFF
39#define S5P_FIMV_RISC2HOST_ARG1		0x0048
40#define S5P_FIMV_RISC2HOST_ARG2		0x004c
41#define S5P_FIMV_RISC2HOST_ARG3		0x0050
42#define S5P_FIMV_RISC2HOST_ARG4		0x0054
43
44#define S5P_FIMV_FW_VERSION		0x0058
45#define S5P_FIMV_SYS_MEM_SZ		0x005c
46#define S5P_FIMV_FW_STATUS		0x0080
47
48/* Memory controller register */
49#define S5P_FIMV_MC_DRAMBASE_ADR_A	0x0508
50#define S5P_FIMV_MC_DRAMBASE_ADR_B	0x050c
51#define S5P_FIMV_MC_STATUS		0x0510
52
53/* Common register */
54#define S5P_FIMV_COMMON_BASE_A		0x0600
55#define S5P_FIMV_COMMON_BASE_B		0x0700
56
57/* Decoder */
58#define S5P_FIMV_DEC_CHROMA_ADR		(S5P_FIMV_COMMON_BASE_A)
59#define S5P_FIMV_DEC_LUMA_ADR		(S5P_FIMV_COMMON_BASE_B)
60
61/* H.264 decoding */
62#define S5P_FIMV_H264_VERT_NB_MV_ADR	(S5P_FIMV_COMMON_BASE_A + 0x8c)
63					/* vertical neighbor motion vector */
64#define S5P_FIMV_H264_NB_IP_ADR		(S5P_FIMV_COMMON_BASE_A + 0x90)
65					/* neighbor pixels for intra pred */
66#define S5P_FIMV_H264_MV_ADR		(S5P_FIMV_COMMON_BASE_B + 0x80)
67					/* H264 motion vector */
68
69/* MPEG4 decoding */
70#define S5P_FIMV_MPEG4_NB_DCAC_ADR	(S5P_FIMV_COMMON_BASE_A + 0x8c)
71					/* neighbor AC/DC coeff. */
72#define S5P_FIMV_MPEG4_UP_NB_MV_ADR	(S5P_FIMV_COMMON_BASE_A + 0x90)
73					/* upper neighbor motion vector */
74#define S5P_FIMV_MPEG4_SA_MV_ADR	(S5P_FIMV_COMMON_BASE_A + 0x94)
75					/* subseq. anchor motion vector */
76#define S5P_FIMV_MPEG4_OT_LINE_ADR	(S5P_FIMV_COMMON_BASE_A + 0x98)
77					/* overlap transform line */
78#define S5P_FIMV_MPEG4_SP_ADR		(S5P_FIMV_COMMON_BASE_A + 0xa8)
79					/* syntax parser */
80
81/* H.263 decoding */
82#define S5P_FIMV_H263_NB_DCAC_ADR	(S5P_FIMV_COMMON_BASE_A + 0x8c)
83#define S5P_FIMV_H263_UP_NB_MV_ADR	(S5P_FIMV_COMMON_BASE_A + 0x90)
84#define S5P_FIMV_H263_SA_MV_ADR		(S5P_FIMV_COMMON_BASE_A + 0x94)
85#define S5P_FIMV_H263_OT_LINE_ADR	(S5P_FIMV_COMMON_BASE_A + 0x98)
86
87/* VC-1 decoding */
88#define S5P_FIMV_VC1_NB_DCAC_ADR	(S5P_FIMV_COMMON_BASE_A + 0x8c)
89#define S5P_FIMV_VC1_UP_NB_MV_ADR	(S5P_FIMV_COMMON_BASE_A + 0x90)
90#define S5P_FIMV_VC1_SA_MV_ADR		(S5P_FIMV_COMMON_BASE_A + 0x94)
91#define S5P_FIMV_VC1_OT_LINE_ADR	(S5P_FIMV_COMMON_BASE_A + 0x98)
92#define S5P_FIMV_VC1_BITPLANE3_ADR	(S5P_FIMV_COMMON_BASE_A + 0x9c)
93					/* bitplane3 */
94#define S5P_FIMV_VC1_BITPLANE2_ADR	(S5P_FIMV_COMMON_BASE_A + 0xa0)
95					/* bitplane2 */
96#define S5P_FIMV_VC1_BITPLANE1_ADR	(S5P_FIMV_COMMON_BASE_A + 0xa4)
97					/* bitplane1 */
98
99/* Encoder */
100#define S5P_FIMV_ENC_REF0_LUMA_ADR	(S5P_FIMV_COMMON_BASE_A + 0x1c)
101#define S5P_FIMV_ENC_REF1_LUMA_ADR	(S5P_FIMV_COMMON_BASE_A + 0x20)
102					/* reconstructed luma */
103#define S5P_FIMV_ENC_REF0_CHROMA_ADR	(S5P_FIMV_COMMON_BASE_B)
104#define S5P_FIMV_ENC_REF1_CHROMA_ADR	(S5P_FIMV_COMMON_BASE_B + 0x04)
105					/* reconstructed chroma */
106#define S5P_FIMV_ENC_REF2_LUMA_ADR	(S5P_FIMV_COMMON_BASE_B + 0x10)
107#define S5P_FIMV_ENC_REF2_CHROMA_ADR	(S5P_FIMV_COMMON_BASE_B + 0x08)
108#define S5P_FIMV_ENC_REF3_LUMA_ADR	(S5P_FIMV_COMMON_BASE_B + 0x14)
109#define S5P_FIMV_ENC_REF3_CHROMA_ADR	(S5P_FIMV_COMMON_BASE_B + 0x0c)
110
111/* H.264 encoding */
112#define S5P_FIMV_H264_UP_MV_ADR		(S5P_FIMV_COMMON_BASE_A)
113					/* upper motion vector */
114#define S5P_FIMV_H264_NBOR_INFO_ADR	(S5P_FIMV_COMMON_BASE_A + 0x04)
115					/* entropy engine's neighbor info. */
116#define S5P_FIMV_H264_UP_INTRA_MD_ADR	(S5P_FIMV_COMMON_BASE_A + 0x08)
117					/* upper intra MD */
118#define S5P_FIMV_H264_COZERO_FLAG_ADR	(S5P_FIMV_COMMON_BASE_A + 0x10)
119					/* direct cozero flag */
120#define S5P_FIMV_H264_UP_INTRA_PRED_ADR	(S5P_FIMV_COMMON_BASE_B + 0x40)
121					/* upper intra PRED */
122
123/* H.263 encoding */
124#define S5P_FIMV_H263_UP_MV_ADR		(S5P_FIMV_COMMON_BASE_A)
125					/* upper motion vector */
126#define S5P_FIMV_H263_ACDC_COEF_ADR	(S5P_FIMV_COMMON_BASE_A + 0x04)
127					/* upper Q coeff. */
128
129/* MPEG4 encoding */
130#define S5P_FIMV_MPEG4_UP_MV_ADR	(S5P_FIMV_COMMON_BASE_A)
131					/* upper motion vector */
132#define S5P_FIMV_MPEG4_ACDC_COEF_ADR	(S5P_FIMV_COMMON_BASE_A + 0x04)
133					/* upper Q coeff. */
134#define S5P_FIMV_MPEG4_COZERO_FLAG_ADR	(S5P_FIMV_COMMON_BASE_A + 0x10)
135					/* direct cozero flag */
136
137#define S5P_FIMV_ENC_REF_B_LUMA_ADR     0x062c /* ref B Luma addr */
138#define S5P_FIMV_ENC_REF_B_CHROMA_ADR   0x0630 /* ref B Chroma addr */
139
140#define S5P_FIMV_ENC_CUR_LUMA_ADR	0x0718 /* current Luma addr */
141#define S5P_FIMV_ENC_CUR_CHROMA_ADR	0x071C /* current Chroma addr */
142
143/* Codec common register */
144#define S5P_FIMV_ENC_HSIZE_PX		0x0818 /* frame width at encoder */
145#define S5P_FIMV_ENC_VSIZE_PX		0x081c /* frame height at encoder */
146#define S5P_FIMV_ENC_PROFILE		0x0830 /* profile register */
147#define S5P_FIMV_ENC_PROFILE_H264_MAIN			0
148#define S5P_FIMV_ENC_PROFILE_H264_HIGH			1
149#define S5P_FIMV_ENC_PROFILE_H264_BASELINE		2
150#define S5P_FIMV_ENC_PROFILE_MPEG4_SIMPLE		0
151#define S5P_FIMV_ENC_PROFILE_MPEG4_ADVANCED_SIMPLE	1
152#define S5P_FIMV_ENC_PIC_STRUCT		0x083c /* picture field/frame flag */
153#define S5P_FIMV_ENC_LF_CTRL		0x0848 /* loop filter control */
154#define S5P_FIMV_ENC_ALPHA_OFF		0x084c /* loop filter alpha offset */
155#define S5P_FIMV_ENC_BETA_OFF		0x0850 /* loop filter beta offset */
156#define S5P_FIMV_MR_BUSIF_CTRL		0x0854 /* hidden, bus interface ctrl */
157#define S5P_FIMV_ENC_PXL_CACHE_CTRL	0x0a00 /* pixel cache control */
158
159/* Channel & stream interface register */
160#define S5P_FIMV_SI_RTN_CHID		0x2000 /* Return CH inst ID register */
161#define S5P_FIMV_SI_CH0_INST_ID		0x2040 /* codec instance ID */
162#define S5P_FIMV_SI_CH1_INST_ID		0x2080 /* codec instance ID */
163/* Decoder */
164#define S5P_FIMV_SI_VRESOL		0x2004 /* vertical res of decoder */
165#define S5P_FIMV_SI_HRESOL		0x2008 /* horizontal res of decoder */
166#define S5P_FIMV_SI_BUF_NUMBER		0x200c /* number of frames in the
167								decoded pic */
168#define S5P_FIMV_SI_DISPLAY_Y_ADR	0x2010 /* luma addr of displayed pic */
169#define S5P_FIMV_SI_DISPLAY_C_ADR	0x2014 /* chroma addrof displayed pic */
170
171#define S5P_FIMV_SI_CONSUMED_BYTES	0x2018 /* Consumed number of bytes to
172							decode a frame */
173#define S5P_FIMV_SI_DISPLAY_STATUS	0x201c /* status of decoded picture */
174
175#define S5P_FIMV_SI_DECODE_Y_ADR	0x2024 /* luma addr of decoded pic */
176#define S5P_FIMV_SI_DECODE_C_ADR	0x2028 /* chroma addrof decoded pic */
177#define S5P_FIMV_SI_DECODE_STATUS	0x202c /* status of decoded picture */
178
179#define S5P_FIMV_SI_CH0_SB_ST_ADR	0x2044 /* start addr of stream buf */
180#define S5P_FIMV_SI_CH0_SB_FRM_SIZE	0x2048 /* size of stream buf */
181#define S5P_FIMV_SI_CH0_DESC_ADR	0x204c /* addr of descriptor buf */
182#define S5P_FIMV_SI_CH0_CPB_SIZE	0x2058 /* max size of coded pic. buf */
183#define S5P_FIMV_SI_CH0_DESC_SIZE	0x205c /* max size of descriptor buf */
184
185#define S5P_FIMV_SI_CH1_SB_ST_ADR	0x2084 /* start addr of stream buf */
186#define S5P_FIMV_SI_CH1_SB_FRM_SIZE	0x2088 /* size of stream buf */
187#define S5P_FIMV_SI_CH1_DESC_ADR	0x208c /* addr of descriptor buf */
188#define S5P_FIMV_SI_CH1_CPB_SIZE	0x2098 /* max size of coded pic. buf */
189#define S5P_FIMV_SI_CH1_DESC_SIZE	0x209c /* max size of descriptor buf */
190
191#define S5P_FIMV_CRC_LUMA0		0x2030 /* luma crc data per frame
192								(top field) */
193#define S5P_FIMV_CRC_CHROMA0		0x2034 /* chroma crc data per frame
194								(top field) */
195#define S5P_FIMV_CRC_LUMA1		0x2038 /* luma crc data per bottom
196								field */
197#define S5P_FIMV_CRC_CHROMA1		0x203c /* chroma crc data per bottom
198								field */
199
200/* Display status */
201#define S5P_FIMV_DEC_STATUS_DECODING_ONLY		0
202#define S5P_FIMV_DEC_STATUS_DECODING_DISPLAY		1
203#define S5P_FIMV_DEC_STATUS_DISPLAY_ONLY		2
204#define S5P_FIMV_DEC_STATUS_DECODING_EMPTY		3
205#define S5P_FIMV_DEC_STATUS_DECODING_STATUS_MASK	7
206#define S5P_FIMV_DEC_STATUS_PROGRESSIVE			(0<<3)
207#define S5P_FIMV_DEC_STATUS_INTERLACE			(1<<3)
208#define S5P_FIMV_DEC_STATUS_INTERLACE_MASK		(1<<3)
209#define S5P_FIMV_DEC_STATUS_CRC_NUMBER_TWO		(0<<4)
210#define S5P_FIMV_DEC_STATUS_CRC_NUMBER_FOUR		(1<<4)
211#define S5P_FIMV_DEC_STATUS_CRC_NUMBER_MASK		(1<<4)
212#define S5P_FIMV_DEC_STATUS_CRC_GENERATED		(1<<5)
213#define S5P_FIMV_DEC_STATUS_CRC_NOT_GENERATED		(0<<5)
214#define S5P_FIMV_DEC_STATUS_CRC_MASK			(1<<5)
215
216#define S5P_FIMV_DEC_STATUS_RESOLUTION_MASK		(3<<4)
217#define S5P_FIMV_DEC_STATUS_RESOLUTION_INC		(1<<4)
218#define S5P_FIMV_DEC_STATUS_RESOLUTION_DEC		(2<<4)
219
220/* Decode frame address */
221#define S5P_FIMV_DECODE_Y_ADR			0x2024
222#define S5P_FIMV_DECODE_C_ADR			0x2028
223
224/* Decoded frame tpe */
225#define S5P_FIMV_DECODE_FRAME_TYPE		0x2020
226#define S5P_FIMV_DECODE_FRAME_MASK		7
227
228#define S5P_FIMV_DECODE_FRAME_SKIPPED		0
229#define S5P_FIMV_DECODE_FRAME_I_FRAME		1
230#define S5P_FIMV_DECODE_FRAME_P_FRAME		2
231#define S5P_FIMV_DECODE_FRAME_B_FRAME		3
232#define S5P_FIMV_DECODE_FRAME_OTHER_FRAME	4
233
234/* Sizes of buffers required for decoding */
235#define S5P_FIMV_DEC_NB_IP_SIZE			(32 * 1024)
236#define S5P_FIMV_DEC_VERT_NB_MV_SIZE		(16 * 1024)
237#define S5P_FIMV_DEC_NB_DCAC_SIZE		(16 * 1024)
238#define S5P_FIMV_DEC_UPNB_MV_SIZE		(68 * 1024)
239#define S5P_FIMV_DEC_SUB_ANCHOR_MV_SIZE		(136 * 1024)
240#define S5P_FIMV_DEC_OVERLAP_TRANSFORM_SIZE     (32 * 1024)
241#define S5P_FIMV_DEC_VC1_BITPLANE_SIZE		(2 * 1024)
242#define S5P_FIMV_DEC_STX_PARSER_SIZE		(68 * 1024)
243
244#define S5P_FIMV_DEC_BUF_ALIGN			(8 * 1024)
245#define S5P_FIMV_ENC_BUF_ALIGN			(8 * 1024)
246#define S5P_FIMV_NV12M_HALIGN			16
247#define S5P_FIMV_NV12M_LVALIGN			16
248#define S5P_FIMV_NV12M_CVALIGN			8
249#define S5P_FIMV_NV12MT_HALIGN			128
250#define S5P_FIMV_NV12MT_VALIGN			32
251#define S5P_FIMV_NV12M_SALIGN			2048
252#define S5P_FIMV_NV12MT_SALIGN			8192
253
254/* Sizes of buffers required for encoding */
255#define S5P_FIMV_ENC_UPMV_SIZE		0x10000
256#define S5P_FIMV_ENC_COLFLG_SIZE	0x10000
257#define S5P_FIMV_ENC_INTRAMD_SIZE	0x10000
258#define S5P_FIMV_ENC_INTRAPRED_SIZE	0x4000
259#define S5P_FIMV_ENC_NBORINFO_SIZE	0x10000
260#define S5P_FIMV_ENC_ACDCCOEF_SIZE	0x10000
261
262/* Encoder */
263#define S5P_FIMV_ENC_SI_STRM_SIZE	0x2004 /* stream size */
264#define S5P_FIMV_ENC_SI_PIC_CNT		0x2008 /* picture count */
265#define S5P_FIMV_ENC_SI_WRITE_PTR	0x200c /* write pointer */
266#define S5P_FIMV_ENC_SI_SLICE_TYPE	0x2010 /* slice type(I/P/B/IDR) */
267#define S5P_FIMV_ENC_SI_SLICE_TYPE_NON_CODED	0
268#define S5P_FIMV_ENC_SI_SLICE_TYPE_I		1
269#define S5P_FIMV_ENC_SI_SLICE_TYPE_P		2
270#define S5P_FIMV_ENC_SI_SLICE_TYPE_B		3
271#define S5P_FIMV_ENC_SI_SLICE_TYPE_SKIPPED	4
272#define S5P_FIMV_ENC_SI_SLICE_TYPE_OTHERS	5
273#define S5P_FIMV_ENCODED_Y_ADDR         0x2014 /* the addr of the encoded
274								luma pic */
275#define S5P_FIMV_ENCODED_C_ADDR         0x2018 /* the addr of the encoded
276								chroma pic */
277
278#define S5P_FIMV_ENC_SI_CH0_SB_ADR	0x2044 /* addr of stream buf */
279#define S5P_FIMV_ENC_SI_CH0_SB_SIZE	0x204c /* size of stream buf */
280#define S5P_FIMV_ENC_SI_CH0_CUR_Y_ADR	0x2050 /* current Luma addr */
281#define S5P_FIMV_ENC_SI_CH0_CUR_C_ADR	0x2054 /* current Chroma addr */
282#define S5P_FIMV_ENC_SI_CH0_FRAME_INS	0x2058 /* frame insertion */
283
284#define S5P_FIMV_ENC_SI_CH1_SB_ADR	0x2084 /* addr of stream buf */
285#define S5P_FIMV_ENC_SI_CH1_SB_SIZE	0x208c /* size of stream buf */
286#define S5P_FIMV_ENC_SI_CH1_CUR_Y_ADR	0x2090 /* current Luma addr */
287#define S5P_FIMV_ENC_SI_CH1_CUR_C_ADR	0x2094 /* current Chroma addr */
288#define S5P_FIMV_ENC_SI_CH1_FRAME_INS	0x2098 /* frame insertion */
289
290#define S5P_FIMV_ENC_PIC_TYPE_CTRL	0xc504 /* pic type level control */
291#define S5P_FIMV_ENC_B_RECON_WRITE_ON	0xc508 /* B frame recon write ctrl */
292#define S5P_FIMV_ENC_MSLICE_CTRL	0xc50c /* multi slice control */
293#define S5P_FIMV_ENC_MSLICE_MB		0xc510 /* MB number in the one slice */
294#define S5P_FIMV_ENC_MSLICE_BIT		0xc514 /* bit count for one slice */
295#define S5P_FIMV_ENC_CIR_CTRL		0xc518 /* number of intra refresh MB */
296#define S5P_FIMV_ENC_MAP_FOR_CUR	0xc51c /* linear or tiled mode */
297#define S5P_FIMV_ENC_PADDING_CTRL	0xc520 /* padding control */
298
299#define S5P_FIMV_ENC_RC_CONFIG		0xc5a0 /* RC config */
300#define S5P_FIMV_ENC_RC_BIT_RATE	0xc5a8 /* bit rate */
301#define S5P_FIMV_ENC_RC_QBOUND		0xc5ac /* max/min QP */
302#define S5P_FIMV_ENC_RC_RPARA		0xc5b0 /* rate control reaction coeff */
303#define S5P_FIMV_ENC_RC_MB_CTRL		0xc5b4 /* MB adaptive scaling */
304
305/* Encoder for H264 only */
306#define S5P_FIMV_ENC_H264_ENTROPY_MODE	0xd004 /* CAVLC or CABAC */
307#define S5P_FIMV_ENC_H264_ALPHA_OFF	0xd008 /* loop filter alpha offset */
308#define S5P_FIMV_ENC_H264_BETA_OFF	0xd00c /* loop filter beta offset */
309#define S5P_FIMV_ENC_H264_NUM_OF_REF	0xd010 /* number of reference for P/B */
310#define S5P_FIMV_ENC_H264_TRANS_FLAG	0xd034 /* 8x8 transform flag in PPS &
311								high profile */
312
313#define S5P_FIMV_ENC_RC_FRAME_RATE	0xd0d0 /* frame rate */
314
315/* Encoder for MPEG4 only */
316#define S5P_FIMV_ENC_MPEG4_QUART_PXL	0xe008 /* qpel interpolation ctrl */
317
318/* Additional */
319#define S5P_FIMV_SI_CH0_DPB_CONF_CTRL   0x2068 /* DPB Config Control Register */
320#define S5P_FIMV_SLICE_INT_MASK		1
321#define S5P_FIMV_SLICE_INT_SHIFT	31
322#define S5P_FIMV_DDELAY_ENA_SHIFT	30
323#define S5P_FIMV_DDELAY_VAL_MASK	0xff
324#define S5P_FIMV_DDELAY_VAL_SHIFT	16
325#define S5P_FIMV_DPB_COUNT_MASK		0xffff
326#define S5P_FIMV_DPB_FLUSH_MASK		1
327#define S5P_FIMV_DPB_FLUSH_SHIFT	14
328
329
330#define S5P_FIMV_SI_CH0_RELEASE_BUF     0x2060 /* DPB release buffer register */
331#define S5P_FIMV_SI_CH0_HOST_WR_ADR	0x2064 /* address of shared memory */
332
333/* Codec numbers  */
334#define S5P_FIMV_CODEC_NONE		-1
335
336#define S5P_FIMV_CODEC_H264_DEC		0
337#define S5P_FIMV_CODEC_VC1_DEC		1
338#define S5P_FIMV_CODEC_MPEG4_DEC	2
339#define S5P_FIMV_CODEC_MPEG2_DEC	3
340#define S5P_FIMV_CODEC_H263_DEC		4
341#define S5P_FIMV_CODEC_VC1RCV_DEC	5
342
343#define S5P_FIMV_CODEC_H264_ENC		16
344#define S5P_FIMV_CODEC_MPEG4_ENC	17
345#define S5P_FIMV_CODEC_H263_ENC		18
346
347/* Channel Control Register */
348#define S5P_FIMV_CH_SEQ_HEADER		1
349#define S5P_FIMV_CH_FRAME_START		2
350#define S5P_FIMV_CH_LAST_FRAME		3
351#define S5P_FIMV_CH_INIT_BUFS		4
352#define S5P_FIMV_CH_FRAME_START_REALLOC	5
353#define S5P_FIMV_CH_MASK		7
354#define S5P_FIMV_CH_SHIFT		16
355
356
357/* Host to RISC command */
358#define S5P_FIMV_H2R_CMD_EMPTY		0
359#define S5P_FIMV_H2R_CMD_OPEN_INSTANCE	1
360#define S5P_FIMV_H2R_CMD_CLOSE_INSTANCE	2
361#define S5P_FIMV_H2R_CMD_SYS_INIT	3
362#define S5P_FIMV_H2R_CMD_FLUSH		4
363#define S5P_FIMV_H2R_CMD_SLEEP		5
364#define S5P_FIMV_H2R_CMD_WAKEUP		6
365
366#define S5P_FIMV_R2H_CMD_EMPTY			0
367#define S5P_FIMV_R2H_CMD_OPEN_INSTANCE_RET	1
368#define S5P_FIMV_R2H_CMD_CLOSE_INSTANCE_RET	2
369#define S5P_FIMV_R2H_CMD_RSV_RET		3
370#define S5P_FIMV_R2H_CMD_SEQ_DONE_RET		4
371#define S5P_FIMV_R2H_CMD_FRAME_DONE_RET		5
372#define S5P_FIMV_R2H_CMD_SLICE_DONE_RET		6
373#define S5P_FIMV_R2H_CMD_ENC_COMPLETE_RET	7
374#define S5P_FIMV_R2H_CMD_SYS_INIT_RET		8
375#define S5P_FIMV_R2H_CMD_FW_STATUS_RET		9
376#define S5P_FIMV_R2H_CMD_SLEEP_RET		10
377#define S5P_FIMV_R2H_CMD_WAKEUP_RET		11
378#define S5P_FIMV_R2H_CMD_FLUSH_RET		12
379#define S5P_FIMV_R2H_CMD_INIT_BUFFERS_RET	15
380#define S5P_FIMV_R2H_CMD_EDFU_INIT_RET		16
381#define S5P_FIMV_R2H_CMD_ERR_RET		32
382
383/* Error handling defines */
384#define S5P_FIMV_ERR_WARNINGS_START		145
385#define S5P_FIMV_ERR_DEC_MASK			0xFFFF
386#define S5P_FIMV_ERR_DEC_SHIFT			0
387#define S5P_FIMV_ERR_DSPL_MASK			0xFFFF0000
388#define S5P_FIMV_ERR_DSPL_SHIFT			16
389
390/* Shared memory registers' offsets */
391
392/* An offset of the start position in the stream when
393 * the start position is not aligned */
394#define S5P_FIMV_SHARED_CROP_INFO_H		0x0020
395#define S5P_FIMV_SHARED_CROP_LEFT_MASK		0xFFFF
396#define S5P_FIMV_SHARED_CROP_LEFT_SHIFT		0
397#define S5P_FIMV_SHARED_CROP_RIGHT_MASK		0xFFFF0000
398#define S5P_FIMV_SHARED_CROP_RIGHT_SHIFT	16
399#define S5P_FIMV_SHARED_CROP_INFO_V		0x0024
400#define S5P_FIMV_SHARED_CROP_TOP_MASK		0xFFFF
401#define S5P_FIMV_SHARED_CROP_TOP_SHIFT		0
402#define S5P_FIMV_SHARED_CROP_BOTTOM_MASK	0xFFFF0000
403#define S5P_FIMV_SHARED_CROP_BOTTOM_SHIFT	16
404#define S5P_FIMV_SHARED_SET_FRAME_TAG		0x0004
405#define S5P_FIMV_SHARED_GET_FRAME_TAG_TOP	0x0008
406#define S5P_FIMV_SHARED_GET_FRAME_TAG_BOT	0x000C
407#define S5P_FIMV_SHARED_START_BYTE_NUM		0x0018
408#define S5P_FIMV_SHARED_RC_VOP_TIMING		0x0030
409#define S5P_FIMV_SHARED_LUMA_DPB_SIZE		0x0064
410#define S5P_FIMV_SHARED_CHROMA_DPB_SIZE		0x0068
411#define S5P_FIMV_SHARED_MV_SIZE			0x006C
412#define S5P_FIMV_SHARED_PIC_TIME_TOP		0x0010
413#define S5P_FIMV_SHARED_PIC_TIME_BOTTOM		0x0014
414#define S5P_FIMV_SHARED_EXT_ENC_CONTROL		0x0028
415#define S5P_FIMV_SHARED_P_B_FRAME_QP		0x0070
416#define S5P_FIMV_SHARED_ASPECT_RATIO_IDC	0x0074
417#define S5P_FIMV_SHARED_EXTENDED_SAR		0x0078
418#define S5P_FIMV_SHARED_H264_I_PERIOD		0x009C
419#define S5P_FIMV_SHARED_RC_CONTROL_CONFIG	0x00A0
420#define S5P_FIMV_SHARED_DISP_FRAME_TYPE_SHIFT	2
421
422/* Offset used by the hardware to store addresses */
423#define MFC_OFFSET_SHIFT	11
424
425#define FIRMWARE_ALIGN		(128 * SZ_1K)	/* 128KB */
426#define MFC_H264_CTX_BUF_SIZE	(600 * SZ_1K)	/* 600KB per H264 instance */
427#define MFC_CTX_BUF_SIZE	(10 * SZ_1K)	/* 10KB per instance */
428#define DESC_BUF_SIZE		(128 * SZ_1K)	/* 128KB for DESC buffer */
429#define SHARED_BUF_SIZE		(8 * SZ_1K)	/* 8KB for shared buffer */
430
431#define DEF_CPB_SIZE		(256 * SZ_1K)	/* 256KB */
432#define MAX_CPB_SIZE		(4 * SZ_1M)	/* 4MB */
433#define MAX_FW_SIZE		(384 * SZ_1K)
434
435#define MFC_VERSION		0x51
436#define MFC_NUM_PORTS		2
437
438#endif /* _REGS_FIMV_H */
439