blob: 3a28c08c35955a1643346c61602c5539d5802925 [file] [log] [blame]
Eric Anholt8c641832009-03-26 17:15:11 -07001/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.13 2003/02/06 04:18:04 dawes Exp $ */
2/**************************************************************************
3
4Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
5All Rights Reserved.
6
7Permission is hereby granted, free of charge, to any person obtaining a
8copy of this software and associated documentation files (the
9"Software"), to deal in the Software without restriction, including
10without limitation the rights to use, copy, modify, merge, publish,
11distribute, sub license, and/or sell copies of the Software, and to
12permit persons to whom the Software is furnished to do so, subject to
13the following conditions:
14
15The above copyright notice and this permission notice (including the
16next paragraph) shall be included in all copies or substantial portions
17of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27**************************************************************************/
28
Thomas Wood1e5c8782014-06-09 14:02:04 +010029/* @file
Eric Anholt8c641832009-03-26 17:15:11 -070030 * Register names and fields for Intel graphics.
31 */
32
33/*
34 * Authors:
35 * Keith Whitwell <keith@tungstengraphics.com>
36 * Eric Anholt <eric@anholt.net>
37 *
38 * based on the i740 driver by
39 * Kevin E. Martin <kevin@precisioninsight.com>
40 *
41 *
42 */
43
44#ifndef _I810_REG_H
45#define _I810_REG_H
46
47/* I/O register offsets
48 */
49#define SRX 0x3C4 /* p208 */
50#define GRX 0x3CE /* p213 */
51#define ARX 0x3C0 /* p224 */
52
53/* VGA Color Palette Registers */
54#define DACMASK 0x3C6 /* p232 */
55#define DACSTATE 0x3C7 /* p232 */
56#define DACRX 0x3C7 /* p233 */
57#define DACWX 0x3C8 /* p233 */
58#define DACDATA 0x3C9 /* p233 */
59
60/* CRT Controller Registers (CRX) */
61#define START_ADDR_HI 0x0C /* p246 */
62#define START_ADDR_LO 0x0D /* p247 */
63#define VERT_SYNC_END 0x11 /* p249 */
64#define EXT_VERT_TOTAL 0x30 /* p257 */
65#define EXT_VERT_DISPLAY 0x31 /* p258 */
66#define EXT_VERT_SYNC_START 0x32 /* p259 */
67#define EXT_VERT_BLANK_START 0x33 /* p260 */
68#define EXT_HORIZ_TOTAL 0x35 /* p261 */
69#define EXT_HORIZ_BLANK 0x39 /* p261 */
70#define EXT_START_ADDR 0x40 /* p262 */
71#define EXT_START_ADDR_ENABLE 0x80
72#define EXT_OFFSET 0x41 /* p263 */
73#define EXT_START_ADDR_HI 0x42 /* p263 */
74#define INTERLACE_CNTL 0x70 /* p264 */
75#define INTERLACE_ENABLE 0x80
76#define INTERLACE_DISABLE 0x00
77
78/* Miscellaneous Output Register
79 */
80#define MSR_R 0x3CC /* p207 */
81#define MSR_W 0x3C2 /* p207 */
82#define IO_ADDR_SELECT 0x01
83
84#define MDA_BASE 0x3B0 /* p207 */
85#define CGA_BASE 0x3D0 /* p207 */
86
87/* CR80 - IO Control, p264
88 */
89#define IO_CTNL 0x80
90#define EXTENDED_ATTR_CNTL 0x02
91#define EXTENDED_CRTC_CNTL 0x01
92
93/* GR10 - Address mapping, p221
94 */
95#define ADDRESS_MAPPING 0x10
96#define PAGE_TO_LOCAL_MEM_ENABLE 0x10
97#define GTT_MEM_MAP_ENABLE 0x08
98#define PACKED_MODE_ENABLE 0x04
99#define LINEAR_MODE_ENABLE 0x02
100#define PAGE_MAPPING_ENABLE 0x01
101
102#define HOTKEY_VBIOS_SWITCH_BLOCK 0x80
103#define HOTKEY_SWITCH 0x20
104#define HOTKEY_TOGGLE 0x10
105
106/* Blitter control, p378
107 */
108#define BITBLT_CNTL 0x7000c
109#define COLEXP_MODE 0x30
110#define COLEXP_8BPP 0x00
111#define COLEXP_16BPP 0x10
112#define COLEXP_24BPP 0x20
113#define COLEXP_RESERVED 0x30
114#define BITBLT_STATUS 0x01
115
116#define CHDECMISC 0x10111
117#define DCC 0x10200
118#define C0DRB0 0x10200
119#define C0DRB1 0x10202
120#define C0DRB2 0x10204
121#define C0DRB3 0x10206
122#define C0DRA01 0x10208
123#define C0DRA23 0x1020a
124#define C1DRB0 0x10600
125#define C1DRB1 0x10602
126#define C1DRB2 0x10604
127#define C1DRB3 0x10606
128#define C1DRA01 0x10608
129#define C1DRA23 0x1060a
130
131/* p375.
132 */
133#define DISPLAY_CNTL 0x70008
134#define VGA_WRAP_MODE 0x02
135#define VGA_WRAP_AT_256KB 0x00
136#define VGA_NO_WRAP 0x02
137#define GUI_MODE 0x01
138#define STANDARD_VGA_MODE 0x00
139#define HIRES_MODE 0x01
140
141/* p375
142 */
143#define PIXPIPE_CONFIG_0 0x70009
144#define DAC_8_BIT 0x80
145#define DAC_6_BIT 0x00
146#define HW_CURSOR_ENABLE 0x10
147#define EXTENDED_PALETTE 0x01
148
149/* p375
150 */
151#define PIXPIPE_CONFIG_1 0x7000a
152#define DISPLAY_COLOR_MODE 0x0F
153#define DISPLAY_VGA_MODE 0x00
154#define DISPLAY_8BPP_MODE 0x02
155#define DISPLAY_15BPP_MODE 0x04
156#define DISPLAY_16BPP_MODE 0x05
157#define DISPLAY_24BPP_MODE 0x06
158#define DISPLAY_32BPP_MODE 0x07
159
160/* p375
161 */
162#define PIXPIPE_CONFIG_2 0x7000b
163#define DISPLAY_GAMMA_ENABLE 0x08
164#define DISPLAY_GAMMA_DISABLE 0x00
165#define OVERLAY_GAMMA_ENABLE 0x04
166#define OVERLAY_GAMMA_DISABLE 0x00
167
168
169/* p380
170 */
171#define DISPLAY_BASE 0x70020
172#define DISPLAY_BASE_MASK 0x03fffffc
173
174
175/* Cursor control registers, pp383-384
176 */
177/* Desktop (845G, 865G) */
178#define CURSOR_CONTROL 0x70080
179#define CURSOR_ENABLE 0x80000000
180#define CURSOR_GAMMA_ENABLE 0x40000000
181#define CURSOR_STRIDE_MASK 0x30000000
182#define CURSOR_FORMAT_SHIFT 24
183#define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
184#define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
185#define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
186#define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
187#define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
188#define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
189
190/* Mobile and i810 */
191#define CURSOR_A_CONTROL CURSOR_CONTROL
192#define CURSOR_ORIGIN_SCREEN 0x00 /* i810 only */
193#define CURSOR_ORIGIN_DISPLAY 0x1 /* i810 only */
194#define CURSOR_MODE 0x27
195#define CURSOR_MODE_DISABLE 0x00
196#define CURSOR_MODE_32_4C_AX 0x01 /* i810 only */
197#define CURSOR_MODE_64_3C 0x04
198#define CURSOR_MODE_64_4C_AX 0x05
199#define CURSOR_MODE_64_4C 0x06
200#define CURSOR_MODE_64_32B_AX 0x07
201#define CURSOR_MODE_64_ARGB_AX (0x20 | CURSOR_MODE_64_32B_AX)
202#define MCURSOR_PIPE_SELECT (1 << 28)
203#define MCURSOR_PIPE_A 0x00
204#define MCURSOR_PIPE_B (1 << 28)
205#define MCURSOR_GAMMA_ENABLE (1 << 26)
206#define MCURSOR_MEM_TYPE_LOCAL (1 << 25)
207
208
209#define CURSOR_BASEADDR 0x70084
210#define CURSOR_A_BASE CURSOR_BASEADDR
211#define CURSOR_BASEADDR_MASK 0x1FFFFF00
212#define CURSOR_A_POSITION 0x70088
213#define CURSOR_POS_SIGN 0x8000
214#define CURSOR_POS_MASK 0x007FF
215#define CURSOR_X_SHIFT 0
216#define CURSOR_Y_SHIFT 16
217#define CURSOR_X_LO 0x70088
218#define CURSOR_X_HI 0x70089
219#define CURSOR_X_POS 0x00
220#define CURSOR_X_NEG 0x80
221#define CURSOR_Y_LO 0x7008A
222#define CURSOR_Y_HI 0x7008B
223#define CURSOR_Y_POS 0x00
224#define CURSOR_Y_NEG 0x80
225
226#define CURSOR_A_PALETTE0 0x70090
227#define CURSOR_A_PALETTE1 0x70094
228#define CURSOR_A_PALETTE2 0x70098
229#define CURSOR_A_PALETTE3 0x7009C
230
231#define CURSOR_SIZE 0x700A0
232#define CURSOR_SIZE_MASK 0x3FF
233#define CURSOR_SIZE_HSHIFT 0
234#define CURSOR_SIZE_VSHIFT 12
235
236#define CURSOR_B_CONTROL 0x700C0
237#define CURSOR_B_BASE 0x700C4
238#define CURSOR_B_POSITION 0x700C8
239#define CURSOR_B_PALETTE0 0x700D0
240#define CURSOR_B_PALETTE1 0x700D4
241#define CURSOR_B_PALETTE2 0x700D8
242#define CURSOR_B_PALETTE3 0x700DC
243
244
245/* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm
246 * not sure they refer to local (graphics) memory.
247 *
248 * These details are for the local memory control registers,
249 * (pp301-310). The test machines are not equiped with local memory,
250 * so nothing is tested. Only a single row seems to be supported.
251 */
252#define DRAM_ROW_TYPE 0x3000
253#define DRAM_ROW_0 0x01
254#define DRAM_ROW_0_SDRAM 0x01
255#define DRAM_ROW_0_EMPTY 0x00
256#define DRAM_ROW_CNTL_LO 0x3001
257#define DRAM_PAGE_MODE_CTRL 0x10
258#define DRAM_RAS_TO_CAS_OVRIDE 0x08
259#define DRAM_CAS_LATENCY 0x04
260#define DRAM_RAS_TIMING 0x02
261#define DRAM_RAS_PRECHARGE 0x01
262#define DRAM_ROW_CNTL_HI 0x3002
263#define DRAM_REFRESH_RATE 0x18
264#define DRAM_REFRESH_DISABLE 0x00
265#define DRAM_REFRESH_60HZ 0x08
266#define DRAM_REFRESH_FAST_TEST 0x10
267#define DRAM_REFRESH_RESERVED 0x18
268#define DRAM_SMS 0x07
269#define DRAM_SMS_NORMAL 0x00
270#define DRAM_SMS_NOP_ENABLE 0x01
271#define DRAM_SMS_ABPCE 0x02
272#define DRAM_SMS_MRCE 0x03
273#define DRAM_SMS_CBRCE 0x04
274
275/* p307
276 */
277#define DPMS_SYNC_SELECT 0x5002
278#define VSYNC_CNTL 0x08
279#define VSYNC_ON 0x00
280#define VSYNC_OFF 0x08
281#define HSYNC_CNTL 0x02
282#define HSYNC_ON 0x00
283#define HSYNC_OFF 0x02
284
285#define GPIOA 0x5010
286#define GPIOB 0x5014
287#define GPIOC 0x5018
288#define GPIOD 0x501c
289#define GPIOE 0x5020
290#define GPIOF 0x5024
291#define GPIOG 0x5028
292#define GPIOH 0x502c
293# define GPIO_CLOCK_DIR_MASK (1 << 0)
294# define GPIO_CLOCK_DIR_IN (0 << 1)
295# define GPIO_CLOCK_DIR_OUT (1 << 1)
296# define GPIO_CLOCK_VAL_MASK (1 << 2)
297# define GPIO_CLOCK_VAL_OUT (1 << 3)
298# define GPIO_CLOCK_VAL_IN (1 << 4)
299# define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
300# define GPIO_DATA_DIR_MASK (1 << 8)
301# define GPIO_DATA_DIR_IN (0 << 9)
302# define GPIO_DATA_DIR_OUT (1 << 9)
303# define GPIO_DATA_VAL_MASK (1 << 10)
304# define GPIO_DATA_VAL_OUT (1 << 11)
305# define GPIO_DATA_VAL_IN (1 << 12)
306# define GPIO_DATA_PULLUP_DISABLE (1 << 13)
307
308/* GMBus registers for hardware-assisted (non-bitbanging) I2C access */
309#define GMBUS0 0x5100
310#define GMBUS1 0x5104
311#define GMBUS2 0x5108
312#define GMBUS3 0x510c
313#define GMBUS4 0x5110
314#define GMBUS5 0x5120
315
316/* p317, 319
317 */
318#define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
319#define VCLK2_VCO_N 0x600a
320#define VCLK2_VCO_DIV_SEL 0x6012
321
322#define VCLK_DIVISOR_VGA0 0x6000
323#define VCLK_DIVISOR_VGA1 0x6004
324#define VCLK_POST_DIV 0x6010
Thomas Wood1e5c8782014-06-09 14:02:04 +0100325/* Selects a post divisor of 4 instead of 2. */
Eric Anholt8c641832009-03-26 17:15:11 -0700326# define VGA1_PD_P2_DIV_4 (1 << 15)
Thomas Wood1e5c8782014-06-09 14:02:04 +0100327/* Overrides the p2 post divisor field */
Eric Anholt8c641832009-03-26 17:15:11 -0700328# define VGA1_PD_P1_DIV_2 (1 << 13)
329# define VGA1_PD_P1_SHIFT 8
Thomas Wood1e5c8782014-06-09 14:02:04 +0100330/* P1 value is 2 greater than this field */
Eric Anholt8c641832009-03-26 17:15:11 -0700331# define VGA1_PD_P1_MASK (0x1f << 8)
Thomas Wood1e5c8782014-06-09 14:02:04 +0100332/* Selects a post divisor of 4 instead of 2. */
Eric Anholt8c641832009-03-26 17:15:11 -0700333# define VGA0_PD_P2_DIV_4 (1 << 7)
Thomas Wood1e5c8782014-06-09 14:02:04 +0100334/* Overrides the p2 post divisor field */
Eric Anholt8c641832009-03-26 17:15:11 -0700335# define VGA0_PD_P1_DIV_2 (1 << 5)
336# define VGA0_PD_P1_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +0100337/* P1 value is 2 greater than this field */
Eric Anholt8c641832009-03-26 17:15:11 -0700338# define VGA0_PD_P1_MASK (0x1f << 0)
339
340#define POST_DIV_SELECT 0x70
341#define POST_DIV_1 0x00
342#define POST_DIV_2 0x10
343#define POST_DIV_4 0x20
344#define POST_DIV_8 0x30
345#define POST_DIV_16 0x40
346#define POST_DIV_32 0x50
347#define VCO_LOOP_DIV_BY_4M 0x00
348#define VCO_LOOP_DIV_BY_16M 0x04
349
350
351/* Instruction Parser Mode Register
352 * - p281
353 * - 2 new bits.
354 */
355#define INST_PM 0x20c0
356#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */
357#define SYNC_PACKET_FLUSH_ENABLE 0x10
358#define TWO_D_INST_DISABLE 0x08
359#define THREE_D_INST_DISABLE 0x04
360#define STATE_VAR_UPDATE_DISABLE 0x02
361#define PAL_STIP_DISABLE 0x01
Ben Widawskye39b13d2011-07-17 12:43:12 -0700362#define GEN6_GLOBAL_DEBUG_ENABLE 0x10
Eric Anholt8c641832009-03-26 17:15:11 -0700363
364
365#define MEMMODE 0x20dc
366
367
368/* Instruction parser error register. p279
369 */
370#define IPEIR 0x2088
371#define IPEHR 0x208C
372
Damien Lespiaud8b1dee2013-06-04 05:41:36 +0100373#define INSTDONE 0x2090
Daniel Vetter3d148e12012-08-25 00:01:27 +0200374#define NOP_ID 0x2094
Jesse Barnesb1e839d2010-06-30 02:02:49 -0700375
Eric Anholt8c641832009-03-26 17:15:11 -0700376#define SCPD0 0x209c /* debug */
377#define INST_PS 0x20c4
378#define IPEIR_I965 0x2064 /* i965 */
379#define IPEHR_I965 0x2068 /* i965 */
Damien Lespiaud8b1dee2013-06-04 05:41:36 +0100380#define INSTDONE_I965 0x206c
Eric Anholt291a5762010-01-15 14:28:16 -0800381#define GEN6_INSTDONE_1 0x206c
Eric Anholt8c641832009-03-26 17:15:11 -0700382#define INST_PS_I965 0x2070
383
384/* Current active ring head address:
385 */
386#define ACTHD_I965 0x2074
387#define ACTHD 0x20C8
388
389/* Current primary/secondary DMA fetch addresses:
390 */
391#define DMA_FADD_P 0x2078
392#define DMA_FADD_S 0x20d4
Damien Lespiaud8b1dee2013-06-04 05:41:36 +0100393#define INSTDONE_1 0x207c
Eric Anholt291a5762010-01-15 14:28:16 -0800394#define GEN6_INSTDONE_2 0x207c
Eric Anholt291a5762010-01-15 14:28:16 -0800395
Eric Anholt8c641832009-03-26 17:15:11 -0700396#define CACHE_MODE_0 0x2120
397#define CACHE_MODE_1 0x2124
398#define MI_MODE 0x209c
399#define MI_DISPLAY_POWER_DOWN 0x20e0
400#define MI_ARB_STATE 0x20e4
401#define MI_RDRET_STATE 0x20fc
402
403/* Start addresses for each of the primary rings:
404 */
405#define PR0_STR 0x20f0
406#define PR1_STR 0x20f4
407#define PR2_STR 0x20f8
408
409#define WIZ_CTL 0x7c00
410#define WIZ_CTL_SINGLE_SUBSPAN (1<<6)
411#define WIZ_CTL_IGNORE_STALLS (1<<5)
412
413#define SVG_WORK_CTL 0x7408
414
415#define TS_CTL 0x7e00
416#define TS_MUX_ERR_CODE (0<<8)
417#define TS_MUX_URB_0 (1<<8)
418#define TS_MUX_DISPATCH_ID_0 (10<<8)
419#define TS_MUX_ERR_CODE_VALID (15<<8)
420#define TS_MUX_TID_0 (16<<8)
421#define TS_MUX_EUID_0 (18<<8)
422#define TS_MUX_FFID_0 (22<<8)
423#define TS_MUX_EOT (26<<8)
424#define TS_MUX_SIDEBAND_0 (27<<8)
425#define TS_SNAP_ALL_CHILD (1<<2)
426#define TS_SNAP_ALL_ROOT (1<<1)
427#define TS_SNAP_ENABLE (1<<0)
428
429#define TS_DEBUG_DATA 0x7e0c
430
431#define TD_CTL 0x8000
432#define TD_CTL2 0x8004
433
434
435#define ECOSKPD 0x21d0
436#define EXCC 0x2028
437
438/* I965 debug regs:
439 */
440#define IA_VERTICES_COUNT_QW 0x2310
441#define IA_PRIMITIVES_COUNT_QW 0x2318
442#define VS_INVOCATION_COUNT_QW 0x2320
443#define GS_INVOCATION_COUNT_QW 0x2328
444#define GS_PRIMITIVES_COUNT_QW 0x2330
445#define CL_INVOCATION_COUNT_QW 0x2338
446#define CL_PRIMITIVES_COUNT_QW 0x2340
447#define PS_INVOCATION_COUNT_QW 0x2348
448#define PS_DEPTH_COUNT_QW 0x2350
449#define TIMESTAMP_QW 0x2358
450#define CLKCMP_QW 0x2360
451
452
453
454
455
456
457/* General error reporting regs, p296
458 */
459#define EIR 0x20B0
460#define EMR 0x20B4
461#define ESR 0x20B8
462# define ERR_VERTEX_MAX (1 << 5) /* lpt/cst */
463# define ERR_PGTBL_ERROR (1 << 4)
464# define ERR_DISPLAY_OVERLAY_UNDERRUN (1 << 3)
465# define ERR_MAIN_MEMORY_REFRESH (1 << 1)
466# define ERR_INSTRUCTION_ERROR (1 << 0)
467
468
469/* Interrupt Control Registers
470 * - new bits for i810
471 * - new register hwstam (mask)
472 */
473#define HWS_PGA 0x2080
474#define PWRCTXA 0x2088 /* 965GM+ only */
475#define PWRCTX_EN (1<<0)
476#define HWSTAM 0x2098 /* p290 */
477#define IER 0x20a0 /* p291 */
478#define IIR 0x20a4 /* p292 */
479#define IMR 0x20a8 /* p293 */
480#define ISR 0x20ac /* p294 */
481#define HW_ERROR 0x8000
482#define SYNC_STATUS_TOGGLE 0x1000
483#define DPY_0_FLIP_PENDING 0x0800
484#define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */
485#define OVL_0_FLIP_PENDING 0x0200
486#define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */
487#define DPY_0_VBLANK 0x0080
488#define DPY_0_EVENT 0x0040
489#define DPY_1_VBLANK 0x0020 /* not implemented on i810 */
490#define DPY_1_EVENT 0x0010 /* not implemented on i810 */
491#define HOST_PORT_EVENT 0x0008 /* */
492#define CAPTURE_EVENT 0x0004 /* */
493#define USER_DEFINED 0x0002
494#define BREAKPOINT 0x0001
495
496
497#define INTR_RESERVED (0x6000 | \
498 DPY_1_FLIP_PENDING | \
499 OVL_1_FLIP_PENDING | \
500 DPY_1_VBLANK | \
501 DPY_1_EVENT | \
502 HOST_PORT_EVENT | \
503 CAPTURE_EVENT )
504
505/* FIFO Watermark and Burst Length Control Register
506 *
507 * - different offset and contents on i810 (p299) (fewer bits per field)
508 * - some overlay fields added
509 * - what does it all mean?
510 */
511#define FWATER_BLC 0x20d8
512#define FWATER_BLC2 0x20dc
513#define MM_BURST_LENGTH 0x00700000
514#define MM_FIFO_WATERMARK 0x0001F000
515#define LM_BURST_LENGTH 0x00000700
516#define LM_FIFO_WATERMARK 0x0000001F
517
518
519/* Fence/Tiling ranges [0..7]
520 */
521#define FENCE 0x2000
522#define FENCE_NR 8
523
524#define FENCE_NEW 0x3000
525#define FENCE_NEW_NR 16
526
527#define FENCE_LINEAR 0
528#define FENCE_XMAJOR 1
529#define FENCE_YMAJOR 2
530
531#define I915G_FENCE_START_MASK 0x0ff00000
532
533#define I830_FENCE_START_MASK 0x07f80000
534
535#define FENCE_START_MASK 0x03F80000
536#define FENCE_X_MAJOR 0x00000000
537#define FENCE_Y_MAJOR 0x00001000
538#define FENCE_SIZE_MASK 0x00000700
539#define FENCE_SIZE_512K 0x00000000
540#define FENCE_SIZE_1M 0x00000100
541#define FENCE_SIZE_2M 0x00000200
542#define FENCE_SIZE_4M 0x00000300
543#define FENCE_SIZE_8M 0x00000400
544#define FENCE_SIZE_16M 0x00000500
545#define FENCE_SIZE_32M 0x00000600
546#define FENCE_SIZE_64M 0x00000700
547#define I915G_FENCE_SIZE_1M 0x00000000
548#define I915G_FENCE_SIZE_2M 0x00000100
549#define I915G_FENCE_SIZE_4M 0x00000200
550#define I915G_FENCE_SIZE_8M 0x00000300
551#define I915G_FENCE_SIZE_16M 0x00000400
552#define I915G_FENCE_SIZE_32M 0x00000500
553#define I915G_FENCE_SIZE_64M 0x00000600
554#define I915G_FENCE_SIZE_128M 0x00000700
555#define I965_FENCE_X_MAJOR 0x00000000
556#define I965_FENCE_Y_MAJOR 0x00000002
557#define FENCE_PITCH_1 0x00000000
558#define FENCE_PITCH_2 0x00000010
559#define FENCE_PITCH_4 0x00000020
560#define FENCE_PITCH_8 0x00000030
561#define FENCE_PITCH_16 0x00000040
562#define FENCE_PITCH_32 0x00000050
563#define FENCE_PITCH_64 0x00000060
564#define FENCE_VALID 0x00000001
565
Daniel Vetterd3221332013-07-09 10:46:09 +0200566#define FENCE_REG_SANDYBRIDGE_0 0x100000
Eric Anholt8c641832009-03-26 17:15:11 -0700567
568/* Registers to control page table, p274
569 */
570#define PGETBL_CTL 0x2020
571#define PGETBL_ADDR_MASK 0xFFFFF000
572#define PGETBL_ENABLE_MASK 0x00000001
573#define PGETBL_ENABLED 0x00000001
Thomas Wood1e5c8782014-06-09 14:02:04 +0100574/* Added in 965G, this field has the actual size of the global GTT */
Eric Anholt8c641832009-03-26 17:15:11 -0700575#define PGETBL_SIZE_MASK 0x0000000e
576#define PGETBL_SIZE_512KB (0 << 1)
577#define PGETBL_SIZE_256KB (1 << 1)
578#define PGETBL_SIZE_128KB (2 << 1)
579#define PGETBL_SIZE_1MB (3 << 1)
580#define PGETBL_SIZE_2MB (4 << 1)
581#define PGETBL_SIZE_1_5MB (5 << 1)
582#define G33_PGETBL_SIZE_MASK (3 << 8)
583#define G33_PGETBL_SIZE_1M (1 << 8)
584#define G33_PGETBL_SIZE_2M (2 << 8)
585
586#define I830_PTE_BASE 0x10000
587#define PTE_ADDRESS_MASK 0xfffff000
588#define PTE_ADDRESS_MASK_HIGH 0x000000f0 /* i915+ */
589#define PTE_MAPPING_TYPE_UNCACHED (0 << 1)
590#define PTE_MAPPING_TYPE_DCACHE (1 << 1) /* i830 only */
591#define PTE_MAPPING_TYPE_CACHED (3 << 1)
592#define PTE_MAPPING_TYPE_MASK (3 << 1)
593#define PTE_VALID (1 << 0)
594
Thomas Wood1e5c8782014-06-09 14:02:04 +0100595/* @defgroup PGE_ERR
Eric Anholt8c641832009-03-26 17:15:11 -0700596 * @{
597 */
Thomas Wood1e5c8782014-06-09 14:02:04 +0100598/* Page table debug register for i845 */
Eric Anholt8c641832009-03-26 17:15:11 -0700599#define PGE_ERR 0x2024
600#define PGE_ERR_ADDR_MASK 0xFFFFF000
601#define PGE_ERR_ID_MASK 0x00000038
602#define PGE_ERR_CAPTURE 0x00000000
603#define PGE_ERR_OVERLAY 0x00000008
604#define PGE_ERR_DISPLAY 0x00000010
605#define PGE_ERR_HOST 0x00000018
606#define PGE_ERR_RENDER 0x00000020
607#define PGE_ERR_BLITTER 0x00000028
608#define PGE_ERR_MAPPING 0x00000030
609#define PGE_ERR_CMD_PARSER 0x00000038
610#define PGE_ERR_TYPE_MASK 0x00000007
611#define PGE_ERR_INV_TABLE 0x00000000
612#define PGE_ERR_INV_PTE 0x00000001
613#define PGE_ERR_MIXED_TYPES 0x00000002
614#define PGE_ERR_PAGE_MISS 0x00000003
615#define PGE_ERR_ILLEGAL_TRX 0x00000004
616#define PGE_ERR_LOCAL_MEM 0x00000005
617#define PGE_ERR_TILED 0x00000006
Thomas Wood1e5c8782014-06-09 14:02:04 +0100618/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -0700619
Thomas Wood1e5c8782014-06-09 14:02:04 +0100620/* @defgroup PGTBL_ER
Eric Anholt8c641832009-03-26 17:15:11 -0700621 * @{
622 */
Thomas Wood1e5c8782014-06-09 14:02:04 +0100623/* Page table debug register for i945 */
Eric Anholt8c641832009-03-26 17:15:11 -0700624# define PGTBL_ER 0x2024
625# define PGTBL_ERR_MT_TILING (1 << 27)
626# define PGTBL_ERR_MT_GTT_PTE (1 << 26)
627# define PGTBL_ERR_LC_TILING (1 << 25)
628# define PGTBL_ERR_LC_GTT_PTE (1 << 24)
629# define PGTBL_ERR_BIN_VERTEXDATA_GTT_PTE (1 << 23)
630# define PGTBL_ERR_BIN_INSTRUCTION_GTT_PTE (1 << 22)
631# define PGTBL_ERR_CS_VERTEXDATA_GTT_PTE (1 << 21)
632# define PGTBL_ERR_CS_INSTRUCTION_GTT_PTE (1 << 20)
633# define PGTBL_ERR_CS_GTT (1 << 19)
634# define PGTBL_ERR_OVERLAY_TILING (1 << 18)
635# define PGTBL_ERR_OVERLAY_GTT_PTE (1 << 16)
636# define PGTBL_ERR_DISPC_TILING (1 << 14)
637# define PGTBL_ERR_DISPC_GTT_PTE (1 << 12)
638# define PGTBL_ERR_DISPB_TILING (1 << 10)
639# define PGTBL_ERR_DISPB_GTT_PTE (1 << 8)
640# define PGTBL_ERR_DISPA_TILING (1 << 6)
641# define PGTBL_ERR_DISPA_GTT_PTE (1 << 4)
642# define PGTBL_ERR_HOST_PTE_DATA (1 << 1)
643# define PGTBL_ERR_HOST_GTT_PTE (1 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +0100644/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -0700645
646/* Ring buffer registers, p277, overview p19
647 */
648#define LP_RING 0x2030
649#define HP_RING 0x2040
650
651#define RING_TAIL 0x00
652#define TAIL_ADDR 0x000FFFF8
653#define I830_TAIL_MASK 0x001FFFF8
654
655#define RING_HEAD 0x04
656#define HEAD_WRAP_COUNT 0xFFE00000
657#define HEAD_WRAP_ONE 0x00200000
658#define HEAD_ADDR 0x001FFFFC
659#define I830_HEAD_MASK 0x001FFFFC
660
661#define RING_START 0x08
662#define START_ADDR 0x03FFFFF8
663#define I830_RING_START_MASK 0xFFFFF000
664
665#define RING_LEN 0x0C
666#define RING_NR_PAGES 0x001FF000
667#define I830_RING_NR_PAGES 0x001FF000
668#define RING_REPORT_MASK 0x00000006
669#define RING_REPORT_64K 0x00000002
670#define RING_REPORT_128K 0x00000004
671#define RING_NO_REPORT 0x00000000
672#define RING_VALID_MASK 0x00000001
673#define RING_VALID 0x00000001
674#define RING_INVALID 0x00000000
675
676
677
678/* BitBlt Instructions
679 *
680 * There are many more masks & ranges yet to add.
681 */
682#define BR00_BITBLT_CLIENT 0x40000000
683#define BR00_OP_COLOR_BLT 0x10000000
684#define BR00_OP_SRC_COPY_BLT 0x10C00000
685#define BR00_OP_FULL_BLT 0x11400000
686#define BR00_OP_MONO_SRC_BLT 0x11800000
687#define BR00_OP_MONO_SRC_COPY_BLT 0x11000000
688#define BR00_OP_MONO_PAT_BLT 0x11C00000
689#define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22)
690#define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000
691
692
693#define BR00_TPCY_DISABLE 0x00000000
694#define BR00_TPCY_ENABLE 0x00000010
695
696#define BR00_TPCY_ROP 0x00000000
697#define BR00_TPCY_NO_ROP 0x00000020
698#define BR00_TPCY_EQ 0x00000000
699#define BR00_TPCY_NOT_EQ 0x00000040
700
701#define BR00_PAT_MSB_FIRST 0x00000000 /* ? */
702
703#define BR00_PAT_VERT_ALIGN 0x000000e0
704
705#define BR00_LENGTH 0x0000000F
706
707#define BR09_DEST_ADDR 0x03FFFFFF
708
709#define BR11_SOURCE_PITCH 0x00003FFF
710
711#define BR12_SOURCE_ADDR 0x03FFFFFF
712
713#define BR13_SOLID_PATTERN 0x80000000
714#define BR13_RIGHT_TO_LEFT 0x40000000
715#define BR13_LEFT_TO_RIGHT 0x00000000
716#define BR13_MONO_TRANSPCY 0x20000000
717#define BR13_MONO_PATN_TRANS 0x10000000
718#define BR13_USE_DYN_DEPTH 0x04000000
719#define BR13_DYN_8BPP 0x00000000
720#define BR13_DYN_16BPP 0x01000000
721#define BR13_DYN_24BPP 0x02000000
722#define BR13_ROP_MASK 0x00FF0000
723#define BR13_DEST_PITCH 0x0000FFFF
724#define BR13_PITCH_SIGN_BIT 0x00008000
725
726#define BR14_DEST_HEIGHT 0xFFFF0000
727#define BR14_DEST_WIDTH 0x0000FFFF
728
729#define BR15_PATTERN_ADDR 0x03FFFFFF
730
731#define BR16_SOLID_PAT_COLOR 0x00FFFFFF
732#define BR16_BACKGND_PAT_CLR 0x00FFFFFF
733
734#define BR17_FGND_PAT_CLR 0x00FFFFFF
735
736#define BR18_SRC_BGND_CLR 0x00FFFFFF
737#define BR19_SRC_FGND_CLR 0x00FFFFFF
738
739
740/* Instruction parser instructions
741 */
742
743#define INST_PARSER_CLIENT 0x00000000
744#define INST_OP_FLUSH 0x02000000
745#define INST_FLUSH_MAP_CACHE 0x00000001
746
747
748#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
749
750
751/* Registers in the i810 host-pci bridge pci config space which affect
752 * the i810 graphics operations.
753 */
754#define SMRAM_MISCC 0x70
755#define GMS 0x000000c0
756#define GMS_DISABLE 0x00000000
757#define GMS_ENABLE_BARE 0x00000040
758#define GMS_ENABLE_512K 0x00000080
759#define GMS_ENABLE_1M 0x000000c0
760#define USMM 0x00000030
761#define USMM_DISABLE 0x00000000
762#define USMM_TSEG_ZERO 0x00000010
763#define USMM_TSEG_512K 0x00000020
764#define USMM_TSEG_1M 0x00000030
765#define GFX_MEM_WIN_SIZE 0x00010000
766#define GFX_MEM_WIN_32M 0x00010000
767#define GFX_MEM_WIN_64M 0x00000000
768
769/* Overkill? I don't know. Need to figure out top of mem to make the
770 * SMRAM calculations come out. Linux seems to have problems
771 * detecting it all on its own, so this seems a reasonable double
772 * check to any user supplied 'mem=...' boot param.
773 *
774 * ... unfortunately this reg doesn't work according to spec on the
775 * test hardware.
776 */
777#define WHTCFG_PAMR_DRP 0x50
778#define SYS_DRAM_ROW_0_SHIFT 16
779#define SYS_DRAM_ROW_1_SHIFT 20
780#define DRAM_MASK 0x0f
781#define DRAM_VALUE_0 0
782#define DRAM_VALUE_1 8
783/* No 2 value defined */
784#define DRAM_VALUE_3 16
785#define DRAM_VALUE_4 16
786#define DRAM_VALUE_5 24
787#define DRAM_VALUE_6 32
788#define DRAM_VALUE_7 32
789#define DRAM_VALUE_8 48
790#define DRAM_VALUE_9 64
791#define DRAM_VALUE_A 64
792#define DRAM_VALUE_B 96
793#define DRAM_VALUE_C 128
794#define DRAM_VALUE_D 128
795#define DRAM_VALUE_E 192
796#define DRAM_VALUE_F 256 /* nice one, geezer */
797#define LM_FREQ_MASK 0x10
798#define LM_FREQ_133 0x10
799#define LM_FREQ_100 0x00
800
801
802
803
804/* These are 3d state registers, but the state is invarient, so we let
805 * the X server handle it:
806 */
807
808
809
810/* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135
811 */
812#define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1)
813#define CC1_UPDATE_KILL_WRITE (1<<28)
814#define CC1_ENABLE_KILL_WRITE (1<<27)
815#define CC1_DISABLE_KILL_WRITE 0
816#define CC1_UPDATE_COLOR_IDX (1<<26)
817#define CC1_UPDATE_CHROMA_LOW (1<<25)
818#define CC1_UPDATE_CHROMA_HI (1<<24)
819#define CC1_CHROMA_LOW_MASK ((1<<24)-1)
820#define CC2_COLOR_IDX_SHIFT 24
821#define CC2_COLOR_IDX_MASK (0xff<<24)
822#define CC2_CHROMA_HI_MASK ((1<<24)-1)
823
824
825#define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23))
826#define CS_UPDATE_LOAD (1<<17)
827#define CS_UPDATE_USE (1<<16)
828#define CS_UPDATE_LOAD (1<<17)
829#define CS_LOAD_CTX0 0
830#define CS_LOAD_CTX1 (1<<8)
831#define CS_USE_CTX0 0
832#define CS_USE_CTX1 (1<<0)
833
834/* I810 LCD/TV registers */
835#define LCD_TV_HTOTAL 0x60000
836#define LCD_TV_C 0x60018
837#define LCD_TV_OVRACT 0x6001C
838
839#define LCD_TV_ENABLE (1 << 31)
840#define LCD_TV_VGAMOD (1 << 28)
841
842/* I830 CRTC registers */
843#define HTOTAL_A 0x60000
844#define HBLANK_A 0x60004
845#define HSYNC_A 0x60008
846#define VTOTAL_A 0x6000c
847#define VBLANK_A 0x60010
848#define VSYNC_A 0x60014
849#define PIPEASRC 0x6001c
850#define BCLRPAT_A 0x60020
851#define VSYNCSHIFT_A 0x60028
852
853#define HTOTAL_B 0x61000
854#define HBLANK_B 0x61004
855#define HSYNC_B 0x61008
856#define VTOTAL_B 0x6100c
857#define VBLANK_B 0x61010
858#define VSYNC_B 0x61014
859#define PIPEBSRC 0x6101c
860#define BCLRPAT_B 0x61020
861#define VSYNCSHIFT_B 0x61028
862
Daniel Vetter0efa6c72012-08-07 18:16:34 +0200863#define HTOTAL_C 0x62000
864#define HBLANK_C 0x62004
865#define HSYNC_C 0x62008
866#define VTOTAL_C 0x6200c
867#define VBLANK_C 0x62010
868#define VSYNC_C 0x62014
869#define PIPECSRC 0x6201c
870#define BCLRPAT_C 0x62020
871#define VSYNCSHIFT_C 0x62028
872
Paulo Zanoni5c0ce0f2013-03-01 15:46:25 -0300873#define HTOTAL_EDP 0x6F000
874#define HBLANK_EDP 0x6F004
875#define HSYNC_EDP 0x6F008
876#define VTOTAL_EDP 0x6F00c
877#define VBLANK_EDP 0x6F010
878#define VSYNC_EDP 0x6F014
879#define VSYNCSHIFT_EDP 0x6F028
880
Eric Anholt8c641832009-03-26 17:15:11 -0700881#define PP_STATUS 0x61200
882# define PP_ON (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +0100883/*
Eric Anholt8c641832009-03-26 17:15:11 -0700884 * Indicates that all dependencies of the panel are on:
885 *
886 * - PLL enabled
887 * - pipe enabled
888 * - LVDS/DVOB/DVOC on
889 */
890# define PP_READY (1 << 30)
891# define PP_SEQUENCE_NONE (0 << 28)
892# define PP_SEQUENCE_ON (1 << 28)
893# define PP_SEQUENCE_OFF (2 << 28)
894# define PP_SEQUENCE_MASK 0x30000000
895
896#define PP_CONTROL 0x61204
897# define POWER_DOWN_ON_RESET (1 << 1)
898# define POWER_TARGET_ON (1 << 0)
899
900#define PP_ON_DELAYS 0x61208
901#define PP_OFF_DELAYS 0x6120c
902#define PP_DIVISOR 0x61210
903
904#define PFIT_CONTROL 0x61230
905# define PFIT_ENABLE (1 << 31)
906/* Pre-965 */
907# define VERT_INTERP_DISABLE (0 << 10)
908# define VERT_INTERP_BILINEAR (1 << 10)
909# define VERT_INTERP_MASK (3 << 10)
910# define VERT_AUTO_SCALE (1 << 9)
911# define HORIZ_INTERP_DISABLE (0 << 6)
912# define HORIZ_INTERP_BILINEAR (1 << 6)
913# define HORIZ_INTERP_MASK (3 << 6)
914# define HORIZ_AUTO_SCALE (1 << 5)
915# define PANEL_8TO6_DITHER_ENABLE (1 << 3)
916/* 965+ */
917# define PFIT_PIPE_MASK (3 << 29)
918# define PFIT_PIPE_SHIFT 29
919# define PFIT_SCALING_MODE_MASK (7 << 26)
920# define PFIT_SCALING_AUTO (0 << 26)
921# define PFIT_SCALING_PROGRAMMED (1 << 26)
922# define PFIT_SCALING_PILLAR (2 << 26)
923# define PFIT_SCALING_LETTER (3 << 26)
924# define PFIT_FILTER_SELECT_MASK (3 << 24)
925# define PFIT_FILTER_FUZZY (0 << 24)
926# define PFIT_FILTER_CRISP (1 << 24)
927# define PFIT_FILTER_MEDIAN (2 << 24)
928
929#define PFIT_PGM_RATIOS 0x61234
930/* Pre-965 */
931# define PFIT_VERT_SCALE_SHIFT 20
932# define PFIT_VERT_SCALE_MASK 0xfff00000
933# define PFIT_HORIZ_SCALE_SHIFT 4
934# define PFIT_HORIZ_SCALE_MASK 0x0000fff0
935/* 965+ */
936# define PFIT_VERT_SCALE_SHIFT_965 16
937# define PFIT_VERT_SCALE_MASK_965 0x1fff0000
938# define PFIT_HORIZ_SCALE_SHIFT_965 0
939# define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
940
941#define DPLL_A 0x06014
942#define DPLL_B 0x06018
943# define DPLL_VCO_ENABLE (1 << 31)
944# define DPLL_DVO_HIGH_SPEED (1 << 30)
945# define DPLL_SYNCLOCK_ENABLE (1 << 29)
946# define DPLL_VGA_MODE_DIS (1 << 28)
947# define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
948# define DPLLB_MODE_LVDS (2 << 26) /* i915 */
949# define DPLL_MODE_MASK (3 << 26)
950# define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
951# define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
952# define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
953# define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
954# define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
955# define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
956# define DPLL_FPA01_P1_POST_DIV_MASK_IGD 0x00ff8000 /* IGD */
Thomas Wood1e5c8782014-06-09 14:02:04 +0100957/*
Eric Anholt8c641832009-03-26 17:15:11 -0700958 * The i830 generation, in DAC/serial mode, defines p1 as two plus this
959 * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
960 */
961# define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
Thomas Wood1e5c8782014-06-09 14:02:04 +0100962/*
Eric Anholt8c641832009-03-26 17:15:11 -0700963 * The i830 generation, in LVDS mode, defines P1 as the bit number set within
964 * this field (only one bit may be set).
965 */
966# define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
967# define DPLL_FPA01_P1_POST_DIV_SHIFT 16
968# define DPLL_FPA01_P1_POST_DIV_SHIFT_IGD 15
969# define PLL_P2_DIVIDE_BY_4 (1 << 23) /* i830, required in DVO non-gang */
970# define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
971# define PLL_REF_INPUT_DREFCLK (0 << 13)
972# define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
Eric Anholt40bff502009-10-06 17:25:10 -0700973# define PLL_REF_INPUT_SUPER_SSC (1 << 13) /* Ironlake: 120M SSC */
Eric Anholt8c641832009-03-26 17:15:11 -0700974# define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
975# define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
976# define PLL_REF_INPUT_MASK (3 << 13)
Eric Anholt40bff502009-10-06 17:25:10 -0700977# define PLL_REF_INPUT_DMICLK (5 << 13) /* Ironlake: DMI refclk */
Eric Anholt8c641832009-03-26 17:15:11 -0700978# define PLL_LOAD_PULSE_PHASE_SHIFT 9
979/*
980 * Parallel to Serial Load Pulse phase selection.
981 * Selects the phase for the 10X DPLL clock for the PCIe
982 * digital display port. The range is 4 to 13; 10 or more
983 * is just a flip delay. The default is 6
984 */
985# define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
986# define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
Eric Anholt40bff502009-10-06 17:25:10 -0700987/* Ironlake */
988# define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9
989# define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9)
990# define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x)-1)<< PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT)
991# define DPLL_FPA1_P1_POST_DIV_SHIFT 0
992# define DPLL_FPA1_P1_POST_DIV_MASK 0xff
Eric Anholt8c641832009-03-26 17:15:11 -0700993
Thomas Wood1e5c8782014-06-09 14:02:04 +0100994/*
Eric Anholt8c641832009-03-26 17:15:11 -0700995 * SDVO multiplier for 945G/GM. Not used on 965.
996 *
997 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
998 */
999# define SDVO_MULTIPLIER_MASK 0x000000ff
1000# define SDVO_MULTIPLIER_SHIFT_HIRES 4
1001# define SDVO_MULTIPLIER_SHIFT_VGA 0
1002
Thomas Wood1e5c8782014-06-09 14:02:04 +01001003/* @defgroup DPLL_MD
Eric Anholt8c641832009-03-26 17:15:11 -07001004 * @{
1005 */
Thomas Wood1e5c8782014-06-09 14:02:04 +01001006/* Pipe A SDVO/UDI clock multiplier/divider register for G965. */
Eric Anholt8c641832009-03-26 17:15:11 -07001007#define DPLL_A_MD 0x0601c
Thomas Wood1e5c8782014-06-09 14:02:04 +01001008/* Pipe B SDVO/UDI clock multiplier/divider register for G965. */
Eric Anholt8c641832009-03-26 17:15:11 -07001009#define DPLL_B_MD 0x06020
Thomas Wood1e5c8782014-06-09 14:02:04 +01001010/*
Eric Anholt8c641832009-03-26 17:15:11 -07001011 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
1012 *
1013 * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
1014 */
1015# define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
1016# define DPLL_MD_UDI_DIVIDER_SHIFT 24
Thomas Wood1e5c8782014-06-09 14:02:04 +01001017/* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
Eric Anholt8c641832009-03-26 17:15:11 -07001018# define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
1019# define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001020/*
Eric Anholt8c641832009-03-26 17:15:11 -07001021 * SDVO/UDI pixel multiplier.
1022 *
1023 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
1024 * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
1025 * modes, the bus rate would be below the limits, so SDVO allows for stuffing
1026 * dummy bytes in the datastream at an increased clock rate, with both sides of
1027 * the link knowing how many bytes are fill.
1028 *
1029 * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
1030 * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
1031 * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
1032 * through an SDVO command.
1033 *
1034 * This register field has values of multiplication factor minus 1, with
1035 * a maximum multiplier of 5 for SDVO.
1036 */
1037# define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
1038# define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
Thomas Wood1e5c8782014-06-09 14:02:04 +01001039/* SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
Eric Anholt8c641832009-03-26 17:15:11 -07001040 * This best be set to the default value (3) or the CRT won't work. No,
1041 * I don't entirely understand what this does...
1042 */
1043# define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
1044# define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001045/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001046
1047#define DPLL_TEST 0x606c
1048# define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
1049# define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
1050# define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
1051# define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
1052# define DPLLB_TEST_N_BYPASS (1 << 19)
1053# define DPLLB_TEST_M_BYPASS (1 << 18)
1054# define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
1055# define DPLLA_TEST_N_BYPASS (1 << 3)
1056# define DPLLA_TEST_M_BYPASS (1 << 2)
1057# define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
1058
1059#define D_STATE 0x6104
1060#define DSPCLK_GATE_D 0x6200
1061# define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */
1062# define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */
1063# define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */
1064# define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */
1065# define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */
1066# define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */
1067# define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */
1068# define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */
1069# define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */
1070# define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */
1071# define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */
1072# define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */
1073# define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */
1074# define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */
1075# define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */
1076# define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */
1077# define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */
1078# define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */
1079# define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */
1080# define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
1081# define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10)
1082# define DCUNIT_CLOCK_GATE_DISABLE (1 << 9)
1083# define DPUNIT_CLOCK_GATE_DISABLE (1 << 8)
1084# define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */
1085# define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */
1086# define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */
1087# define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5)
1088# define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001089/*
Eric Anholt8c641832009-03-26 17:15:11 -07001090 * This bit must be set on the 830 to prevent hangs when turning off the
1091 * overlay scaler.
1092 */
1093# define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3)
1094# define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2)
1095# define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1)
1096# define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */
1097# define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */
1098
1099#define RENCLK_GATE_D1 0x6204
1100# define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */
1101# define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */
1102# define PC_FE_CLOCK_GATE_DISABLE (1 << 11)
1103# define PC_BE_CLOCK_GATE_DISABLE (1 << 10)
1104# define WINDOWER_CLOCK_GATE_DISABLE (1 << 9)
1105# define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8)
1106# define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7)
1107# define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6)
1108# define MAG_CLOCK_GATE_DISABLE (1 << 5)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001109/* This bit must be unset on 855,865 */
Eric Anholt8c641832009-03-26 17:15:11 -07001110# define MECI_CLOCK_GATE_DISABLE (1 << 4)
1111# define DCMP_CLOCK_GATE_DISABLE (1 << 3)
1112# define MEC_CLOCK_GATE_DISABLE (1 << 2)
1113# define MECO_CLOCK_GATE_DISABLE (1 << 1)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001114/* This bit must be set on 855,865. */
Eric Anholt8c641832009-03-26 17:15:11 -07001115# define SV_CLOCK_GATE_DISABLE (1 << 0)
1116# define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16)
1117# define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15)
1118# define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14)
1119# define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13)
1120# define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12)
1121# define I915_WM_CLOCK_GATE_DISABLE (1 << 11)
1122# define I915_IZ_CLOCK_GATE_DISABLE (1 << 10)
1123# define I915_PI_CLOCK_GATE_DISABLE (1 << 9)
1124# define I915_DI_CLOCK_GATE_DISABLE (1 << 8)
1125# define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7)
1126# define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6)
1127# define I915_SC_CLOCK_GATE_DISABLE (1 << 5)
1128# define I915_FL_CLOCK_GATE_DISABLE (1 << 4)
1129# define I915_DM_CLOCK_GATE_DISABLE (1 << 3)
1130# define I915_PS_CLOCK_GATE_DISABLE (1 << 2)
1131# define I915_CC_CLOCK_GATE_DISABLE (1 << 1)
1132# define I915_BY_CLOCK_GATE_DISABLE (1 << 0)
1133
1134# define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001135/* This bit must always be set on 965G/965GM */
Eric Anholt8c641832009-03-26 17:15:11 -07001136# define I965_RCC_CLOCK_GATE_DISABLE (1 << 29)
1137# define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28)
1138# define I965_DAP_CLOCK_GATE_DISABLE (1 << 27)
1139# define I965_ROC_CLOCK_GATE_DISABLE (1 << 26)
1140# define I965_GW_CLOCK_GATE_DISABLE (1 << 25)
1141# define I965_TD_CLOCK_GATE_DISABLE (1 << 24)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001142/* This bit must always be set on 965G */
Eric Anholt8c641832009-03-26 17:15:11 -07001143# define I965_ISC_CLOCK_GATE_DISABLE (1 << 23)
1144# define I965_IC_CLOCK_GATE_DISABLE (1 << 22)
1145# define I965_EU_CLOCK_GATE_DISABLE (1 << 21)
1146# define I965_IF_CLOCK_GATE_DISABLE (1 << 20)
1147# define I965_TC_CLOCK_GATE_DISABLE (1 << 19)
1148# define I965_SO_CLOCK_GATE_DISABLE (1 << 17)
1149# define I965_FBC_CLOCK_GATE_DISABLE (1 << 16)
1150# define I965_MARI_CLOCK_GATE_DISABLE (1 << 15)
1151# define I965_MASF_CLOCK_GATE_DISABLE (1 << 14)
1152# define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13)
1153# define I965_EM_CLOCK_GATE_DISABLE (1 << 12)
1154# define I965_UC_CLOCK_GATE_DISABLE (1 << 11)
1155# define I965_SI_CLOCK_GATE_DISABLE (1 << 6)
1156# define I965_MT_CLOCK_GATE_DISABLE (1 << 5)
1157# define I965_PL_CLOCK_GATE_DISABLE (1 << 4)
1158# define I965_DG_CLOCK_GATE_DISABLE (1 << 3)
1159# define I965_QC_CLOCK_GATE_DISABLE (1 << 2)
1160# define I965_FT_CLOCK_GATE_DISABLE (1 << 1)
1161# define I965_DM_CLOCK_GATE_DISABLE (1 << 0)
1162
1163#define RENCLK_GATE_D2 0x6208
1164#define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)
1165#define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)
1166#define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6)
1167#define RAMCLK_GATE_D 0x6210 /* CRL only */
1168#define DEUC 0x6214 /* CRL only */
1169
1170/*
1171 * This is a PCI config space register to manipulate backlight brightness
1172 * It is used when the BLM_LEGACY_MODE is turned on. When enabled, the first
1173 * byte of this config register sets brightness within the range from
1174 * 0 to 0xff
1175 */
1176#define LEGACY_BACKLIGHT_BRIGHTNESS 0xf4
1177
1178#define BLC_PWM_CTL 0x61254
1179#define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
1180#define BACKLIGHT_MODULATION_FREQ_SHIFT2 (16)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001181/*
Eric Anholt8c641832009-03-26 17:15:11 -07001182 * This is the most significant 15 bits of the number of backlight cycles in a
1183 * complete cycle of the modulated backlight control.
1184 *
1185 * The actual value is this field multiplied by two.
1186 */
1187#define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
1188#define BACKLIGHT_MODULATION_FREQ_MASK2 (0xffff << 16)
1189#define BLM_LEGACY_MODE (1 << 16)
1190
Thomas Wood1e5c8782014-06-09 14:02:04 +01001191/*
Eric Anholt8c641832009-03-26 17:15:11 -07001192 * This is the number of cycles out of the backlight modulation cycle for which
1193 * the backlight is on.
1194 *
1195 * This field must be no greater than the number of cycles in the complete
1196 * backlight modulation cycle.
1197 */
1198#define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
1199#define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
1200
1201/* On 965+ backlight control is in another register */
1202#define BLC_PWM_CTL2 0x61250
1203#define BLM_LEGACY_MODE2 (1 << 30)
1204
1205#define BLM_CTL 0x61260
1206#define BLM_THRESHOLD_0 0x61270
1207#define BLM_THRESHOLD_1 0x61274
1208#define BLM_THRESHOLD_2 0x61278
1209#define BLM_THRESHOLD_3 0x6127c
1210#define BLM_THRESHOLD_4 0x61280
1211#define BLM_THRESHOLD_5 0x61284
1212
1213#define BLM_ACCUMULATOR_0 0x61290
1214#define BLM_ACCUMULATOR_1 0x61294
1215#define BLM_ACCUMULATOR_2 0x61298
1216#define BLM_ACCUMULATOR_3 0x6129c
1217#define BLM_ACCUMULATOR_4 0x612a0
1218#define BLM_ACCUMULATOR_5 0x612a4
1219
1220#define FPA0 0x06040
1221#define FPA1 0x06044
1222#define FPB0 0x06048
1223#define FPB1 0x0604c
1224# define FP_N_DIV_MASK 0x003f0000
1225# define FP_N_IGD_DIV_MASK 0x00ff0000
1226# define FP_N_DIV_SHIFT 16
1227# define FP_M1_DIV_MASK 0x00003f00
1228# define FP_M1_DIV_SHIFT 8
1229# define FP_M2_DIV_MASK 0x0000003f
1230# define FP_M2_IGD_DIV_MASK 0x000000ff
1231# define FP_M2_DIV_SHIFT 0
1232
1233#define PORT_HOTPLUG_EN 0x61110
1234# define HDMIB_HOTPLUG_INT_EN (1 << 29)
1235# define HDMIC_HOTPLUG_INT_EN (1 << 28)
1236# define HDMID_HOTPLUG_INT_EN (1 << 27)
1237# define SDVOB_HOTPLUG_INT_EN (1 << 26)
1238# define SDVOC_HOTPLUG_INT_EN (1 << 25)
1239# define TV_HOTPLUG_INT_EN (1 << 18)
1240# define CRT_HOTPLUG_INT_EN (1 << 9)
1241# define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8)
1242/* must use period 64 on GM45 according to docs */
1243# define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
1244# define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
1245# define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
1246# define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
1247# define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
1248# define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
1249# define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
1250# define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
1251# define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
1252# define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
1253# define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
1254# define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
1255# define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
1256# define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */
1257
1258#define PORT_HOTPLUG_STAT 0x61114
1259# define HDMIB_HOTPLUG_INT_STATUS (1 << 29)
1260# define HDMIC_HOTPLUG_INT_STATUS (1 << 28)
1261# define HDMID_HOTPLUG_INT_STATUS (1 << 27)
1262# define CRT_HOTPLUG_INT_STATUS (1 << 11)
1263# define TV_HOTPLUG_INT_STATUS (1 << 10)
1264# define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
1265# define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
1266# define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
1267# define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
1268# define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
1269# define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
1270
1271#define SDVOB 0x61140
1272#define SDVOC 0x61160
1273#define SDVO_ENABLE (1 << 31)
1274#define SDVO_PIPE_B_SELECT (1 << 30)
1275#define SDVO_STALL_SELECT (1 << 29)
1276#define SDVO_INTERRUPT_ENABLE (1 << 26)
Yang, Libin99177442015-01-12 01:38:34 +00001277
1278#define DISPLAY_HOTPLUG_CTL 0x61164
Thomas Wood1e5c8782014-06-09 14:02:04 +01001279/*
Eric Anholt8c641832009-03-26 17:15:11 -07001280 * 915G/GM SDVO pixel multiplier.
1281 *
1282 * Programmed value is multiplier - 1, up to 5x.
1283 *
1284 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
1285 */
1286#define SDVO_PORT_MULTIPLY_MASK (7 << 23)
1287#define SDVO_PORT_MULTIPLY_SHIFT 23
1288#define SDVO_PHASE_SELECT_MASK (15 << 19)
1289#define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
1290#define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
1291#define SDVOC_GANG_MODE (1 << 16)
1292#define SDVO_ENCODING_SDVO (0x0 << 10)
1293#define SDVO_ENCODING_HDMI (0x2 << 10)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001294/* Requird for HDMI operation */
Eric Anholt8c641832009-03-26 17:15:11 -07001295#define SDVO_NULL_PACKETS_DURING_VSYNC (1 << 9)
1296#define SDVO_BORDER_ENABLE (1 << 7)
1297#define SDVO_AUDIO_ENABLE (1 << 6)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001298/* New with 965, default is to be set */
Eric Anholt8c641832009-03-26 17:15:11 -07001299#define SDVO_VSYNC_ACTIVE_HIGH (1 << 4)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001300/* New with 965, default is to be set */
Eric Anholt8c641832009-03-26 17:15:11 -07001301#define SDVO_HSYNC_ACTIVE_HIGH (1 << 3)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001302/* 915/945 only, read-only bit */
Eric Anholt8c641832009-03-26 17:15:11 -07001303#define SDVOB_PCIE_CONCURRENCY (1 << 3)
1304#define SDVO_DETECTED (1 << 2)
1305/* Bits to be preserved when writing */
1306#define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14))
1307#define SDVOC_PRESERVE_MASK (1 << 17)
1308
1309#define UDIB_SVB_SHB_CODES 0x61144
1310#define UDIB_SHA_BLANK_CODES 0x61148
1311#define UDIB_START_END_FILL_CODES 0x6114c
1312
1313
1314#define SDVOUDI 0x61150
1315
1316#define I830_HTOTAL_MASK 0xfff0000
1317#define I830_HACTIVE_MASK 0x7ff
1318
1319#define I830_HBLANKEND_MASK 0xfff0000
1320#define I830_HBLANKSTART_MASK 0xfff
1321
1322#define I830_HSYNCEND_MASK 0xfff0000
1323#define I830_HSYNCSTART_MASK 0xfff
1324
1325#define I830_VTOTAL_MASK 0xfff0000
1326#define I830_VACTIVE_MASK 0x7ff
1327
1328#define I830_VBLANKEND_MASK 0xfff0000
1329#define I830_VBLANKSTART_MASK 0xfff
1330
1331#define I830_VSYNCEND_MASK 0xfff0000
1332#define I830_VSYNCSTART_MASK 0xfff
1333
1334#define I830_PIPEA_HORZ_MASK 0x7ff0000
1335#define I830_PIPEA_VERT_MASK 0x7ff
1336
1337#define ADPA 0x61100
1338#define ADPA_DAC_ENABLE (1<<31)
1339#define ADPA_DAC_DISABLE 0
1340#define ADPA_PIPE_SELECT_MASK (1<<30)
1341#define ADPA_PIPE_A_SELECT 0
1342#define ADPA_PIPE_B_SELECT (1<<30)
1343#define ADPA_USE_VGA_HVPOLARITY (1<<15)
1344#define ADPA_SETS_HVPOLARITY 0
1345#define ADPA_VSYNC_CNTL_DISABLE (1<<11)
1346#define ADPA_VSYNC_CNTL_ENABLE 0
1347#define ADPA_HSYNC_CNTL_DISABLE (1<<10)
1348#define ADPA_HSYNC_CNTL_ENABLE 0
1349#define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
1350#define ADPA_VSYNC_ACTIVE_LOW 0
1351#define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
1352#define ADPA_HSYNC_ACTIVE_LOW 0
1353
Daniel Vetterda647312012-12-01 00:52:24 +01001354#define PCH_DSP_CHICKEN1 0x42000
1355#define PCH_DSP_CHICKEN2 0x42004
1356#define PCH_DSP_CHICKEN3 0x4200c
Eric Anholt253acc32010-12-16 16:42:52 -08001357#define PCH_DSPCLK_GATE_D 0x42020
1358#define PCH_DSPRAMCLK_GATE_D 0x42024
1359#define PCH_3DCGDIS0 0x46020
1360#define PCH_3DCGDIS1 0x46024
1361#define PCH_3DRAMCGDIS0 0x46028
1362#define SOUTH_DSPCLK_GATE_D 0xc2020
1363
Jesse Barnes7ab19ae2010-09-20 14:37:07 -07001364#define CPU_eDP_A 0x64000
Zhao Yakui7daa4812010-01-05 14:13:43 +00001365#define PCH_DP_B 0xe4100
1366#define PCH_DP_C 0xe4200
1367#define PCH_DP_D 0xe4300
Eric Anholt8c641832009-03-26 17:15:11 -07001368
1369#define DVOA 0x61120
1370#define DVOB 0x61140
1371#define DVOC 0x61160
1372#define DVO_ENABLE (1 << 31)
1373#define DVO_PIPE_B_SELECT (1 << 30)
1374#define DVO_PIPE_STALL_UNUSED (0 << 28)
1375#define DVO_PIPE_STALL (1 << 28)
1376#define DVO_PIPE_STALL_TV (2 << 28)
1377#define DVO_PIPE_STALL_MASK (3 << 28)
1378#define DVO_USE_VGA_SYNC (1 << 15)
1379#define DVO_DATA_ORDER_I740 (0 << 14)
1380#define DVO_DATA_ORDER_FP (1 << 14)
1381#define DVO_VSYNC_DISABLE (1 << 11)
1382#define DVO_HSYNC_DISABLE (1 << 10)
1383#define DVO_VSYNC_TRISTATE (1 << 9)
1384#define DVO_HSYNC_TRISTATE (1 << 8)
1385#define DVO_BORDER_ENABLE (1 << 7)
1386#define DVO_DATA_ORDER_GBRG (1 << 6)
1387#define DVO_DATA_ORDER_RGGB (0 << 6)
1388#define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6)
1389#define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6)
1390#define DVO_VSYNC_ACTIVE_HIGH (1 << 4)
1391#define DVO_HSYNC_ACTIVE_HIGH (1 << 3)
1392#define DVO_BLANK_ACTIVE_HIGH (1 << 2)
1393#define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
1394#define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
1395#define DVO_PRESERVE_MASK (0x7<<24)
1396
1397#define DVOA_SRCDIM 0x61124
1398#define DVOB_SRCDIM 0x61144
1399#define DVOC_SRCDIM 0x61164
1400#define DVO_SRCDIM_HORIZONTAL_SHIFT 12
1401#define DVO_SRCDIM_VERTICAL_SHIFT 0
1402
Thomas Wood1e5c8782014-06-09 14:02:04 +01001403/* @defgroup LVDS
Eric Anholt8c641832009-03-26 17:15:11 -07001404 * @{
1405 */
Thomas Wood1e5c8782014-06-09 14:02:04 +01001406/*
Eric Anholt8c641832009-03-26 17:15:11 -07001407 * This register controls the LVDS output enable, pipe selection, and data
1408 * format selection.
1409 *
1410 * All of the clock/data pairs are force powered down by power sequencing.
1411 */
1412#define LVDS 0x61180
Thomas Wood1e5c8782014-06-09 14:02:04 +01001413/*
Eric Anholt8c641832009-03-26 17:15:11 -07001414 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
1415 * the DPLL semantics change when the LVDS is assigned to that pipe.
1416 */
1417# define LVDS_PORT_EN (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001418/* Selects pipe B for LVDS data. Must be set on pre-965. */
Eric Anholt8c641832009-03-26 17:15:11 -07001419# define LVDS_PIPEB_SELECT (1 << 30)
1420
1421/* on 965, dithering is enabled in this register, not PFIT_CONTROL */
1422# define LVDS_DITHER_ENABLE (1 << 25)
1423
1424/*
1425 * Selects between .0 and .1 formats:
1426 *
1427 * 0 = 1x18.0, 2x18.0, 1x24.0 or 2x24.0
1428 * 1 = 1x24.1 or 2x24.1
1429 */
1430# define LVDS_DATA_FORMAT_DOT_ONE (1 << 24)
1431
1432/* Using LE instead of HS on second channel control signal */
1433# define LVDS_LE_CONTROL_ENABLE (1 << 23)
1434
1435/* Using LF instead of VS on second channel control signal */
1436# define LVDS_LF_CONTROL_ENABLE (1 << 22)
1437
1438/* invert vsync signal polarity */
1439# define LVDS_VSYNC_POLARITY_INVERT (1 << 21)
1440
1441/* invert hsync signal polarity */
1442# define LVDS_HSYNC_POLARITY_INVERT (1 << 20)
1443
1444/* invert display enable signal polarity */
1445# define LVDS_DE_POLARITY_INVERT (1 << 19)
1446
1447/*
1448 * Control signals for second channel, ignored in single channel modes
1449 */
1450
1451/* send DE, HS, VS on second channel */
1452# define LVDS_SECOND_CHANNEL_DE_HS_VS (0 << 17)
1453
1454# define LVDS_SECOND_CHANNEL_RESERVED (1 << 17)
1455
1456/* Send zeros instead of DE, HS, VS on second channel */
1457# define LVDS_SECOND_CHANNEL_ZEROS (2 << 17)
1458
1459/* Set DE=0, HS=LE, VS=LF on second channel */
1460# define LVDS_SECOND_CHANNEL_HS_VS (3 << 17)
1461
1462/*
1463 * Send duplicate data for channel reserved bits, otherwise send zeros
1464 */
1465# define LVDS_CHANNEL_DUP_RESERVED (1 << 16)
1466
1467/*
1468 * Enable border for unscaled (or aspect-scaled) display
1469 */
1470# define LVDS_BORDER_ENABLE (1 << 15)
1471
1472/*
1473 * Tri-state the LVDS buffers when powered down, otherwise
1474 * they are set to 0V
1475 */
1476# define LVDS_POWER_DOWN_TRI_STATE (1 << 10)
1477
Thomas Wood1e5c8782014-06-09 14:02:04 +01001478/*
Eric Anholt8c641832009-03-26 17:15:11 -07001479 * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
1480 * pixel.
1481 */
1482# define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
1483# define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
1484# define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001485/*
Eric Anholt8c641832009-03-26 17:15:11 -07001486 * Controls the A3 data pair, which contains the additional LSBs for 24 bit
1487 * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
1488 * on.
1489 */
1490# define LVDS_A3_POWER_MASK (3 << 6)
1491# define LVDS_A3_POWER_DOWN (0 << 6)
1492# define LVDS_A3_POWER_UP (3 << 6)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001493/*
Eric Anholt8c641832009-03-26 17:15:11 -07001494 * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
1495 * is set.
1496 */
1497# define LVDS_CLKB_POWER_MASK (3 << 4)
1498# define LVDS_CLKB_POWER_DOWN (0 << 4)
1499# define LVDS_CLKB_POWER_UP (3 << 4)
1500
Thomas Wood1e5c8782014-06-09 14:02:04 +01001501/*
Eric Anholt8c641832009-03-26 17:15:11 -07001502 * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
1503 * setting for whether we are in dual-channel mode. The B3 pair will
1504 * additionally only be powered up when LVDS_A3_POWER_UP is set.
1505 */
1506# define LVDS_B0B3_POWER_MASK (3 << 2)
1507# define LVDS_B0B3_POWER_DOWN (0 << 2)
1508# define LVDS_B0B3_POWER_UP (3 << 2)
1509
Thomas Wood1e5c8782014-06-09 14:02:04 +01001510/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001511
1512#define DP_B 0x64100
1513#define DPB_AUX_CH_CTL 0x64110
1514#define DPB_AUX_CH_DATA1 0x64114
1515#define DPB_AUX_CH_DATA2 0x64118
1516#define DPB_AUX_CH_DATA3 0x6411c
1517#define DPB_AUX_CH_DATA4 0x64120
1518#define DPB_AUX_CH_DATA5 0x64124
1519
1520#define DP_C 0x64200
1521#define DPC_AUX_CH_CTL 0x64210
1522#define DPC_AUX_CH_DATA1 0x64214
1523#define DPC_AUX_CH_DATA2 0x64218
1524#define DPC_AUX_CH_DATA3 0x6421c
1525#define DPC_AUX_CH_DATA4 0x64220
1526#define DPC_AUX_CH_DATA5 0x64224
1527
1528#define DP_D 0x64300
1529#define DPD_AUX_CH_CTL 0x64310
1530#define DPD_AUX_CH_DATA1 0x64314
1531#define DPD_AUX_CH_DATA2 0x64318
1532#define DPD_AUX_CH_DATA3 0x6431c
1533#define DPD_AUX_CH_DATA4 0x64320
1534#define DPD_AUX_CH_DATA5 0x64324
1535
1536/*
1537 * Two channel clock control. Turn this on if you need clkb for two channel mode
1538 * Overridden by global LVDS power sequencing
1539 */
1540
1541/* clkb off */
1542# define LVDS_CLKB_POWER_DOWN (0 << 4)
1543
1544/* powered up, but clkb forced to 0 */
1545# define LVDS_CLKB_POWER_PARTIAL (1 << 4)
1546
1547/* clock B running */
1548# define LVDS_CLKB_POWER_UP (3 << 4)
1549
1550/*
1551 * Two channel mode B0-B2 control. Sets state when power is on.
1552 * Set to POWER_DOWN in single channel mode, other settings enable
1553 * two channel mode. The CLKB power control controls whether that clock
1554 * is enabled during two channel mode.
1555 *
1556 */
1557/* Everything is off, including B3 and CLKB */
1558# define LVDS_B_POWER_DOWN (0 << 2)
1559
1560/* B0, B1, B2 and data lines forced to 0. timing is active */
1561# define LVDS_B_POWER_PARTIAL (1 << 2)
1562
1563/* data lines active (both timing and colour) */
1564# define LVDS_B_POWER_UP (3 << 2)
1565
Thomas Wood1e5c8782014-06-09 14:02:04 +01001566/* @defgroup TV_CTL
Eric Anholt8c641832009-03-26 17:15:11 -07001567 * @{
1568 */
1569#define TV_CTL 0x68000
Thomas Wood1e5c8782014-06-09 14:02:04 +01001570/* Enables the TV encoder */
Eric Anholt8c641832009-03-26 17:15:11 -07001571# define TV_ENC_ENABLE (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001572/* Sources the TV encoder input from pipe B instead of A. */
Eric Anholt8c641832009-03-26 17:15:11 -07001573# define TV_ENC_PIPEB_SELECT (1 << 30)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001574/* Outputs composite video (DAC A only) */
Eric Anholt8c641832009-03-26 17:15:11 -07001575# define TV_ENC_OUTPUT_COMPOSITE (0 << 28)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001576/* Outputs SVideo video (DAC B/C) */
Eric Anholt8c641832009-03-26 17:15:11 -07001577# define TV_ENC_OUTPUT_SVIDEO (1 << 28)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001578/* Outputs Component video (DAC A/B/C) */
Eric Anholt8c641832009-03-26 17:15:11 -07001579# define TV_ENC_OUTPUT_COMPONENT (2 << 28)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001580/* Outputs Composite and SVideo (DAC A/B/C) */
Eric Anholt8c641832009-03-26 17:15:11 -07001581# define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28)
1582# define TV_TRILEVEL_SYNC (1 << 21)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001583/* Enables slow sync generation (945GM only) */
Eric Anholt8c641832009-03-26 17:15:11 -07001584# define TV_SLOW_SYNC (1 << 20)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001585/* Selects 4x oversampling for 480i and 576p */
Eric Anholt8c641832009-03-26 17:15:11 -07001586# define TV_OVERSAMPLE_4X (0 << 18)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001587/* Selects 2x oversampling for 720p and 1080i */
Eric Anholt8c641832009-03-26 17:15:11 -07001588# define TV_OVERSAMPLE_2X (1 << 18)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001589/* Selects no oversampling for 1080p */
Eric Anholt8c641832009-03-26 17:15:11 -07001590# define TV_OVERSAMPLE_NONE (2 << 18)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001591/* Selects 8x oversampling */
Eric Anholt8c641832009-03-26 17:15:11 -07001592# define TV_OVERSAMPLE_8X (3 << 18)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001593/* Selects progressive mode rather than interlaced */
Eric Anholt8c641832009-03-26 17:15:11 -07001594# define TV_PROGRESSIVE (1 << 17)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001595/* Sets the colorburst to PAL mode. Required for non-M PAL modes. */
Eric Anholt8c641832009-03-26 17:15:11 -07001596# define TV_PAL_BURST (1 << 16)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001597/* Field for setting delay of Y compared to C */
Eric Anholt8c641832009-03-26 17:15:11 -07001598# define TV_YC_SKEW_MASK (7 << 12)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001599/* Enables a fix for 480p/576p standard definition modes on the 915GM only */
Eric Anholt8c641832009-03-26 17:15:11 -07001600# define TV_ENC_SDP_FIX (1 << 11)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001601/*
Eric Anholt8c641832009-03-26 17:15:11 -07001602 * Enables a fix for the 915GM only.
1603 *
1604 * Not sure what it does.
1605 */
1606# define TV_ENC_C0_FIX (1 << 10)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001607/* Bits that must be preserved by software */
Eric Anholt8c641832009-03-26 17:15:11 -07001608# define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf)
1609# define TV_FUSE_STATE_MASK (3 << 4)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001610/* Read-only state that reports all features enabled */
Eric Anholt8c641832009-03-26 17:15:11 -07001611# define TV_FUSE_STATE_ENABLED (0 << 4)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001612/* Read-only state that reports that Macrovision is disabled in hardware*/
Eric Anholt8c641832009-03-26 17:15:11 -07001613# define TV_FUSE_STATE_NO_MACROVISION (1 << 4)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001614/* Read-only state that reports that TV-out is disabled in hardware. */
Eric Anholt8c641832009-03-26 17:15:11 -07001615# define TV_FUSE_STATE_DISABLED (2 << 4)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001616/* Normal operation */
Eric Anholt8c641832009-03-26 17:15:11 -07001617# define TV_TEST_MODE_NORMAL (0 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001618/* Encoder test pattern 1 - combo pattern */
Eric Anholt8c641832009-03-26 17:15:11 -07001619# define TV_TEST_MODE_PATTERN_1 (1 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001620/* Encoder test pattern 2 - full screen vertical 75% color bars */
Eric Anholt8c641832009-03-26 17:15:11 -07001621# define TV_TEST_MODE_PATTERN_2 (2 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001622/* Encoder test pattern 3 - full screen horizontal 75% color bars */
Eric Anholt8c641832009-03-26 17:15:11 -07001623# define TV_TEST_MODE_PATTERN_3 (3 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001624/* Encoder test pattern 4 - random noise */
Eric Anholt8c641832009-03-26 17:15:11 -07001625# define TV_TEST_MODE_PATTERN_4 (4 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001626/* Encoder test pattern 5 - linear color ramps */
Eric Anholt8c641832009-03-26 17:15:11 -07001627# define TV_TEST_MODE_PATTERN_5 (5 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001628/*
Eric Anholt8c641832009-03-26 17:15:11 -07001629 * This test mode forces the DACs to 50% of full output.
1630 *
1631 * This is used for load detection in combination with TVDAC_SENSE_MASK
1632 */
1633# define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
1634# define TV_TEST_MODE_MASK (7 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001635/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001636
Thomas Wood1e5c8782014-06-09 14:02:04 +01001637/* @defgroup TV_DAC
Eric Anholt8c641832009-03-26 17:15:11 -07001638 * @{
1639 */
1640#define TV_DAC 0x68004
Thomas Wood1e5c8782014-06-09 14:02:04 +01001641/*
Eric Anholt8c641832009-03-26 17:15:11 -07001642 * Reports that DAC state change logic has reported change (RO).
1643 *
1644 * This gets cleared when TV_DAC_STATE_EN is cleared
1645*/
1646# define TVDAC_STATE_CHG (1 << 31)
1647# define TVDAC_SENSE_MASK (7 << 28)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001648/* Reports that DAC A voltage is above the detect threshold */
Eric Anholt8c641832009-03-26 17:15:11 -07001649# define TVDAC_A_SENSE (1 << 30)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001650/* Reports that DAC B voltage is above the detect threshold */
Eric Anholt8c641832009-03-26 17:15:11 -07001651# define TVDAC_B_SENSE (1 << 29)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001652/* Reports that DAC C voltage is above the detect threshold */
Eric Anholt8c641832009-03-26 17:15:11 -07001653# define TVDAC_C_SENSE (1 << 28)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001654/*
Eric Anholt8c641832009-03-26 17:15:11 -07001655 * Enables DAC state detection logic, for load-based TV detection.
1656 *
1657 * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
1658 * to off, for load detection to work.
1659 */
1660# define TVDAC_STATE_CHG_EN (1 << 27)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001661/* Sets the DAC A sense value to high */
Eric Anholt8c641832009-03-26 17:15:11 -07001662# define TVDAC_A_SENSE_CTL (1 << 26)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001663/* Sets the DAC B sense value to high */
Eric Anholt8c641832009-03-26 17:15:11 -07001664# define TVDAC_B_SENSE_CTL (1 << 25)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001665/* Sets the DAC C sense value to high */
Eric Anholt8c641832009-03-26 17:15:11 -07001666# define TVDAC_C_SENSE_CTL (1 << 24)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001667/* Overrides the ENC_ENABLE and DAC voltage levels */
Eric Anholt8c641832009-03-26 17:15:11 -07001668# define DAC_CTL_OVERRIDE (1 << 7)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001669/* Sets the slew rate. Must be preserved in software */
Eric Anholt8c641832009-03-26 17:15:11 -07001670# define ENC_TVDAC_SLEW_FAST (1 << 6)
1671# define DAC_A_1_3_V (0 << 4)
1672# define DAC_A_1_1_V (1 << 4)
1673# define DAC_A_0_7_V (2 << 4)
1674# define DAC_A_OFF (3 << 4)
1675# define DAC_B_1_3_V (0 << 2)
1676# define DAC_B_1_1_V (1 << 2)
1677# define DAC_B_0_7_V (2 << 2)
1678# define DAC_B_OFF (3 << 2)
1679# define DAC_C_1_3_V (0 << 0)
1680# define DAC_C_1_1_V (1 << 0)
1681# define DAC_C_0_7_V (2 << 0)
1682# define DAC_C_OFF (3 << 0)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001683/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001684
Thomas Wood1e5c8782014-06-09 14:02:04 +01001685/*
Eric Anholt8c641832009-03-26 17:15:11 -07001686 * CSC coefficients are stored in a floating point format with 9 bits of
Thomas Wood1e5c8782014-06-09 14:02:04 +01001687 * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2*-n,
Eric Anholt8c641832009-03-26 17:15:11 -07001688 * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
1689 * -1 (0x3) being the only legal negative value.
1690 */
1691#define TV_CSC_Y 0x68010
1692# define TV_RY_MASK 0x07ff0000
1693# define TV_RY_SHIFT 16
1694# define TV_GY_MASK 0x00000fff
1695# define TV_GY_SHIFT 0
1696
1697#define TV_CSC_Y2 0x68014
1698# define TV_BY_MASK 0x07ff0000
1699# define TV_BY_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001700/*
Eric Anholt8c641832009-03-26 17:15:11 -07001701 * Y attenuation for component video.
1702 *
1703 * Stored in 1.9 fixed point.
1704 */
1705# define TV_AY_MASK 0x000003ff
1706# define TV_AY_SHIFT 0
1707
1708#define TV_CSC_U 0x68018
1709# define TV_RU_MASK 0x07ff0000
1710# define TV_RU_SHIFT 16
1711# define TV_GU_MASK 0x000007ff
1712# define TV_GU_SHIFT 0
1713
1714#define TV_CSC_U2 0x6801c
1715# define TV_BU_MASK 0x07ff0000
1716# define TV_BU_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001717/*
Eric Anholt8c641832009-03-26 17:15:11 -07001718 * U attenuation for component video.
1719 *
1720 * Stored in 1.9 fixed point.
1721 */
1722# define TV_AU_MASK 0x000003ff
1723# define TV_AU_SHIFT 0
1724
1725#define TV_CSC_V 0x68020
1726# define TV_RV_MASK 0x0fff0000
1727# define TV_RV_SHIFT 16
1728# define TV_GV_MASK 0x000007ff
1729# define TV_GV_SHIFT 0
1730
1731#define TV_CSC_V2 0x68024
1732# define TV_BV_MASK 0x07ff0000
1733# define TV_BV_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001734/*
Eric Anholt8c641832009-03-26 17:15:11 -07001735 * V attenuation for component video.
1736 *
1737 * Stored in 1.9 fixed point.
1738 */
1739# define TV_AV_MASK 0x000007ff
1740# define TV_AV_SHIFT 0
1741
Thomas Wood1e5c8782014-06-09 14:02:04 +01001742/* @defgroup TV_CSC_KNOBS
Eric Anholt8c641832009-03-26 17:15:11 -07001743 * @{
1744 */
1745#define TV_CLR_KNOBS 0x68028
Thomas Wood1e5c8782014-06-09 14:02:04 +01001746/* 2s-complement brightness adjustment */
Eric Anholt8c641832009-03-26 17:15:11 -07001747# define TV_BRIGHTNESS_MASK 0xff000000
1748# define TV_BRIGHTNESS_SHIFT 24
Thomas Wood1e5c8782014-06-09 14:02:04 +01001749/* Contrast adjustment, as a 2.6 unsigned floating point number */
Eric Anholt8c641832009-03-26 17:15:11 -07001750# define TV_CONTRAST_MASK 0x00ff0000
1751# define TV_CONTRAST_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001752/* Saturation adjustment, as a 2.6 unsigned floating point number */
Eric Anholt8c641832009-03-26 17:15:11 -07001753# define TV_SATURATION_MASK 0x0000ff00
1754# define TV_SATURATION_SHIFT 8
Thomas Wood1e5c8782014-06-09 14:02:04 +01001755/* Hue adjustment, as an integer phase angle in degrees */
Eric Anholt8c641832009-03-26 17:15:11 -07001756# define TV_HUE_MASK 0x000000ff
1757# define TV_HUE_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001758/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001759
Thomas Wood1e5c8782014-06-09 14:02:04 +01001760/* @defgroup TV_CLR_LEVEL
Eric Anholt8c641832009-03-26 17:15:11 -07001761 * @{
1762 */
1763#define TV_CLR_LEVEL 0x6802c
Thomas Wood1e5c8782014-06-09 14:02:04 +01001764/* Controls the DAC level for black */
Eric Anholt8c641832009-03-26 17:15:11 -07001765# define TV_BLACK_LEVEL_MASK 0x01ff0000
1766# define TV_BLACK_LEVEL_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001767/* Controls the DAC level for blanking */
Eric Anholt8c641832009-03-26 17:15:11 -07001768# define TV_BLANK_LEVEL_MASK 0x000001ff
1769# define TV_BLANK_LEVEL_SHIFT 0
1770/* @} */
1771
Thomas Wood1e5c8782014-06-09 14:02:04 +01001772/* @defgroup TV_H_CTL_1
Eric Anholt8c641832009-03-26 17:15:11 -07001773 * @{
1774 */
1775#define TV_H_CTL_1 0x68030
Thomas Wood1e5c8782014-06-09 14:02:04 +01001776/* Number of pixels in the hsync. */
Eric Anholt8c641832009-03-26 17:15:11 -07001777# define TV_HSYNC_END_MASK 0x1fff0000
1778# define TV_HSYNC_END_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001779/* Total number of pixels minus one in the line (display and blanking). */
Eric Anholt8c641832009-03-26 17:15:11 -07001780# define TV_HTOTAL_MASK 0x00001fff
1781# define TV_HTOTAL_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001782/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001783
Thomas Wood1e5c8782014-06-09 14:02:04 +01001784/* @defgroup TV_H_CTL_2
Eric Anholt8c641832009-03-26 17:15:11 -07001785 * @{
1786 */
1787#define TV_H_CTL_2 0x68034
Thomas Wood1e5c8782014-06-09 14:02:04 +01001788/* Enables the colorburst (needed for non-component color) */
Eric Anholt8c641832009-03-26 17:15:11 -07001789# define TV_BURST_ENA (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001790/* Offset of the colorburst from the start of hsync, in pixels minus one. */
Eric Anholt8c641832009-03-26 17:15:11 -07001791# define TV_HBURST_START_SHIFT 16
1792# define TV_HBURST_START_MASK 0x1fff0000
Thomas Wood1e5c8782014-06-09 14:02:04 +01001793/* Length of the colorburst */
Eric Anholt8c641832009-03-26 17:15:11 -07001794# define TV_HBURST_LEN_SHIFT 0
1795# define TV_HBURST_LEN_MASK 0x0001fff
Thomas Wood1e5c8782014-06-09 14:02:04 +01001796/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001797
Thomas Wood1e5c8782014-06-09 14:02:04 +01001798/* @defgroup TV_H_CTL_3
Eric Anholt8c641832009-03-26 17:15:11 -07001799 * @{
1800 */
1801#define TV_H_CTL_3 0x68038
Thomas Wood1e5c8782014-06-09 14:02:04 +01001802/* End of hblank, measured in pixels minus one from start of hsync */
Eric Anholt8c641832009-03-26 17:15:11 -07001803# define TV_HBLANK_END_SHIFT 16
1804# define TV_HBLANK_END_MASK 0x1fff0000
Thomas Wood1e5c8782014-06-09 14:02:04 +01001805/* Start of hblank, measured in pixels minus one from start of hsync */
Eric Anholt8c641832009-03-26 17:15:11 -07001806# define TV_HBLANK_START_SHIFT 0
1807# define TV_HBLANK_START_MASK 0x0001fff
Thomas Wood1e5c8782014-06-09 14:02:04 +01001808/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001809
Thomas Wood1e5c8782014-06-09 14:02:04 +01001810/* @defgroup TV_V_CTL_1
Eric Anholt8c641832009-03-26 17:15:11 -07001811 * @{
1812 */
1813#define TV_V_CTL_1 0x6803c
Thomas Wood1e5c8782014-06-09 14:02:04 +01001814/* XXX */
Eric Anholt8c641832009-03-26 17:15:11 -07001815# define TV_NBR_END_SHIFT 16
1816# define TV_NBR_END_MASK 0x07ff0000
Thomas Wood1e5c8782014-06-09 14:02:04 +01001817/* XXX */
Eric Anholt8c641832009-03-26 17:15:11 -07001818# define TV_VI_END_F1_SHIFT 8
1819# define TV_VI_END_F1_MASK 0x00003f00
Thomas Wood1e5c8782014-06-09 14:02:04 +01001820/* XXX */
Eric Anholt8c641832009-03-26 17:15:11 -07001821# define TV_VI_END_F2_SHIFT 0
1822# define TV_VI_END_F2_MASK 0x0000003f
Thomas Wood1e5c8782014-06-09 14:02:04 +01001823/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001824
Thomas Wood1e5c8782014-06-09 14:02:04 +01001825/* @defgroup TV_V_CTL_2
Eric Anholt8c641832009-03-26 17:15:11 -07001826 * @{
1827 */
1828#define TV_V_CTL_2 0x68040
Thomas Wood1e5c8782014-06-09 14:02:04 +01001829/* Length of vsync, in half lines */
Eric Anholt8c641832009-03-26 17:15:11 -07001830# define TV_VSYNC_LEN_MASK 0x07ff0000
1831# define TV_VSYNC_LEN_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001832/* Offset of the start of vsync in field 1, measured in one less than the
Eric Anholt8c641832009-03-26 17:15:11 -07001833 * number of half lines.
1834 */
1835# define TV_VSYNC_START_F1_MASK 0x00007f00
1836# define TV_VSYNC_START_F1_SHIFT 8
Thomas Wood1e5c8782014-06-09 14:02:04 +01001837/*
Eric Anholt8c641832009-03-26 17:15:11 -07001838 * Offset of the start of vsync in field 2, measured in one less than the
1839 * number of half lines.
1840 */
1841# define TV_VSYNC_START_F2_MASK 0x0000007f
1842# define TV_VSYNC_START_F2_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001843/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001844
Thomas Wood1e5c8782014-06-09 14:02:04 +01001845/* @defgroup TV_V_CTL_3
Eric Anholt8c641832009-03-26 17:15:11 -07001846 * @{
1847 */
1848#define TV_V_CTL_3 0x68044
Thomas Wood1e5c8782014-06-09 14:02:04 +01001849/* Enables generation of the equalization signal */
Eric Anholt8c641832009-03-26 17:15:11 -07001850# define TV_EQUAL_ENA (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001851/* Length of vsync, in half lines */
Eric Anholt8c641832009-03-26 17:15:11 -07001852# define TV_VEQ_LEN_MASK 0x007f0000
1853# define TV_VEQ_LEN_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001854/* Offset of the start of equalization in field 1, measured in one less than
Eric Anholt8c641832009-03-26 17:15:11 -07001855 * the number of half lines.
1856 */
1857# define TV_VEQ_START_F1_MASK 0x0007f00
1858# define TV_VEQ_START_F1_SHIFT 8
Thomas Wood1e5c8782014-06-09 14:02:04 +01001859/*
Eric Anholt8c641832009-03-26 17:15:11 -07001860 * Offset of the start of equalization in field 2, measured in one less than
1861 * the number of half lines.
1862 */
1863# define TV_VEQ_START_F2_MASK 0x000007f
1864# define TV_VEQ_START_F2_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001865/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001866
Thomas Wood1e5c8782014-06-09 14:02:04 +01001867/* @defgroup TV_V_CTL_4
Eric Anholt8c641832009-03-26 17:15:11 -07001868 * @{
1869 */
1870#define TV_V_CTL_4 0x68048
Thomas Wood1e5c8782014-06-09 14:02:04 +01001871/*
Eric Anholt8c641832009-03-26 17:15:11 -07001872 * Offset to start of vertical colorburst, measured in one less than the
1873 * number of lines from vertical start.
1874 */
1875# define TV_VBURST_START_F1_MASK 0x003f0000
1876# define TV_VBURST_START_F1_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001877/*
Eric Anholt8c641832009-03-26 17:15:11 -07001878 * Offset to the end of vertical colorburst, measured in one less than the
1879 * number of lines from the start of NBR.
1880 */
1881# define TV_VBURST_END_F1_MASK 0x000000ff
1882# define TV_VBURST_END_F1_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001883/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001884
Thomas Wood1e5c8782014-06-09 14:02:04 +01001885/* @defgroup TV_V_CTL_5
Eric Anholt8c641832009-03-26 17:15:11 -07001886 * @{
1887 */
1888#define TV_V_CTL_5 0x6804c
Thomas Wood1e5c8782014-06-09 14:02:04 +01001889/*
Eric Anholt8c641832009-03-26 17:15:11 -07001890 * Offset to start of vertical colorburst, measured in one less than the
1891 * number of lines from vertical start.
1892 */
1893# define TV_VBURST_START_F2_MASK 0x003f0000
1894# define TV_VBURST_START_F2_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001895/*
Eric Anholt8c641832009-03-26 17:15:11 -07001896 * Offset to the end of vertical colorburst, measured in one less than the
1897 * number of lines from the start of NBR.
1898 */
1899# define TV_VBURST_END_F2_MASK 0x000000ff
1900# define TV_VBURST_END_F2_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001901/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001902
Thomas Wood1e5c8782014-06-09 14:02:04 +01001903/* @defgroup TV_V_CTL_6
Eric Anholt8c641832009-03-26 17:15:11 -07001904 * @{
1905 */
1906#define TV_V_CTL_6 0x68050
Thomas Wood1e5c8782014-06-09 14:02:04 +01001907/*
Eric Anholt8c641832009-03-26 17:15:11 -07001908 * Offset to start of vertical colorburst, measured in one less than the
1909 * number of lines from vertical start.
1910 */
1911# define TV_VBURST_START_F3_MASK 0x003f0000
1912# define TV_VBURST_START_F3_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001913/*
Eric Anholt8c641832009-03-26 17:15:11 -07001914 * Offset to the end of vertical colorburst, measured in one less than the
1915 * number of lines from the start of NBR.
1916 */
1917# define TV_VBURST_END_F3_MASK 0x000000ff
1918# define TV_VBURST_END_F3_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001919/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001920
Thomas Wood1e5c8782014-06-09 14:02:04 +01001921/* @defgroup TV_V_CTL_7
Eric Anholt8c641832009-03-26 17:15:11 -07001922 * @{
1923 */
1924#define TV_V_CTL_7 0x68054
Thomas Wood1e5c8782014-06-09 14:02:04 +01001925/*
Eric Anholt8c641832009-03-26 17:15:11 -07001926 * Offset to start of vertical colorburst, measured in one less than the
1927 * number of lines from vertical start.
1928 */
1929# define TV_VBURST_START_F4_MASK 0x003f0000
1930# define TV_VBURST_START_F4_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001931/*
Eric Anholt8c641832009-03-26 17:15:11 -07001932 * Offset to the end of vertical colorburst, measured in one less than the
1933 * number of lines from the start of NBR.
1934 */
1935# define TV_VBURST_END_F4_MASK 0x000000ff
1936# define TV_VBURST_END_F4_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001937/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001938
Thomas Wood1e5c8782014-06-09 14:02:04 +01001939/* @defgroup TV_SC_CTL_1
Eric Anholt8c641832009-03-26 17:15:11 -07001940 * @{
1941 */
1942#define TV_SC_CTL_1 0x68060
Thomas Wood1e5c8782014-06-09 14:02:04 +01001943/* Turns on the first subcarrier phase generation DDA */
Eric Anholt8c641832009-03-26 17:15:11 -07001944# define TV_SC_DDA1_EN (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001945/* Turns on the first subcarrier phase generation DDA */
Eric Anholt8c641832009-03-26 17:15:11 -07001946# define TV_SC_DDA2_EN (1 << 30)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001947/* Turns on the first subcarrier phase generation DDA */
Eric Anholt8c641832009-03-26 17:15:11 -07001948# define TV_SC_DDA3_EN (1 << 29)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001949/* Sets the subcarrier DDA to reset frequency every other field */
Eric Anholt8c641832009-03-26 17:15:11 -07001950# define TV_SC_RESET_EVERY_2 (0 << 24)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001951/* Sets the subcarrier DDA to reset frequency every fourth field */
Eric Anholt8c641832009-03-26 17:15:11 -07001952# define TV_SC_RESET_EVERY_4 (1 << 24)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001953/* Sets the subcarrier DDA to reset frequency every eighth field */
Eric Anholt8c641832009-03-26 17:15:11 -07001954# define TV_SC_RESET_EVERY_8 (2 << 24)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001955/* Sets the subcarrier DDA to never reset the frequency */
Eric Anholt8c641832009-03-26 17:15:11 -07001956# define TV_SC_RESET_NEVER (3 << 24)
Thomas Wood1e5c8782014-06-09 14:02:04 +01001957/* Sets the peak amplitude of the colorburst.*/
Eric Anholt8c641832009-03-26 17:15:11 -07001958# define TV_BURST_LEVEL_MASK 0x00ff0000
1959# define TV_BURST_LEVEL_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001960/* Sets the increment of the first subcarrier phase generation DDA */
Eric Anholt8c641832009-03-26 17:15:11 -07001961# define TV_SCDDA1_INC_MASK 0x00000fff
1962# define TV_SCDDA1_INC_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001963/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001964
Thomas Wood1e5c8782014-06-09 14:02:04 +01001965/* @defgroup TV_SC_CTL_2
Eric Anholt8c641832009-03-26 17:15:11 -07001966 * @{
1967 */
1968#define TV_SC_CTL_2 0x68064
Thomas Wood1e5c8782014-06-09 14:02:04 +01001969/* Sets the rollover for the second subcarrier phase generation DDA */
Eric Anholt8c641832009-03-26 17:15:11 -07001970# define TV_SCDDA2_SIZE_MASK 0x7fff0000
1971# define TV_SCDDA2_SIZE_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001972/* Sets the increent of the second subcarrier phase generation DDA */
Eric Anholt8c641832009-03-26 17:15:11 -07001973# define TV_SCDDA2_INC_MASK 0x00007fff
1974# define TV_SCDDA2_INC_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001975/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001976
Thomas Wood1e5c8782014-06-09 14:02:04 +01001977/* @defgroup TV_SC_CTL_3
Eric Anholt8c641832009-03-26 17:15:11 -07001978 * @{
1979 */
1980#define TV_SC_CTL_3 0x68068
Thomas Wood1e5c8782014-06-09 14:02:04 +01001981/* Sets the rollover for the third subcarrier phase generation DDA */
Eric Anholt8c641832009-03-26 17:15:11 -07001982# define TV_SCDDA3_SIZE_MASK 0x7fff0000
1983# define TV_SCDDA3_SIZE_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001984/* Sets the increent of the third subcarrier phase generation DDA */
Eric Anholt8c641832009-03-26 17:15:11 -07001985# define TV_SCDDA3_INC_MASK 0x00007fff
1986# define TV_SCDDA3_INC_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001987/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07001988
Thomas Wood1e5c8782014-06-09 14:02:04 +01001989/* @defgroup TV_WIN_POS
Eric Anholt8c641832009-03-26 17:15:11 -07001990 * @{
1991 */
1992#define TV_WIN_POS 0x68070
Thomas Wood1e5c8782014-06-09 14:02:04 +01001993/* X coordinate of the display from the start of horizontal active */
Eric Anholt8c641832009-03-26 17:15:11 -07001994# define TV_XPOS_MASK 0x1fff0000
1995# define TV_XPOS_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01001996/* Y coordinate of the display from the start of vertical active (NBR) */
Eric Anholt8c641832009-03-26 17:15:11 -07001997# define TV_YPOS_MASK 0x00000fff
1998# define TV_YPOS_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01001999/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07002000
Thomas Wood1e5c8782014-06-09 14:02:04 +01002001/* @defgroup TV_WIN_SIZE
Eric Anholt8c641832009-03-26 17:15:11 -07002002 * @{
2003 */
2004#define TV_WIN_SIZE 0x68074
Thomas Wood1e5c8782014-06-09 14:02:04 +01002005/* Horizontal size of the display window, measured in pixels*/
Eric Anholt8c641832009-03-26 17:15:11 -07002006# define TV_XSIZE_MASK 0x1fff0000
2007# define TV_XSIZE_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01002008/*
Eric Anholt8c641832009-03-26 17:15:11 -07002009 * Vertical size of the display window, measured in pixels.
2010 *
2011 * Must be even for interlaced modes.
2012 */
2013# define TV_YSIZE_MASK 0x00000fff
2014# define TV_YSIZE_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01002015/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07002016
Thomas Wood1e5c8782014-06-09 14:02:04 +01002017/* @defgroup TV_FILTER_CTL_1
Eric Anholt8c641832009-03-26 17:15:11 -07002018 * @{
2019 */
2020#define TV_FILTER_CTL_1 0x68080
Thomas Wood1e5c8782014-06-09 14:02:04 +01002021/*
Eric Anholt8c641832009-03-26 17:15:11 -07002022 * Enables automatic scaling calculation.
2023 *
2024 * If set, the rest of the registers are ignored, and the calculated values can
2025 * be read back from the register.
2026 */
2027# define TV_AUTO_SCALE (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +01002028/*
Eric Anholt8c641832009-03-26 17:15:11 -07002029 * Disables the vertical filter.
2030 *
2031 * This is required on modes more than 1024 pixels wide */
2032# define TV_V_FILTER_BYPASS (1 << 29)
Thomas Wood1e5c8782014-06-09 14:02:04 +01002033/* Enables adaptive vertical filtering */
Eric Anholt8c641832009-03-26 17:15:11 -07002034# define TV_VADAPT (1 << 28)
2035# define TV_VADAPT_MODE_MASK (3 << 26)
Thomas Wood1e5c8782014-06-09 14:02:04 +01002036/* Selects the least adaptive vertical filtering mode */
Eric Anholt8c641832009-03-26 17:15:11 -07002037# define TV_VADAPT_MODE_LEAST (0 << 26)
Thomas Wood1e5c8782014-06-09 14:02:04 +01002038/* Selects the moderately adaptive vertical filtering mode */
Eric Anholt8c641832009-03-26 17:15:11 -07002039# define TV_VADAPT_MODE_MODERATE (1 << 26)
Thomas Wood1e5c8782014-06-09 14:02:04 +01002040/* Selects the most adaptive vertical filtering mode */
Eric Anholt8c641832009-03-26 17:15:11 -07002041# define TV_VADAPT_MODE_MOST (3 << 26)
Thomas Wood1e5c8782014-06-09 14:02:04 +01002042/*
Eric Anholt8c641832009-03-26 17:15:11 -07002043 * Sets the horizontal scaling factor.
2044 *
2045 * This should be the fractional part of the horizontal scaling factor divided
2046 * by the oversampling rate. TV_HSCALE should be less than 1, and set to:
2047 *
2048 * (src width - 1) / ((oversample * dest width) - 1)
2049 */
2050# define TV_HSCALE_FRAC_MASK 0x00003fff
2051# define TV_HSCALE_FRAC_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01002052/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07002053
Thomas Wood1e5c8782014-06-09 14:02:04 +01002054/* @defgroup TV_FILTER_CTL_2
Eric Anholt8c641832009-03-26 17:15:11 -07002055 * @{
2056 */
2057#define TV_FILTER_CTL_2 0x68084
Thomas Wood1e5c8782014-06-09 14:02:04 +01002058/*
Eric Anholt8c641832009-03-26 17:15:11 -07002059 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
2060 *
2061 * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
2062 */
2063# define TV_VSCALE_INT_MASK 0x00038000
2064# define TV_VSCALE_INT_SHIFT 15
Thomas Wood1e5c8782014-06-09 14:02:04 +01002065/*
Eric Anholt8c641832009-03-26 17:15:11 -07002066 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
2067 *
2068 * \sa TV_VSCALE_INT_MASK
2069 */
2070# define TV_VSCALE_FRAC_MASK 0x00007fff
2071# define TV_VSCALE_FRAC_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01002072/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07002073
Thomas Wood1e5c8782014-06-09 14:02:04 +01002074/* @defgroup TV_FILTER_CTL_3
Eric Anholt8c641832009-03-26 17:15:11 -07002075 * @{
2076 */
2077#define TV_FILTER_CTL_3 0x68088
Thomas Wood1e5c8782014-06-09 14:02:04 +01002078/*
Eric Anholt8c641832009-03-26 17:15:11 -07002079 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
2080 *
2081 * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
2082 *
2083 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
2084 */
2085# define TV_VSCALE_IP_INT_MASK 0x00038000
2086# define TV_VSCALE_IP_INT_SHIFT 15
Thomas Wood1e5c8782014-06-09 14:02:04 +01002087/*
Eric Anholt8c641832009-03-26 17:15:11 -07002088 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
2089 *
2090 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
2091 *
2092 * \sa TV_VSCALE_IP_INT_MASK
2093 */
2094# define TV_VSCALE_IP_FRAC_MASK 0x00007fff
2095# define TV_VSCALE_IP_FRAC_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01002096/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07002097
Thomas Wood1e5c8782014-06-09 14:02:04 +01002098/* @defgroup TV_CC_CONTROL
Eric Anholt8c641832009-03-26 17:15:11 -07002099 * @{
2100 */
2101#define TV_CC_CONTROL 0x68090
2102# define TV_CC_ENABLE (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +01002103/*
Eric Anholt8c641832009-03-26 17:15:11 -07002104 * Specifies which field to send the CC data in.
2105 *
2106 * CC data is usually sent in field 0.
2107 */
2108# define TV_CC_FID_MASK (1 << 27)
2109# define TV_CC_FID_SHIFT 27
Thomas Wood1e5c8782014-06-09 14:02:04 +01002110/* Sets the horizontal position of the CC data. Usually 135. */
Eric Anholt8c641832009-03-26 17:15:11 -07002111# define TV_CC_HOFF_MASK 0x03ff0000
2112# define TV_CC_HOFF_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01002113/* Sets the vertical position of the CC data. Usually 21 */
Eric Anholt8c641832009-03-26 17:15:11 -07002114# define TV_CC_LINE_MASK 0x0000003f
2115# define TV_CC_LINE_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01002116/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07002117
Thomas Wood1e5c8782014-06-09 14:02:04 +01002118/* @defgroup TV_CC_DATA
Eric Anholt8c641832009-03-26 17:15:11 -07002119 * @{
2120 */
2121#define TV_CC_DATA 0x68094
2122# define TV_CC_RDY (1 << 31)
Thomas Wood1e5c8782014-06-09 14:02:04 +01002123/* Second word of CC data to be transmitted. */
Eric Anholt8c641832009-03-26 17:15:11 -07002124# define TV_CC_DATA_2_MASK 0x007f0000
2125# define TV_CC_DATA_2_SHIFT 16
Thomas Wood1e5c8782014-06-09 14:02:04 +01002126/* First word of CC data to be transmitted. */
Eric Anholt8c641832009-03-26 17:15:11 -07002127# define TV_CC_DATA_1_MASK 0x0000007f
2128# define TV_CC_DATA_1_SHIFT 0
Thomas Wood1e5c8782014-06-09 14:02:04 +01002129/* @}
Eric Anholt8c641832009-03-26 17:15:11 -07002130 */
2131
Thomas Wood1e5c8782014-06-09 14:02:04 +01002132/* @{ */
Eric Anholt8c641832009-03-26 17:15:11 -07002133#define TV_H_LUMA_0 0x68100
2134#define TV_H_LUMA_59 0x681ec
2135#define TV_H_CHROMA_0 0x68200
2136#define TV_H_CHROMA_59 0x682ec
2137#define TV_V_LUMA_0 0x68300
2138#define TV_V_LUMA_42 0x683a8
2139#define TV_V_CHROMA_0 0x68400
2140#define TV_V_CHROMA_42 0x684a8
Thomas Wood1e5c8782014-06-09 14:02:04 +01002141/* @} */
Eric Anholt8c641832009-03-26 17:15:11 -07002142
2143#define PIPEA_DSL 0x70000
2144
2145#define PIPEACONF 0x70008
2146#define PIPEACONF_ENABLE (1<<31)
2147#define PIPEACONF_DISABLE 0
2148#define PIPEACONF_DOUBLE_WIDE (1<<30)
2149#define I965_PIPECONF_ACTIVE (1<<30)
2150#define PIPEACONF_SINGLE_WIDE 0
2151#define PIPEACONF_PIPE_UNLOCKED 0
2152#define PIPEACONF_PIPE_LOCKED (1<<25)
2153#define PIPEACONF_PALETTE 0
2154#define PIPEACONF_GAMMA (1<<24)
2155#define PIPECONF_FORCE_BORDER (1<<25)
2156#define PIPECONF_PROGRESSIVE (0 << 21)
2157#define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
2158#define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
Eric Anholt40bff502009-10-06 17:25:10 -07002159/* ironlake: gamma */
2160#define PIPECONF_PALETTE_8BIT (0<<24)
2161#define PIPECONF_PALETTE_10BIT (1<<24)
2162#define PIPECONF_PALETTE_12BIT (2<<24)
2163#define PIPECONF_FORCE_BORDER (1<<25)
2164#define PIPECONF_PROGRESSIVE (0 << 21)
2165#define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
2166#define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
2167/* ironlake */
2168#define PIPECONF_MSA_TIMING_DELAY (0<<18) /* for eDP */
2169#define PIPECONF_NO_DYNAMIC_RATE_CHANGE (0 << 16)
2170#define PIPECONF_NO_ROTATION (0<<14)
2171#define PIPECONF_FULL_COLOR_RANGE (0<<13)
2172#define PIPECONF_CE_COLOR_RANGE (1<<13)
2173#define PIPECONF_COLOR_SPACE_RGB (0<<11)
2174#define PIPECONF_COLOR_SPACE_YUV601 (1<<11)
2175#define PIPECONF_COLOR_SPACE_YUV709 (2<<11)
2176#define PIPECONF_CONNECT_DEFAULT (0<<9)
2177#define PIPECONF_8BPP (0<<5)
2178#define PIPECONF_10BPP (1<<5)
2179#define PIPECONF_6BPP (2<<5)
2180#define PIPECONF_12BPP (3<<5)
2181#define PIPECONF_ENABLE_DITHER (1<<4)
2182#define PIPECONF_DITHER_SPATIAL (0<<2)
2183#define PIPECONF_DITHER_ST1 (1<<2)
2184#define PIPECONF_DITHER_ST2 (2<<2)
2185#define PIPECONF_DITHER_TEMPORAL (3<<2)
Eric Anholt8c641832009-03-26 17:15:11 -07002186
2187#define PIPEAGCMAXRED 0x70010
2188#define PIPEAGCMAXGREEN 0x70014
2189#define PIPEAGCMAXBLUE 0x70018
2190#define PIPEASTAT 0x70024
2191# define FIFO_UNDERRUN (1 << 31)
2192# define CRC_ERROR_ENABLE (1 << 29)
2193# define CRC_DONE_ENABLE (1 << 28)
2194# define GMBUS_EVENT_ENABLE (1 << 27)
2195# define VSYNC_INT_ENABLE (1 << 25)
2196# define DLINE_COMPARE_ENABLE (1 << 24)
2197# define DPST_EVENT_ENABLE (1 << 23)
2198# define LBLC_EVENT_ENABLE (1 << 22)
2199# define OFIELD_INT_ENABLE (1 << 21)
2200# define EFIELD_INT_ENABLE (1 << 20)
2201# define SVBLANK_INT_ENABLE (1 << 18)
2202# define VBLANK_INT_ENABLE (1 << 17)
2203# define OREG_UPDATE_ENABLE (1 << 16)
2204# define CRC_ERROR_INT_STATUS (1 << 13)
2205# define CRC_DONE_INT_STATUS (1 << 12)
2206# define GMBUS_INT_STATUS (1 << 11)
2207# define VSYNC_INT_STATUS (1 << 9)
2208# define DLINE_COMPARE_STATUS (1 << 8)
2209# define DPST_EVENT_STATUS (1 << 7)
2210# define LBLC_EVENT_STATUS (1 << 6)
2211# define OFIELD_INT_STATUS (1 << 5)
2212# define EFIELD_INT_STATUS (1 << 4)
2213# define SVBLANK_INT_STATUS (1 << 2)
2214# define VBLANK_INT_STATUS (1 << 1)
2215# define OREG_UPDATE_STATUS (1 << 0)
2216
Daniel Vetter3c55a7d2013-11-20 10:58:55 +01002217#define FW_BLC 0x020d8
2218#define FW_BLC2 0x020dc
2219#define FW_BLC_SELF 0x020e0 /* 915+ only */
Eric Anholt8c641832009-03-26 17:15:11 -07002220
2221#define DSPARB 0x70030
2222#define DSPARB_CSTART_SHIFT 7
2223#define DSPARB_BSTART_SHIFT 0
2224#define DSPARB_BEND_SHIFT 9 /* on 855 */
2225#define DSPARB_AEND_SHIFT 0
2226#define DSPFW1 0x70034
2227#define DSPFW2 0x70038
2228#define DSPFW3 0x7003c
2229/*
2230 * The two pipe frame counter registers are not synchronized, so
2231 * reading a stable value is somewhat tricky. The following code
2232 * should work:
2233 *
2234 * do {
2235 * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> PIPE_FRAME_HIGH_SHIFT;
2236 * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >> PIPE_FRAME_LOW_SHIFT);
2237 * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> PIPE_FRAME_HIGH_SHIFT);
2238 * } while (high1 != high2);
2239 * frame = (high1 << 8) | low1;
2240 */
2241#define PIPEAFRAMEHIGH 0x70040
2242#define PIPE_FRAME_HIGH_MASK 0x0000ffff
2243#define PIPE_FRAME_HIGH_SHIFT 0
2244#define PIPEAFRAMEPIXEL 0x70044
2245#define PIPE_FRAME_LOW_MASK 0xff000000
2246#define PIPE_FRAME_LOW_SHIFT 24
2247/*
2248 * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register
2249 * and is 24 bits wide.
2250 */
2251#define PIPE_PIXEL_MASK 0x00ffffff
2252#define PIPE_PIXEL_SHIFT 0
Ville Syrjälä8c1566e2013-10-29 18:17:39 +02002253/*
2254 * g4x+ frame/flip counters
2255 */
2256#define PIPEAFRMCOUNT_G4X 0x70040
2257#define PIPEAFLIPCOUNT_G4X 0x70044
Eric Anholt40bff502009-10-06 17:25:10 -07002258/*
2259 * Computing GMCH M and N values.
2260 *
2261 * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
2262 *
2263 * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
2264 *
2265 * The GMCH value is used internally
2266 */
2267#define PIPEA_GMCH_DATA_M 0x70050
2268
2269/* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
2270#define PIPE_GMCH_DATA_M_TU_SIZE_MASK (0x3f << 25)
2271#define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT 25
2272
2273#define PIPE_GMCH_DATA_M_MASK (0xffffff)
2274
2275#define PIPEA_GMCH_DATA_N 0x70054
2276#define PIPE_GMCH_DATA_N_MASK (0xffffff)
2277
2278/*
2279 * Computing Link M and N values.
2280 *
2281 * Link M / N = pixel_clock / ls_clk
2282 *
2283 * (the DP spec calls pixel_clock the 'strm_clk')
2284 *
2285 * The Link value is transmitted in the Main Stream
2286 * Attributes and VB-ID.
2287 */
2288
2289#define PIPEA_DP_LINK_M 0x70060
2290#define PIPEA_DP_LINK_M_MASK (0xffffff)
2291
2292#define PIPEA_DP_LINK_N 0x70064
2293#define PIPEA_DP_LINK_N_MASK (0xffffff)
2294
Eric Anholt8c641832009-03-26 17:15:11 -07002295#define PIPEB_DSL 0x71000
2296
Daniel Vetter0efa6c72012-08-07 18:16:34 +02002297#define PIPEBCONF 0x71008
Eric Anholt8c641832009-03-26 17:15:11 -07002298
2299#define PIPEBGCMAXRED 0x71010
2300#define PIPEBGCMAXGREEN 0x71014
2301#define PIPEBGCMAXBLUE 0x71018
2302#define PIPEBSTAT 0x71024
2303#define PIPEBFRAMEHIGH 0x71040
2304#define PIPEBFRAMEPIXEL 0x71044
Ville Syrjälä8c1566e2013-10-29 18:17:39 +02002305#define PIPEBFRMCOUNT_G4X 0x71040
2306#define PIPEBFLIPCOUNT_G4X 0x71044
Eric Anholt8c641832009-03-26 17:15:11 -07002307
Eric Anholt40bff502009-10-06 17:25:10 -07002308#define PIPEB_GMCH_DATA_M 0x71050
2309#define PIPEB_GMCH_DATA_N 0x71054
2310#define PIPEB_DP_LINK_M 0x71060
2311#define PIPEB_DP_LINK_N 0x71064
2312
Ville Syrjälä8c1566e2013-10-29 18:17:39 +02002313#define PIPEC_DSL 0x72000
2314
Daniel Vetter0efa6c72012-08-07 18:16:34 +02002315#define PIPECCONF 0x72008
2316
2317#define PIPECGCMAXRED 0x72010
2318#define PIPECGCMAXGREEN 0x72014
2319#define PIPECGCMAXBLUE 0x72018
2320#define PIPECSTAT 0x72024
Ville Syrjälä8c1566e2013-10-29 18:17:39 +02002321#define PIPECFRMCOUNT_G4X 0x72040
2322#define PIPECFLIPCOUNT_G4X 0x72044
Daniel Vetter0efa6c72012-08-07 18:16:34 +02002323
2324#define PIPEC_GMCH_DATA_M 0x72050
2325#define PIPEC_GMCH_DATA_N 0x72054
2326#define PIPEC_DP_LINK_M 0x72060
2327#define PIPEC_DP_LINK_N 0x72064
2328
Paulo Zanoni5c0ce0f2013-03-01 15:46:25 -03002329#define PIPEEDPCONF 0x7F008
2330
Eric Anholt8c641832009-03-26 17:15:11 -07002331#define DSPACNTR 0x70180
2332#define DSPBCNTR 0x71180
Daniel Vetter0efa6c72012-08-07 18:16:34 +02002333#define DSPCCNTR 0x72180
Eric Anholt8c641832009-03-26 17:15:11 -07002334#define DISPLAY_PLANE_ENABLE (1<<31)
2335#define DISPLAY_PLANE_DISABLE 0
2336#define DISPLAY_PLANE_TILED (1<<10)
2337#define DISPPLANE_GAMMA_ENABLE (1<<30)
2338#define DISPPLANE_GAMMA_DISABLE 0
2339#define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
2340#define DISPPLANE_8BPP (0x2<<26)
2341#define DISPPLANE_15_16BPP (0x4<<26)
2342#define DISPPLANE_16BPP (0x5<<26)
2343#define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
2344#define DISPPLANE_32BPP (0x7<<26)
2345#define DISPPLANE_STEREO_ENABLE (1<<25)
2346#define DISPPLANE_STEREO_DISABLE 0
2347#define DISPPLANE_SEL_PIPE_MASK (1<<24)
2348#define DISPPLANE_SEL_PIPE_A 0
2349#define DISPPLANE_SEL_PIPE_B (1<<24)
2350#define DISPPLANE_SRC_KEY_ENABLE (1<<22)
2351#define DISPPLANE_SRC_KEY_DISABLE 0
2352#define DISPPLANE_LINE_DOUBLE (1<<20)
2353#define DISPPLANE_NO_LINE_DOUBLE 0
2354#define DISPPLANE_STEREO_POLARITY_FIRST 0
2355#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
2356/* plane B only */
2357#define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
2358#define DISPPLANE_ALPHA_TRANS_DISABLE 0
2359#define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
2360#define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
2361
2362#define DSPABASE 0x70184
2363#define DSPASTRIDE 0x70188
2364
2365#define DSPBBASE 0x71184
2366#define DSPBADDR DSPBBASE
2367#define DSPBSTRIDE 0x71188
2368
Daniel Vetter0efa6c72012-08-07 18:16:34 +02002369#define DSPCBASE 0x72184
2370#define DSPCADDR DSPCBASE
2371#define DSPCSTRIDE 0x72188
2372
Eric Anholt8c641832009-03-26 17:15:11 -07002373#define DSPAKEYVAL 0x70194
2374#define DSPAKEYMASK 0x70198
2375
2376#define DSPAPOS 0x7018C /* reserved */
2377#define DSPASIZE 0x70190
2378#define DSPBPOS 0x7118C
2379#define DSPBSIZE 0x71190
2380
2381#define DSPASURF 0x7019C
2382#define DSPATILEOFF 0x701A4
Ville Syrjälä8c1566e2013-10-29 18:17:39 +02002383#define DSPASURFLIVE 0x701AC
Eric Anholt8c641832009-03-26 17:15:11 -07002384
2385#define DSPBSURF 0x7119C
2386#define DSPBTILEOFF 0x711A4
Ville Syrjälä8c1566e2013-10-29 18:17:39 +02002387#define DSPBSURFLIVE 0x711AC
Eric Anholt8c641832009-03-26 17:15:11 -07002388
Daniel Vetter0efa6c72012-08-07 18:16:34 +02002389#define DSPCSURF 0x7219C
2390#define DSPCTILEOFF 0x721A4
Ville Syrjälä8c1566e2013-10-29 18:17:39 +02002391#define DSPCSURFLIVE 0x721AC
Daniel Vetter0efa6c72012-08-07 18:16:34 +02002392
Eric Anholt8c641832009-03-26 17:15:11 -07002393#define VGACNTRL 0x71400
2394# define VGA_DISP_DISABLE (1 << 31)
2395# define VGA_2X_MODE (1 << 30)
2396# define VGA_PIPE_B_SELECT (1 << 29)
2397
2398/* Various masks for reserved bits, etc. */
2399#define I830_FWATER1_MASK (~((1<<11)|(1<<10)|(1<<9)| \
2400 (1<<8)|(1<<26)|(1<<25)|(1<<24)|(1<<5)|(1<<4)|(1<<3)| \
2401 (1<<2)|(1<<1)|1|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)))
2402#define I830_FWATER2_MASK ~(0)
2403
2404#define DV0A_RESERVED ((1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1)
2405#define DV0B_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1)
2406#define VGA0_N_DIVISOR_MASK ((1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
2407#define VGA0_M1_DIVISOR_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))
2408#define VGA0_M2_DIVISOR_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
2409#define VGA0_M1M2N_RESERVED ~(VGA0_N_DIVISOR_MASK|VGA0_M1_DIVISOR_MASK|VGA0_M2_DIVISOR_MASK)
2410#define VGA0_POSTDIV_MASK ((1<<7)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
2411#define VGA1_POSTDIV_MASK ((1<<15)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))
2412#define VGA_POSTDIV_RESERVED ~(VGA0_POSTDIV_MASK|VGA1_POSTDIV_MASK|(1<<7)|(1<<15))
2413#define DPLLA_POSTDIV_MASK ((1<<23)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
2414#define DPLLA_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<22)|(1<<15)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
2415#define ADPA_RESERVED ((1<<2)|(1<<1)|1|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
2416#define SUPER_WORD 32
2417#define BURST_A_MASK ((1<<11)|(1<<10)|(1<<9)|(1<<8))
2418#define BURST_B_MASK ((1<<26)|(1<<25)|(1<<24))
2419#define WATER_A_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
2420#define WATER_B_MASK ((1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
2421#define WATER_RESERVED ((1<<31)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<7)|(1<<6))
2422#define PIPEACONF_RESERVED ((1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff)
2423#define PIPEBCONF_RESERVED ((1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff)
2424#define DSPACNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0xffff)
2425#define DSPBCNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0x7ffe)
2426
2427#define I830_GMCH_CTRL 0x52
2428
2429#define I830_GMCH_ENABLED 0x4
2430#define I830_GMCH_MEM_MASK 0x1
2431#define I830_GMCH_MEM_64M 0x1
2432#define I830_GMCH_MEM_128M 0
2433
2434#define I830_GMCH_GMS_MASK 0x70
2435#define I830_GMCH_GMS_DISABLED 0x00
2436#define I830_GMCH_GMS_LOCAL 0x10
2437#define I830_GMCH_GMS_STOLEN_512 0x20
2438#define I830_GMCH_GMS_STOLEN_1024 0x30
2439#define I830_GMCH_GMS_STOLEN_8192 0x40
2440
2441#define I830_RDRAM_CHANNEL_TYPE 0x03010
2442#define I830_RDRAM_ND(x) (((x) & 0x20) >> 5)
2443#define I830_RDRAM_DDT(x) (((x) & 0x18) >> 3)
2444
2445#define I855_GMCH_GMS_MASK (0xF << 4)
2446#define I855_GMCH_GMS_DISABLED 0x00
2447#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4)
2448#define I855_GMCH_GMS_STOLEN_4M (0x2 << 4)
2449#define I855_GMCH_GMS_STOLEN_8M (0x3 << 4)
2450#define I855_GMCH_GMS_STOLEN_16M (0x4 << 4)
2451#define I855_GMCH_GMS_STOLEN_32M (0x5 << 4)
2452#define I915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
2453#define I915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
2454#define G33_GMCH_GMS_STOLEN_128M (0x8 << 4)
2455#define G33_GMCH_GMS_STOLEN_256M (0x9 << 4)
2456#define INTEL_GMCH_GMS_STOLEN_96M (0xa << 4)
2457#define INTEL_GMCH_GMS_STOLEN_160M (0xb << 4)
2458#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)
2459#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4)
2460
2461
2462#define I85X_CAPID 0x44
2463#define I85X_VARIANT_MASK 0x7
2464#define I85X_VARIANT_SHIFT 5
2465#define I855_GME 0x0
2466#define I855_GM 0x4
2467#define I852_GME 0x2
2468#define I852_GM 0x5
2469
2470#define I915_GCFGC 0xf0
2471#define I915_LOW_FREQUENCY_ENABLE (1 << 7)
2472#define I915_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
2473#define I915_DISPLAY_CLOCK_333_MHZ (4 << 4)
2474#define I915_DISPLAY_CLOCK_MASK (7 << 4)
2475
2476#define I855_HPLLCC 0xc0
2477#define I855_CLOCK_CONTROL_MASK (3 << 0)
2478#define I855_CLOCK_133_200 (0 << 0)
2479#define I855_CLOCK_100_200 (1 << 0)
2480#define I855_CLOCK_100_133 (2 << 0)
2481#define I855_CLOCK_166_250 (3 << 0)
2482
2483/* BLT commands */
2484#define COLOR_BLT_CMD ((2<<29)|(0x40<<22)|(0x3))
2485#define COLOR_BLT_WRITE_ALPHA (1<<21)
2486#define COLOR_BLT_WRITE_RGB (1<<20)
2487
Ben Widawsky672911d2013-12-05 14:14:35 -08002488#define XY_COLOR_BLT_CMD_NOLEN ((2<<29)|(0x50<<22))
Eric Anholt8c641832009-03-26 17:15:11 -07002489#define XY_COLOR_BLT_WRITE_ALPHA (1<<21)
2490#define XY_COLOR_BLT_WRITE_RGB (1<<20)
2491#define XY_COLOR_BLT_TILED (1<<11)
2492
2493#define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22)|1)
2494
Ben Widawskyf4dfa372013-10-08 15:02:07 -07002495#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22))
Eric Anholt8c641832009-03-26 17:15:11 -07002496#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
2497#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
2498#define XY_SRC_COPY_BLT_SRC_TILED (1<<15)
2499#define XY_SRC_COPY_BLT_DST_TILED (1<<11)
2500
2501#define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|0x4)
2502#define SRC_COPY_BLT_WRITE_ALPHA (1<<21)
2503#define SRC_COPY_BLT_WRITE_RGB (1<<20)
2504
2505#define XY_PAT_BLT_IMMEDIATE ((2<<29)|(0x72<<22))
2506
2507#define XY_MONO_PAT_BLT_CMD ((0x2<<29)|(0x52<<22)|0x7)
2508#define XY_MONO_PAT_VERT_SEED ((1<<10)|(1<<9)|(1<<8))
2509#define XY_MONO_PAT_HORT_SEED ((1<<14)|(1<<13)|(1<<12))
2510#define XY_MONO_PAT_BLT_WRITE_ALPHA (1<<21)
2511#define XY_MONO_PAT_BLT_WRITE_RGB (1<<20)
2512
2513#define XY_MONO_SRC_BLT_CMD ((0x2<<29)|(0x54<<22)|(0x6))
2514#define XY_MONO_SRC_BLT_WRITE_ALPHA (1<<21)
2515#define XY_MONO_SRC_BLT_WRITE_RGB (1<<20)
2516
Damien Lespiaucbd927c2015-03-03 14:10:57 +00002517#define XY_FAST_COPY_BLT ((2<<29)|(0x42<<22)|0x8)
2518/* dword 0 */
2519#define XY_FAST_COPY_SRC_TILING_LINEAR (0 << 20)
2520#define XY_FAST_COPY_SRC_TILING_X (1 << 20)
2521#define XY_FAST_COPY_SRC_TILING_Yb_Yf (2 << 20)
2522#define XY_FAST_COPY_SRC_TILING_Ys (3 << 20)
2523#define XY_FAST_COPY_SRC_HORIZONTAL_ALIGNMENT(n) (n << 17)
2524#define XY_FAST_COPY_SRC_VERTICAL_ALIGNMENT(n) (n << 15)
2525#define XY_FAST_COPY_DST_TILING_X (1 << 13)
2526#define XY_FAST_COPY_DST_TILING_Yb_Yf (2 << 13)
2527#define XY_FAST_COPY_DST_TILING_Ys (3 << 13)
2528#define XY_FAST_COPY_DST_HORIZONTAL_ALIGNMENT(n) (n << 10)
2529#define XY_FAST_COPY_DST_VERTICAL_ALIGNMENT(n) (n << 8)
2530/* dword 1 */
2531#define XY_FAST_COPY_SRC_TILING_Yf (1 << 31)
2532#define XY_FAST_COPY_DST_TILING_Yf (1 << 30)
2533#define XY_FAST_COPY_COLOR_DEPTH_32 (3 << 24)
2534
Jesse Barnesbbafc3d2009-06-18 18:07:47 -07002535#define MI_STORE_DWORD_IMM ((0x20<<23)|2)
2536#define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */
2537
Eric Anholt8c641832009-03-26 17:15:11 -07002538#define MI_SET_CONTEXT (0x18<<23)
Chris Wilson719ffef2011-05-22 10:34:12 +01002539#define CTXT_NO_RESTORE (1)
Eric Anholt8c641832009-03-26 17:15:11 -07002540#define CTXT_PALETTE_SAVE_DISABLE (1<<3)
2541#define CTXT_PALETTE_RESTORE_DISABLE (1<<2)
2542
2543/* Dword 0 */
2544#define MI_VERTEX_BUFFER (0x17<<23)
Chris Wilson719ffef2011-05-22 10:34:12 +01002545#define MI_VERTEX_BUFFER_IDX(x) (x<<20)
Eric Anholt8c641832009-03-26 17:15:11 -07002546#define MI_VERTEX_BUFFER_PITCH(x) (x<<13)
2547#define MI_VERTEX_BUFFER_WIDTH(x) (x<<6)
2548/* Dword 1 */
2549#define MI_VERTEX_BUFFER_DISABLE (1)
2550
2551/* Overlay Flip */
2552#define MI_OVERLAY_FLIP (0x11<<23)
2553#define MI_OVERLAY_FLIP_CONTINUE (0<<21)
2554#define MI_OVERLAY_FLIP_ON (1<<21)
2555#define MI_OVERLAY_FLIP_OFF (2<<21)
2556
2557/* Wait for Events */
2558#define MI_WAIT_FOR_EVENT (0x03<<23)
2559#define MI_WAIT_FOR_PIPEB_SVBLANK (1<<18)
2560#define MI_WAIT_FOR_PIPEA_SVBLANK (1<<17)
2561#define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
2562#define MI_WAIT_FOR_PIPEB_VBLANK (1<<7)
2563#define MI_WAIT_FOR_PIPEA_VBLANK (1<<3)
Jesse Barnesbbafc3d2009-06-18 18:07:47 -07002564#define MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW (1<<5)
2565#define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW (1<<1)
2566
2567#define MI_LOAD_SCAN_LINES_INCL (0x12<<23)
Mika Kuoppalab77145d2014-08-01 21:19:55 +03002568#define MI_LOAD_REGISTER_IMM ((0x22 << 23) | 1)
Eric Anholt8c641832009-03-26 17:15:11 -07002569
2570/* Flush */
2571#define MI_FLUSH (0x04<<23)
2572#define MI_WRITE_DIRTY_STATE (1<<4)
2573#define MI_END_SCENE (1<<3)
2574#define MI_GLOBAL_SNAPSHOT_COUNT_RESET (1<<3)
2575#define MI_INHIBIT_RENDER_CACHE_FLUSH (1<<2)
2576#define MI_STATE_INSTRUCTION_CACHE_FLUSH (1<<1)
2577#define MI_INVALIDATE_MAP_CACHE (1<<0)
2578/* broadwater flush bits */
2579#define BRW_MI_GLOBAL_SNAPSHOT_RESET (1 << 3)
2580
2581/* Noop */
2582#define MI_NOOP 0x00
2583#define MI_NOOP_WRITE_ID (1<<22)
2584#define MI_NOOP_ID_MASK (1<<22 - 1)
2585
2586#define STATE3D_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x01<<16))
2587
2588/* Batch */
2589#define MI_BATCH_BUFFER ((0x30 << 23) | 1)
2590#define MI_BATCH_BUFFER_START (0x31 << 23)
2591#define MI_BATCH_BUFFER_END (0xA << 23)
2592#define MI_BATCH_NON_SECURE (1)
2593#define MI_BATCH_NON_SECURE_I965 (1 << 8)
Brad Volkina06071c2014-10-15 14:52:42 -07002594#define MI_BATCH_NON_SECURE_HSW (1<<13) /* Additional bit for RCS */
Eric Anholt8c641832009-03-26 17:15:11 -07002595
Eric Anholt8c641832009-03-26 17:15:11 -07002596#define MAX_DISPLAY_PIPES 2
2597
2598typedef enum {
2599 CrtIndex = 0,
2600 TvIndex,
2601 DfpIndex,
2602 LfpIndex,
2603 Crt2Index,
2604 Tv2Index,
2605 Dfp2Index,
2606 Lfp2Index,
2607 NumDisplayTypes
2608} DisplayType;
2609
2610/* What's connected to the pipes (as reported by the BIOS) */
2611#define PIPE_ACTIVE_MASK 0xff
2612#define PIPE_CRT_ACTIVE (1 << CrtIndex)
2613#define PIPE_TV_ACTIVE (1 << TvIndex)
2614#define PIPE_DFP_ACTIVE (1 << DfpIndex)
2615#define PIPE_LCD_ACTIVE (1 << LfpIndex)
2616#define PIPE_CRT2_ACTIVE (1 << Crt2Index)
2617#define PIPE_TV2_ACTIVE (1 << Tv2Index)
2618#define PIPE_DFP2_ACTIVE (1 << Dfp2Index)
2619#define PIPE_LCD2_ACTIVE (1 << Lfp2Index)
2620
2621#define PIPE_SIZED_DISP_MASK (PIPE_DFP_ACTIVE | \
2622 PIPE_LCD_ACTIVE | \
2623 PIPE_DFP2_ACTIVE)
2624
2625#define PIPE_A_SHIFT 0
2626#define PIPE_B_SHIFT 8
2627#define PIPE_SHIFT(n) ((n) == 0 ? \
2628 PIPE_A_SHIFT : PIPE_B_SHIFT)
2629
2630/*
2631 * Some BIOS scratch area registers. The 845 (and 830?) store the amount
2632 * of video memory available to the BIOS in SWF1.
2633 */
2634
2635#define SWF0 0x71410
2636#define SWF1 0x71414
2637#define SWF2 0x71418
2638#define SWF3 0x7141c
2639#define SWF4 0x71420
2640#define SWF5 0x71424
2641#define SWF6 0x71428
2642
2643/*
2644 * 855 scratch registers.
2645 */
2646#define SWF00 0x70410
2647#define SWF01 0x70414
2648#define SWF02 0x70418
2649#define SWF03 0x7041c
2650#define SWF04 0x70420
2651#define SWF05 0x70424
2652#define SWF06 0x70428
2653
2654#define SWF10 SWF0
2655#define SWF11 SWF1
2656#define SWF12 SWF2
2657#define SWF13 SWF3
2658#define SWF14 SWF4
2659#define SWF15 SWF5
2660#define SWF16 SWF6
2661
2662#define SWF30 0x72414
2663#define SWF31 0x72418
2664#define SWF32 0x7241c
2665
2666/*
2667 * Overlay registers. These are overlay registers accessed via MMIO.
2668 * Those loaded via the overlay register page are defined in i830_video.c.
2669 */
2670#define OVADD 0x30000
2671
2672#define DOVSTA 0x30008
2673#define OC_BUF (0x3<<20)
2674
2675#define OGAMC5 0x30010
2676#define OGAMC4 0x30014
2677#define OGAMC3 0x30018
2678#define OGAMC2 0x3001c
2679#define OGAMC1 0x30020
2680#define OGAMC0 0x30024
2681
2682
2683/*
2684 * Palette registers
2685 */
2686#define PALETTE_A 0x0a000
2687#define PALETTE_B 0x0a800
2688
2689/* Framebuffer compression */
2690#define FBC_CFB_BASE 0x03200 /* 4k page aligned */
2691#define FBC_LL_BASE 0x03204 /* 4k page aligned */
2692#define FBC_CONTROL 0x03208
2693#define FBC_CTL_EN (1<<31)
2694#define FBC_CTL_PERIODIC (1<<30)
2695#define FBC_CTL_INTERVAL_SHIFT (16)
2696#define FBC_CTL_UNCOMPRESSIBLE (1<<14)
2697#define FBC_CTL_STRIDE_SHIFT (5)
2698#define FBC_CTL_FENCENO (1<<0)
2699#define FBC_COMMAND 0x0320c
2700#define FBC_CMD_COMPRESS (1<<0)
2701#define FBC_STATUS 0x03210
2702#define FBC_STAT_COMPRESSING (1<<31)
2703#define FBC_STAT_COMPRESSED (1<<30)
2704#define FBC_STAT_MODIFIED (1<<29)
2705#define FBC_STAT_CURRENT_LINE (1<<0)
2706#define FBC_CONTROL2 0x03214
2707#define FBC_CTL_FENCE_DBL (0<<4)
2708#define FBC_CTL_IDLE_IMM (0<<2)
2709#define FBC_CTL_IDLE_FULL (1<<2)
2710#define FBC_CTL_IDLE_LINE (2<<2)
2711#define FBC_CTL_IDLE_DEBUG (3<<2)
2712#define FBC_CTL_CPU_FENCE (1<<1)
2713#define FBC_CTL_PLANEA (0<<0)
2714#define FBC_CTL_PLANEB (1<<0)
2715#define FBC_FENCE_OFF 0x0321b
2716#define FBC_MOD_NUM 0x03220
2717#define FBC_TAG_DEBUG 0x03300
2718
2719#define FBC_LL_SIZE (1536)
2720#define FBC_LL_PAD (32)
2721
2722/* Framebuffer compression version 2 */
2723#define DPFC_CB_BASE 0x3200
2724#define DPFC_CONTROL 0x3208
2725#define DPFC_CTL_EN (1<<31)
2726#define DPFC_CTL_PLANEA (0<<30)
2727#define DPFC_CTL_PLANEB (1<<30)
2728#define DPFC_CTL_FENCE_EN (1<<29)
2729#define DPFC_CTL_LIMIT_1X (0<<6)
2730#define DPFC_CTL_LIMIT_2X (1<<6)
2731#define DPFC_CTL_LIMIT_4X (2<<6)
2732#define DPFC_RECOMP_CTL 0x320c
2733#define DPFC_RECOMP_STALL_EN (1<<27)
2734#define DPFC_RECOMP_STALL_WM_SHIFT (16)
2735#define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
2736#define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
2737#define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
2738#define DPFC_STATUS 0x3210
2739#define DPFC_INVAL_SEG_SHIFT (16)
2740#define DPFC_INVAL_SEG_MASK (0x07ff0000)
2741#define DPFC_COMP_SEG_SHIFT (0)
2742#define DPFC_COMP_SEG_MASK (0x000003ff)
2743#define DPFC_STATUS2 0x3214
2744#define DPFC_FENCE_YOFF 0x3218
2745
2746#define PEG_BAND_GAP_DATA 0x14d68
2747
2748#define MCHBAR_RENDER_STANDBY 0x111B8
2749#define RENDER_STANDBY_ENABLE (1 << 30)
2750
Eric Anholt40bff502009-10-06 17:25:10 -07002751
2752/* Ironlake */
2753
2754/* warmup time in us */
2755#define WARMUP_PCH_REF_CLK_SSC_MOD 1
2756#define WARMUP_PCH_FDI_RECEIVER_PLL 25
2757#define WARMUP_PCH_DPLL 50
2758#define WARMUP_CPU_DP_PLL 20
2759#define WARMUP_CPU_FDI_TRANSMITTER_PLL 10
2760#define WARMUP_DMI_LATENCY 20
2761#define FDI_TRAIN_PATTERN_1_TIME 0.5
2762#define FDI_TRAIN_PATTERN_2_TIME 1.5
2763#define FDI_ONE_IDLE_PATTERN_TIME 31
2764
2765#define CPU_VGACNTRL 0x41000
2766
2767#define DIGITAL_PORT_HOTPLUG_CNTRL 0x44030
2768#define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4)
2769#define DIGITAL_PORTA_SHORT_PULSE_2MS (0 << 2)
2770#define DIGITAL_PORTA_SHORT_PULSE_4_5MS (1 << 2)
2771#define DIGITAL_PORTA_SHORT_PULSE_6MS (2 << 2)
2772#define DIGITAL_PORTA_SHORT_PULSE_100MS (3 << 2)
2773#define DIGITAL_PORTA_NO_DETECT (0 << 0)
2774#define DIGITAL_PORTA_LONG_PULSE_DETECT_MASK (1 << 1)
2775#define DIGITAL_PORTA_SHORT_PULSE_DETECT_MASK (1 << 0)
2776
2777/* refresh rate hardware control */
2778#define RR_HW_CTL 0x45300
2779#define RR_HW_LOW_POWER_FRAMES_MASK 0xff
2780#define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00
2781
2782#define FDI_PLL_BIOS_0 0x46000
2783#define FDI_PLL_BIOS_1 0x46004
2784#define FDI_PLL_BIOS_2 0x46008
2785#define DISPLAY_PORT_PLL_BIOS_0 0x4600c
2786#define DISPLAY_PORT_PLL_BIOS_1 0x46010
2787#define DISPLAY_PORT_PLL_BIOS_2 0x46014
2788
2789#define FDI_PLL_FREQ_CTL 0x46030
2790#define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
2791#define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
2792#define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff
2793
2794#define PIPEA_DATA_M1 0x60030
2795#define TU_SIZE(x) (((x)-1) << 25) /* default size 64 */
2796#define TU_SIZE_MASK 0x7e000000
2797#define PIPEA_DATA_M1_OFFSET 0
2798#define PIPEA_DATA_N1 0x60034
2799#define PIPEA_DATA_N1_OFFSET 0
2800
2801#define PIPEA_DATA_M2 0x60038
2802#define PIPEA_DATA_M2_OFFSET 0
2803#define PIPEA_DATA_N2 0x6003c
2804#define PIPEA_DATA_N2_OFFSET 0
2805
2806#define PIPEA_LINK_M1 0x60040
2807#define PIPEA_LINK_M1_OFFSET 0
2808#define PIPEA_LINK_N1 0x60044
2809#define PIPEA_LINK_N1_OFFSET 0
2810
2811#define PIPEA_LINK_M2 0x60048
2812#define PIPEA_LINK_M2_OFFSET 0
2813#define PIPEA_LINK_N2 0x6004c
2814#define PIPEA_LINK_N2_OFFSET 0
2815
2816/* PIPEB timing regs are same start from 0x61000 */
2817
2818#define PIPEB_DATA_M1 0x61030
Eric Anholt40bff502009-10-06 17:25:10 -07002819#define PIPEB_DATA_N1 0x61034
Eric Anholt40bff502009-10-06 17:25:10 -07002820
2821#define PIPEB_DATA_M2 0x61038
Eric Anholt40bff502009-10-06 17:25:10 -07002822#define PIPEB_DATA_N2 0x6103c
Eric Anholt40bff502009-10-06 17:25:10 -07002823
2824#define PIPEB_LINK_M1 0x61040
Eric Anholt40bff502009-10-06 17:25:10 -07002825#define PIPEB_LINK_N1 0x61044
Eric Anholt40bff502009-10-06 17:25:10 -07002826
2827#define PIPEB_LINK_M2 0x61048
Eric Anholt40bff502009-10-06 17:25:10 -07002828#define PIPEB_LINK_N2 0x6104c
Daniel Vetter0efa6c72012-08-07 18:16:34 +02002829
2830/* PIPEC timing regs */
2831
2832#define PIPEC_DATA_M1 0x62030
2833#define PIPEC_DATA_N1 0x62034
2834
2835#define PIPEC_DATA_M2 0x62038
2836#define PIPEC_DATA_N2 0x6203c
2837
2838#define PIPEC_LINK_M1 0x62040
2839#define PIPEC_LINK_N1 0x62044
2840
2841#define PIPEC_LINK_M2 0x62048
2842#define PIPEC_LINK_N2 0x6204c
Eric Anholt40bff502009-10-06 17:25:10 -07002843
Paulo Zanoni5c0ce0f2013-03-01 15:46:25 -03002844#define PIPEEDP_DATA_M1 0x6F030
2845#define PIPEEDP_DATA_N1 0x6F034
2846
2847#define PIPEEDP_LINK_M1 0x6F040
2848#define PIPEEDP_LINK_N1 0x6F044
2849
Eric Anholt40bff502009-10-06 17:25:10 -07002850/* PIPECONF for pipe A/B addr is same */
2851
2852/* cusor A is only connected to pipe A,
2853 cursor B is connected to pipe B. Otherwise no change. */
2854
2855/* Plane A/B, DSPACNTR/DSPBCNTR addr not changed */
2856
2857/* CPU panel fitter */
2858#define PFA_CTL_1 0x68080
2859#define PFB_CTL_1 0x68880
Daniel Vetterf56a2892012-08-07 14:50:54 +02002860#define PFC_CTL_1 0x69080
Eric Anholt40bff502009-10-06 17:25:10 -07002861#define PF_ENABLE (1<<31)
Chris Wilsonc09fa382010-09-05 12:05:52 +01002862#define PFA_CTL_2 0x68084
2863#define PFB_CTL_2 0x68884
Daniel Vetterf56a2892012-08-07 14:50:54 +02002864#define PFC_CTL_2 0x69084
Chris Wilsonc09fa382010-09-05 12:05:52 +01002865#define PFA_CTL_3 0x68088
2866#define PFB_CTL_3 0x68888
Daniel Vetterf56a2892012-08-07 14:50:54 +02002867#define PFC_CTL_3 0x69088
Chris Wilsonc09fa382010-09-05 12:05:52 +01002868#define PFA_CTL_4 0x68090
2869#define PFB_CTL_4 0x68890
Daniel Vetterf56a2892012-08-07 14:50:54 +02002870#define PFC_CTL_4 0x69090
Eric Anholt40bff502009-10-06 17:25:10 -07002871
2872#define PFA_WIN_POS 0x68070
2873#define PFB_WIN_POS 0x68870
Daniel Vetterf56a2892012-08-07 14:50:54 +02002874#define PFC_WIN_POS 0x69070
Eric Anholt40bff502009-10-06 17:25:10 -07002875#define PFA_WIN_SIZE 0x68074
2876#define PFB_WIN_SIZE 0x68874
Daniel Vetterf56a2892012-08-07 14:50:54 +02002877#define PFC_WIN_SIZE 0x69074
Eric Anholt40bff502009-10-06 17:25:10 -07002878
2879/* legacy palette */
2880#define LGC_PALETTE_A 0x4a000
2881#define LGC_PALETTE_B 0x4a800
2882
2883/* interrupts */
2884#define DE_MASTER_IRQ_CONTROL (1 << 31)
2885#define DE_SPRITEB_FLIP_DONE (1 << 29)
2886#define DE_SPRITEA_FLIP_DONE (1 << 28)
2887#define DE_PLANEB_FLIP_DONE (1 << 27)
2888#define DE_PLANEA_FLIP_DONE (1 << 26)
2889#define DE_PCU_EVENT (1 << 25)
2890#define DE_GTT_FAULT (1 << 24)
2891#define DE_POISON (1 << 23)
2892#define DE_PERFORM_COUNTER (1 << 22)
2893#define DE_PCH_EVENT (1 << 21)
2894#define DE_AUX_CHANNEL_A (1 << 20)
2895#define DE_DP_A_HOTPLUG (1 << 19)
2896#define DE_GSE (1 << 18)
2897#define DE_PIPEB_VBLANK (1 << 15)
2898#define DE_PIPEB_EVEN_FIELD (1 << 14)
2899#define DE_PIPEB_ODD_FIELD (1 << 13)
2900#define DE_PIPEB_LINE_COMPARE (1 << 12)
2901#define DE_PIPEB_VSYNC (1 << 11)
2902#define DE_PIPEB_FIFO_UNDERRUN (1 << 8)
2903#define DE_PIPEA_VBLANK (1 << 7)
2904#define DE_PIPEA_EVEN_FIELD (1 << 6)
2905#define DE_PIPEA_ODD_FIELD (1 << 5)
2906#define DE_PIPEA_LINE_COMPARE (1 << 4)
2907#define DE_PIPEA_VSYNC (1 << 3)
2908#define DE_PIPEA_FIFO_UNDERRUN (1 << 0)
2909
2910#define DEISR 0x44000
2911#define DEIMR 0x44004
2912#define DEIIR 0x44008
2913#define DEIER 0x4400c
2914
Ville Syrjälä8c1566e2013-10-29 18:17:39 +02002915#define GEN8_DE_PIPE_ISR(pipe) (0x44400 + 0x10 * (pipe))
2916#define GEN8_DE_PIPE_IMR(pipe) (0x44404 + 0x10 * (pipe))
2917#define GEN8_DE_PIPE_IIR(pipe) (0x44408 + 0x10 * (pipe))
2918#define GEN8_DE_PIPE_IER(pipe) (0x4440c + 0x10 * (pipe))
2919
Eric Anholt40bff502009-10-06 17:25:10 -07002920/* GT interrupt */
2921#define GT_SYNC_STATUS (1 << 2)
2922#define GT_USER_INTERRUPT (1 << 0)
2923
2924#define GTISR 0x44010
2925#define GTIMR 0x44014
2926#define GTIIR 0x44018
2927#define GTIER 0x4401c
2928
2929/* PCH */
2930
2931/* south display engine interrupt */
2932#define SDE_CRT_HOTPLUG (1 << 11)
2933#define SDE_PORTD_HOTPLUG (1 << 10)
2934#define SDE_PORTC_HOTPLUG (1 << 9)
2935#define SDE_PORTB_HOTPLUG (1 << 8)
2936#define SDE_SDVOB_HOTPLUG (1 << 6)
2937
2938#define SDEISR 0xc4000
2939#define SDEIMR 0xc4004
2940#define SDEIIR 0xc4008
2941#define SDEIER 0xc400c
2942
2943/* digital port hotplug */
2944#define PCH_PORT_HOTPLUG 0xc4030
2945#define PORTD_HOTPLUG_ENABLE (1 << 20)
2946#define PORTD_PULSE_DURATION_2ms (0)
2947#define PORTD_PULSE_DURATION_4_5ms (1 << 18)
2948#define PORTD_PULSE_DURATION_6ms (2 << 18)
2949#define PORTD_PULSE_DURATION_100ms (3 << 18)
2950#define PORTD_HOTPLUG_NO_DETECT (0)
2951#define PORTD_HOTPLUG_SHORT_DETECT (1 << 16)
2952#define PORTD_HOTPLUG_LONG_DETECT (1 << 17)
2953#define PORTC_HOTPLUG_ENABLE (1 << 12)
2954#define PORTC_PULSE_DURATION_2ms (0)
2955#define PORTC_PULSE_DURATION_4_5ms (1 << 10)
2956#define PORTC_PULSE_DURATION_6ms (2 << 10)
2957#define PORTC_PULSE_DURATION_100ms (3 << 10)
2958#define PORTC_HOTPLUG_NO_DETECT (0)
2959#define PORTC_HOTPLUG_SHORT_DETECT (1 << 8)
2960#define PORTC_HOTPLUG_LONG_DETECT (1 << 9)
2961#define PORTB_HOTPLUG_ENABLE (1 << 4)
2962#define PORTB_PULSE_DURATION_2ms (0)
2963#define PORTB_PULSE_DURATION_4_5ms (1 << 2)
2964#define PORTB_PULSE_DURATION_6ms (2 << 2)
2965#define PORTB_PULSE_DURATION_100ms (3 << 2)
2966#define PORTB_HOTPLUG_NO_DETECT (0)
2967#define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
2968#define PORTB_HOTPLUG_LONG_DETECT (1 << 1)
2969
2970#define PCH_GPIOA 0xc5010
2971#define PCH_GPIOB 0xc5014
2972#define PCH_GPIOC 0xc5018
2973#define PCH_GPIOD 0xc501c
2974#define PCH_GPIOE 0xc5020
2975#define PCH_GPIOF 0xc5024
2976#define PCH_GMBUS0 0xc5100
2977#define PCH_GMBUS1 0xc5104
2978#define PCH_GMBUS2 0xc5108
2979#define PCH_GMBUS3 0xc510c
2980#define PCH_GMBUS4 0xc5110
2981#define PCH_GMBUS5 0xc5120
2982
2983#define PCH_DPLL_A 0xc6014
2984#define PCH_DPLL_B 0xc6018
2985
2986#define PCH_FPA0 0xc6040
2987#define PCH_FPA1 0xc6044
2988#define PCH_FPB0 0xc6048
2989#define PCH_FPB1 0xc604c
2990
2991#define PCH_DPLL_TEST 0xc606c
2992
2993#define PCH_DREF_CONTROL 0xC6200
2994#define DREF_CONTROL_MASK 0x7fc3
2995#define DREF_CPU_SOURCE_OUTPUT_DISABLE (0<<13)
2996#define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2<<13)
2997#define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3<<13)
2998#define DREF_SSC_SOURCE_DISABLE (0<<11)
2999#define DREF_SSC_SOURCE_ENABLE (2<<11)
3000#define DREF_NONSPREAD_SOURCE_DISABLE (0<<9)
3001#define DREF_NONSPREAD_SOURCE_ENABLE (2<<9)
3002#define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7)
3003#define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7)
3004#define DREF_SSC4_DOWNSPREAD (0<<6)
3005#define DREF_SSC4_CENTERSPREAD (1<<6)
3006#define DREF_SSC1_DISABLE (0<<1)
3007#define DREF_SSC1_ENABLE (1<<1)
3008#define DREF_SSC4_DISABLE (0)
3009#define DREF_SSC4_ENABLE (1)
3010
3011#define PCH_RAWCLK_FREQ 0xc6204
3012#define FDL_TP1_TIMER_SHIFT 12
3013#define FDL_TP1_TIMER_MASK (3<<12)
3014#define FDL_TP2_TIMER_SHIFT 10
3015#define FDL_TP2_TIMER_MASK (3<<10)
3016#define RAWCLK_FREQ_MASK 0x3ff
3017
3018#define PCH_DPLL_TMR_CFG 0xc6208
3019
3020#define PCH_SSC4_PARMS 0xc6210
3021#define PCH_SSC4_AUX_PARMS 0xc6214
3022
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003023/* CPT */
3024#define PCH_DPLL_ANALOG_CTL 0xc6300
3025
3026#define PCH_DPLL_SEL 0xc7000
3027#define TRANSA_DPLL_ENABLE (1<<3)
3028#define TRANSA_DPLLA_SEL (0)
3029#define TRANSA_DPLLB_SEL (1<<0)
3030#define TRANSB_DPLL_ENABLE (1<<7)
3031#define TRANSB_DPLLA_SEL (0<<4)
3032#define TRANSB_DPLLB_SEL (1<<4)
3033#define TRANSC_DPLL_ENABLE (1<<11)
3034#define TRANSC_DPLLA_SEL (0<<8)
3035#define TRANSC_DPLLB_SEL (1<<8)
3036
Eric Anholt40bff502009-10-06 17:25:10 -07003037/* transcoder */
3038
3039#define TRANS_HTOTAL_A 0xe0000
3040#define TRANS_HTOTAL_SHIFT 16
3041#define TRANS_HACTIVE_SHIFT 0
3042#define TRANS_HBLANK_A 0xe0004
3043#define TRANS_HBLANK_END_SHIFT 16
3044#define TRANS_HBLANK_START_SHIFT 0
3045#define TRANS_HSYNC_A 0xe0008
3046#define TRANS_HSYNC_END_SHIFT 16
3047#define TRANS_HSYNC_START_SHIFT 0
3048#define TRANS_VTOTAL_A 0xe000c
3049#define TRANS_VTOTAL_SHIFT 16
3050#define TRANS_VACTIVE_SHIFT 0
3051#define TRANS_VBLANK_A 0xe0010
3052#define TRANS_VBLANK_END_SHIFT 16
3053#define TRANS_VBLANK_START_SHIFT 0
3054#define TRANS_VSYNC_A 0xe0014
3055#define TRANS_VSYNC_END_SHIFT 16
3056#define TRANS_VSYNC_START_SHIFT 0
Daniel Vetter611e0cb2012-01-27 18:50:21 +01003057#define TRANS_VSYNCSHIFT_A 0xe0028
Eric Anholt40bff502009-10-06 17:25:10 -07003058
3059#define TRANSA_DATA_M1 0xe0030
3060#define TRANSA_DATA_N1 0xe0034
3061#define TRANSA_DATA_M2 0xe0038
3062#define TRANSA_DATA_N2 0xe003c
3063#define TRANSA_DP_LINK_M1 0xe0040
3064#define TRANSA_DP_LINK_N1 0xe0044
3065#define TRANSA_DP_LINK_M2 0xe0048
3066#define TRANSA_DP_LINK_N2 0xe004c
3067
3068#define TRANS_HTOTAL_B 0xe1000
3069#define TRANS_HBLANK_B 0xe1004
3070#define TRANS_HSYNC_B 0xe1008
3071#define TRANS_VTOTAL_B 0xe100c
3072#define TRANS_VBLANK_B 0xe1010
3073#define TRANS_VSYNC_B 0xe1014
Daniel Vetter611e0cb2012-01-27 18:50:21 +01003074#define TRANS_VSYNCSHIFT_B 0xe1028
Eric Anholt40bff502009-10-06 17:25:10 -07003075
3076#define TRANSB_DATA_M1 0xe1030
3077#define TRANSB_DATA_N1 0xe1034
3078#define TRANSB_DATA_M2 0xe1038
3079#define TRANSB_DATA_N2 0xe103c
3080#define TRANSB_DP_LINK_M1 0xe1040
3081#define TRANSB_DP_LINK_N1 0xe1044
3082#define TRANSB_DP_LINK_M2 0xe1048
3083#define TRANSB_DP_LINK_N2 0xe104c
3084
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003085#define TRANS_HTOTAL_C 0xe2000
3086#define TRANS_HBLANK_C 0xe2004
3087#define TRANS_HSYNC_C 0xe2008
3088#define TRANS_VTOTAL_C 0xe200c
3089#define TRANS_VBLANK_C 0xe2010
3090#define TRANS_VSYNC_C 0xe2014
Daniel Vetter611e0cb2012-01-27 18:50:21 +01003091#define TRANS_VSYNCSHIFT_C 0xe2028
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003092
3093#define TRANSC_DATA_M1 0xe2030
3094#define TRANSC_DATA_N1 0xe2034
3095#define TRANSC_DATA_M2 0xe2038
3096#define TRANSC_DATA_N2 0xe203c
3097#define TRANSC_DP_LINK_M1 0xe2040
3098#define TRANSC_DP_LINK_N1 0xe2044
3099#define TRANSC_DP_LINK_M2 0xe2048
3100#define TRANSC_DP_LINK_N2 0xe204c
3101
Ville Syrjäläf7126712016-08-05 10:12:46 +03003102#define DP_BUFTRANS(x) (0xe4f00 + 4 * (x))
3103
Eric Anholt40bff502009-10-06 17:25:10 -07003104#define TRANSACONF 0xf0008
3105#define TRANSBCONF 0xf1008
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003106#define TRANSCCONF 0xf2008
Eric Anholt40bff502009-10-06 17:25:10 -07003107#define TRANS_DISABLE (0<<31)
3108#define TRANS_ENABLE (1<<31)
3109#define TRANS_STATE_MASK (1<<30)
3110#define TRANS_STATE_DISABLE (0<<30)
3111#define TRANS_STATE_ENABLE (1<<30)
3112#define TRANS_FSYNC_DELAY_HB1 (0<<27)
3113#define TRANS_FSYNC_DELAY_HB2 (1<<27)
3114#define TRANS_FSYNC_DELAY_HB3 (2<<27)
3115#define TRANS_FSYNC_DELAY_HB4 (3<<27)
3116#define TRANS_DP_AUDIO_ONLY (1<<26)
3117#define TRANS_DP_VIDEO_AUDIO (0<<26)
3118#define TRANS_PROGRESSIVE (0<<21)
3119#define TRANS_8BPC (0<<5)
3120#define TRANS_10BPC (1<<5)
3121#define TRANS_6BPC (2<<5)
3122#define TRANS_12BPC (3<<5)
3123
3124#define FDI_RXA_CHICKEN 0xc200c
3125#define FDI_RXB_CHICKEN 0xc2010
3126#define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1)
3127
3128/* CPU: FDI_TX */
3129#define FDI_TXA_CTL 0x60100
3130#define FDI_TXB_CTL 0x61100
Jesse Barnes2b484c12011-10-28 08:53:48 -07003131#define FDI_TXC_CTL 0x62100
Eric Anholt40bff502009-10-06 17:25:10 -07003132#define FDI_TX_DISABLE (0<<31)
3133#define FDI_TX_ENABLE (1<<31)
3134#define FDI_LINK_TRAIN_PATTERN_1 (0<<28)
3135#define FDI_LINK_TRAIN_PATTERN_2 (1<<28)
3136#define FDI_LINK_TRAIN_PATTERN_IDLE (2<<28)
3137#define FDI_LINK_TRAIN_NONE (3<<28)
3138#define FDI_LINK_TRAIN_VOLTAGE_0_4V (0<<25)
3139#define FDI_LINK_TRAIN_VOLTAGE_0_6V (1<<25)
3140#define FDI_LINK_TRAIN_VOLTAGE_0_8V (2<<25)
3141#define FDI_LINK_TRAIN_VOLTAGE_1_2V (3<<25)
3142#define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0<<22)
3143#define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1<<22)
3144#define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2<<22)
3145#define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3<<22)
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003146/* ILK always use 400mV 0dB for voltage swing and pre-emphasis level.
3147 SNB has different settings. */
3148/* SNB A-stepping */
3149#define FDI_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22)
3150#define FDI_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22)
3151#define FDI_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
3152#define FDI_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
3153/* SNB B-stepping */
3154#define FDI_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22)
3155#define FDI_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22)
3156#define FDI_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22)
3157#define FDI_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22)
3158#define FDI_LINK_TRAIN_VOL_EMP_MASK (0x3f<<22)
Eric Anholt40bff502009-10-06 17:25:10 -07003159#define FDI_DP_PORT_WIDTH_X1 (0<<19)
3160#define FDI_DP_PORT_WIDTH_X2 (1<<19)
3161#define FDI_DP_PORT_WIDTH_X3 (2<<19)
3162#define FDI_DP_PORT_WIDTH_X4 (3<<19)
3163#define FDI_TX_ENHANCE_FRAME_ENABLE (1<<18)
3164/* Ironlake: hardwired to 1 */
3165#define FDI_TX_PLL_ENABLE (1<<14)
3166/* both Tx and Rx */
3167#define FDI_SCRAMBLING_ENABLE (0<<7)
3168#define FDI_SCRAMBLING_DISABLE (1<<7)
3169
Daniel Vetterda647312012-12-01 00:52:24 +01003170/* Additional cpu TX control regs, from ivb bspec */
3171#define DPAFE_BMFUNC 0x6c024
3172#define DPAFE_DL_IREFCAL0 0x6c02c
3173#define DPAFE_DL_IREFCAL1 0x6c030
3174#define DPAFE_DP_IREFCAL 0x6c034
3175
Eric Anholt40bff502009-10-06 17:25:10 -07003176/* FDI_RX, FDI_X is hard-wired to Transcoder_X */
3177#define FDI_RXA_CTL 0xf000c
3178#define FDI_RXB_CTL 0xf100c
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003179#define FDI_RXC_CTL 0xf200c
Eric Anholt40bff502009-10-06 17:25:10 -07003180#define FDI_RX_ENABLE (1<<31)
3181#define FDI_RX_DISABLE (0<<31)
3182/* train, dp width same as FDI_TX */
3183#define FDI_DP_PORT_WIDTH_X8 (7<<19)
3184#define FDI_8BPC (0<<16)
3185#define FDI_10BPC (1<<16)
3186#define FDI_6BPC (2<<16)
3187#define FDI_12BPC (3<<16)
3188#define FDI_LINK_REVERSE_OVERWRITE (1<<15)
3189#define FDI_DMI_LINK_REVERSE_MASK (1<<14)
3190#define FDI_RX_PLL_ENABLE (1<<13)
3191#define FDI_FS_ERR_CORRECT_ENABLE (1<<11)
3192#define FDI_FE_ERR_CORRECT_ENABLE (1<<10)
3193#define FDI_FS_ERR_REPORT_ENABLE (1<<9)
3194#define FDI_FE_ERR_REPORT_ENABLE (1<<8)
3195#define FDI_RX_ENHANCE_FRAME_ENABLE (1<<6)
3196#define FDI_SEL_RAWCLK (0<<4)
3197#define FDI_SEL_PCDCLK (1<<4)
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003198/* CPT */
3199#define FDI_AUTO_TRAINING (1<<10)
3200#define FDI_LINK_TRAIN_PATTERN_1_CPT (0<<8)
3201#define FDI_LINK_TRAIN_PATTERN_2_CPT (1<<8)
3202#define FDI_LINK_TRAIN_PATTERN_IDLE_CPT (2<<8)
3203#define FDI_LINK_TRAIN_NORMAL_CPT (3<<8)
3204#define FDI_LINK_TRAIN_PATTERN_MASK_CPT (3<<8)
Eric Anholt40bff502009-10-06 17:25:10 -07003205
3206#define FDI_RXA_MISC 0xf0010
3207#define FDI_RXB_MISC 0xf1010
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003208#define FDI_RXC_MISC 0xf2010
Eric Anholt40bff502009-10-06 17:25:10 -07003209#define FDI_RXA_TUSIZE1 0xf0030
3210#define FDI_RXA_TUSIZE2 0xf0038
3211#define FDI_RXB_TUSIZE1 0xf1030
3212#define FDI_RXB_TUSIZE2 0xf1038
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003213#define FDI_RXC_TUSIZE1 0xf2030
3214#define FDI_RXC_TUSIZE2 0xf2038
Eric Anholt40bff502009-10-06 17:25:10 -07003215
3216/* FDI_RX interrupt register format */
3217#define FDI_RX_INTER_LANE_ALIGN (1<<10)
3218#define FDI_RX_SYMBOL_LOCK (1<<9) /* train 2 */
3219#define FDI_RX_BIT_LOCK (1<<8) /* train 1 */
3220#define FDI_RX_TRAIN_PATTERN_2_FAIL (1<<7)
3221#define FDI_RX_FS_CODE_ERR (1<<6)
3222#define FDI_RX_FE_CODE_ERR (1<<5)
3223#define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1<<4)
3224#define FDI_RX_HDCP_LINK_FAIL (1<<3)
3225#define FDI_RX_PIXEL_FIFO_OVERFLOW (1<<2)
3226#define FDI_RX_CROSS_CLOCK_OVERFLOW (1<<1)
3227#define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1<<0)
3228
3229#define FDI_RXA_IIR 0xf0014
3230#define FDI_RXA_IMR 0xf0018
3231#define FDI_RXB_IIR 0xf1014
3232#define FDI_RXB_IMR 0xf1018
3233
3234#define FDI_PLL_CTL_1 0xfe000
3235#define FDI_PLL_CTL_2 0xfe004
3236
3237/* CRT */
3238#define PCH_ADPA 0xe1100
3239#define ADPA_TRANS_SELECT_MASK (1<<30)
3240#define ADPA_TRANS_A_SELECT 0
3241#define ADPA_TRANS_B_SELECT (1<<30)
3242/* HPD is here */
3243#define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */
3244#define ADPA_CRT_HOTPLUG_MONITOR_NONE (0<<24)
3245#define ADPA_CRT_HOTPLUG_MONITOR_MASK (3<<24)
3246#define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3<<24)
3247#define ADPA_CRT_HOTPLUG_MONITOR_MONO (2<<24)
3248#define ADPA_CRT_HOTPLUG_ENABLE (1<<23)
3249#define ADPA_CRT_HOTPLUG_PERIOD_64 (0<<22)
3250#define ADPA_CRT_HOTPLUG_PERIOD_128 (1<<22)
3251#define ADPA_CRT_HOTPLUG_WARMUP_5MS (0<<21)
3252#define ADPA_CRT_HOTPLUG_WARMUP_10MS (1<<21)
3253#define ADPA_CRT_HOTPLUG_SAMPLE_2S (0<<20)
3254#define ADPA_CRT_HOTPLUG_SAMPLE_4S (1<<20)
3255#define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0<<18)
3256#define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1<<18)
3257#define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2<<18)
3258#define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3<<18)
3259#define ADPA_CRT_HOTPLUG_VOLREF_325MV (0<<17)
3260#define ADPA_CRT_HOTPLUG_VOLREF_475MV (1<<17)
3261#define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16)
3262/* polarity control not changed */
3263
3264/* or SDVOB */
3265#define HDMIB 0xe1140
3266#define PORT_ENABLE (1 << 31)
3267#define TRANSCODER_A (0)
3268#define TRANSCODER_B (1 << 30)
3269#define COLOR_FORMAT_8bpc (0)
3270#define COLOR_FORMAT_12bpc (3 << 26)
3271#define SDVOB_HOTPLUG_ENABLE (1 << 23)
3272#define SDVO_ENCODING (0)
3273#define TMDS_ENCODING (2 << 10)
3274#define NULL_PACKET_VSYNC_ENABLE (1 << 9)
3275#define SDVOB_BORDER_ENABLE (1 << 7)
3276#define AUDIO_ENABLE (1 << 6)
3277#define VSYNC_ACTIVE_HIGH (1 << 4)
3278#define HSYNC_ACTIVE_HIGH (1 << 3)
3279#define PORT_DETECTED (1 << 2)
3280
3281#define HDMIC 0xe1150
3282#define HDMID 0xe1160
3283#define PCH_LVDS 0xe1180
3284
Paulo Zanonib0c63a72013-04-04 14:33:59 -03003285/* Since IVB, the old _CTL2 is now _CTL and the old _CTL is now _DATA. */
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003286#define BLC_PWM_CPU_CTL2 0x48250
Paulo Zanonib0c63a72013-04-04 14:33:59 -03003287#define BLC_PWM2_CPU_CTL2 0x48350
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003288#define PWM_ENABLE (1 << 31)
3289#define PWM_PIPE_A (0 << 29)
3290#define PWM_PIPE_B (1 << 29)
3291#define BLC_PWM_CPU_CTL 0x48254
Paulo Zanonib0c63a72013-04-04 14:33:59 -03003292#define BLC_PWM2_CPU_CTL 0x48354
3293#define BLC_MISC_CTL 0x48360
3294
3295#define UTIL_PIN_CTL 0x48400
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003296
3297#define BLC_PWM_PCH_CTL1 0xc8250
3298#define PWM_PCH_ENABLE (1 << 31)
3299#define PWM_POLARITY_ACTIVE_LOW (1 << 29)
3300#define PWM_POLARITY_ACTIVE_HIGH (0 << 29)
3301#define PWM_POLARITY_ACTIVE_LOW2 (1 << 28)
3302#define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28)
3303
3304#define BLC_PWM_PCH_CTL2 0xc8254
3305
3306#define PCH_PP_STATUS 0xc7200
3307#define PCH_PP_CONTROL 0xc7204
3308#define EDP_FORCE_VDD (1 << 3)
3309#define EDP_BLC_ENABLE (1 << 2)
3310#define PANEL_POWER_RESET (1 << 1)
3311#define PANEL_POWER_OFF (0 << 0)
3312#define PANEL_POWER_ON (1 << 0)
3313#define PCH_PP_ON_DELAYS 0xc7208
3314#define EDP_PANEL (1 << 30)
3315#define PCH_PP_OFF_DELAYS 0xc720c
3316#define PCH_PP_DIVISOR 0xc7210
3317
Eric Anholt40bff502009-10-06 17:25:10 -07003318#define AUD_CONFIG 0x62000
3319#define AUD_DEBUG 0x62010
3320#define AUD_VID_DID 0x62020
3321#define AUD_RID 0x62024
3322#define AUD_SUBN_CNT 0x62028
3323#define AUD_FUNC_GRP 0x62040
3324#define AUD_SUBN_CNT2 0x62044
3325#define AUD_GRP_CAP 0x62048
3326#define AUD_PWRST 0x6204c
3327#define AUD_SUPPWR 0x62050
3328#define AUD_SID 0x62054
3329#define AUD_OUT_CWCAP 0x62070
3330#define AUD_OUT_PCMSIZE 0x62074
3331#define AUD_OUT_STR 0x62078
3332#define AUD_OUT_DIG_CNVT 0x6207c
3333#define AUD_OUT_CH_STR 0x62080
3334#define AUD_OUT_STR_DESC 0x62084
3335#define AUD_PINW_CAP 0x620a0
3336#define AUD_PIN_CAP 0x620a4
3337#define AUD_PINW_CONNLNG 0x620a8
3338#define AUD_PINW_CONNLST 0x620ac
3339#define AUD_PINW_CNTR 0x620b0
3340#define AUD_PINW_UNSOLRESP 0x620b8
3341#define AUD_CNTL_ST 0x620b4
3342#define AUD_PINW_CONFIG 0x620bc
3343#define AUD_HDMIW_STATUS 0x620d4
3344#define AUD_HDMIW_HDMIEDID 0x6210c
3345#define AUD_HDMIW_INFOFR 0x62118
3346#define AUD_CONV_CHCNT 0x62120
3347#define AUD_CTS_ENABLE 0x62128
3348
3349#define VIDEO_DIP_CTL 0x61170
Wu Fengguang9e9c9f22009-11-06 11:06:22 +08003350#define VIDEO_DIP_DATA 0x61178
Eric Anholt40bff502009-10-06 17:25:10 -07003351
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003352/* CPT */
3353#define TRANS_DP_CTL_A 0xe0300
3354#define TRANS_DP_CTL_B 0xe1300
3355#define TRANS_DP_CTL_C 0xe2300
3356#define TRANS_DP_OUTPUT_ENABLE (1<<31)
3357#define TRANS_DP_PORT_SEL_B (0<<29)
3358#define TRANS_DP_PORT_SEL_C (1<<29)
3359#define TRANS_DP_PORT_SEL_D (2<<29)
3360#define TRANS_DP_PORT_SEL_MASK (3<<29)
3361#define TRANS_DP_AUDIO_ONLY (1<<26)
3362#define TRANS_DP_ENH_FRAMING (1<<18)
3363#define TRANS_DP_8BPC (0<<9)
3364#define TRANS_DP_10BPC (1<<9)
3365#define TRANS_DP_6BPC (2<<9)
3366#define TRANS_DP_12BPC (3<<9)
3367#define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4)
3368#define TRANS_DP_VSYNC_ACTIVE_LOW 0
3369#define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3)
3370#define TRANS_DP_HSYNC_ACTIVE_LOW 0
3371
Ben Widawskye39b13d2011-07-17 12:43:12 -07003372/* Debug regs */
3373#define GEN6_TD_CTL 0x7000 /* <= GEN5 was at 0x8000 */
3374#define GEN6_TD_CTL_FORCE_TD_BKPT (1<<4)
Zhenyu Wangeae80ed2010-04-15 01:25:50 +08003375
Eugeni Dodonov1649ab32011-10-25 14:40:12 -02003376/* Port debugging
3377 */
3378
3379#define PORT_DBG 0x42308
3380#define PORT_DBG_DRRS_HW_STATE_OFF (0<<30)
3381#define PORT_DBG_DRRS_HW_STATE_LOW (1<<30)
3382#define PORT_DBG_DRRS_HW_STATE_HIGH (2<<30)
3383
Eugeni Dodonov47a5bc52011-12-19 16:25:53 -02003384/* RC6 residence counters
3385 */
3386#define RC6_RESIDENCY_TIME 0x138108
3387#define RC6p_RESIDENCY_TIME 0x13810C
3388#define RC6pp_RESIDENCY_TIME 0x138110
3389
Eric Anholt73254772012-02-20 10:04:01 -08003390#define GEN6_RPNSWREQ 0xA008
3391#define GEN6_RC_VIDEO_FREQ 0xA00C
3392#define GEN6_RC_CONTROL 0xA090
3393#define GEN6_RP_DOWN_TIMEOUT 0xA010
3394#define GEN6_RP_INTERRUPT_LIMITS 0xA014
3395#define GEN6_RPSTAT1 0xA01C
3396#define GEN6_RP_CONTROL 0xA024
3397#define GEN6_RP_UP_THRESHOLD 0xA02C
3398#define GEN6_RP_DOWN_THRESHOLD 0xA030
3399#define GEN6_RP_CUR_UP_EI 0xA050
3400#define GEN6_RP_CUR_UP 0xA054
3401#define GEN6_RP_PREV_UP 0xA058
3402#define GEN6_RP_CUR_DOWN_EI 0xA05C
3403#define GEN6_RP_CUR_DOWN 0xA060
3404#define GEN6_RP_PREV_DOWN 0xA064
3405#define GEN6_RP_UP_EI 0xA068
3406#define GEN6_RP_DOWN_EI 0xA06C
3407#define GEN6_RP_IDLE_HYSTERSIS 0xA070
3408#define GEN6_RC_STATE 0xA094
3409#define GEN6_RC1_WAKE_RATE_LIMIT 0xA098
3410#define GEN6_RC6_WAKE_RATE_LIMIT 0xA09C
3411#define GEN6_RC6pp_WAKE_RATE_LIMIT 0xA0A0
3412#define GEN6_RC_EVALUATION_INTERVAL 0xA0A8
3413#define GEN6_RC_IDLE_HYSTERSIS 0xA0AC
3414#define GEN6_RC_SLEEP 0xA0B0
3415#define GEN6_RC1e_THRESHOLD 0xA0B4
3416#define GEN6_RC6_THRESHOLD 0xA0B8
3417#define GEN6_RC6p_THRESHOLD 0xA0BC
3418#define GEN6_RC6pp_THRESHOLD 0xA0C0
3419#define GEN6_PMINTRMSK 0xA168
Eugeni Dodonovb28a3992012-06-13 15:34:40 -03003420#define GEN6_RC_EVALUATION_INTERVAL 0xA0A8
3421#define GEN6_RC_IDLE_HYSTERSIS 0xA0AC
3422#define GEN6_PMIER 0x4402C
3423#define GEN6_PMIMR 0x44024 /* rps_lock */
3424#define GEN6_PMINTRMSK 0xA168
Eric Anholt73254772012-02-20 10:04:01 -08003425
Eugeni Dodonov3986d9f2012-05-08 15:55:05 -03003426/* Haswell-related items */
3427
3428/* HSW Power Wells */
3429#define HSW_PWR_WELL_CTL1 0x45400 /* BIOS */
3430#define HSW_PWR_WELL_CTL2 0x45404 /* Driver */
3431#define HSW_PWR_WELL_CTL3 0x45408 /* KVMR */
3432#define HSW_PWR_WELL_CTL4 0x4540C /* Debug */
Paulo Zanonid5cdee92013-12-03 16:44:08 -02003433#define HSW_PWR_WELL_ENABLE_REQUEST (1<<31)
3434#define HSW_PWR_WELL_STATE_ENABLED (1<<30)
Eugeni Dodonov3986d9f2012-05-08 15:55:05 -03003435#define HSW_PWR_WELL_CTL5 0x45410
3436#define HSW_PWR_WELL_ENABLE_SINGLE_STEP (1<<31)
3437#define HSW_PWR_WELL_PWR_GATE_OVERRIDE (1<<20)
3438#define HSW_PWR_WELL_FORCE_ON (1<<19)
3439#define HSW_PWR_WELL_CTL6 0x45414
3440
3441/* Per-pipe DDI Function Control */
3442#define PIPE_DDI_FUNC_CTL_A 0x60400
3443#define PIPE_DDI_FUNC_CTL_B 0x61400
3444#define PIPE_DDI_FUNC_CTL_C 0x62400
3445#define PIPE_DDI_FUNC_CTL_EDP 0x6F400
3446#define DDI_FUNC_CTL(pipe) _PIPE(pipe, \
3447 PIPE_DDI_FUNC_CTL_A, \
3448 PIPE_DDI_FUNC_CTL_B)
3449#define PIPE_DDI_FUNC_ENABLE (1<<31)
3450/* Those bits are ignored by pipe EDP since it can only connect to DDI A */
3451#define PIPE_DDI_PORT_MASK (0xf<<28)
3452#define PIPE_DDI_SELECT_PORT(x) ((x)<<28)
3453#define PIPE_DDI_MODE_SELECT_HDMI (0<<24)
3454#define PIPE_DDI_MODE_SELECT_DVI (1<<24)
3455#define PIPE_DDI_MODE_SELECT_DP_SST (2<<24)
3456#define PIPE_DDI_MODE_SELECT_DP_MST (3<<24)
3457#define PIPE_DDI_MODE_SELECT_FDI (4<<24)
3458#define PIPE_DDI_BPC_8 (0<<20)
3459#define PIPE_DDI_BPC_10 (1<<20)
3460#define PIPE_DDI_BPC_6 (2<<20)
3461#define PIPE_DDI_BPC_12 (3<<20)
3462#define PIPE_DDI_BFI_ENABLE (1<<4)
3463#define PIPE_DDI_PORT_WIDTH_X1 (0<<1)
3464#define PIPE_DDI_PORT_WIDTH_X2 (1<<1)
3465#define PIPE_DDI_PORT_WIDTH_X4 (3<<1)
3466
3467/* DisplayPort Transport Control */
3468#define DP_TP_CTL_A 0x64040
3469#define DP_TP_CTL_B 0x64140
3470#define DP_TP_CTL_C 0x64240
3471#define DP_TP_CTL_D 0x64340
3472#define DP_TP_CTL_E 0x64440
3473#define DP_TP_CTL_ENABLE (1<<31)
3474#define DP_TP_CTL_MODE_SST (0<<27)
3475#define DP_TP_CTL_MODE_MST (1<<27)
3476#define DP_TP_CTL_ENHANCED_FRAME_ENABLE (1<<18)
3477#define DP_TP_CTL_FDI_AUTOTRAIN (1<<15)
3478#define DP_TP_CTL_LINK_TRAIN_MASK (7<<8)
3479#define DP_TP_CTL_LINK_TRAIN_PAT1 (0<<8)
3480#define DP_TP_CTL_LINK_TRAIN_PAT2 (1<<8)
3481#define DP_TP_CTL_LINK_TRAIN_NORMAL (3<<8)
3482
3483/* DisplayPort Transport Status */
3484#define DP_TP_STATUS_A 0x64044
3485#define DP_TP_STATUS_B 0x64144
3486#define DP_TP_STATUS_C 0x64244
3487#define DP_TP_STATUS_D 0x64344
3488#define DP_TP_STATUS_E 0x64444
3489#define DP_TP_STATUS_AUTOTRAIN_DONE (1<<12)
3490
3491/* DDI Buffer Control */
3492#define DDI_BUF_CTL_A 0x64000
3493#define DDI_BUF_CTL_B 0x64100
3494#define DDI_BUF_CTL_C 0x64200
3495#define DDI_BUF_CTL_D 0x64300
3496#define DDI_BUF_CTL_E 0x64400
3497#define DDI_BUF_CTL_ENABLE (1<<31)
3498#define DDI_BUF_EMP_400MV_0DB_HSW (0<<24) /* Sel0 */
3499#define DDI_BUF_EMP_400MV_3_5DB_HSW (1<<24) /* Sel1 */
3500#define DDI_BUF_EMP_400MV_6DB_HSW (2<<24) /* Sel2 */
3501#define DDI_BUF_EMP_400MV_9_5DB_HSW (3<<24) /* Sel3 */
3502#define DDI_BUF_EMP_600MV_0DB_HSW (4<<24) /* Sel4 */
3503#define DDI_BUF_EMP_600MV_3_5DB_HSW (5<<24) /* Sel5 */
3504#define DDI_BUF_EMP_600MV_6DB_HSW (6<<24) /* Sel6 */
3505#define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */
3506#define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */
3507#define DDI_BUF_EMP_MASK (0xf<<24)
3508#define DDI_BUF_IS_IDLE (1<<7)
3509#define DDI_PORT_WIDTH_X1 (0<<1)
3510#define DDI_PORT_WIDTH_X2 (1<<1)
3511#define DDI_PORT_WIDTH_X4 (3<<1)
3512#define DDI_INIT_DISPLAY_DETECTED (1<<0)
3513
3514/* LPT PIXCLK_GATE */
3515#define PIXCLK_GATE 0xC6020
3516#define PIXCLK_GATE_UNGATE 1<<0
3517#define PIXCLK_GATE_GATE 0<<0
3518
3519/* SPLL */
3520#define SPLL_CTL 0x46020
3521#define SPLL_PLL_ENABLE (1<<31)
3522#define SPLL_PLL_SCC (1<<28)
3523#define SPLL_PLL_NON_SCC (2<<28)
3524#define SPLL_PLL_FREQ_810MHz (0<<26)
3525#define SPLL_PLL_FREQ_1350MHz (1<<26)
3526
3527/* WRPLL */
3528#define WRPLL_CTL1 0x46040
3529#define WRPLL_CTL2 0x46060
3530#define WRPLL_PLL_ENABLE (1<<31)
3531#define WRPLL_PLL_SELECT_SSC (0x01<<28)
3532#define WRPLL_PLL_SELECT_NON_SCC (0x02<<28)
3533#define WRPLL_PLL_SELECT_LCPLL_2700 (0x03<<28)
3534/* WRPLL divider programming */
3535#define WRPLL_DIVIDER_REFERENCE(x) ((x)<<0)
3536#define WRPLL_DIVIDER_POST(x) ((x)<<8)
3537#define WRPLL_DIVIDER_FEEDBACK(x) ((x)<<16)
3538
3539/* Port clock selection */
3540#define PORT_CLK_SEL_A 0x46100
3541#define PORT_CLK_SEL_B 0x46104
3542#define PORT_CLK_SEL_C 0x46108
3543#define PORT_CLK_SEL_D 0x4610C
3544#define PORT_CLK_SEL_E 0x46110
3545#define PORT_CLK_SEL_LCPLL_2700 (0<<29)
3546#define PORT_CLK_SEL_LCPLL_1350 (1<<29)
3547#define PORT_CLK_SEL_LCPLL_810 (2<<29)
3548#define PORT_CLK_SEL_SPLL (3<<29)
3549#define PORT_CLK_SEL_WRPLL1 (4<<29)
3550#define PORT_CLK_SEL_WRPLL2 (5<<29)
3551
3552/* Pipe clock selection */
3553#define PIPE_CLK_SEL_A 0x46140
3554#define PIPE_CLK_SEL_B 0x46144
3555#define PIPE_CLK_SEL_C 0x46148
3556/* For each pipe, we need to select the corresponding port clock */
3557#define PIPE_CLK_SEL_DISABLED (0x0<<29)
3558#define PIPE_CLK_SEL_PORT(x) ((x+1)<<29)
3559
3560/* LCPLL Control */
3561#define LCPLL_CTL 0x130040
3562#define LCPLL_PLL_DISABLE (1<<31)
3563#define LCPLL_PLL_LOCK (1<<30)
3564#define LCPLL_CD_CLOCK_DISABLE (1<<25)
3565#define LCPLL_CD2X_CLOCK_DISABLE (1<<23)
3566
3567/* Pipe WM_LINETIME - watermark line time */
Paulo Zanoni051e3272013-03-01 17:12:29 -03003568#define WM_PIPE_A 0x45100
3569#define WM_PIPE_B 0x45104
3570#define WM_PIPE_C 0x45200
3571#define WM_LP1 0x45108
3572#define WM_LP2 0x4510C
3573#define WM_LP3 0x45110
3574#define WM_LP1_SPR 0x45120
3575#define WM_LP2_SPR 0x45124
3576#define WM_LP3_SPR 0x45128
3577#define WM_MISC 0x45260
3578#define WM_SR_CNT 0x45264
Paulo Zanonia1ca6f92013-07-03 14:13:34 -03003579#define WM_DBG 0x45280
Eugeni Dodonov3986d9f2012-05-08 15:55:05 -03003580#define PIPE_WM_LINETIME_A 0x45270
3581#define PIPE_WM_LINETIME_B 0x45274
3582#define PIPE_WM_LINETIME_C 0x45278
3583#define PIPE_WM_LINETIME_MASK (0x1ff)
3584#define PIPE_WM_LINETIME_TIME(x) ((x))
3585#define PIPE_WM_LINETIME_IPS_LINETIME_MASK (0x1ff<<16)
3586#define PIPE_WM_LINETIME_IPS_LINETIME(x) ((x)<<16)
3587
3588/* SFUSE_STRAP */
3589#define SFUSE_STRAP 0xc2014
3590#define SFUSE_STRAP_DDIB_DETECTED (1<<2)
3591#define SFUSE_STRAP_DDIC_DETECTED (1<<1)
3592#define SFUSE_STRAP_DDID_DETECTED (1<<0)
3593
Vijay Purushothaman4fc76ad2012-08-17 18:06:52 +05303594/* Valleyview related items */
Jesse Barnes81095302014-01-28 13:46:38 -08003595#define VLV_DISPLAY_BASE 0x180000
Vijay Purushothaman4fc76ad2012-08-17 18:06:52 +05303596
Jesse Barnes81095302014-01-28 13:46:38 -08003597/*
3598 * IOSF sideband
3599 */
3600#define VLV_IOSF_DOORBELL_REQ (VLV_DISPLAY_BASE + 0x2100)
Jesse Barnes25339592013-04-16 13:14:58 -07003601#define IOSF_DEVFN_SHIFT 24
3602#define IOSF_OPCODE_SHIFT 16
3603#define IOSF_PORT_SHIFT 8
3604#define IOSF_BYTE_ENABLES_SHIFT 4
3605#define IOSF_BAR_SHIFT 1
3606#define IOSF_SB_BUSY (1<<0)
Jesse Barnes81095302014-01-28 13:46:38 -08003607#define IOSF_PORT_BUNIT 0x3
Jesse Barnes25339592013-04-16 13:14:58 -07003608#define IOSF_PORT_PUNIT 0x4
3609#define IOSF_PORT_NC 0x11
Jesse Barnes81095302014-01-28 13:46:38 -08003610#define IOSF_PORT_DPIO 0x12
Ville Syrjälä0f906082014-05-28 18:26:39 +03003611#define IOSF_PORT_DPIO_2 0x1a
Jesse Barnes81095302014-01-28 13:46:38 -08003612#define IOSF_PORT_GPIO_NC 0x13
3613#define IOSF_PORT_CCK 0x14
3614#define IOSF_PORT_CCU 0xA9
3615#define IOSF_PORT_GPS_CORE 0x48
3616#define IOSF_PORT_FLISDSI 0x1B
3617#define VLV_IOSF_DATA (VLV_DISPLAY_BASE + 0x2104)
3618#define VLV_IOSF_ADDR (VLV_DISPLAY_BASE + 0x2108)
Jesse Barnes25339592013-04-16 13:14:58 -07003619
Eric Anholt8c641832009-03-26 17:15:11 -07003620#endif /* _I810_REG_H */