upload tizen1.0 source
[kernel/linux-2.6.36.git] / arch / arm / plat-s5p / include / plat / regs-fimc.h
1 /* linux/arch/arm/plat-s5p/include/plat/regs-fimc.h
2  *
3  * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4  *              http://www.samsung.com/
5  *
6  * Register definition file for Samsung Camera Interface (FIMC) driver
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11 */
12
13 #ifndef __ASM_PLAT_REGS_FIMC_H
14 #define __ASM_PLAT_REGS_FIMC_H __FILE__
15
16 /*
17  * Register part
18 */
19 #define S3C_CISRCFMT            (0x00)  /* Input source format */
20 #define S3C_CIWDOFST            (0x04)  /* Window offset */
21 #define S3C_CIGCTRL             (0x08)  /* Global control */
22 #define S3C_CIWDOFST2           (0x14)  /* Window offset 2 */
23 #define S3C_CIOYSA1             (0x18)  /* Y 1st frame start address for output DMA */
24 #define S3C_CIOYSA2             (0x1c)  /* Y 2nd frame start address for output DMA */
25 #define S3C_CIOYSA3             (0x20)  /* Y 3rd frame start address for output DMA */
26 #define S3C_CIOYSA4             (0x24)  /* Y 4th frame start address for output DMA */
27 #define S3C_CIOCBSA1            (0x28)  /* Cb 1st frame start address for output DMA */
28 #define S3C_CIOCBSA2            (0x2c)  /* Cb 2nd frame start address for output DMA */
29 #define S3C_CIOCBSA3            (0x30)  /* Cb 3rd frame start address for output DMA */
30 #define S3C_CIOCBSA4            (0x34)  /* Cb 4th frame start address for output DMA */
31 #define S3C_CIOCRSA1            (0x38)  /* Cr 1st frame start address for output DMA */
32 #define S3C_CIOCRSA2            (0x3c)  /* Cr 2nd frame start address for output DMA */
33 #define S3C_CIOCRSA3            (0x40)  /* Cr 3rd frame start address for output DMA */
34 #define S3C_CIOCRSA4            (0x44)  /* Cr 4th frame start address for output DMA */
35 #define S3C_CITRGFMT            (0x48)  /* Target image format */
36 #define S3C_CIOCTRL             (0x4c)  /* Output DMA control */
37 #define S3C_CISCPRERATIO        (0x50)  /* Pre-scaler control 1 */
38 #define S3C_CISCPREDST          (0x54)  /* Pre-scaler control 2 */
39 #define S3C_CISCCTRL            (0x58)  /* Main scaler control */
40 #define S3C_CITAREA             (0x5c)  /* Target area */
41 #define S3C_CISTATUS            (0x64)  /* Status */
42 #define S3C_CISTATUS2           (0x68)  /* Status2 */
43 #define S3C_CIIMGCPT            (0xc0)  /* Image capture enable command */
44 #define S3C_CICPTSEQ            (0xc4)  /* Capture sequence */
45 #define S3C_CIIMGEFF            (0xd0)  /* Image effects */
46 #define S3C_CIIYSA0             (0xd4)  /* Y frame start address for input DMA */
47 #define S3C_CIICBSA0            (0xd8)  /* Cb frame start address for input DMA */
48 #define S3C_CIICRSA0            (0xdc)  /* Cr frame start address for input DMA */
49 #define S3C_CIILINESKIP_Y       (0xec)  /* Input DMA Y Line Skip */
50 #define S3C_CIILINESKIP_CB      (0xf0)  /* Input DMA Cb Line Skip */
51 #define S3C_CIILINESKIP_CR      (0xf4)  /* Input DMA Cr Line Skip */
52 #define S3C_CIREAL_ISIZE        (0xf8)  /* Real input DMA image size */
53 #define S3C_MSCTRL              (0xfc)  /* Input DMA control */
54 #define S3C_CIOYOFF             (0x168) /* Output DMA Y offset */
55 #define S3C_CIOCBOFF            (0x16c) /* Output DMA CB offset */
56 #define S3C_CIOCROFF            (0x170) /* Output DMA CR offset */
57 #define S3C_CIIYOFF             (0x174) /* Input DMA Y offset */
58 #define S3C_CIICBOFF            (0x178) /* Input DMA CB offset */
59 #define S3C_CIICROFF            (0x17c) /* Input DMA CR offset */
60 #define S3C_ORGISIZE            (0x180) /* Input DMA original image size */
61 #define S3C_ORGOSIZE            (0x184) /* Output DMA original image size */
62 #define S3C_CIEXTEN             (0x188) /* Real output DMA image size */
63 #define S3C_CIDMAPARAM          (0x18c) /* DMA parameter */
64 #define S3C_CSIIMGFMT           (0x194) /* MIPI CSI image format */
65 #define S3C_MISC_FIMC           (0x198) /* FIMC Clock Source Select */
66
67 /* Add for FIMC v5.1 */
68 #define S3C_CIFCNTSEQ           (0x1fc) /* Output Frame Buffer Sequence */
69 #define S3C_CIOYSA5             (0x200) /* Y 5th frame start address for output DMA */
70 #define S3C_CIOYSA6             (0x204) /* Y 6th frame start address for output DMA */
71 #define S3C_CIOYSA7             (0x208) /* Y 7th frame start address for output DMA */
72 #define S3C_CIOYSA8             (0x20c) /* Y 8th frame start address for output DMA */
73 #define S3C_CIOYSA9             (0x210) /* Y 9th frame start address for output DMA */
74 #define S3C_CIOYSA10            (0x214) /* Y 10th frame start address for output DMA */
75 #define S3C_CIOYSA11            (0x218) /* Y 11th frame start address for output DMA */
76 #define S3C_CIOYSA12            (0x21c) /* Y 12th frame start address for output DMA */
77 #define S3C_CIOYSA13            (0x220) /* Y 13th frame start address for output DMA */
78 #define S3C_CIOYSA14            (0x224) /* Y 14th frame start address for output DMA */
79 #define S3C_CIOYSA15            (0x228) /* Y 15th frame start address for output DMA */
80 #define S3C_CIOYSA16            (0x22c) /* Y 16th frame start address for output DMA */
81 #define S3C_CIOYSA17            (0x230) /* Y 17th frame start address for output DMA */
82 #define S3C_CIOYSA18            (0x234) /* Y 18th frame start address for output DMA */
83 #define S3C_CIOYSA19            (0x238) /* Y 19th frame start address for output DMA */
84 #define S3C_CIOYSA20            (0x23c) /* Y 20th frame start address for output DMA */
85 #define S3C_CIOYSA21            (0x240) /* Y 21th frame start address for output DMA */
86 #define S3C_CIOYSA22            (0x244) /* Y 22th frame start address for output DMA */
87 #define S3C_CIOYSA23            (0x248) /* Y 23th frame start address for output DMA */
88 #define S3C_CIOYSA24            (0x24c) /* Y 24th frame start address for output DMA */
89 #define S3C_CIOYSA25            (0x250) /* Y 25th frame start address for output DMA */
90 #define S3C_CIOYSA26            (0x254) /* Y 26th frame start address for output DMA */
91 #define S3C_CIOYSA27            (0x258) /* Y 27th frame start address for output DMA */
92 #define S3C_CIOYSA28            (0x25c) /* Y 28th frame start address for output DMA */
93 #define S3C_CIOYSA29            (0x260) /* Y 29th frame start address for output DMA */
94 #define S3C_CIOYSA30            (0x264) /* Y 30th frame start address for output DMA */
95 #define S3C_CIOYSA31            (0x268) /* Y 31th frame start address for output DMA */
96 #define S3C_CIOYSA32            (0x26c) /* Y 32th frame start address for output DMA */
97
98 #define S3C_CIOCBSA5            (0x270) /* CB 5th frame start address for output DMA */
99 #define S3C_CIOCBSA6            (0x274) /* CB 6th frame start address for output DMA */
100 #define S3C_CIOCBSA7            (0x278) /* CB 7th frame start address for output DMA */
101 #define S3C_CIOCBSA8            (0x27c) /* CB 8th frame start address for output DMA */
102 #define S3C_CIOCBSA9            (0x280) /* CB 9th frame start address for output DMA */
103 #define S3C_CIOCBSA10           (0x284) /* CB 10th frame start address for output DMA */
104 #define S3C_CIOCBSA11           (0x288) /* CB 11th frame start address for output DMA */
105 #define S3C_CIOCBSA12           (0x28c) /* CB 12th frame start address for output DMA */
106 #define S3C_CIOCBSA13           (0x290) /* CB 13th frame start address for output DMA */
107 #define S3C_CIOCBSA14           (0x294) /* CB 14th frame start address for output DMA */
108 #define S3C_CIOCBSA15           (0x298) /* CB 15th frame start address for output DMA */
109 #define S3C_CIOCBSA16           (0x29c) /* CB 16th frame start address for output DMA */
110 #define S3C_CIOCBSA17           (0x2a0) /* CB 17th frame start address for output DMA */
111 #define S3C_CIOCBSA18           (0x2a4) /* CB 18th frame start address for output DMA */
112 #define S3C_CIOCBSA19           (0x2a8) /* CB 19th frame start address for output DMA */
113 #define S3C_CIOCBSA20           (0x2ac) /* CB 20th frame start address for output DMA */
114 #define S3C_CIOCBSA21           (0x2b0) /* CB 21th frame start address for output DMA */
115 #define S3C_CIOCBSA22           (0x2b4) /* CB 22th frame start address for output DMA */
116 #define S3C_CIOCBSA23           (0x2b8) /* CB 23th frame start address for output DMA */
117 #define S3C_CIOCBSA24           (0x2bc) /* CB 24th frame start address for output DMA */
118 #define S3C_CIOCBSA25           (0x2c0) /* CB 25th frame start address for output DMA */
119 #define S3C_CIOCBSA26           (0x2c4) /* CB 26th frame start address for output DMA */
120 #define S3C_CIOCBSA27           (0x2c8) /* CB 27th frame start address for output DMA */
121 #define S3C_CIOCBSA28           (0x2cc) /* CB 28th frame start address for output DMA */
122 #define S3C_CIOCBSA29           (0x2d0) /* CB 29th frame start address for output DMA */
123 #define S3C_CIOCBSA30           (0x2d4) /* CB 30th frame start address for output DMA */
124 #define S3C_CIOCBSA31           (0x2d8) /* CB 31th frame start address for output DMA */
125 #define S3C_CIOCBSA32           (0x2dc) /* CB 32th frame start address for output DMA */
126
127 #define S3C_CIOCRSA5            (0x2e0) /* CR 5th frame start address for output DMA */
128 #define S3C_CIOCRSA6            (0x2e4) /* CR 6th frame start address for output DMA */
129 #define S3C_CIOCRSA7            (0x2e8) /* CR 7th frame start address for output DMA */
130 #define S3C_CIOCRSA8            (0x2ec) /* CR 8th frame start address for output DMA */
131 #define S3C_CIOCRSA9            (0x2f0) /* CR 9th frame start address for output DMA */
132 #define S3C_CIOCRSA10           (0x2f4) /* CR 10th frame start address for output DMA */
133 #define S3C_CIOCRSA11           (0x2f8) /* CR 11th frame start address for output DMA */
134 #define S3C_CIOCRSA12           (0x2fc) /* CR 12th frame start address for output DMA */
135 #define S3C_CIOCRSA13           (0x300) /* CR 13th frame start address for output DMA */
136 #define S3C_CIOCRSA14           (0x304) /* CR 14th frame start address for output DMA */
137 #define S3C_CIOCRSA15           (0x308) /* CR 15th frame start address for output DMA */
138 #define S3C_CIOCRSA16           (0x30c) /* CR 16th frame start address for output DMA */
139 #define S3C_CIOCRSA17           (0x310) /* CR 17th frame start address for output DMA */
140 #define S3C_CIOCRSA18           (0x314) /* CR 18th frame start address for output DMA */
141 #define S3C_CIOCRSA19           (0x318) /* CR 19th frame start address for output DMA */
142 #define S3C_CIOCRSA20           (0x31c) /* CR 20th frame start address for output DMA */
143 #define S3C_CIOCRSA21           (0x320) /* CR 21th frame start address for output DMA */
144 #define S3C_CIOCRSA22           (0x324) /* CR 22th frame start address for output DMA */
145 #define S3C_CIOCRSA23           (0x328) /* CR 23th frame start address for output DMA */
146 #define S3C_CIOCRSA24           (0x32c) /* CR 24th frame start address for output DMA */
147 #define S3C_CIOCRSA25           (0x330) /* CR 25th frame start address for output DMA */
148 #define S3C_CIOCRSA26           (0x334) /* CR 26th frame start address for output DMA */
149 #define S3C_CIOCRSA27           (0x338) /* CR 27th frame start address for output DMA */
150 #define S3C_CIOCRSA28           (0x33c) /* CR 28th frame start address for output DMA */
151 #define S3C_CIOCRSA29           (0x340) /* CR 29th frame start address for output DMA */
152 #define S3C_CIOCRSA30           (0x344) /* CR 30th frame start address for output DMA */
153 #define S3C_CIOCRSA31           (0x348) /* CR 31th frame start address for output DMA */
154 #define S3C_CIOCRSA32           (0x34c) /* CR 32th frame start address for output DMA */
155 /*
156  * Macro part
157 */
158 /* frame start address 1 ~ 4, 5 ~ 32 */
159 #define DEF_PP          4 /* Number of Default PingPong Memory */
160 #define S3C_CIOYSA(__x)         \
161         (((__x) < DEF_PP) ?     \
162          (S3C_CIOYSA1  + (__x) * 4) : (S3C_CIOYSA5  + ((__x) - DEF_PP) * 4))
163 #define S3C_CIOCBSA(__x)        \
164         (((__x) < DEF_PP) ?     \
165          (S3C_CIOCBSA1 + (__x) * 4) : (S3C_CIOCBSA5 + ((__x) - DEF_PP) * 4))
166 #define S3C_CIOCRSA(__x)        \
167         (((__x) < DEF_PP) ?     \
168          (S3C_CIOCRSA1 + (__x) * 4) : (S3C_CIOCRSA5 + ((__x) - DEF_PP) * 4))
169
170 #define S3C_CISRCFMT_SOURCEHSIZE(x)             ((x) << 16)
171 #define S3C_CISRCFMT_SOURCEVSIZE(x)             ((x) << 0)
172
173 #define S3C_CIWDOFST_WINHOROFST(x)              ((x) << 16)
174 #define S3C_CIWDOFST_WINVEROFST(x)              ((x) << 0)
175
176 #define S3C_CIWDOFST2_WINHOROFST2(x)            ((x) << 16)
177 #define S3C_CIWDOFST2_WINVEROFST2(x)            ((x) << 0)
178
179 #define S3C_CITRGFMT_TARGETHSIZE(x)             (((x) & 0x1fff) << 16)
180 #define S3C_CITRGFMT_TARGETVSIZE(x)             (((x) & 0x1fff) << 0)
181
182 #define S3C_CISCPRERATIO_SHFACTOR(x)            ((x) << 28)
183 #define S3C_CISCPRERATIO_PREHORRATIO(x)         ((x) << 16)
184 #define S3C_CISCPRERATIO_PREVERRATIO(x)         ((x) << 0)
185
186 #define S3C_CISCPREDST_PREDSTWIDTH(x)           ((x) << 16)
187 #define S3C_CISCPREDST_PREDSTHEIGHT(x)          ((x) << 0)
188
189 #define S3C_CISCCTRL_MAINHORRATIO(x)            ((x) << 16)
190 #define S3C_CISCCTRL_MAINVERRATIO(x)            ((x) << 0)
191
192 #define S3C_CITAREA_TARGET_AREA(x)              ((x) << 0)
193
194 #define S3C_CISTATUS_GET_FRAME_COUNT(x)         (((x) >> 26) & 0x3)
195 #define S3C_CISTATUS_GET_FRAME_END(x)           (((x) >> 17) & 0x1)
196 #define S3C_CISTATUS_GET_LAST_CAPTURE_END(x)    (((x) >> 16) & 0x1)
197 #define S3C_CISTATUS_GET_LCD_STATUS(x)          (((x) >> 9) & 0x1)
198 #define S3C_CISTATUS_GET_ENVID_STATUS(x)        ((x) & 0x1)
199
200 #define S3C_CISTATUS2_GET_FRAMECOUNT_BEFORE(x)  (((x) >> 7) & 0x3f)
201 #define S3C_CISTATUS2_GET_FRAMECOUNT_PRESENT(x) ((x) & 0x3f)
202
203 #define S3C_CIIMGEFF_FIN(x)                     ((x & 0x7) << 26)
204 #define S3C_CIIMGEFF_PAT_CB(x)                  ((x) << 13)
205 #define S3C_CIIMGEFF_PAT_CR(x)                  ((x) << 0)
206
207 #define S3C_CIILINESKIP(x)                      (((x) & 0xf) << 24)
208
209 #define S3C_CIREAL_ISIZE_HEIGHT(x)              ((x) << 16)
210 #define S3C_CIREAL_ISIZE_WIDTH(x)               ((x) << 0)
211
212 #define S3C_MSCTRL_SUCCESSIVE_COUNT(x)          ((x) << 24)
213 #define S3C_MSCTRL_GET_INDMA_STATUS(x)          ((x) & 0x1)
214
215 #define S3C_CIOYOFF_VERTICAL(x)                 ((x) << 16)
216 #define S3C_CIOYOFF_HORIZONTAL(x)               ((x) << 0)
217
218 #define S3C_CIOCBOFF_VERTICAL(x)                ((x) << 16)
219 #define S3C_CIOCBOFF_HORIZONTAL(x)              ((x) << 0)
220
221 #define S3C_CIOCROFF_VERTICAL(x)                ((x) << 16)
222 #define S3C_CIOCROFF_HORIZONTAL(x)              ((x) << 0)
223
224 #define S3C_CIIYOFF_VERTICAL(x)                 ((x) << 16)
225 #define S3C_CIIYOFF_HORIZONTAL(x)               ((x) << 0)
226
227 #define S3C_CIICBOFF_VERTICAL(x)                ((x) << 16)
228 #define S3C_CIICBOFF_HORIZONTAL(x)              ((x) << 0)
229
230 #define S3C_CIICROFF_VERTICAL(x)                ((x) << 16)
231 #define S3C_CIICROFF_HORIZONTAL(x)              ((x) << 0)
232
233 #define S3C_ORGISIZE_VERTICAL(x)                ((x) << 16)
234 #define S3C_ORGISIZE_HORIZONTAL(x)              ((x) << 0)
235
236 #define S3C_ORGOSIZE_VERTICAL(x)                ((x) << 16)
237 #define S3C_ORGOSIZE_HORIZONTAL(x)              ((x) << 0)
238
239 #define S3C_CIEXTEN_TARGETH_EXT(x)              (((x) & 0x2000) << 26)
240 #define S3C_CIEXTEN_TARGETV_EXT(x)              (((x) & 0x2000) << 24)
241 #define S3C_CIEXTEN_MAINHORRATIO_EXT(x)         (((x) & 0x3F) << 10)
242 #define S3C_CIEXTEN_MAINVERRATIO_EXT(x)         ((x) & 0x3F)
243
244 /*
245  * Bit definition part
246 */
247 /* Source format register */
248 #define S3C_CISRCFMT_ITU601_8BIT                (1 << 31)
249 #define S3C_CISRCFMT_ITU656_8BIT                (0 << 31)
250 #define S3C_CISRCFMT_ITU601_16BIT               (1 << 29)
251 #define S3C_CISRCFMT_ORDER422_YCBYCR            (0 << 14)
252 #define S3C_CISRCFMT_ORDER422_YCRYCB            (1 << 14)
253 #define S3C_CISRCFMT_ORDER422_CBYCRY            (2 << 14)
254 #define S3C_CISRCFMT_ORDER422_CRYCBY            (3 << 14)
255 #define S3C_CISRCFMT_ORDER422_Y4CBCRCBCR        (0 << 14)       /* ITU601 16bit only */
256 #define S3C_CISRCFMT_ORDER422_Y4CRCBCRCB        (1 << 14)       /* ITU601 16bit only */
257
258 /* Window offset register */
259 #define S3C_CIWDOFST_WINOFSEN                   (1 << 31)
260 #define S3C_CIWDOFST_CLROVFIY                   (1 << 30)
261 #define S3C_CIWDOFST_CLROVRLB                   (1 << 29)
262 #define S3C_CIWDOFST_WINHOROFST_MASK            (0x7ff << 16)
263 #define S3C_CIWDOFST_CLROVFICB                  (1 << 15)
264 #define S3C_CIWDOFST_CLROVFICR                  (1 << 14)
265 #define S3C_CIWDOFST_WINVEROFST_MASK            (0xfff << 0)
266
267 /* Global control register */
268 #define S3C_CIGCTRL_SWRST                       (1 << 31)
269 #define S3C_CIGCTRL_CAMRST_A                    (1 << 30)
270 #define S3C_CIGCTRL_SELCAM_ITU_B                (0 << 29)
271 #define S3C_CIGCTRL_SELCAM_ITU_A                (1 << 29)
272 #define S3C_CIGCTRL_SELCAM_ITU_MASK             (1 << 29)
273 #define S3C_CIGCTRL_TESTPATTERN_NORMAL          (0 << 27)
274 #define S3C_CIGCTRL_TESTPATTERN_COLOR_BAR       (1 << 27)
275 #define S3C_CIGCTRL_TESTPATTERN_HOR_INC         (2 << 27)
276 #define S3C_CIGCTRL_TESTPATTERN_VER_INC         (3 << 27)
277 #define S3C_CIGCTRL_TESTPATTERN_MASK            (3 << 27)
278 #define S3C_CIGCTRL_TESTPATTERN_SHIFT           (27)
279 #define S3C_CIGCTRL_INVPOLPCLK                  (1 << 26)
280 #define S3C_CIGCTRL_INVPOLVSYNC                 (1 << 25)
281 #define S3C_CIGCTRL_INVPOLHREF                  (1 << 24)
282 #define S3C_CIGCTRL_IRQ_OVFEN                   (1 << 22)
283 #define S3C_CIGCTRL_HREF_MASK                   (1 << 21)
284 #define S3C_CIGCTRL_IRQ_EDGE                    (0 << 20)
285 #define S3C_CIGCTRL_IRQ_LEVEL                   (1 << 20)
286 #define S3C_CIGCTRL_IRQ_CLR                     (1 << 19)
287 #define S3C_CIGCTRL_IRQ_END_DISABLE             (1 << 18)
288 #define S3C_CIGCTRL_IRQ_DISABLE                 (0 << 16)
289 #define S3C_CIGCTRL_IRQ_ENABLE                  (1 << 16)
290 #define S3C_CIGCTRL_SHADOW_DISABLE              (1 << 12)
291 #define S3C_CIGCTRL_CAM_JPEG                    (1 << 8)
292 #define S3C_CIGCTRL_SELCAM_MIPI_B               (0 << 7)
293 #define S3C_CIGCTRL_SELCAM_MIPI_A               (1 << 7)
294 #define S3C_CIGCTRL_SELCAM_MIPI_MASK            (1 << 7)
295 #define S3C_CIGCTRL_SELWB_CAMIF_CAMERA          (0 << 6)
296 #define S3C_CIGCTRL_SELWB_CAMIF_WRITEBACK       (1 << 6)
297 #define S3C_CIGCTRL_SELWRITEBACK_MASK           (1 << 10)
298 #define S3C_CIGCTRL_SELWRITEBACK_A              (1 << 10)
299 #define S3C_CIGCTRL_SELWRITEBACK_B              (0 << 10)
300 #define S3C_CIGCTRL_SELWB_CAMIF_MASK            (1 << 6)
301 #define S3C_CIGCTRL_CSC_ITU601                  (0 << 5)
302 #define S3C_CIGCTRL_CSC_ITU709                  (1 << 5)
303 #define S3C_CIGCTRL_CSC_MASK                    (1 << 5)
304 #define S3C_CIGCTRL_INVPOLHSYNC                 (1 << 4)
305 #define S3C_CIGCTRL_SELCAM_FIMC_ITU             (0 << 3)
306 #define S3C_CIGCTRL_SELCAM_FIMC_MIPI            (1 << 3)
307 #define S3C_CIGCTRL_SELCAM_FIMC_MASK            (1 << 3)
308 #define S3C_CIGCTRL_PROGRESSIVE                 (0 << 0)
309 #define S3C_CIGCTRL_INTERLACE                   (1 << 0)
310
311 /* Window offset2 register */
312 #define S3C_CIWDOFST_WINHOROFST2_MASK           (0xfff << 16)
313 #define S3C_CIWDOFST_WINVEROFST2_MASK           (0xfff << 16)
314
315 /* Target format register */
316 #define S3C_CITRGFMT_INROT90_CLOCKWISE          (1 << 31)
317 #define S3C_CITRGFMT_OUTFORMAT_YCBCR420         (0 << 29)
318 #define S3C_CITRGFMT_OUTFORMAT_YCBCR422         (1 << 29)
319 #define S3C_CITRGFMT_OUTFORMAT_YCBCR422_1PLANE  (2 << 29)
320 #define S3C_CITRGFMT_OUTFORMAT_RGB              (3 << 29)
321 #define S3C_CITRGFMT_OUTFORMAT_MASK             (3 << 29)
322 #define S3C_CITRGFMT_FLIP_SHIFT                 (14)
323 #define S3C_CITRGFMT_FLIP_NORMAL                (0 << 14)
324 #define S3C_CITRGFMT_FLIP_X_MIRROR              (1 << 14)
325 #define S3C_CITRGFMT_FLIP_Y_MIRROR              (2 << 14)
326 #define S3C_CITRGFMT_FLIP_180                   (3 << 14)
327 #define S3C_CITRGFMT_FLIP_MASK                  (3 << 14)
328 #define S3C_CITRGFMT_OUTROT90_CLOCKWISE         (1 << 13)
329 #define S3C_CITRGFMT_TARGETV_MASK               (0x1fff << 0)
330 #define S3C_CITRGFMT_TARGETH_MASK               (0x1fff << 16)
331
332 /* Output DMA control register */
333 #define S3C_CIOCTRL_WEAVE_OUT                   (1 << 31)
334 #define S3C_CIOCTRL_WEAVE_MASK                  (1 << 31)
335 #define S3C_CIOCTRL_LASTENDEN                   (1 << 30)
336 #define S3C_CIOCTRL_ORDER2P_LSB_CBCR            (0 << 24)
337 #define S3C_CIOCTRL_ORDER2P_LSB_CRCB            (1 << 24)
338 #define S3C_CIOCTRL_ORDER2P_MSB_CRCB            (2 << 24)
339 #define S3C_CIOCTRL_ORDER2P_MSB_CBCR            (3 << 24)
340 #define S3C_CIOCTRL_ORDER2P_SHIFT               (24)
341 #define S3C_CIOCTRL_ORDER2P_MASK                (3 << 24)
342 #define S3C_CIOCTRL_YCBCR_3PLANE                (0 << 3)
343 #define S3C_CIOCTRL_YCBCR_2PLANE                (1 << 3)
344 #define S3C_CIOCTRL_YCBCR_PLANE_MASK            (1 << 3)
345 #define S3C_CIOCTRL_LASTIRQ_ENABLE              (1 << 2)
346 #define S3C_CIOCTRL_ORDER422_YCBYCR             (0 << 0)
347 #define S3C_CIOCTRL_ORDER422_YCRYCB             (1 << 0)
348 #define S3C_CIOCTRL_ORDER422_CBYCRY             (2 << 0)
349 #define S3C_CIOCTRL_ORDER422_CRYCBY             (3 << 0)
350 #define S3C_CIOCTRL_ORDER422_MASK               (3 << 0)
351
352 /* Main scaler control register */
353 #define S3C_CISCCTRL_SCALERBYPASS               (1 << 31)
354 #define S3C_CISCCTRL_SCALEUP_H                  (1 << 30)
355 #define S3C_CISCCTRL_SCALEUP_V                  (1 << 29)
356 #define S3C_CISCCTRL_CSCR2Y_NARROW              (0 << 28)
357 #define S3C_CISCCTRL_CSCR2Y_WIDE                (1 << 28)
358 #define S3C_CISCCTRL_CSCY2R_NARROW              (0 << 27)
359 #define S3C_CISCCTRL_CSCY2R_WIDE                (1 << 27)
360 #define S3C_CISCCTRL_LCDPATHEN_FIFO             (1 << 26)
361 #define S3C_CISCCTRL_PROGRESSIVE                (0 << 25)
362 #define S3C_CISCCTRL_INTERLACE                  (1 << 25)
363 #define S3C_CISCCTRL_SCAN_MASK                  (1 << 25)
364 #define S3C_CISCCTRL_SCALERSTART                (1 << 15)
365 #define S3C_CISCCTRL_INRGB_FMT_RGB565           (0 << 13)
366 #define S3C_CISCCTRL_INRGB_FMT_RGB666           (1 << 13)
367 #define S3C_CISCCTRL_INRGB_FMT_RGB888           (2 << 13)
368 #define S3C_CISCCTRL_INRGB_FMT_RGB_MASK         (3 << 13)
369 #define S3C_CISCCTRL_OUTRGB_FMT_RGB565          (0 << 11)
370 #define S3C_CISCCTRL_OUTRGB_FMT_RGB666          (1 << 11)
371 #define S3C_CISCCTRL_OUTRGB_FMT_RGB888          (2 << 11)
372 #define S3C_CISCCTRL_OUTRGB_FMT_RGB_MASK        (3 << 11)
373 #define S3C_CISCCTRL_EXTRGB_NORMAL              (0 << 10)
374 #define S3C_CISCCTRL_EXTRGB_EXTENSION           (1 << 10)
375 #define S3C_CISCCTRL_ONE2ONE                    (1 << 9)
376 #define S3C_CISCCTRL_MAIN_V_RATIO_MASK          (0x1ff << 0)
377 #define S3C_CISCCTRL_MAIN_H_RATIO_MASK          (0x1ff << 16)
378
379 /* Status register */
380 #define S3C_CISTATUS_OVFIY                      (1 << 31)
381 #define S3C_CISTATUS_OVFICB                     (1 << 30)
382 #define S3C_CISTATUS_OVFICR                     (1 << 29)
383 #define S3C_CISTATUS_VSYNC                      (1 << 28)
384 #define S3C_CISTATUS_SCALERSTART                (1 << 26)
385 #define S3C_CISTATUS_WINOFSTEN                  (1 << 25)
386 #define S3C_CISTATUS_IMGCPTEN                   (1 << 22)
387 #define S3C_CISTATUS_IMGCPTENSC                 (1 << 21)
388 #define S3C_CISTATUS_VSYNC_A                    (1 << 20)
389 #define S3C_CISTATUS_VSYNC_B                    (1 << 19)
390 #define S3C_CISTATUS_OVRLB                      (1 << 18)
391 #define S3C_CISTATUS_FRAMEEND                   (1 << 17)
392 #define S3C_CISTATUS_LASTCAPTUREEND             (1 << 16)
393 #define S3C_CISTATUS_VVALID_A                   (1 << 15)
394 #define S3C_CISTATUS_VVALID_B                   (1 << 14)
395
396 /* Image capture enable register */
397 #define S3C_CIIMGCPT_IMGCPTEN                   (1 << 31)
398 #define S3C_CIIMGCPT_IMGCPTEN_SC                (1 << 30)
399 #define S3C_CIIMGCPT_CPT_FREN_ENABLE            (1 << 25)
400 #define S3C_CIIMGCPT_CPT_FRMOD_EN               (0 << 18)
401 #define S3C_CIIMGCPT_CPT_FRMOD_CNT              (1 << 18)
402
403 /* Image effects register */
404 #define S3C_CIIMGEFF_IE_DISABLE                 (0 << 30)
405 #define S3C_CIIMGEFF_IE_ENABLE                  (1 << 30)
406 #define S3C_CIIMGEFF_IE_SC_BEFORE               (0 << 29)
407 #define S3C_CIIMGEFF_IE_SC_AFTER                (1 << 29)
408 #define S3C_CIIMGEFF_FIN_BYPASS                 (0 << 26)
409 #define S3C_CIIMGEFF_FIN_ARBITRARY              (1 << 26)
410 #define S3C_CIIMGEFF_FIN_NEGATIVE               (2 << 26)
411 #define S3C_CIIMGEFF_FIN_ARTFREEZE              (3 << 26)
412 #define S3C_CIIMGEFF_FIN_EMBOSSING              (4 << 26)
413 #define S3C_CIIMGEFF_FIN_SILHOUETTE             (5 << 26)
414 #define S3C_CIIMGEFF_FIN_MASK                   (7 << 26)
415 #define S3C_CIIMGEFF_PAT_CBCR_MASK              ((0xff < 13) | (0xff < 0))
416
417 /* Real input DMA size register */
418 #define S3C_CIREAL_ISIZE_AUTOLOAD_ENABLE        (1 << 31)
419 #define S3C_CIREAL_ISIZE_ADDR_CH_DISABLE        (1 << 30)
420 #define S3C_CIREAL_ISIZE_HEIGHT_MASK            (0x3FFF << 16)
421 #define S3C_CIREAL_ISIZE_WIDTH_MASK             (0x3FFF << 0)
422
423 /* Input DMA control register */
424 #define S3C_MSCTRL_FIELD_MASK                   (1 << 31)
425 #define S3C_MSCTRL_FIELD_WEAVE                  (1 << 31)
426 #define S3C_MSCTRL_FIELD_NORMAL                 (0 << 31)
427 #define S3C_MSCTRL_BURST_CNT                    (24)
428 #define S3C_MSCTRL_BURST_CNT_MASK               (0xf << 24)
429 #define S3C_MSCTRL_ORDER2P_LSB_CBCR             (0 << 16)
430 #define S3C_MSCTRL_ORDER2P_LSB_CRCB             (1 << 16)
431 #define S3C_MSCTRL_ORDER2P_MSB_CRCB             (2 << 16)
432 #define S3C_MSCTRL_ORDER2P_MSB_CBCR             (3 << 16)
433 #define S3C_MSCTRL_ORDER2P_SHIFT                (16)
434 #define S3C_MSCTRL_ORDER2P_SHIFT_MASK           (0x3 << 16)
435 #define S3C_MSCTRL_C_INT_IN_3PLANE              (0 << 15)
436 #define S3C_MSCTRL_C_INT_IN_2PLANE              (1 << 15)
437 #define S3C_MSCTRL_FLIP_SHIFT                   (13)
438 #define S3C_MSCTRL_FLIP_NORMAL                  (0 << 13)
439 #define S3C_MSCTRL_FLIP_X_MIRROR                (1 << 13)
440 #define S3C_MSCTRL_FLIP_Y_MIRROR                (2 << 13)
441 #define S3C_MSCTRL_FLIP_180                     (3 << 13)
442 #define S3C_MSCTRL_FLIP_MASK                    (3 << 13)
443 #define S3C_MSCTRL_ORDER422_CRYCBY              (0 << 4)
444 #define S3C_MSCTRL_ORDER422_YCRYCB              (1 << 4)
445 #define S3C_MSCTRL_ORDER422_CBYCRY              (2 << 4)
446 #define S3C_MSCTRL_ORDER422_YCBYCR              (3 << 4)
447 #define S3C_MSCTRL_INPUT_EXTCAM                 (0 << 3)
448 #define S3C_MSCTRL_INPUT_MEMORY                 (1 << 3)
449 #define S3C_MSCTRL_INPUT_MASK                   (1 << 3)
450 #define S3C_MSCTRL_INFORMAT_YCBCR420            (0 << 1)
451 #define S3C_MSCTRL_INFORMAT_YCBCR422            (1 << 1)
452 #define S3C_MSCTRL_INFORMAT_YCBCR422_1PLANE     (2 << 1)
453 #define S3C_MSCTRL_INFORMAT_RGB                 (3 << 1)
454 #define S3C_MSCTRL_ENVID                        (1 << 0)
455
456 /* DMA parameter register */
457 #define S3C_CIDMAPARAM_R_MODE_LINEAR            (0 << 29)
458 #define S3C_CIDMAPARAM_R_MODE_CONFTILE          (1 << 29)
459 #define S3C_CIDMAPARAM_R_MODE_16X16             (2 << 29)
460 #define S3C_CIDMAPARAM_R_MODE_64X32             (3 << 29)
461 #define S3C_CIDMAPARAM_R_MODE_MASK              (3 << 29)
462 #define S3C_CIDMAPARAM_R_TILE_HSIZE_64          (0 << 24)
463 #define S3C_CIDMAPARAM_R_TILE_HSIZE_128         (1 << 24)
464 #define S3C_CIDMAPARAM_R_TILE_HSIZE_256         (2 << 24)
465 #define S3C_CIDMAPARAM_R_TILE_HSIZE_512         (3 << 24)
466 #define S3C_CIDMAPARAM_R_TILE_HSIZE_1024        (4 << 24)
467 #define S3C_CIDMAPARAM_R_TILE_HSIZE_2048        (5 << 24)
468 #define S3C_CIDMAPARAM_R_TILE_HSIZE_4096        (6 << 24)
469 #define S3C_CIDMAPARAM_R_TILE_VSIZE_1           (0 << 20)
470 #define S3C_CIDMAPARAM_R_TILE_VSIZE_2           (1 << 20)
471 #define S3C_CIDMAPARAM_R_TILE_VSIZE_4           (2 << 20)
472 #define S3C_CIDMAPARAM_R_TILE_VSIZE_8           (3 << 20)
473 #define S3C_CIDMAPARAM_R_TILE_VSIZE_16          (4 << 20)
474 #define S3C_CIDMAPARAM_R_TILE_VSIZE_32          (5 << 20)
475 #define S3C_CIDMAPARAM_W_MODE_LINEAR            (0 << 13)
476 #define S3C_CIDMAPARAM_W_MODE_CONFTILE          (1 << 13)
477 #define S3C_CIDMAPARAM_W_MODE_16X16             (2 << 13)
478 #define S3C_CIDMAPARAM_W_MODE_64X32             (3 << 13)
479 #define S3C_CIDMAPARAM_W_MODE_MASK              (3 << 13)
480 #define S3C_CIDMAPARAM_W_TILE_HSIZE_64          (0 << 8)
481 #define S3C_CIDMAPARAM_W_TILE_HSIZE_128         (1 << 8)
482 #define S3C_CIDMAPARAM_W_TILE_HSIZE_256         (2 << 8)
483 #define S3C_CIDMAPARAM_W_TILE_HSIZE_512         (3 << 8)
484 #define S3C_CIDMAPARAM_W_TILE_HSIZE_1024        (4 << 8)
485 #define S3C_CIDMAPARAM_W_TILE_HSIZE_2048        (5 << 8)
486 #define S3C_CIDMAPARAM_W_TILE_HSIZE_4096        (6 << 8)
487 #define S3C_CIDMAPARAM_W_TILE_VSIZE_1           (0 << 4)
488 #define S3C_CIDMAPARAM_W_TILE_VSIZE_2           (1 << 4)
489 #define S3C_CIDMAPARAM_W_TILE_VSIZE_4           (2 << 4)
490 #define S3C_CIDMAPARAM_W_TILE_VSIZE_8           (3 << 4)
491 #define S3C_CIDMAPARAM_W_TILE_VSIZE_16          (4 << 4)
492 #define S3C_CIDMAPARAM_W_TILE_VSIZE_32          (5 << 4)
493
494 /* Gathering Extension register */
495 #define S3C_CIEXTEN_TARGETH_EXT_MASK            (1 << 26)
496 #define S3C_CIEXTEN_TARGETV_EXT_MASK            (1 << 24)
497 #define S3C_CIEXTEN_MAINHORRATIO_EXT_MASK       (0x3F << 10)
498 #define S3C_CIEXTEN_MAINVERRATIO_EXT_MASK       (0x3F)
499 #define S3C_CIEXTEN_YUV444_OUT                  (1 << 22)
500
501 /* FIMC Clock Source Select register */
502 #define S3C_CLKSRC_HCLK                         (0 << 1)
503 #define S3C_CLKSRC_HCLK_MASK                    (1 << 1)
504 #define S3C_CLKSRC_SCLK                         (1 << 1)
505
506 /* SYSREG for FIMC writeback */
507 #define SYSREG_CAMERA_BLK                       (S3C_VA_SYS + 0x0218)
508 #define FIMD0_WB_DEST_FIMC0                     (0x0 << 14)
509 #define FIMD0_WB_DEST_FIMC1                     (0x1 << 14)
510 #define FIMD0_WB_DEST_FIMC2                     (0x2 << 14)
511 #define FIMD0_WB_DEST_FIMC3                     (0x3 << 14)
512
513 #define FIMD1_WB_DEST_FIMC0                     (0x0 << 10)
514 #define FIMD1_WB_DEST_FIMC1                     (0x1 << 10)
515 #define FIMD1_WB_DEST_FIMC2                     (0x2 << 10)
516 #define FIMD1_WB_DEST_FIMC3                     (0x3 << 10)
517
518 #endif /* __ASM_PLAT_REGS_FIMC_H */