1
2
3
4
5
6
7#ifndef __ASM_ARCH_TEGRA_DC_H
8#define __ASM_ARCH_TEGRA_DC_H
9
10
11
12
13struct dc_cmd_reg {
14
15 uint gen_incr_syncpt;
16 uint gen_incr_syncpt_ctrl;
17 uint gen_incr_syncpt_err;
18
19 uint reserved0[5];
20
21
22 uint win_a_incr_syncpt;
23 uint win_a_incr_syncpt_ctrl;
24 uint win_a_incr_syncpt_err;
25
26 uint reserved1[5];
27
28
29 uint win_b_incr_syncpt;
30 uint win_b_incr_syncpt_ctrl;
31 uint win_b_incr_syncpt_err;
32
33 uint reserved2[5];
34
35
36 uint win_c_incr_syncpt;
37 uint win_c_incr_syncpt_ctrl;
38 uint win_c_incr_syncpt_err;
39
40 uint reserved3[13];
41
42
43 uint cont_syncpt_vsync;
44
45 uint reserved4[7];
46
47
48 uint ctxsw;
49 uint disp_cmd_opt0;
50 uint disp_cmd;
51 uint sig_raise;
52
53 uint reserved5[2];
54
55
56 uint disp_pow_ctrl;
57 uint int_stat;
58 uint int_mask;
59 uint int_enb;
60 uint int_type;
61 uint int_polarity;
62 uint sig_raise1;
63 uint sig_raise2;
64 uint sig_raise3;
65
66 uint reserved6;
67
68
69 uint state_access;
70 uint state_ctrl;
71 uint disp_win_header;
72 uint reg_act_ctrl;
73};
74
75enum {
76 PIN_REG_COUNT = 4,
77 PIN_OUTPUT_SEL_COUNT = 7,
78};
79
80
81struct dc_com_reg {
82
83 uint crc_ctrl;
84 uint crc_checksum;
85
86
87 uint pin_output_enb[PIN_REG_COUNT];
88
89
90 uint pin_output_polarity[PIN_REG_COUNT];
91
92
93 uint pin_output_data[PIN_REG_COUNT];
94
95
96 uint pin_input_enb[PIN_REG_COUNT];
97
98
99 uint pin_input_data0;
100 uint pin_input_data1;
101
102
103 uint pin_output_sel[PIN_OUTPUT_SEL_COUNT];
104
105
106 uint pin_misc_ctrl;
107 uint pm0_ctrl;
108 uint pm0_duty_cycle;
109 uint pm1_ctrl;
110 uint pm1_duty_cycle;
111 uint spi_ctrl;
112 uint spi_start_byte;
113 uint hspi_wr_data_ab;
114 uint hspi_wr_data_cd;
115 uint hspi_cs_dc;
116 uint scratch_reg_a;
117 uint scratch_reg_b;
118 uint gpio_ctrl;
119 uint gpio_debounce_cnt;
120 uint crc_checksum_latched;
121};
122
123enum dc_disp_h_pulse_pos {
124 H_PULSE0_POSITION_A,
125 H_PULSE0_POSITION_B,
126 H_PULSE0_POSITION_C,
127 H_PULSE0_POSITION_D,
128 H_PULSE0_POSITION_COUNT,
129};
130
131struct _disp_h_pulse {
132
133 uint h_pulse_ctrl;
134
135 uint h_pulse_pos[H_PULSE0_POSITION_COUNT];
136};
137
138enum dc_disp_v_pulse_pos {
139 V_PULSE0_POSITION_A,
140 V_PULSE0_POSITION_B,
141 V_PULSE0_POSITION_C,
142 V_PULSE0_POSITION_COUNT,
143};
144
145struct _disp_v_pulse0 {
146
147 uint v_pulse_ctrl;
148
149 uint v_pulse_pos[V_PULSE0_POSITION_COUNT];
150};
151
152struct _disp_v_pulse2 {
153
154 uint v_pulse_ctrl;
155
156 uint v_pulse_pos_a;
157};
158
159enum dc_disp_h_pulse_reg {
160 H_PULSE0,
161 H_PULSE1,
162 H_PULSE2,
163 H_PULSE_COUNT,
164};
165
166enum dc_disp_pp_select {
167 PP_SELECT_A,
168 PP_SELECT_B,
169 PP_SELECT_C,
170 PP_SELECT_D,
171 PP_SELECT_COUNT,
172};
173
174
175struct dc_disp_reg {
176
177 uint disp_signal_opt0;
178 uint disp_signal_opt1;
179 uint disp_win_opt;
180 uint mem_high_pri;
181 uint mem_high_pri_timer;
182 uint disp_timing_opt;
183 uint ref_to_sync;
184 uint sync_width;
185 uint back_porch;
186 uint disp_active;
187 uint front_porch;
188
189
190 struct _disp_h_pulse h_pulse[H_PULSE_COUNT];
191
192
193 struct _disp_v_pulse0 v_pulse0;
194 struct _disp_v_pulse0 v_pulse1;
195
196
197 struct _disp_v_pulse2 v_pulse3;
198 struct _disp_v_pulse2 v_pulse4;
199
200
201 uint m0_ctrl;
202 uint m1_ctrl;
203 uint di_ctrl;
204 uint pp_ctrl;
205
206
207 uint pp_select[PP_SELECT_COUNT];
208
209
210 uint disp_clk_ctrl;
211 uint disp_interface_ctrl;
212 uint disp_color_ctrl;
213 uint shift_clk_opt;
214 uint data_enable_opt;
215 uint serial_interface_opt;
216 uint lcd_spi_opt;
217 uint border_color;
218
219
220 uint color_key0_lower;
221 uint color_key0_upper;
222 uint color_key1_lower;
223 uint color_key1_upper;
224
225 uint reserved0[2];
226
227
228 uint cursor_foreground;
229 uint cursor_background;
230 uint cursor_start_addr;
231 uint cursor_start_addr_ns;
232 uint cursor_pos;
233 uint cursor_pos_ns;
234 uint seq_ctrl;
235
236
237 uint spi_init_seq_data_a;
238 uint spi_init_seq_data_b;
239 uint spi_init_seq_data_c;
240 uint spi_init_seq_data_d;
241
242 uint reserved1[0x39];
243
244
245 uint dc_mccif_fifoctrl;
246 uint mccif_disp0a_hyst;
247 uint mccif_disp0b_hyst;
248 uint mccif_disp0c_hyst;
249 uint mccif_disp1b_hyst;
250
251 uint reserved2[0x3b];
252
253
254 uint dac_crt_ctrl;
255 uint disp_misc_ctrl;
256
257 u32 rsvd_4c2[34];
258
259
260 u32 blend_background_color;
261};
262
263enum dc_winc_filter_p {
264 WINC_FILTER_COUNT = 0x10,
265};
266
267
268struct dc_winc_reg {
269
270
271 uint color_palette;
272
273 uint reserved0[0xff];
274
275
276 uint palette_color_ext;
277
278
279
280 uint h_filter_p[WINC_FILTER_COUNT];
281
282
283 uint csc_yof;
284 uint csc_kyrgb;
285 uint csc_kur;
286 uint csc_kvr;
287 uint csc_kug;
288 uint csc_kvg;
289 uint csc_kub;
290 uint csc_kvb;
291
292
293 uint v_filter_p[WINC_FILTER_COUNT];
294};
295
296
297struct dc_win_reg {
298
299 uint win_opt;
300 uint byte_swap;
301 uint buffer_ctrl;
302 uint color_depth;
303 uint pos;
304 uint size;
305 uint prescaled_size;
306 uint h_initial_dda;
307 uint v_initial_dda;
308 uint dda_increment;
309 uint line_stride;
310 uint buf_stride;
311 uint uv_buf_stride;
312 uint buffer_addr_mode;
313 uint dv_ctrl;
314 uint blend_nokey;
315 uint blend_1win;
316 uint blend_2win_x;
317 uint blend_2win_y;
318 uint blend_3win_xy;
319 uint hp_fetch_ctrl;
320 uint global_alpha;
321 uint blend_layer_ctrl;
322 uint blend_match_select;
323 uint blend_nomatch_select;
324 uint blend_alpha_1bit;
325};
326
327
328struct dc_winbuf_reg {
329
330 uint start_addr;
331 uint start_addr_ns;
332 uint start_addr_u;
333 uint start_addr_u_ns;
334 uint start_addr_v;
335 uint start_addr_v_ns;
336 uint addr_h_offset;
337 uint addr_h_offset_ns;
338 uint addr_v_offset;
339 uint addr_v_offset_ns;
340 uint uflow_status;
341 uint buffer_surface_kind;
342 uint rsvd_80c;
343 uint start_addr_hi;
344};
345
346
347struct dc_ctlr {
348 struct dc_cmd_reg cmd;
349 uint reserved0[0x2bc];
350
351 struct dc_com_reg com;
352 uint reserved1[0xd6];
353
354 struct dc_disp_reg disp;
355 uint reserved2[0x1b];
356
357 struct dc_winc_reg winc;
358 uint reserved3[0xd7];
359
360 struct dc_win_reg win;
361 uint reserved4[0xe6];
362
363 struct dc_winbuf_reg winbuf;
364};
365
366
367#define CTRL_MODE_SHIFT 5
368#define CTRL_MODE_MASK (0x3 << CTRL_MODE_SHIFT)
369enum {
370 CTRL_MODE_STOP,
371 CTRL_MODE_C_DISPLAY,
372 CTRL_MODE_NC_DISPLAY,
373};
374
375
376enum win_color_depth_id {
377 COLOR_DEPTH_P1,
378 COLOR_DEPTH_P2,
379 COLOR_DEPTH_P4,
380 COLOR_DEPTH_P8,
381 COLOR_DEPTH_B4G4R4A4,
382 COLOR_DEPTH_B5G5R5A,
383 COLOR_DEPTH_B5G6R5,
384 COLOR_DEPTH_AB5G5R5,
385 COLOR_DEPTH_B8G8R8A8 = 12,
386 COLOR_DEPTH_R8G8B8A8,
387 COLOR_DEPTH_B6x2G6x2R6x2A8,
388 COLOR_DEPTH_R6x2G6x2B6x2A8,
389 COLOR_DEPTH_YCbCr422,
390 COLOR_DEPTH_YUV422,
391 COLOR_DEPTH_YCbCr420P,
392 COLOR_DEPTH_YUV420P,
393 COLOR_DEPTH_YCbCr422P,
394 COLOR_DEPTH_YUV422P,
395 COLOR_DEPTH_YCbCr422R,
396 COLOR_DEPTH_YUV422R,
397 COLOR_DEPTH_YCbCr422RA,
398 COLOR_DEPTH_YUV422RA,
399};
400
401
402#define PW0_ENABLE BIT(0)
403#define PW1_ENABLE BIT(2)
404#define PW2_ENABLE BIT(4)
405#define PW3_ENABLE BIT(6)
406#define PW4_ENABLE BIT(8)
407#define PM0_ENABLE BIT(16)
408#define PM1_ENABLE BIT(18)
409#define SPI_ENABLE BIT(24)
410#define HSPI_ENABLE BIT(25)
411
412
413#define READ_MUX_ASSEMBLY (0 << 0)
414#define READ_MUX_ACTIVE (1 << 0)
415#define WRITE_MUX_ASSEMBLY (0 << 2)
416#define WRITE_MUX_ACTIVE (1 << 2)
417
418
419#define GENERAL_ACT_REQ BIT(0)
420#define WIN_A_ACT_REQ BIT(1)
421#define WIN_B_ACT_REQ BIT(2)
422#define WIN_C_ACT_REQ BIT(3)
423#define WIN_D_ACT_REQ BIT(4)
424#define WIN_H_ACT_REQ BIT(5)
425#define CURSOR_ACT_REQ BIT(7)
426#define GENERAL_UPDATE BIT(8)
427#define WIN_A_UPDATE BIT(9)
428#define WIN_B_UPDATE BIT(10)
429#define WIN_C_UPDATE BIT(11)
430#define WIN_D_UPDATE BIT(12)
431#define WIN_H_UPDATE BIT(13)
432#define CURSOR_UPDATE BIT(15)
433#define NC_HOST_TRIG BIT(24)
434
435
436#define WINDOW_A_SELECT BIT(4)
437#define WINDOW_B_SELECT BIT(5)
438#define WINDOW_C_SELECT BIT(6)
439#define WINDOW_D_SELECT BIT(7)
440#define WINDOW_H_SELECT BIT(8)
441
442
443#define CURSOR_ENABLE BIT(16)
444#define SOR_ENABLE BIT(25)
445#define TVO_ENABLE BIT(28)
446#define DSI_ENABLE BIT(29)
447#define HDMI_ENABLE BIT(30)
448
449
450#define VSYNC_H_POSITION(x) ((x) & 0xfff)
451
452
453#define SHIFT_CLK_DIVIDER_SHIFT 0
454#define SHIFT_CLK_DIVIDER_MASK (0xff << SHIFT_CLK_DIVIDER_SHIFT)
455#define PIXEL_CLK_DIVIDER_SHIFT 8
456#define PIXEL_CLK_DIVIDER_MSK (0xf << PIXEL_CLK_DIVIDER_SHIFT)
457enum {
458 PIXEL_CLK_DIVIDER_PCD1,
459 PIXEL_CLK_DIVIDER_PCD1H,
460 PIXEL_CLK_DIVIDER_PCD2,
461 PIXEL_CLK_DIVIDER_PCD3,
462 PIXEL_CLK_DIVIDER_PCD4,
463 PIXEL_CLK_DIVIDER_PCD6,
464 PIXEL_CLK_DIVIDER_PCD8,
465 PIXEL_CLK_DIVIDER_PCD9,
466 PIXEL_CLK_DIVIDER_PCD12,
467 PIXEL_CLK_DIVIDER_PCD16,
468 PIXEL_CLK_DIVIDER_PCD18,
469 PIXEL_CLK_DIVIDER_PCD24,
470 PIXEL_CLK_DIVIDER_PCD13,
471};
472
473
474#define DATA_FORMAT_SHIFT 0
475#define DATA_FORMAT_MASK (0xf << DATA_FORMAT_SHIFT)
476enum {
477 DATA_FORMAT_DF1P1C,
478 DATA_FORMAT_DF1P2C24B,
479 DATA_FORMAT_DF1P2C18B,
480 DATA_FORMAT_DF1P2C16B,
481 DATA_FORMAT_DF2S,
482 DATA_FORMAT_DF3S,
483 DATA_FORMAT_DFSPI,
484 DATA_FORMAT_DF1P3C24B,
485 DATA_FORMAT_DF1P3C18B,
486};
487#define DATA_ALIGNMENT_SHIFT 8
488enum {
489 DATA_ALIGNMENT_MSB,
490 DATA_ALIGNMENT_LSB,
491};
492#define DATA_ORDER_SHIFT 9
493enum {
494 DATA_ORDER_RED_BLUE,
495 DATA_ORDER_BLUE_RED,
496};
497
498
499#define DE_SELECT_SHIFT 0
500#define DE_SELECT_MASK (0x3 << DE_SELECT_SHIFT)
501#define DE_SELECT_ACTIVE_BLANK 0x0
502#define DE_SELECT_ACTIVE 0x1
503#define DE_SELECT_ACTIVE_IS 0x2
504#define DE_CONTROL_SHIFT 2
505#define DE_CONTROL_MASK (0x7 << DE_CONTROL_SHIFT)
506enum {
507 DE_CONTROL_ONECLK,
508 DE_CONTROL_NORMAL,
509 DE_CONTROL_EARLY_EXT,
510 DE_CONTROL_EARLY,
511 DE_CONTROL_ACTIVE_BLANK,
512};
513
514
515#define H_DIRECTION BIT(0)
516enum {
517 H_DIRECTION_INCREMENT,
518 H_DIRECTION_DECREMENT,
519};
520#define V_DIRECTION BIT(2)
521enum {
522 V_DIRECTION_INCREMENT,
523 V_DIRECTION_DECREMENT,
524};
525#define COLOR_EXPAND BIT(6)
526#define CP_ENABLE BIT(16)
527#define DV_ENABLE BIT(20)
528#define WIN_ENABLE BIT(30)
529
530
531#define BYTE_SWAP_SHIFT 0
532#define BYTE_SWAP_MASK (3 << BYTE_SWAP_SHIFT)
533enum {
534 BYTE_SWAP_NOSWAP,
535 BYTE_SWAP_SWAP2,
536 BYTE_SWAP_SWAP4,
537 BYTE_SWAP_SWAP4HW
538};
539
540
541#define H_POSITION_SHIFT 0
542#define H_POSITION_MASK (0x1FFF << H_POSITION_SHIFT)
543#define V_POSITION_SHIFT 16
544#define V_POSITION_MASK (0x1FFF << V_POSITION_SHIFT)
545
546
547#define H_SIZE_SHIFT 0
548#define H_SIZE_MASK (0x1FFF << H_SIZE_SHIFT)
549#define V_SIZE_SHIFT 16
550#define V_SIZE_MASK (0x1FFF << V_SIZE_SHIFT)
551
552
553#define H_PRESCALED_SIZE_SHIFT 0
554#define H_PRESCALED_SIZE_MASK (0x7FFF << H_PRESCALED_SIZE)
555#define V_PRESCALED_SIZE_SHIFT 16
556#define V_PRESCALED_SIZE_MASK (0x1FFF << V_PRESCALED_SIZE)
557
558
559#define H_DDA_INC_SHIFT 0
560#define H_DDA_INC_MASK (0xFFFF << H_DDA_INC_SHIFT)
561#define V_DDA_INC_SHIFT 16
562#define V_DDA_INC_MASK (0xFFFF << V_DDA_INC_SHIFT)
563
564#define DC_POLL_TIMEOUT_MS 50
565#define DC_N_WINDOWS 5
566#define DC_REG_SAVE_SPACE (DC_N_WINDOWS + 5)
567
568#endif
569