xref: /linux/drivers/gpu/drm/gma500/psb_intel_reg.h (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
1*a61127c2SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
289c78134SAlan Cox /*
389c78134SAlan Cox  * Copyright (c) 2009, Intel Corporation.
489c78134SAlan Cox  */
589c78134SAlan Cox #ifndef __PSB_INTEL_REG_H__
689c78134SAlan Cox #define __PSB_INTEL_REG_H__
789c78134SAlan Cox 
85c0c1d50SPatrik Jakobsson /*
95c0c1d50SPatrik Jakobsson  * GPIO regs
105c0c1d50SPatrik Jakobsson  */
115c0c1d50SPatrik Jakobsson #define GPIOA			0x5010
125c0c1d50SPatrik Jakobsson #define GPIOB			0x5014
135c0c1d50SPatrik Jakobsson #define GPIOC			0x5018
145c0c1d50SPatrik Jakobsson #define GPIOD			0x501c
155c0c1d50SPatrik Jakobsson #define GPIOE			0x5020
165c0c1d50SPatrik Jakobsson #define GPIOF			0x5024
175c0c1d50SPatrik Jakobsson #define GPIOG			0x5028
185c0c1d50SPatrik Jakobsson #define GPIOH			0x502c
195c0c1d50SPatrik Jakobsson # define GPIO_CLOCK_DIR_MASK		(1 << 0)
205c0c1d50SPatrik Jakobsson # define GPIO_CLOCK_DIR_IN		(0 << 1)
215c0c1d50SPatrik Jakobsson # define GPIO_CLOCK_DIR_OUT		(1 << 1)
225c0c1d50SPatrik Jakobsson # define GPIO_CLOCK_VAL_MASK		(1 << 2)
235c0c1d50SPatrik Jakobsson # define GPIO_CLOCK_VAL_OUT		(1 << 3)
245c0c1d50SPatrik Jakobsson # define GPIO_CLOCK_VAL_IN		(1 << 4)
255c0c1d50SPatrik Jakobsson # define GPIO_CLOCK_PULLUP_DISABLE	(1 << 5)
265c0c1d50SPatrik Jakobsson # define GPIO_DATA_DIR_MASK		(1 << 8)
275c0c1d50SPatrik Jakobsson # define GPIO_DATA_DIR_IN		(0 << 9)
285c0c1d50SPatrik Jakobsson # define GPIO_DATA_DIR_OUT		(1 << 9)
295c0c1d50SPatrik Jakobsson # define GPIO_DATA_VAL_MASK		(1 << 10)
305c0c1d50SPatrik Jakobsson # define GPIO_DATA_VAL_OUT		(1 << 11)
315c0c1d50SPatrik Jakobsson # define GPIO_DATA_VAL_IN		(1 << 12)
325c0c1d50SPatrik Jakobsson # define GPIO_DATA_PULLUP_DISABLE	(1 << 13)
335c0c1d50SPatrik Jakobsson 
345c0c1d50SPatrik Jakobsson #define GMBUS0			0x5100 /* clock/port select */
355c0c1d50SPatrik Jakobsson #define   GMBUS_RATE_100KHZ	(0<<8)
365c0c1d50SPatrik Jakobsson #define   GMBUS_RATE_50KHZ	(1<<8)
375c0c1d50SPatrik Jakobsson #define   GMBUS_RATE_400KHZ	(2<<8) /* reserved on Pineview */
385c0c1d50SPatrik Jakobsson #define   GMBUS_RATE_1MHZ	(3<<8) /* reserved on Pineview */
395c0c1d50SPatrik Jakobsson #define   GMBUS_HOLD_EXT	(1<<7) /* 300ns hold time, rsvd on Pineview */
405c0c1d50SPatrik Jakobsson #define   GMBUS_PORT_DISABLED	0
415c0c1d50SPatrik Jakobsson #define   GMBUS_PORT_SSC	1
425c0c1d50SPatrik Jakobsson #define   GMBUS_PORT_VGADDC	2
435c0c1d50SPatrik Jakobsson #define   GMBUS_PORT_PANEL	3
445c0c1d50SPatrik Jakobsson #define   GMBUS_PORT_DPC	4 /* HDMIC */
455c0c1d50SPatrik Jakobsson #define   GMBUS_PORT_DPB	5 /* SDVO, HDMIB */
465c0c1d50SPatrik Jakobsson 				  /* 6 reserved */
475c0c1d50SPatrik Jakobsson #define   GMBUS_PORT_DPD	7 /* HDMID */
485c0c1d50SPatrik Jakobsson #define   GMBUS_NUM_PORTS       8
495c0c1d50SPatrik Jakobsson #define GMBUS1			0x5104 /* command/status */
505c0c1d50SPatrik Jakobsson #define   GMBUS_SW_CLR_INT	(1<<31)
515c0c1d50SPatrik Jakobsson #define   GMBUS_SW_RDY		(1<<30)
525c0c1d50SPatrik Jakobsson #define   GMBUS_ENT		(1<<29) /* enable timeout */
535c0c1d50SPatrik Jakobsson #define   GMBUS_CYCLE_NONE	(0<<25)
545c0c1d50SPatrik Jakobsson #define   GMBUS_CYCLE_WAIT	(1<<25)
555c0c1d50SPatrik Jakobsson #define   GMBUS_CYCLE_INDEX	(2<<25)
565c0c1d50SPatrik Jakobsson #define   GMBUS_CYCLE_STOP	(4<<25)
575c0c1d50SPatrik Jakobsson #define   GMBUS_BYTE_COUNT_SHIFT 16
585c0c1d50SPatrik Jakobsson #define   GMBUS_SLAVE_INDEX_SHIFT 8
595c0c1d50SPatrik Jakobsson #define   GMBUS_SLAVE_ADDR_SHIFT 1
605c0c1d50SPatrik Jakobsson #define   GMBUS_SLAVE_READ	(1<<0)
615c0c1d50SPatrik Jakobsson #define   GMBUS_SLAVE_WRITE	(0<<0)
625c0c1d50SPatrik Jakobsson #define GMBUS2			0x5108 /* status */
635c0c1d50SPatrik Jakobsson #define   GMBUS_INUSE		(1<<15)
645c0c1d50SPatrik Jakobsson #define   GMBUS_HW_WAIT_PHASE	(1<<14)
655c0c1d50SPatrik Jakobsson #define   GMBUS_STALL_TIMEOUT	(1<<13)
665c0c1d50SPatrik Jakobsson #define   GMBUS_INT		(1<<12)
675c0c1d50SPatrik Jakobsson #define   GMBUS_HW_RDY		(1<<11)
685c0c1d50SPatrik Jakobsson #define   GMBUS_SATOER		(1<<10)
695c0c1d50SPatrik Jakobsson #define   GMBUS_ACTIVE		(1<<9)
705c0c1d50SPatrik Jakobsson #define GMBUS3			0x510c /* data buffer bytes 3-0 */
715c0c1d50SPatrik Jakobsson #define GMBUS4			0x5110 /* interrupt mask (Pineview+) */
725c0c1d50SPatrik Jakobsson #define   GMBUS_SLAVE_TIMEOUT_EN (1<<4)
735c0c1d50SPatrik Jakobsson #define   GMBUS_NAK_EN		(1<<3)
745c0c1d50SPatrik Jakobsson #define   GMBUS_IDLE_EN		(1<<2)
755c0c1d50SPatrik Jakobsson #define   GMBUS_HW_WAIT_EN	(1<<1)
765c0c1d50SPatrik Jakobsson #define   GMBUS_HW_RDY_EN	(1<<0)
775c0c1d50SPatrik Jakobsson #define GMBUS5			0x5120 /* byte index */
785c0c1d50SPatrik Jakobsson #define   GMBUS_2BYTE_INDEX_EN	(1<<31)
795c0c1d50SPatrik Jakobsson 
8089c78134SAlan Cox #define BLC_PWM_CTL		0x61254
8189c78134SAlan Cox #define BLC_PWM_CTL2		0x61250
82d235e64aSAlan Cox #define  PWM_ENABLE		(1 << 31)
83d235e64aSAlan Cox #define  PWM_LEGACY_MODE	(1 << 30)
84d235e64aSAlan Cox #define  PWM_PIPE_B		(1 << 29)
8589c78134SAlan Cox #define BLC_PWM_CTL_C		0x62254
8689c78134SAlan Cox #define BLC_PWM_CTL2_C		0x62250
8789c78134SAlan Cox #define BACKLIGHT_MODULATION_FREQ_SHIFT		(17)
8889c78134SAlan Cox /*
8989c78134SAlan Cox  * This is the most significant 15 bits of the number of backlight cycles in a
9089c78134SAlan Cox  * complete cycle of the modulated backlight control.
9189c78134SAlan Cox  *
9289c78134SAlan Cox  * The actual value is this field multiplied by two.
9389c78134SAlan Cox  */
9489c78134SAlan Cox #define BACKLIGHT_MODULATION_FREQ_MASK	(0x7fff << 17)
9589c78134SAlan Cox #define BLM_LEGACY_MODE			(1 << 16)
9689c78134SAlan Cox /*
9789c78134SAlan Cox  * This is the number of cycles out of the backlight modulation cycle for which
9889c78134SAlan Cox  * the backlight is on.
9989c78134SAlan Cox  *
10089c78134SAlan Cox  * This field must be no greater than the number of cycles in the complete
10189c78134SAlan Cox  * backlight modulation cycle.
10289c78134SAlan Cox  */
10389c78134SAlan Cox #define BACKLIGHT_DUTY_CYCLE_SHIFT	(0)
10489c78134SAlan Cox #define BACKLIGHT_DUTY_CYCLE_MASK	(0xffff)
10589c78134SAlan Cox 
10689c78134SAlan Cox #define I915_GCFGC			0xf0
10789c78134SAlan Cox #define I915_LOW_FREQUENCY_ENABLE	(1 << 7)
10889c78134SAlan Cox #define I915_DISPLAY_CLOCK_190_200_MHZ	(0 << 4)
10989c78134SAlan Cox #define I915_DISPLAY_CLOCK_333_MHZ	(4 << 4)
11089c78134SAlan Cox #define I915_DISPLAY_CLOCK_MASK		(7 << 4)
11189c78134SAlan Cox 
11289c78134SAlan Cox #define I855_HPLLCC			0xc0
11389c78134SAlan Cox #define I855_CLOCK_CONTROL_MASK		(3 << 0)
11489c78134SAlan Cox #define I855_CLOCK_133_200		(0 << 0)
11589c78134SAlan Cox #define I855_CLOCK_100_200		(1 << 0)
11689c78134SAlan Cox #define I855_CLOCK_100_133		(2 << 0)
11789c78134SAlan Cox #define I855_CLOCK_166_250		(3 << 0)
11889c78134SAlan Cox 
11989c78134SAlan Cox /* I830 CRTC registers */
12089c78134SAlan Cox #define HTOTAL_A		0x60000
12189c78134SAlan Cox #define HBLANK_A		0x60004
12289c78134SAlan Cox #define HSYNC_A			0x60008
12389c78134SAlan Cox #define VTOTAL_A		0x6000c
12489c78134SAlan Cox #define VBLANK_A		0x60010
12589c78134SAlan Cox #define VSYNC_A			0x60014
12689c78134SAlan Cox #define PIPEASRC		0x6001c
12789c78134SAlan Cox #define BCLRPAT_A		0x60020
12889c78134SAlan Cox #define VSYNCSHIFT_A		0x60028
12989c78134SAlan Cox 
13089c78134SAlan Cox #define HTOTAL_B		0x61000
13189c78134SAlan Cox #define HBLANK_B		0x61004
13289c78134SAlan Cox #define HSYNC_B			0x61008
13389c78134SAlan Cox #define VTOTAL_B		0x6100c
13489c78134SAlan Cox #define VBLANK_B		0x61010
13589c78134SAlan Cox #define VSYNC_B			0x61014
13689c78134SAlan Cox #define PIPEBSRC		0x6101c
13789c78134SAlan Cox #define BCLRPAT_B		0x61020
13889c78134SAlan Cox #define VSYNCSHIFT_B		0x61028
13989c78134SAlan Cox 
14089c78134SAlan Cox #define HTOTAL_C		0x62000
14189c78134SAlan Cox #define HBLANK_C		0x62004
14289c78134SAlan Cox #define HSYNC_C			0x62008
14389c78134SAlan Cox #define VTOTAL_C		0x6200c
14489c78134SAlan Cox #define VBLANK_C		0x62010
14589c78134SAlan Cox #define VSYNC_C			0x62014
14689c78134SAlan Cox #define PIPECSRC		0x6201c
14789c78134SAlan Cox #define BCLRPAT_C		0x62020
14889c78134SAlan Cox #define VSYNCSHIFT_C		0x62028
14989c78134SAlan Cox 
15089c78134SAlan Cox #define PP_STATUS		0x61200
15189c78134SAlan Cox # define PP_ON				(1 << 31)
15289c78134SAlan Cox /*
15389c78134SAlan Cox  * Indicates that all dependencies of the panel are on:
15489c78134SAlan Cox  *
15589c78134SAlan Cox  * - PLL enabled
15689c78134SAlan Cox  * - pipe enabled
15789c78134SAlan Cox  * - LVDS/DVOB/DVOC on
15889c78134SAlan Cox  */
15989c78134SAlan Cox #define PP_READY			(1 << 30)
16089c78134SAlan Cox #define PP_SEQUENCE_NONE		(0 << 28)
16189c78134SAlan Cox #define PP_SEQUENCE_ON			(1 << 28)
16289c78134SAlan Cox #define PP_SEQUENCE_OFF			(2 << 28)
16389c78134SAlan Cox #define PP_SEQUENCE_MASK		0x30000000
164d112a816SZhao Yakui #define	PP_CYCLE_DELAY_ACTIVE		(1 << 27)
165d112a816SZhao Yakui #define	PP_SEQUENCE_STATE_ON_IDLE	(1 << 3)
166d112a816SZhao Yakui #define	PP_SEQUENCE_STATE_MASK		0x0000000f
167d112a816SZhao Yakui 
16889c78134SAlan Cox #define PP_CONTROL		0x61204
16989c78134SAlan Cox #define POWER_TARGET_ON			(1 << 0)
170d112a816SZhao Yakui #define	PANEL_UNLOCK_REGS		(0xabcd << 16)
171d112a816SZhao Yakui #define	PANEL_UNLOCK_MASK		(0xffff << 16)
172d112a816SZhao Yakui #define	EDP_FORCE_VDD			(1 << 3)
173d112a816SZhao Yakui #define	EDP_BLC_ENABLE			(1 << 2)
174d112a816SZhao Yakui #define	PANEL_POWER_RESET		(1 << 1)
175d112a816SZhao Yakui #define	PANEL_POWER_OFF			(0 << 0)
176d112a816SZhao Yakui #define	PANEL_POWER_ON			(1 << 0)
17789c78134SAlan Cox 
178d112a816SZhao Yakui /* Poulsbo/Oaktrail */
17989c78134SAlan Cox #define LVDSPP_ON		0x61208
18089c78134SAlan Cox #define LVDSPP_OFF		0x6120c
18189c78134SAlan Cox #define PP_CYCLE		0x61210
18289c78134SAlan Cox 
183d112a816SZhao Yakui /* Cedartrail */
18409016a11SAlan Cox #define PP_ON_DELAYS		0x61208		/* Cedartrail */
185d112a816SZhao Yakui #define PANEL_PORT_SELECT_MASK 		(3 << 30)
186d112a816SZhao Yakui #define PANEL_PORT_SELECT_LVDS 		(0 << 30)
187d112a816SZhao Yakui #define PANEL_PORT_SELECT_EDP		(1 << 30)
188d112a816SZhao Yakui #define PANEL_POWER_UP_DELAY_MASK	(0x1fff0000)
189d112a816SZhao Yakui #define PANEL_POWER_UP_DELAY_SHIFT	16
190d112a816SZhao Yakui #define PANEL_LIGHT_ON_DELAY_MASK	(0x1fff)
191d112a816SZhao Yakui #define PANEL_LIGHT_ON_DELAY_SHIFT	0
192d112a816SZhao Yakui 
19309016a11SAlan Cox #define PP_OFF_DELAYS		0x6120c		/* Cedartrail */
194d112a816SZhao Yakui #define PANEL_POWER_DOWN_DELAY_MASK	(0x1fff0000)
195d112a816SZhao Yakui #define PANEL_POWER_DOWN_DELAY_SHIFT	16
196d112a816SZhao Yakui #define PANEL_LIGHT_OFF_DELAY_MASK	(0x1fff)
197d112a816SZhao Yakui #define PANEL_LIGHT_OFF_DELAY_SHIFT	0
198d112a816SZhao Yakui 
199d112a816SZhao Yakui #define PP_DIVISOR		0x61210		/* Cedartrail */
200d112a816SZhao Yakui #define  PP_REFERENCE_DIVIDER_MASK	(0xffffff00)
201d112a816SZhao Yakui #define  PP_REFERENCE_DIVIDER_SHIFT	8
202d112a816SZhao Yakui #define  PANEL_POWER_CYCLE_DELAY_MASK	(0x1f)
203d112a816SZhao Yakui #define  PANEL_POWER_CYCLE_DELAY_SHIFT	0
20409016a11SAlan Cox 
20589c78134SAlan Cox #define PFIT_CONTROL		0x61230
20689c78134SAlan Cox #define PFIT_ENABLE			(1 << 31)
20789c78134SAlan Cox #define PFIT_PIPE_MASK			(3 << 29)
20889c78134SAlan Cox #define PFIT_PIPE_SHIFT			29
20989c78134SAlan Cox #define PFIT_SCALING_MODE_PILLARBOX	(1 << 27)
21089c78134SAlan Cox #define PFIT_SCALING_MODE_LETTERBOX	(3 << 26)
21189c78134SAlan Cox #define VERT_INTERP_DISABLE		(0 << 10)
21289c78134SAlan Cox #define VERT_INTERP_BILINEAR		(1 << 10)
21389c78134SAlan Cox #define VERT_INTERP_MASK		(3 << 10)
21489c78134SAlan Cox #define VERT_AUTO_SCALE			(1 << 9)
21589c78134SAlan Cox #define HORIZ_INTERP_DISABLE		(0 << 6)
21689c78134SAlan Cox #define HORIZ_INTERP_BILINEAR		(1 << 6)
21789c78134SAlan Cox #define HORIZ_INTERP_MASK		(3 << 6)
21889c78134SAlan Cox #define HORIZ_AUTO_SCALE		(1 << 5)
21989c78134SAlan Cox #define PANEL_8TO6_DITHER_ENABLE	(1 << 3)
22089c78134SAlan Cox 
22189c78134SAlan Cox #define PFIT_PGM_RATIOS		0x61234
22289c78134SAlan Cox #define PFIT_VERT_SCALE_MASK			0xfff00000
22389c78134SAlan Cox #define PFIT_HORIZ_SCALE_MASK			0x0000fff0
22489c78134SAlan Cox 
22589c78134SAlan Cox #define PFIT_AUTO_RATIOS	0x61238
22689c78134SAlan Cox 
22789c78134SAlan Cox #define DPLL_A			0x06014
22889c78134SAlan Cox #define DPLL_B			0x06018
22989c78134SAlan Cox #define DPLL_VCO_ENABLE			(1 << 31)
23089c78134SAlan Cox #define DPLL_DVO_HIGH_SPEED		(1 << 30)
23189c78134SAlan Cox #define DPLL_SYNCLOCK_ENABLE		(1 << 29)
23289c78134SAlan Cox #define DPLL_VGA_MODE_DIS		(1 << 28)
23389c78134SAlan Cox #define DPLLB_MODE_DAC_SERIAL		(1 << 26)	/* i915 */
23489c78134SAlan Cox #define DPLLB_MODE_LVDS			(2 << 26)	/* i915 */
23589c78134SAlan Cox #define DPLL_MODE_MASK			(3 << 26)
23689c78134SAlan Cox #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10	(0 << 24)	/* i915 */
23789c78134SAlan Cox #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5	(1 << 24)	/* i915 */
23889c78134SAlan Cox #define DPLLB_LVDS_P2_CLOCK_DIV_14	(0 << 24)	/* i915 */
23989c78134SAlan Cox #define DPLLB_LVDS_P2_CLOCK_DIV_7	(1 << 24)	/* i915 */
24089c78134SAlan Cox #define DPLL_P2_CLOCK_DIV_MASK		0x03000000	/* i915 */
241ae0a246aSAlan Cox #define DPLL_FPA0h1_P1_POST_DIV_MASK	0x00ff0000	/* i915 */
24289c78134SAlan Cox #define DPLL_LOCK			(1 << 15)	/* CDV */
24389c78134SAlan Cox 
24489c78134SAlan Cox /*
24589c78134SAlan Cox  *  The i830 generation, in DAC/serial mode, defines p1 as two plus this
24689c78134SAlan Cox  * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
24789c78134SAlan Cox  */
24889c78134SAlan Cox # define DPLL_FPA01_P1_POST_DIV_MASK_I830	0x001f0000
24989c78134SAlan Cox /*
25089c78134SAlan Cox  * The i830 generation, in LVDS mode, defines P1 as the bit number set within
25189c78134SAlan Cox  * this field (only one bit may be set).
25289c78134SAlan Cox  */
25389c78134SAlan Cox #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS	0x003f0000
25489c78134SAlan Cox #define DPLL_FPA01_P1_POST_DIV_SHIFT	16
25589c78134SAlan Cox #define PLL_P2_DIVIDE_BY_4		(1 << 23)	/* i830, required
25689c78134SAlan Cox 							 * in DVO non-gang */
25789c78134SAlan Cox # define PLL_P1_DIVIDE_BY_TWO		(1 << 21)	/* i830 */
25889c78134SAlan Cox #define PLL_REF_INPUT_DREFCLK		(0 << 13)
25989c78134SAlan Cox #define PLL_REF_INPUT_TVCLKINA		(1 << 13)	/* i830 */
26089c78134SAlan Cox #define PLL_REF_INPUT_TVCLKINBC		(2 << 13)	/* SDVO
26189c78134SAlan Cox 								 * TVCLKIN */
26289c78134SAlan Cox #define PLLB_REF_INPUT_SPREADSPECTRUMIN	(3 << 13)
26389c78134SAlan Cox #define PLL_REF_INPUT_MASK		(3 << 13)
26489c78134SAlan Cox #define PLL_LOAD_PULSE_PHASE_SHIFT	9
26589c78134SAlan Cox /*
26689c78134SAlan Cox  * Parallel to Serial Load Pulse phase selection.
26789c78134SAlan Cox  * Selects the phase for the 10X DPLL clock for the PCIe
26889c78134SAlan Cox  * digital display port. The range is 4 to 13; 10 or more
26989c78134SAlan Cox  * is just a flip delay. The default is 6
27089c78134SAlan Cox  */
27189c78134SAlan Cox #define PLL_LOAD_PULSE_PHASE_MASK	(0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
27289c78134SAlan Cox #define DISPLAY_RATE_SELECT_FPA1	(1 << 8)
27389c78134SAlan Cox 
27489c78134SAlan Cox /*
27589c78134SAlan Cox  * SDVO multiplier for 945G/GM. Not used on 965.
27689c78134SAlan Cox  *
27789c78134SAlan Cox  * DPLL_MD_UDI_MULTIPLIER_MASK
27889c78134SAlan Cox  */
27989c78134SAlan Cox #define SDVO_MULTIPLIER_MASK		0x000000ff
28089c78134SAlan Cox #define SDVO_MULTIPLIER_SHIFT_HIRES	4
28189c78134SAlan Cox #define SDVO_MULTIPLIER_SHIFT_VGA	0
28289c78134SAlan Cox 
28389c78134SAlan Cox /*
28489c78134SAlan Cox  * PLL_MD
28589c78134SAlan Cox  */
28689c78134SAlan Cox /* Pipe A SDVO/UDI clock multiplier/divider register for G965. */
28789c78134SAlan Cox #define DPLL_A_MD		0x0601c
28889c78134SAlan Cox /* Pipe B SDVO/UDI clock multiplier/divider register for G965. */
28989c78134SAlan Cox #define DPLL_B_MD		0x06020
29089c78134SAlan Cox /*
29189c78134SAlan Cox  * UDI pixel divider, controlling how many pixels are stuffed into a packet.
29289c78134SAlan Cox  *
29389c78134SAlan Cox  * Value is pixels minus 1.  Must be set to 1 pixel for SDVO.
29489c78134SAlan Cox  */
29589c78134SAlan Cox #define DPLL_MD_UDI_DIVIDER_MASK	0x3f000000
29689c78134SAlan Cox #define DPLL_MD_UDI_DIVIDER_SHIFT	24
29789c78134SAlan Cox /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
29889c78134SAlan Cox #define DPLL_MD_VGA_UDI_DIVIDER_MASK	0x003f0000
29989c78134SAlan Cox #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT	16
30089c78134SAlan Cox /*
30189c78134SAlan Cox  * SDVO/UDI pixel multiplier.
30289c78134SAlan Cox  *
30389c78134SAlan Cox  * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
30489c78134SAlan Cox  * clock rate is 10 times the DPLL clock.  At low resolution/refresh rate
30589c78134SAlan Cox  * modes, the bus rate would be below the limits, so SDVO allows for stuffing
30689c78134SAlan Cox  * dummy bytes in the datastream at an increased clock rate, with both sides of
30789c78134SAlan Cox  * the link knowing how many bytes are fill.
30889c78134SAlan Cox  *
30989c78134SAlan Cox  * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
31089c78134SAlan Cox  * rate to 130Mhz to get a bus rate of 1.30Ghz.  The DPLL clock rate would be
31189c78134SAlan Cox  * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
31289c78134SAlan Cox  * through an SDVO command.
31389c78134SAlan Cox  *
31489c78134SAlan Cox  * This register field has values of multiplication factor minus 1, with
31589c78134SAlan Cox  * a maximum multiplier of 5 for SDVO.
31689c78134SAlan Cox  */
31789c78134SAlan Cox #define DPLL_MD_UDI_MULTIPLIER_MASK	0x00003f00
31889c78134SAlan Cox #define DPLL_MD_UDI_MULTIPLIER_SHIFT	8
31989c78134SAlan Cox /*
32089c78134SAlan Cox  * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
32189c78134SAlan Cox  * This best be set to the default value (3) or the CRT won't work. No,
32289c78134SAlan Cox  * I don't entirely understand what this does...
32389c78134SAlan Cox  */
32489c78134SAlan Cox #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK	0x0000003f
32589c78134SAlan Cox #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
32689c78134SAlan Cox 
32789c78134SAlan Cox #define DPLL_TEST		0x606c
32889c78134SAlan Cox #define DPLLB_TEST_SDVO_DIV_1		(0 << 22)
32989c78134SAlan Cox #define DPLLB_TEST_SDVO_DIV_2		(1 << 22)
33089c78134SAlan Cox #define DPLLB_TEST_SDVO_DIV_4		(2 << 22)
33189c78134SAlan Cox #define DPLLB_TEST_SDVO_DIV_MASK	(3 << 22)
33289c78134SAlan Cox #define DPLLB_TEST_N_BYPASS		(1 << 19)
33389c78134SAlan Cox #define DPLLB_TEST_M_BYPASS		(1 << 18)
33489c78134SAlan Cox #define DPLLB_INPUT_BUFFER_ENABLE	(1 << 16)
33589c78134SAlan Cox #define DPLLA_TEST_N_BYPASS		(1 << 3)
33689c78134SAlan Cox #define DPLLA_TEST_M_BYPASS		(1 << 2)
33789c78134SAlan Cox #define DPLLA_INPUT_BUFFER_ENABLE	(1 << 0)
33889c78134SAlan Cox 
33989c78134SAlan Cox #define ADPA			0x61100
34089c78134SAlan Cox #define ADPA_DAC_ENABLE			(1 << 31)
34189c78134SAlan Cox #define ADPA_DAC_DISABLE		0
34289c78134SAlan Cox #define ADPA_PIPE_SELECT_MASK		(1 << 30)
34389c78134SAlan Cox #define ADPA_PIPE_A_SELECT		0
34489c78134SAlan Cox #define ADPA_PIPE_B_SELECT		(1 << 30)
34589c78134SAlan Cox #define ADPA_USE_VGA_HVPOLARITY		(1 << 15)
34689c78134SAlan Cox #define ADPA_SETS_HVPOLARITY		0
34789c78134SAlan Cox #define ADPA_VSYNC_CNTL_DISABLE		(1 << 11)
34889c78134SAlan Cox #define ADPA_VSYNC_CNTL_ENABLE		0
34989c78134SAlan Cox #define ADPA_HSYNC_CNTL_DISABLE		(1 << 10)
35089c78134SAlan Cox #define ADPA_HSYNC_CNTL_ENABLE		0
35189c78134SAlan Cox #define ADPA_VSYNC_ACTIVE_HIGH		(1 << 4)
35289c78134SAlan Cox #define ADPA_VSYNC_ACTIVE_LOW		0
35389c78134SAlan Cox #define ADPA_HSYNC_ACTIVE_HIGH		(1 << 3)
35489c78134SAlan Cox #define ADPA_HSYNC_ACTIVE_LOW		0
35589c78134SAlan Cox 
35689c78134SAlan Cox #define FPA0			0x06040
35789c78134SAlan Cox #define FPA1			0x06044
35889c78134SAlan Cox #define FPB0			0x06048
35989c78134SAlan Cox #define FPB1			0x0604c
36089c78134SAlan Cox #define FP_N_DIV_MASK			0x003f0000
36189c78134SAlan Cox #define FP_N_DIV_SHIFT			16
36289c78134SAlan Cox #define FP_M1_DIV_MASK			0x00003f00
36389c78134SAlan Cox #define FP_M1_DIV_SHIFT			8
36489c78134SAlan Cox #define FP_M2_DIV_MASK			0x0000003f
36589c78134SAlan Cox #define FP_M2_DIV_SHIFT			0
36689c78134SAlan Cox 
36789c78134SAlan Cox #define PORT_HOTPLUG_EN		0x61110
368ae0a246aSAlan Cox #define HDMIB_HOTPLUG_INT_EN		(1 << 29)
369ae0a246aSAlan Cox #define HDMIC_HOTPLUG_INT_EN		(1 << 28)
370ae0a246aSAlan Cox #define HDMID_HOTPLUG_INT_EN		(1 << 27)
37189c78134SAlan Cox #define SDVOB_HOTPLUG_INT_EN		(1 << 26)
37289c78134SAlan Cox #define SDVOC_HOTPLUG_INT_EN		(1 << 25)
37389c78134SAlan Cox #define TV_HOTPLUG_INT_EN		(1 << 18)
37489c78134SAlan Cox #define CRT_HOTPLUG_INT_EN		(1 << 9)
37589c78134SAlan Cox #define CRT_HOTPLUG_FORCE_DETECT	(1 << 3)
37689c78134SAlan Cox /* CDV.. */
37789c78134SAlan Cox #define CRT_HOTPLUG_ACTIVATION_PERIOD_64	(1 << 8)
37889c78134SAlan Cox #define CRT_HOTPLUG_DAC_ON_TIME_2M		(0 << 7)
37989c78134SAlan Cox #define CRT_HOTPLUG_DAC_ON_TIME_4M		(1 << 7)
38089c78134SAlan Cox #define CRT_HOTPLUG_VOLTAGE_COMPARE_40		(0 << 5)
38189c78134SAlan Cox #define CRT_HOTPLUG_VOLTAGE_COMPARE_50		(1 << 5)
38289c78134SAlan Cox #define CRT_HOTPLUG_VOLTAGE_COMPARE_60		(2 << 5)
38389c78134SAlan Cox #define CRT_HOTPLUG_VOLTAGE_COMPARE_70		(3 << 5)
38489c78134SAlan Cox #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK	(3 << 5)
38589c78134SAlan Cox #define CRT_HOTPLUG_DETECT_DELAY_1G		(0 << 4)
38689c78134SAlan Cox #define CRT_HOTPLUG_DETECT_DELAY_2G		(1 << 4)
38789c78134SAlan Cox #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV	(0 << 2)
38889c78134SAlan Cox #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV	(1 << 2)
38989c78134SAlan Cox #define CRT_HOTPLUG_DETECT_MASK			0x000000F8
39089c78134SAlan Cox 
39189c78134SAlan Cox #define PORT_HOTPLUG_STAT	0x61114
39289c78134SAlan Cox #define CRT_HOTPLUG_INT_STATUS		(1 << 11)
39389c78134SAlan Cox #define TV_HOTPLUG_INT_STATUS		(1 << 10)
39489c78134SAlan Cox #define CRT_HOTPLUG_MONITOR_MASK	(3 << 8)
39589c78134SAlan Cox #define CRT_HOTPLUG_MONITOR_COLOR	(3 << 8)
39689c78134SAlan Cox #define CRT_HOTPLUG_MONITOR_MONO	(2 << 8)
39789c78134SAlan Cox #define CRT_HOTPLUG_MONITOR_NONE	(0 << 8)
39889c78134SAlan Cox #define SDVOC_HOTPLUG_INT_STATUS	(1 << 7)
39989c78134SAlan Cox #define SDVOB_HOTPLUG_INT_STATUS	(1 << 6)
40089c78134SAlan Cox 
40189c78134SAlan Cox #define SDVOB			0x61140
40289c78134SAlan Cox #define SDVOC			0x61160
40389c78134SAlan Cox #define SDVO_ENABLE			(1 << 31)
40489c78134SAlan Cox #define SDVO_PIPE_B_SELECT		(1 << 30)
40589c78134SAlan Cox #define SDVO_STALL_SELECT		(1 << 29)
40689c78134SAlan Cox #define SDVO_INTERRUPT_ENABLE		(1 << 26)
4075736995bSPatrik Jakobsson #define SDVO_COLOR_RANGE_16_235		(1 << 8)
4085736995bSPatrik Jakobsson #define SDVO_AUDIO_ENABLE		(1 << 6)
40989c78134SAlan Cox 
41089c78134SAlan Cox /**
41189c78134SAlan Cox  * 915G/GM SDVO pixel multiplier.
41289c78134SAlan Cox  *
41389c78134SAlan Cox  * Programmed value is multiplier - 1, up to 5x.
41489c78134SAlan Cox  *
41589c78134SAlan Cox  * DPLL_MD_UDI_MULTIPLIER_MASK
41689c78134SAlan Cox  */
41789c78134SAlan Cox #define SDVO_PORT_MULTIPLY_MASK		(7 << 23)
41889c78134SAlan Cox #define SDVO_PORT_MULTIPLY_SHIFT	23
41989c78134SAlan Cox #define SDVO_PHASE_SELECT_MASK		(15 << 19)
42089c78134SAlan Cox #define SDVO_PHASE_SELECT_DEFAULT	(6 << 19)
42189c78134SAlan Cox #define SDVO_CLOCK_OUTPUT_INVERT	(1 << 18)
42289c78134SAlan Cox #define SDVOC_GANG_MODE			(1 << 16)
42389c78134SAlan Cox #define SDVO_BORDER_ENABLE		(1 << 7)
42489c78134SAlan Cox #define SDVOB_PCIE_CONCURRENCY		(1 << 3)
42589c78134SAlan Cox #define SDVO_DETECTED			(1 << 2)
42689c78134SAlan Cox /* Bits to be preserved when writing */
42789c78134SAlan Cox #define SDVOB_PRESERVE_MASK		((1 << 17) | (1 << 16) | (1 << 14))
42889c78134SAlan Cox #define SDVOC_PRESERVE_MASK		(1 << 17)
42989c78134SAlan Cox 
43089c78134SAlan Cox /*
43189c78134SAlan Cox  * This register controls the LVDS output enable, pipe selection, and data
43289c78134SAlan Cox  * format selection.
43389c78134SAlan Cox  *
43489c78134SAlan Cox  * All of the clock/data pairs are force powered down by power sequencing.
43589c78134SAlan Cox  */
43689c78134SAlan Cox #define LVDS			0x61180
43789c78134SAlan Cox /*
43889c78134SAlan Cox  * Enables the LVDS port.  This bit must be set before DPLLs are enabled, as
43989c78134SAlan Cox  * the DPLL semantics change when the LVDS is assigned to that pipe.
44089c78134SAlan Cox  */
44189c78134SAlan Cox #define LVDS_PORT_EN			(1 << 31)
44289c78134SAlan Cox /* Selects pipe B for LVDS data.  Must be set on pre-965. */
44389c78134SAlan Cox #define LVDS_PIPEB_SELECT		(1 << 30)
44489c78134SAlan Cox 
44589c78134SAlan Cox /* Turns on border drawing to allow centered display. */
44689c78134SAlan Cox #define LVDS_BORDER_EN			(1 << 15)
44789c78134SAlan Cox 
44889c78134SAlan Cox /*
44989c78134SAlan Cox  * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
45089c78134SAlan Cox  * pixel.
45189c78134SAlan Cox  */
45289c78134SAlan Cox #define LVDS_A0A2_CLKA_POWER_MASK	(3 << 8)
45389c78134SAlan Cox #define LVDS_A0A2_CLKA_POWER_DOWN	(0 << 8)
45489c78134SAlan Cox #define LVDS_A0A2_CLKA_POWER_UP		(3 << 8)
45589c78134SAlan Cox /*
45689c78134SAlan Cox  * Controls the A3 data pair, which contains the additional LSBs for 24 bit
45789c78134SAlan Cox  * mode.  Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
45889c78134SAlan Cox  * on.
45989c78134SAlan Cox  */
46089c78134SAlan Cox #define LVDS_A3_POWER_MASK		(3 << 6)
46189c78134SAlan Cox #define LVDS_A3_POWER_DOWN		(0 << 6)
46289c78134SAlan Cox #define LVDS_A3_POWER_UP		(3 << 6)
46389c78134SAlan Cox /*
46489c78134SAlan Cox  * Controls the CLKB pair.  This should only be set when LVDS_B0B3_POWER_UP
46589c78134SAlan Cox  * is set.
46689c78134SAlan Cox  */
46789c78134SAlan Cox #define LVDS_CLKB_POWER_MASK		(3 << 4)
46889c78134SAlan Cox #define LVDS_CLKB_POWER_DOWN		(0 << 4)
46989c78134SAlan Cox #define LVDS_CLKB_POWER_UP		(3 << 4)
47089c78134SAlan Cox /*
47189c78134SAlan Cox  * Controls the B0-B3 data pairs.  This must be set to match the DPLL p2
47289c78134SAlan Cox  * setting for whether we are in dual-channel mode.  The B3 pair will
47389c78134SAlan Cox  * additionally only be powered up when LVDS_A3_POWER_UP is set.
47489c78134SAlan Cox  */
47589c78134SAlan Cox #define LVDS_B0B3_POWER_MASK		(3 << 2)
47689c78134SAlan Cox #define LVDS_B0B3_POWER_DOWN		(0 << 2)
47789c78134SAlan Cox #define LVDS_B0B3_POWER_UP		(3 << 2)
47889c78134SAlan Cox 
47989c78134SAlan Cox #define PIPEACONF		0x70008
48089c78134SAlan Cox #define PIPEACONF_ENABLE		(1 << 31)
48189c78134SAlan Cox #define PIPEACONF_DISABLE		0
48289c78134SAlan Cox #define PIPEACONF_DOUBLE_WIDE		(1 << 30)
48389c78134SAlan Cox #define PIPECONF_ACTIVE			(1 << 30)
48489c78134SAlan Cox #define PIPECONF_DSIPLL_LOCK		(1 << 29)
48589c78134SAlan Cox #define PIPEACONF_SINGLE_WIDE		0
48689c78134SAlan Cox #define PIPEACONF_PIPE_UNLOCKED		0
48789c78134SAlan Cox #define PIPEACONF_DSR			(1 << 26)
48889c78134SAlan Cox #define PIPEACONF_PIPE_LOCKED		(1 << 25)
48989c78134SAlan Cox #define PIPEACONF_PALETTE		0
49089c78134SAlan Cox #define PIPECONF_FORCE_BORDER		(1 << 25)
49189c78134SAlan Cox #define PIPEACONF_GAMMA			(1 << 24)
49289c78134SAlan Cox #define PIPECONF_PROGRESSIVE		(0 << 21)
49389c78134SAlan Cox #define PIPECONF_INTERLACE_W_FIELD_INDICATION	(6 << 21)
49489c78134SAlan Cox #define PIPECONF_INTERLACE_FIELD_0_ONLY		(7 << 21)
49589c78134SAlan Cox #define PIPECONF_PLANE_OFF		(1 << 19)
49689c78134SAlan Cox #define PIPECONF_CURSOR_OFF		(1 << 18)
49789c78134SAlan Cox 
49889c78134SAlan Cox #define PIPEBCONF		0x71008
49989c78134SAlan Cox #define PIPEBCONF_ENABLE		(1 << 31)
50089c78134SAlan Cox #define PIPEBCONF_DISABLE		0
50189c78134SAlan Cox #define PIPEBCONF_DOUBLE_WIDE		(1 << 30)
50289c78134SAlan Cox #define PIPEBCONF_DISABLE		0
50389c78134SAlan Cox #define PIPEBCONF_GAMMA			(1 << 24)
50489c78134SAlan Cox #define PIPEBCONF_PALETTE		0
50589c78134SAlan Cox 
50689c78134SAlan Cox #define PIPECCONF		0x72008
50789c78134SAlan Cox 
50889c78134SAlan Cox #define PIPEBGCMAXRED		0x71010
50989c78134SAlan Cox #define PIPEBGCMAXGREEN		0x71014
51089c78134SAlan Cox #define PIPEBGCMAXBLUE		0x71018
51189c78134SAlan Cox 
51289c78134SAlan Cox #define PIPEASTAT		0x70024
51389c78134SAlan Cox #define PIPEBSTAT		0x71024
51489c78134SAlan Cox #define PIPECSTAT		0x72024
51589c78134SAlan Cox #define PIPE_VBLANK_INTERRUPT_STATUS		(1UL << 1)
51689c78134SAlan Cox #define PIPE_START_VBLANK_INTERRUPT_STATUS	(1UL << 2)
51789c78134SAlan Cox #define PIPE_VBLANK_CLEAR			(1 << 1)
51889c78134SAlan Cox #define PIPE_VBLANK_STATUS			(1 << 1)
51989c78134SAlan Cox #define PIPE_TE_STATUS				(1UL << 6)
52089c78134SAlan Cox #define PIPE_DPST_EVENT_STATUS			(1UL << 7)
52189c78134SAlan Cox #define PIPE_VSYNC_CLEAR			(1UL << 9)
52289c78134SAlan Cox #define PIPE_VSYNC_STATUS			(1UL << 9)
52389c78134SAlan Cox #define PIPE_HDMI_AUDIO_UNDERRUN_STATUS		(1UL << 10)
52489c78134SAlan Cox #define PIPE_HDMI_AUDIO_BUFFER_DONE_STATUS	(1UL << 11)
52589c78134SAlan Cox #define PIPE_VBLANK_INTERRUPT_ENABLE		(1UL << 17)
52689c78134SAlan Cox #define PIPE_START_VBLANK_INTERRUPT_ENABLE	(1UL << 18)
52789c78134SAlan Cox #define PIPE_TE_ENABLE				(1UL << 22)
528d839ede4SAlan Cox #define PIPE_LEGACY_BLC_EVENT_ENABLE		(1UL << 22)
52989c78134SAlan Cox #define PIPE_DPST_EVENT_ENABLE			(1UL << 23)
53089c78134SAlan Cox #define PIPE_VSYNC_ENABL			(1UL << 25)
53189c78134SAlan Cox #define PIPE_HDMI_AUDIO_UNDERRUN		(1UL << 26)
53289c78134SAlan Cox #define PIPE_HDMI_AUDIO_BUFFER_DONE		(1UL << 27)
533acd7ef92SAlan Cox #define PIPE_FIFO_UNDERRUN			(1UL << 31)
53489c78134SAlan Cox #define PIPE_HDMI_AUDIO_INT_MASK		(PIPE_HDMI_AUDIO_UNDERRUN | \
53589c78134SAlan Cox 						PIPE_HDMI_AUDIO_BUFFER_DONE)
53689c78134SAlan Cox #define PIPE_EVENT_MASK ((1 << 29)|(1 << 28)|(1 << 27)|(1 << 26)|(1 << 24)|(1 << 23)|(1 << 22)|(1 << 21)|(1 << 20)|(1 << 16))
53789c78134SAlan Cox #define PIPE_VBLANK_MASK ((1 << 25)|(1 << 24)|(1 << 18)|(1 << 17))
53889c78134SAlan Cox #define HISTOGRAM_INT_CONTROL		0x61268
53989c78134SAlan Cox #define HISTOGRAM_BIN_DATA		0X61264
54089c78134SAlan Cox #define HISTOGRAM_LOGIC_CONTROL		0x61260
54189c78134SAlan Cox #define PWM_CONTROL_LOGIC		0x61250
54289c78134SAlan Cox #define PIPE_HOTPLUG_INTERRUPT_STATUS		(1UL << 10)
54389c78134SAlan Cox #define HISTOGRAM_INTERRUPT_ENABLE		(1UL << 31)
54489c78134SAlan Cox #define HISTOGRAM_LOGIC_ENABLE			(1UL << 31)
54589c78134SAlan Cox #define PWM_LOGIC_ENABLE			(1UL << 31)
54689c78134SAlan Cox #define PWM_PHASEIN_ENABLE			(1UL << 25)
54789c78134SAlan Cox #define PWM_PHASEIN_INT_ENABLE			(1UL << 24)
54889c78134SAlan Cox #define PWM_PHASEIN_VB_COUNT			0x00001f00
54989c78134SAlan Cox #define PWM_PHASEIN_INC				0x0000001f
55089c78134SAlan Cox #define HISTOGRAM_INT_CTRL_CLEAR		(1UL << 30)
55189c78134SAlan Cox #define DPST_YUV_LUMA_MODE			0
55289c78134SAlan Cox 
55389c78134SAlan Cox #define PIPEAFRAMEHIGH		0x70040
55489c78134SAlan Cox #define PIPEAFRAMEPIXEL		0x70044
55589c78134SAlan Cox #define PIPEBFRAMEHIGH		0x71040
55689c78134SAlan Cox #define PIPEBFRAMEPIXEL		0x71044
55789c78134SAlan Cox #define PIPECFRAMEHIGH		0x72040
55889c78134SAlan Cox #define PIPECFRAMEPIXEL		0x72044
55989c78134SAlan Cox #define PIPE_FRAME_HIGH_MASK	0x0000ffff
56089c78134SAlan Cox #define PIPE_FRAME_HIGH_SHIFT	0
56189c78134SAlan Cox #define PIPE_FRAME_LOW_MASK	0xff000000
56289c78134SAlan Cox #define PIPE_FRAME_LOW_SHIFT	24
56389c78134SAlan Cox #define PIPE_PIXEL_MASK		0x00ffffff
56489c78134SAlan Cox #define PIPE_PIXEL_SHIFT	0
56589c78134SAlan Cox 
566acd7ef92SAlan Cox #define FW_BLC_SELF		0x20e0
567acd7ef92SAlan Cox #define FW_BLC_SELF_EN          (1<<15)
568acd7ef92SAlan Cox 
56989c78134SAlan Cox #define DSPARB			0x70030
57089c78134SAlan Cox #define DSPFW1			0x70034
571acd7ef92SAlan Cox #define DSP_FIFO_SR_WM_MASK		0xFF800000
572acd7ef92SAlan Cox #define DSP_FIFO_SR_WM_SHIFT		23
573acd7ef92SAlan Cox #define CURSOR_B_FIFO_WM_MASK		0x003F0000
574acd7ef92SAlan Cox #define CURSOR_B_FIFO_WM_SHIFT		16
57589c78134SAlan Cox #define DSPFW2			0x70038
576acd7ef92SAlan Cox #define CURSOR_A_FIFO_WM_MASK		0x3F00
577acd7ef92SAlan Cox #define CURSOR_A_FIFO_WM_SHIFT		8
578acd7ef92SAlan Cox #define DSP_PLANE_C_FIFO_WM_MASK	0x7F
579acd7ef92SAlan Cox #define DSP_PLANE_C_FIFO_WM_SHIFT	0
58089c78134SAlan Cox #define DSPFW3			0x7003c
58189c78134SAlan Cox #define DSPFW4			0x70050
58289c78134SAlan Cox #define DSPFW5			0x70054
583acd7ef92SAlan Cox #define DSP_PLANE_B_FIFO_WM1_SHIFT	24
584acd7ef92SAlan Cox #define DSP_PLANE_A_FIFO_WM1_SHIFT	16
585acd7ef92SAlan Cox #define CURSOR_B_FIFO_WM1_SHIFT		8
586acd7ef92SAlan Cox #define CURSOR_FIFO_SR_WM1_SHIFT	0
58789c78134SAlan Cox #define DSPFW6			0x70058
58889c78134SAlan Cox #define DSPCHICKENBIT		0x70400
58989c78134SAlan Cox #define DSPACNTR		0x70180
59089c78134SAlan Cox #define DSPBCNTR		0x71180
59189c78134SAlan Cox #define DSPCCNTR		0x72180
59289c78134SAlan Cox #define DISPLAY_PLANE_ENABLE			(1 << 31)
59389c78134SAlan Cox #define DISPLAY_PLANE_DISABLE			0
59489c78134SAlan Cox #define DISPPLANE_GAMMA_ENABLE			(1 << 30)
59589c78134SAlan Cox #define DISPPLANE_GAMMA_DISABLE			0
59689c78134SAlan Cox #define DISPPLANE_PIXFORMAT_MASK		(0xf << 26)
59789c78134SAlan Cox #define DISPPLANE_8BPP				(0x2 << 26)
59889c78134SAlan Cox #define DISPPLANE_15_16BPP			(0x4 << 26)
59989c78134SAlan Cox #define DISPPLANE_16BPP				(0x5 << 26)
60089c78134SAlan Cox #define DISPPLANE_32BPP_NO_ALPHA		(0x6 << 26)
60189c78134SAlan Cox #define DISPPLANE_32BPP				(0x7 << 26)
60289c78134SAlan Cox #define DISPPLANE_STEREO_ENABLE			(1 << 25)
60389c78134SAlan Cox #define DISPPLANE_STEREO_DISABLE		0
60489c78134SAlan Cox #define DISPPLANE_SEL_PIPE_MASK			(1 << 24)
60589c78134SAlan Cox #define DISPPLANE_SEL_PIPE_POS			24
60689c78134SAlan Cox #define DISPPLANE_SEL_PIPE_A			0
60789c78134SAlan Cox #define DISPPLANE_SEL_PIPE_B			(1 << 24)
60889c78134SAlan Cox #define DISPPLANE_SRC_KEY_ENABLE		(1 << 22)
60989c78134SAlan Cox #define DISPPLANE_SRC_KEY_DISABLE		0
61089c78134SAlan Cox #define DISPPLANE_LINE_DOUBLE			(1 << 20)
61189c78134SAlan Cox #define DISPPLANE_NO_LINE_DOUBLE		0
61289c78134SAlan Cox #define DISPPLANE_STEREO_POLARITY_FIRST		0
61389c78134SAlan Cox #define DISPPLANE_STEREO_POLARITY_SECOND	(1 << 18)
61489c78134SAlan Cox /* plane B only */
61589c78134SAlan Cox #define DISPPLANE_ALPHA_TRANS_ENABLE		(1 << 15)
61689c78134SAlan Cox #define DISPPLANE_ALPHA_TRANS_DISABLE		0
61789c78134SAlan Cox #define DISPPLANE_SPRITE_ABOVE_DISPLAYA		0
61889c78134SAlan Cox #define DISPPLANE_SPRITE_ABOVE_OVERLAY		(1)
61989c78134SAlan Cox #define DISPPLANE_BOTTOM			(4)
62089c78134SAlan Cox 
62189c78134SAlan Cox #define DSPABASE		0x70184
62289c78134SAlan Cox #define DSPALINOFF		0x70184
62389c78134SAlan Cox #define DSPASTRIDE		0x70188
62489c78134SAlan Cox 
62589c78134SAlan Cox #define DSPBBASE		0x71184
62689c78134SAlan Cox #define DSPBLINOFF		0X71184
62789c78134SAlan Cox #define DSPBADDR		DSPBBASE
62889c78134SAlan Cox #define DSPBSTRIDE		0x71188
62989c78134SAlan Cox 
63089c78134SAlan Cox #define DSPCBASE		0x72184
63189c78134SAlan Cox #define DSPCLINOFF		0x72184
63289c78134SAlan Cox #define DSPCSTRIDE		0x72188
63389c78134SAlan Cox 
63489c78134SAlan Cox #define DSPAKEYVAL		0x70194
63589c78134SAlan Cox #define DSPAKEYMASK		0x70198
63689c78134SAlan Cox 
63789c78134SAlan Cox #define DSPAPOS			0x7018C	/* reserved */
63889c78134SAlan Cox #define DSPASIZE		0x70190
63989c78134SAlan Cox #define DSPBPOS			0x7118C
64089c78134SAlan Cox #define DSPBSIZE		0x71190
64189c78134SAlan Cox #define DSPCPOS			0x7218C
64289c78134SAlan Cox #define DSPCSIZE		0x72190
64389c78134SAlan Cox 
64489c78134SAlan Cox #define DSPASURF		0x7019C
64589c78134SAlan Cox #define DSPATILEOFF		0x701A4
64689c78134SAlan Cox 
64789c78134SAlan Cox #define DSPBSURF		0x7119C
64889c78134SAlan Cox #define DSPBTILEOFF		0x711A4
64989c78134SAlan Cox 
65089c78134SAlan Cox #define DSPCSURF		0x7219C
65189c78134SAlan Cox #define DSPCTILEOFF		0x721A4
65289c78134SAlan Cox #define DSPCKEYMAXVAL		0x721A0
65389c78134SAlan Cox #define DSPCKEYMINVAL		0x72194
65489c78134SAlan Cox #define DSPCKEYMSK		0x72198
65589c78134SAlan Cox 
65689c78134SAlan Cox #define VGACNTRL		0x71400
65789c78134SAlan Cox #define VGA_DISP_DISABLE		(1 << 31)
65889c78134SAlan Cox #define VGA_2X_MODE			(1 << 30)
65989c78134SAlan Cox #define VGA_PIPE_B_SELECT		(1 << 29)
66089c78134SAlan Cox 
66189c78134SAlan Cox /*
66289c78134SAlan Cox  * Overlay registers
66389c78134SAlan Cox  */
66489c78134SAlan Cox #define OV_C_OFFSET		0x08000
66589c78134SAlan Cox #define OV_OVADD		0x30000
66689c78134SAlan Cox #define OV_DOVASTA		0x30008
66789c78134SAlan Cox # define OV_PIPE_SELECT			((1 << 6)|(1 << 7))
66889c78134SAlan Cox # define OV_PIPE_SELECT_POS		6
66989c78134SAlan Cox # define OV_PIPE_A			0
67089c78134SAlan Cox # define OV_PIPE_C			1
67189c78134SAlan Cox #define OV_OGAMC5		0x30010
67289c78134SAlan Cox #define OV_OGAMC4		0x30014
67389c78134SAlan Cox #define OV_OGAMC3		0x30018
67489c78134SAlan Cox #define OV_OGAMC2		0x3001C
67589c78134SAlan Cox #define OV_OGAMC1		0x30020
67689c78134SAlan Cox #define OV_OGAMC0		0x30024
67789c78134SAlan Cox #define OVC_OVADD		0x38000
67889c78134SAlan Cox #define OVC_DOVCSTA		0x38008
67989c78134SAlan Cox #define OVC_OGAMC5		0x38010
68089c78134SAlan Cox #define OVC_OGAMC4		0x38014
68189c78134SAlan Cox #define OVC_OGAMC3		0x38018
68289c78134SAlan Cox #define OVC_OGAMC2		0x3801C
68389c78134SAlan Cox #define OVC_OGAMC1		0x38020
68489c78134SAlan Cox #define OVC_OGAMC0		0x38024
68589c78134SAlan Cox 
68689c78134SAlan Cox /*
68789c78134SAlan Cox  * Some BIOS scratch area registers.  The 845 (and 830?) store the amount
68889c78134SAlan Cox  * of video memory available to the BIOS in SWF1.
68989c78134SAlan Cox  */
69089c78134SAlan Cox #define SWF0			0x71410
69189c78134SAlan Cox #define SWF1			0x71414
69289c78134SAlan Cox #define SWF2			0x71418
69389c78134SAlan Cox #define SWF3			0x7141c
69489c78134SAlan Cox #define SWF4			0x71420
69589c78134SAlan Cox #define SWF5			0x71424
69689c78134SAlan Cox #define SWF6			0x71428
69789c78134SAlan Cox 
69889c78134SAlan Cox /*
69989c78134SAlan Cox  * 855 scratch registers.
70089c78134SAlan Cox  */
70189c78134SAlan Cox #define SWF00			0x70410
70289c78134SAlan Cox #define SWF01			0x70414
70389c78134SAlan Cox #define SWF02			0x70418
70489c78134SAlan Cox #define SWF03			0x7041c
70589c78134SAlan Cox #define SWF04			0x70420
70689c78134SAlan Cox #define SWF05			0x70424
70789c78134SAlan Cox #define SWF06			0x70428
70889c78134SAlan Cox 
70989c78134SAlan Cox #define SWF10			SWF0
71089c78134SAlan Cox #define SWF11			SWF1
71189c78134SAlan Cox #define SWF12			SWF2
71289c78134SAlan Cox #define SWF13			SWF3
71389c78134SAlan Cox #define SWF14			SWF4
71489c78134SAlan Cox #define SWF15			SWF5
71589c78134SAlan Cox #define SWF16			SWF6
71689c78134SAlan Cox 
71789c78134SAlan Cox #define SWF30			0x72414
71889c78134SAlan Cox #define SWF31			0x72418
71989c78134SAlan Cox #define SWF32			0x7241c
72089c78134SAlan Cox 
72189c78134SAlan Cox 
72289c78134SAlan Cox /*
72389c78134SAlan Cox  * Palette registers
72489c78134SAlan Cox  */
72589c78134SAlan Cox #define PALETTE_A		0x0a000
72689c78134SAlan Cox #define PALETTE_B		0x0a800
72789c78134SAlan Cox #define PALETTE_C		0x0ac00
72889c78134SAlan Cox 
72989c78134SAlan Cox /* Cursor A & B regs */
73089c78134SAlan Cox #define CURACNTR		0x70080
73189c78134SAlan Cox #define CURSOR_MODE_DISABLE		0x00
73289c78134SAlan Cox #define CURSOR_MODE_64_32B_AX		0x07
73389c78134SAlan Cox #define CURSOR_MODE_64_ARGB_AX		((1 << 5) | CURSOR_MODE_64_32B_AX)
73489c78134SAlan Cox #define MCURSOR_GAMMA_ENABLE		(1 << 26)
73589c78134SAlan Cox #define CURABASE		0x70084
73689c78134SAlan Cox #define CURAPOS			0x70088
73789c78134SAlan Cox #define CURSOR_POS_MASK			0x007FF
73889c78134SAlan Cox #define CURSOR_POS_SIGN			0x8000
73989c78134SAlan Cox #define CURSOR_X_SHIFT			0
74089c78134SAlan Cox #define CURSOR_Y_SHIFT			16
74189c78134SAlan Cox #define CURBCNTR		0x700c0
74289c78134SAlan Cox #define CURBBASE		0x700c4
74389c78134SAlan Cox #define CURBPOS			0x700c8
74489c78134SAlan Cox #define CURCCNTR		0x700e0
74589c78134SAlan Cox #define CURCBASE		0x700e4
74689c78134SAlan Cox #define CURCPOS			0x700e8
74789c78134SAlan Cox 
74889c78134SAlan Cox /*
74989c78134SAlan Cox  * Interrupt Registers
75089c78134SAlan Cox  */
75189c78134SAlan Cox #define IER			0x020a0
75289c78134SAlan Cox #define IIR			0x020a4
75389c78134SAlan Cox #define IMR			0x020a8
75489c78134SAlan Cox #define ISR			0x020ac
75589c78134SAlan Cox 
75689c78134SAlan Cox /*
75789c78134SAlan Cox  * MOORESTOWN delta registers
75889c78134SAlan Cox  */
75989c78134SAlan Cox #define MRST_DPLL_A		0x0f014
76089c78134SAlan Cox #define DPLLA_MODE_LVDS			(2 << 26)	/* mrst */
76189c78134SAlan Cox #define MRST_FPA0		0x0f040
76289c78134SAlan Cox #define MRST_FPA1		0x0f044
76389c78134SAlan Cox #define MRST_PERF_MODE		0x020f4
76489c78134SAlan Cox 
76589c78134SAlan Cox /*
76689c78134SAlan Cox  * MEDFIELD HDMI registers
76789c78134SAlan Cox  */
76889c78134SAlan Cox #define HDMIPHYMISCCTL		0x61134
76989c78134SAlan Cox #define HDMI_PHY_POWER_DOWN		0x7f
77089c78134SAlan Cox #define HDMIB_CONTROL		0x61140
77189c78134SAlan Cox #define HDMIB_PORT_EN			(1 << 31)
77289c78134SAlan Cox #define HDMIB_PIPE_B_SELECT		(1 << 30)
77389c78134SAlan Cox #define HDMIB_NULL_PACKET		(1 << 9)
77489c78134SAlan Cox #define HDMIB_HDCP_PORT			(1 << 5)
77589c78134SAlan Cox 
77689c78134SAlan Cox /* #define LVDS			0x61180 */
77789c78134SAlan Cox #define MRST_PANEL_8TO6_DITHER_ENABLE	(1 << 25)
77889c78134SAlan Cox #define MRST_PANEL_24_DOT_1_FORMAT	(1 << 24)
77989c78134SAlan Cox #define LVDS_A3_POWER_UP_0_OUTPUT	(1 << 6)
78089c78134SAlan Cox 
78189c78134SAlan Cox #define MIPI			0x61190
78289c78134SAlan Cox #define MIPI_C			0x62190
78389c78134SAlan Cox #define MIPI_PORT_EN			(1 << 31)
78489c78134SAlan Cox /* Turns on border drawing to allow centered display. */
78589c78134SAlan Cox #define SEL_FLOPPED_HSTX		(1 << 23)
78689c78134SAlan Cox #define PASS_FROM_SPHY_TO_AFE		(1 << 16)
78789c78134SAlan Cox #define MIPI_BORDER_EN			(1 << 15)
78889c78134SAlan Cox #define MIPIA_3LANE_MIPIC_1LANE		0x1
78989c78134SAlan Cox #define MIPIA_2LANE_MIPIC_2LANE		0x2
79089c78134SAlan Cox #define TE_TRIGGER_DSI_PROTOCOL		(1 << 2)
79189c78134SAlan Cox #define TE_TRIGGER_GPIO_PIN		(1 << 3)
79289c78134SAlan Cox #define MIPI_TE_COUNT		0x61194
79389c78134SAlan Cox 
79489c78134SAlan Cox /* #define PP_CONTROL	0x61204 */
79589c78134SAlan Cox #define POWER_DOWN_ON_RESET		(1 << 1)
79689c78134SAlan Cox 
79789c78134SAlan Cox /* #define PFIT_CONTROL	0x61230 */
79889c78134SAlan Cox #define PFIT_PIPE_SELECT		(3 << 29)
79989c78134SAlan Cox #define PFIT_PIPE_SELECT_SHIFT		(29)
80089c78134SAlan Cox 
80189c78134SAlan Cox /* #define BLC_PWM_CTL		0x61254 */
80289c78134SAlan Cox #define MRST_BACKLIGHT_MODULATION_FREQ_SHIFT	(16)
80389c78134SAlan Cox #define MRST_BACKLIGHT_MODULATION_FREQ_MASK	(0xffff << 16)
80489c78134SAlan Cox 
80589c78134SAlan Cox /* #define PIPEACONF 0x70008 */
80689c78134SAlan Cox #define PIPEACONF_PIPE_STATE		(1 << 30)
80789c78134SAlan Cox /* #define DSPACNTR		0x70180 */
80889c78134SAlan Cox 
80989c78134SAlan Cox #define MRST_DSPABASE		0x7019c
81089c78134SAlan Cox #define MRST_DSPBBASE		0x7119c
81189c78134SAlan Cox 
81289c78134SAlan Cox /*
81389c78134SAlan Cox  * Moorestown registers.
81489c78134SAlan Cox  */
81589c78134SAlan Cox 
81689c78134SAlan Cox /*
81789c78134SAlan Cox  *	MIPI IP registers
81889c78134SAlan Cox  */
81989c78134SAlan Cox #define MIPIC_REG_OFFSET		0x800
82089c78134SAlan Cox 
82189c78134SAlan Cox #define DEVICE_READY_REG		0xb000
82289c78134SAlan Cox #define LP_OUTPUT_HOLD				(1 << 16)
82389c78134SAlan Cox #define EXIT_ULPS_DEV_READY			0x3
82489c78134SAlan Cox #define LP_OUTPUT_HOLD_RELEASE			0x810000
82589c78134SAlan Cox # define ENTERING_ULPS				(2 << 1)
82689c78134SAlan Cox # define EXITING_ULPS				(1 << 1)
82789c78134SAlan Cox # define ULPS_MASK				(3 << 1)
82889c78134SAlan Cox # define BUS_POSSESSION				(1 << 3)
82989c78134SAlan Cox #define INTR_STAT_REG			0xb004
83089c78134SAlan Cox #define RX_SOT_ERROR				(1 << 0)
83189c78134SAlan Cox #define RX_SOT_SYNC_ERROR			(1 << 1)
83289c78134SAlan Cox #define RX_ESCAPE_MODE_ENTRY_ERROR		(1 << 3)
83389c78134SAlan Cox #define RX_LP_TX_SYNC_ERROR			(1 << 4)
83489c78134SAlan Cox #define RX_HS_RECEIVE_TIMEOUT_ERROR		(1 << 5)
83589c78134SAlan Cox #define RX_FALSE_CONTROL_ERROR			(1 << 6)
83689c78134SAlan Cox #define RX_ECC_SINGLE_BIT_ERROR			(1 << 7)
83789c78134SAlan Cox #define RX_ECC_MULTI_BIT_ERROR			(1 << 8)
83889c78134SAlan Cox #define RX_CHECKSUM_ERROR			(1 << 9)
83989c78134SAlan Cox #define RX_DSI_DATA_TYPE_NOT_RECOGNIZED		(1 << 10)
84089c78134SAlan Cox #define RX_DSI_VC_ID_INVALID			(1 << 11)
84189c78134SAlan Cox #define TX_FALSE_CONTROL_ERROR			(1 << 12)
84289c78134SAlan Cox #define TX_ECC_SINGLE_BIT_ERROR			(1 << 13)
84389c78134SAlan Cox #define TX_ECC_MULTI_BIT_ERROR			(1 << 14)
84489c78134SAlan Cox #define TX_CHECKSUM_ERROR			(1 << 15)
84589c78134SAlan Cox #define TX_DSI_DATA_TYPE_NOT_RECOGNIZED		(1 << 16)
84689c78134SAlan Cox #define TX_DSI_VC_ID_INVALID			(1 << 17)
84789c78134SAlan Cox #define HIGH_CONTENTION				(1 << 18)
84889c78134SAlan Cox #define LOW_CONTENTION				(1 << 19)
84989c78134SAlan Cox #define DPI_FIFO_UNDER_RUN			(1 << 20)
85089c78134SAlan Cox #define HS_TX_TIMEOUT				(1 << 21)
85189c78134SAlan Cox #define LP_RX_TIMEOUT				(1 << 22)
85289c78134SAlan Cox #define TURN_AROUND_ACK_TIMEOUT			(1 << 23)
85389c78134SAlan Cox #define ACK_WITH_NO_ERROR			(1 << 24)
85489c78134SAlan Cox #define HS_GENERIC_WR_FIFO_FULL			(1 << 27)
85589c78134SAlan Cox #define LP_GENERIC_WR_FIFO_FULL			(1 << 28)
85689c78134SAlan Cox #define SPL_PKT_SENT				(1 << 30)
85789c78134SAlan Cox #define INTR_EN_REG			0xb008
85889c78134SAlan Cox #define DSI_FUNC_PRG_REG		0xb00c
85989c78134SAlan Cox #define DPI_CHANNEL_NUMBER_POS			0x03
86089c78134SAlan Cox #define DBI_CHANNEL_NUMBER_POS			0x05
86189c78134SAlan Cox #define FMT_DPI_POS				0x07
86289c78134SAlan Cox #define FMT_DBI_POS				0x0A
86389c78134SAlan Cox #define DBI_DATA_WIDTH_POS			0x0D
86489c78134SAlan Cox 
86589c78134SAlan Cox /* DPI PIXEL FORMATS */
86689c78134SAlan Cox #define RGB_565_FMT				0x01	/* RGB 565 FORMAT */
86789c78134SAlan Cox #define RGB_666_FMT				0x02	/* RGB 666 FORMAT */
86889c78134SAlan Cox #define LRGB_666_FMT				0x03	/* RGB LOOSELY PACKED
86989c78134SAlan Cox 							 * 666 FORMAT
87089c78134SAlan Cox 							 */
87189c78134SAlan Cox #define RGB_888_FMT				0x04	/* RGB 888 FORMAT */
87289c78134SAlan Cox #define VIRTUAL_CHANNEL_NUMBER_0		0x00	/* Virtual channel 0 */
87389c78134SAlan Cox #define VIRTUAL_CHANNEL_NUMBER_1		0x01	/* Virtual channel 1 */
87489c78134SAlan Cox #define VIRTUAL_CHANNEL_NUMBER_2		0x02	/* Virtual channel 2 */
87589c78134SAlan Cox #define VIRTUAL_CHANNEL_NUMBER_3		0x03	/* Virtual channel 3 */
87689c78134SAlan Cox 
87789c78134SAlan Cox #define DBI_NOT_SUPPORTED			0x00	/* command mode
87889c78134SAlan Cox 							 * is not supported
87989c78134SAlan Cox 							 */
88089c78134SAlan Cox #define DBI_DATA_WIDTH_16BIT			0x01	/* 16 bit data */
88189c78134SAlan Cox #define DBI_DATA_WIDTH_9BIT			0x02	/* 9 bit data */
88289c78134SAlan Cox #define DBI_DATA_WIDTH_8BIT			0x03	/* 8 bit data */
88389c78134SAlan Cox #define DBI_DATA_WIDTH_OPT1			0x04	/* option 1 */
88489c78134SAlan Cox #define DBI_DATA_WIDTH_OPT2			0x05	/* option 2 */
88589c78134SAlan Cox 
88689c78134SAlan Cox #define HS_TX_TIMEOUT_REG		0xb010
88789c78134SAlan Cox #define LP_RX_TIMEOUT_REG		0xb014
88889c78134SAlan Cox #define TURN_AROUND_TIMEOUT_REG		0xb018
88989c78134SAlan Cox #define DEVICE_RESET_REG		0xb01C
89089c78134SAlan Cox #define DPI_RESOLUTION_REG		0xb020
89189c78134SAlan Cox #define RES_V_POS				0x10
89289c78134SAlan Cox #define HORIZ_SYNC_PAD_COUNT_REG	0xb028
89389c78134SAlan Cox #define HORIZ_BACK_PORCH_COUNT_REG	0xb02C
89489c78134SAlan Cox #define HORIZ_FRONT_PORCH_COUNT_REG	0xb030
89589c78134SAlan Cox #define HORIZ_ACTIVE_AREA_COUNT_REG	0xb034
89689c78134SAlan Cox #define VERT_SYNC_PAD_COUNT_REG		0xb038
89789c78134SAlan Cox #define VERT_BACK_PORCH_COUNT_REG	0xb03c
89889c78134SAlan Cox #define VERT_FRONT_PORCH_COUNT_REG	0xb040
89989c78134SAlan Cox #define HIGH_LOW_SWITCH_COUNT_REG	0xb044
90089c78134SAlan Cox #define DPI_CONTROL_REG			0xb048
90189c78134SAlan Cox #define DPI_SHUT_DOWN				(1 << 0)
90289c78134SAlan Cox #define DPI_TURN_ON				(1 << 1)
90389c78134SAlan Cox #define DPI_COLOR_MODE_ON			(1 << 2)
90489c78134SAlan Cox #define DPI_COLOR_MODE_OFF			(1 << 3)
90589c78134SAlan Cox #define DPI_BACK_LIGHT_ON			(1 << 4)
90689c78134SAlan Cox #define DPI_BACK_LIGHT_OFF			(1 << 5)
90789c78134SAlan Cox #define DPI_LP					(1 << 6)
90889c78134SAlan Cox #define DPI_DATA_REG			0xb04c
90989c78134SAlan Cox #define DPI_BACK_LIGHT_ON_DATA			0x07
91089c78134SAlan Cox #define DPI_BACK_LIGHT_OFF_DATA			0x17
91189c78134SAlan Cox #define INIT_COUNT_REG			0xb050
91289c78134SAlan Cox #define MAX_RET_PAK_REG			0xb054
91389c78134SAlan Cox #define VIDEO_FMT_REG			0xb058
91489c78134SAlan Cox #define COMPLETE_LAST_PCKT			(1 << 2)
91589c78134SAlan Cox #define EOT_DISABLE_REG			0xb05c
91689c78134SAlan Cox #define ENABLE_CLOCK_STOPPING			(1 << 1)
91789c78134SAlan Cox #define LP_BYTECLK_REG			0xb060
91889c78134SAlan Cox #define LP_GEN_DATA_REG			0xb064
91989c78134SAlan Cox #define HS_GEN_DATA_REG			0xb068
92089c78134SAlan Cox #define LP_GEN_CTRL_REG			0xb06C
92189c78134SAlan Cox #define HS_GEN_CTRL_REG			0xb070
92289c78134SAlan Cox #define DCS_CHANNEL_NUMBER_POS		0x6
92389c78134SAlan Cox #define MCS_COMMANDS_POS		0x8
92489c78134SAlan Cox #define WORD_COUNTS_POS			0x8
92589c78134SAlan Cox #define MCS_PARAMETER_POS			0x10
92689c78134SAlan Cox #define GEN_FIFO_STAT_REG		0xb074
92789c78134SAlan Cox #define HS_DATA_FIFO_FULL			(1 << 0)
92889c78134SAlan Cox #define HS_DATA_FIFO_HALF_EMPTY			(1 << 1)
92989c78134SAlan Cox #define HS_DATA_FIFO_EMPTY			(1 << 2)
93089c78134SAlan Cox #define LP_DATA_FIFO_FULL			(1 << 8)
93189c78134SAlan Cox #define LP_DATA_FIFO_HALF_EMPTY			(1 << 9)
93289c78134SAlan Cox #define LP_DATA_FIFO_EMPTY			(1 << 10)
93389c78134SAlan Cox #define HS_CTRL_FIFO_FULL			(1 << 16)
93489c78134SAlan Cox #define HS_CTRL_FIFO_HALF_EMPTY			(1 << 17)
93589c78134SAlan Cox #define HS_CTRL_FIFO_EMPTY			(1 << 18)
93689c78134SAlan Cox #define LP_CTRL_FIFO_FULL			(1 << 24)
93789c78134SAlan Cox #define LP_CTRL_FIFO_HALF_EMPTY			(1 << 25)
93889c78134SAlan Cox #define LP_CTRL_FIFO_EMPTY			(1 << 26)
93989c78134SAlan Cox #define DBI_FIFO_EMPTY				(1 << 27)
94089c78134SAlan Cox #define DPI_FIFO_EMPTY				(1 << 28)
94189c78134SAlan Cox #define HS_LS_DBI_ENABLE_REG		0xb078
94289c78134SAlan Cox #define TXCLKESC_REG			0xb07c
94389c78134SAlan Cox #define DPHY_PARAM_REG			0xb080
94489c78134SAlan Cox #define DBI_BW_CTRL_REG			0xb084
94589c78134SAlan Cox #define CLK_LANE_SWT_REG		0xb088
94689c78134SAlan Cox 
94789c78134SAlan Cox /*
94889c78134SAlan Cox  * MIPI Adapter registers
94989c78134SAlan Cox  */
95089c78134SAlan Cox #define MIPI_CONTROL_REG		0xb104
95189c78134SAlan Cox #define MIPI_2X_CLOCK_BITS			((1 << 0) | (1 << 1))
95289c78134SAlan Cox #define MIPI_DATA_ADDRESS_REG		0xb108
95389c78134SAlan Cox #define MIPI_DATA_LENGTH_REG		0xb10C
95489c78134SAlan Cox #define MIPI_COMMAND_ADDRESS_REG	0xb110
95589c78134SAlan Cox #define MIPI_COMMAND_LENGTH_REG		0xb114
95689c78134SAlan Cox #define MIPI_READ_DATA_RETURN_REG0	0xb118
95789c78134SAlan Cox #define MIPI_READ_DATA_RETURN_REG1	0xb11C
95889c78134SAlan Cox #define MIPI_READ_DATA_RETURN_REG2	0xb120
95989c78134SAlan Cox #define MIPI_READ_DATA_RETURN_REG3	0xb124
96089c78134SAlan Cox #define MIPI_READ_DATA_RETURN_REG4	0xb128
96189c78134SAlan Cox #define MIPI_READ_DATA_RETURN_REG5	0xb12C
96289c78134SAlan Cox #define MIPI_READ_DATA_RETURN_REG6	0xb130
96389c78134SAlan Cox #define MIPI_READ_DATA_RETURN_REG7	0xb134
96489c78134SAlan Cox #define MIPI_READ_DATA_VALID_REG	0xb138
96589c78134SAlan Cox 
96689c78134SAlan Cox /* DBI COMMANDS */
96789c78134SAlan Cox #define soft_reset			0x01
96889c78134SAlan Cox /*
96989c78134SAlan Cox  *	The display module performs a software reset.
97089c78134SAlan Cox  *	Registers are written with their SW Reset default values.
97189c78134SAlan Cox  */
97289c78134SAlan Cox #define get_power_mode			0x0a
97389c78134SAlan Cox /*
97489c78134SAlan Cox  *	The display module returns the current power mode
97589c78134SAlan Cox  */
97689c78134SAlan Cox #define get_address_mode		0x0b
97789c78134SAlan Cox /*
97889c78134SAlan Cox  *	The display module returns the current status.
97989c78134SAlan Cox  */
98089c78134SAlan Cox #define get_pixel_format		0x0c
98189c78134SAlan Cox /*
98289c78134SAlan Cox  *	This command gets the pixel format for the RGB image data
98389c78134SAlan Cox  *	used by the interface.
98489c78134SAlan Cox  */
98589c78134SAlan Cox #define get_display_mode		0x0d
98689c78134SAlan Cox /*
98789c78134SAlan Cox  *	The display module returns the Display Image Mode status.
98889c78134SAlan Cox  */
98989c78134SAlan Cox #define get_signal_mode			0x0e
99089c78134SAlan Cox /*
99189c78134SAlan Cox  *	The display module returns the Display Signal Mode.
99289c78134SAlan Cox  */
99389c78134SAlan Cox #define get_diagnostic_result		0x0f
99489c78134SAlan Cox /*
99589c78134SAlan Cox  *	The display module returns the self-diagnostic results following
99689c78134SAlan Cox  *	a Sleep Out command.
99789c78134SAlan Cox  */
99889c78134SAlan Cox #define enter_sleep_mode		0x10
99989c78134SAlan Cox /*
100089c78134SAlan Cox  *	This command causes the display module to enter the Sleep mode.
100189c78134SAlan Cox  *	In this mode, all unnecessary blocks inside the display module are
100289c78134SAlan Cox  *	disabled except interface communication. This is the lowest power
100389c78134SAlan Cox  *	mode the display module supports.
100489c78134SAlan Cox  */
100589c78134SAlan Cox #define exit_sleep_mode			0x11
100689c78134SAlan Cox /*
100789c78134SAlan Cox  *	This command causes the display module to exit Sleep mode.
100889c78134SAlan Cox  *	All blocks inside the display module are enabled.
100989c78134SAlan Cox  */
101089c78134SAlan Cox #define enter_partial_mode		0x12
101189c78134SAlan Cox /*
101289c78134SAlan Cox  *	This command causes the display module to enter the Partial Display
101389c78134SAlan Cox  *	Mode. The Partial Display Mode window is described by the
101489c78134SAlan Cox  *	set_partial_area command.
101589c78134SAlan Cox  */
101689c78134SAlan Cox #define enter_normal_mode		0x13
101789c78134SAlan Cox /*
101889c78134SAlan Cox  *	This command causes the display module to enter the Normal mode.
101989c78134SAlan Cox  *	Normal Mode is defined as Partial Display mode and Scroll mode are off
102089c78134SAlan Cox  */
102189c78134SAlan Cox #define exit_invert_mode		0x20
102289c78134SAlan Cox /*
102389c78134SAlan Cox  *	This command causes the display module to stop inverting the image
102489c78134SAlan Cox  *	data on the display device. The frame memory contents remain unchanged.
102589c78134SAlan Cox  *	No status bits are changed.
102689c78134SAlan Cox  */
102789c78134SAlan Cox #define enter_invert_mode		0x21
102889c78134SAlan Cox /*
102989c78134SAlan Cox  *	This command causes the display module to invert the image data only on
103089c78134SAlan Cox  *	the display device. The frame memory contents remain unchanged.
103189c78134SAlan Cox  *	No status bits are changed.
103289c78134SAlan Cox  */
103389c78134SAlan Cox #define set_gamma_curve			0x26
103489c78134SAlan Cox /*
103589c78134SAlan Cox  *	This command selects the desired gamma curve for the display device.
103689c78134SAlan Cox  *	Four fixed gamma curves are defined in section DCS spec.
103789c78134SAlan Cox  */
103889c78134SAlan Cox #define set_display_off			0x28
103989c78134SAlan Cox /* ************************************************************************* *\
104089c78134SAlan Cox This command causes the display module to stop displaying the image data
104189c78134SAlan Cox on the display device. The frame memory contents remain unchanged.
104289c78134SAlan Cox No status bits are changed.
104389c78134SAlan Cox \* ************************************************************************* */
104489c78134SAlan Cox #define set_display_on			0x29
104589c78134SAlan Cox /* ************************************************************************* *\
104689c78134SAlan Cox This command causes the display module to start displaying the image data
104789c78134SAlan Cox on the display device. The frame memory contents remain unchanged.
104889c78134SAlan Cox No status bits are changed.
104989c78134SAlan Cox \* ************************************************************************* */
105089c78134SAlan Cox #define set_column_address		0x2a
105189c78134SAlan Cox /*
105289c78134SAlan Cox  *	This command defines the column extent of the frame memory accessed by
105389c78134SAlan Cox  *	the hostprocessor with the read_memory_continue and
105489c78134SAlan Cox  *	write_memory_continue commands.
105589c78134SAlan Cox  *	No status bits are changed.
105689c78134SAlan Cox  */
105789c78134SAlan Cox #define set_page_addr			0x2b
105889c78134SAlan Cox /*
105989c78134SAlan Cox  *	This command defines the page extent of the frame memory accessed by
106089c78134SAlan Cox  *	the host processor with the write_memory_continue and
106189c78134SAlan Cox  *	read_memory_continue command.
106289c78134SAlan Cox  *	No status bits are changed.
106389c78134SAlan Cox  */
106489c78134SAlan Cox #define write_mem_start			0x2c
106589c78134SAlan Cox /*
106689c78134SAlan Cox  *	This command transfers image data from the host processor to the
106789c78134SAlan Cox  *	display modules frame memory starting at the pixel location specified
106889c78134SAlan Cox  *	by preceding set_column_address and set_page_address commands.
106989c78134SAlan Cox  */
107089c78134SAlan Cox #define set_partial_area		0x30
107189c78134SAlan Cox /*
107289c78134SAlan Cox  *	This command defines the Partial Display mode s display area.
107389c78134SAlan Cox  *	There are two parameters associated with this command, the first
107489c78134SAlan Cox  *	defines the Start Row (SR) and the second the End Row (ER). SR and ER
107589c78134SAlan Cox  *	refer to the Frame Memory Line Pointer.
107689c78134SAlan Cox  */
107789c78134SAlan Cox #define set_scroll_area			0x33
107889c78134SAlan Cox /*
107989c78134SAlan Cox  *	This command defines the display modules Vertical Scrolling Area.
108089c78134SAlan Cox  */
108189c78134SAlan Cox #define set_tear_off			0x34
108289c78134SAlan Cox /*
108389c78134SAlan Cox  *	This command turns off the display modules Tearing Effect output
108489c78134SAlan Cox  *	signal on the TE signal line.
108589c78134SAlan Cox  */
108689c78134SAlan Cox #define set_tear_on			0x35
108789c78134SAlan Cox /*
108889c78134SAlan Cox  *	This command turns on the display modules Tearing Effect output signal
108989c78134SAlan Cox  *	on the TE signal line.
109089c78134SAlan Cox  */
109189c78134SAlan Cox #define set_address_mode		0x36
109289c78134SAlan Cox /*
109389c78134SAlan Cox  *	This command sets the data order for transfers from the host processor
109489c78134SAlan Cox  *	to display modules frame memory,bits B[7:5] and B3, and from the
109589c78134SAlan Cox  *	display modules frame memory to the display device, bits B[2:0] and B4.
109689c78134SAlan Cox  */
109789c78134SAlan Cox #define set_scroll_start		0x37
109889c78134SAlan Cox /*
109989c78134SAlan Cox  *	This command sets the start of the vertical scrolling area in the frame
110089c78134SAlan Cox  *	memory. The vertical scrolling area is fully defined when this command
110189c78134SAlan Cox  *	is used with the set_scroll_area command The set_scroll_start command
110289c78134SAlan Cox  *	has one parameter, the Vertical Scroll Pointer. The VSP defines the
110389c78134SAlan Cox  *	line in the frame memory that is written to the display device as the
110489c78134SAlan Cox  *	first line of the vertical scroll area.
110589c78134SAlan Cox  */
110689c78134SAlan Cox #define exit_idle_mode			0x38
110789c78134SAlan Cox /*
110889c78134SAlan Cox  *	This command causes the display module to exit Idle mode.
110989c78134SAlan Cox  */
111089c78134SAlan Cox #define enter_idle_mode			0x39
111189c78134SAlan Cox /*
111289c78134SAlan Cox  *	This command causes the display module to enter Idle Mode.
111389c78134SAlan Cox  *	In Idle Mode, color expression is reduced. Colors are shown on the
111489c78134SAlan Cox  *	display device using the MSB of each of the R, G and B color
111589c78134SAlan Cox  *	components in the frame memory
111689c78134SAlan Cox  */
111789c78134SAlan Cox #define set_pixel_format		0x3a
111889c78134SAlan Cox /*
111989c78134SAlan Cox  *	This command sets the pixel format for the RGB image data used by the
112089c78134SAlan Cox  *	interface.
112189c78134SAlan Cox  *	Bits D[6:4]  DPI Pixel Format Definition
112289c78134SAlan Cox  *	Bits D[2:0]  DBI Pixel Format Definition
112389c78134SAlan Cox  *	Bits D7 and D3 are not used.
112489c78134SAlan Cox  */
112589c78134SAlan Cox #define DCS_PIXEL_FORMAT_3bpp		0x1
112689c78134SAlan Cox #define DCS_PIXEL_FORMAT_8bpp		0x2
112789c78134SAlan Cox #define DCS_PIXEL_FORMAT_12bpp		0x3
112889c78134SAlan Cox #define DCS_PIXEL_FORMAT_16bpp		0x5
112989c78134SAlan Cox #define DCS_PIXEL_FORMAT_18bpp		0x6
113089c78134SAlan Cox #define DCS_PIXEL_FORMAT_24bpp		0x7
113189c78134SAlan Cox 
113289c78134SAlan Cox #define write_mem_cont			0x3c
113389c78134SAlan Cox 
113489c78134SAlan Cox /*
113589c78134SAlan Cox  *	This command transfers image data from the host processor to the
113689c78134SAlan Cox  *	display module's frame memory continuing from the pixel location
113789c78134SAlan Cox  *	following the previous write_memory_continue or write_memory_start
113889c78134SAlan Cox  *	command.
113989c78134SAlan Cox  */
114089c78134SAlan Cox #define set_tear_scanline		0x44
114189c78134SAlan Cox /*
114289c78134SAlan Cox  *	This command turns on the display modules Tearing Effect output signal
114389c78134SAlan Cox  *	on the TE signal line when the display module reaches line N.
114489c78134SAlan Cox  */
114589c78134SAlan Cox #define get_scanline			0x45
114689c78134SAlan Cox /*
114789c78134SAlan Cox  *	The display module returns the current scanline, N, used to update the
114889c78134SAlan Cox  *	 display device. The total number of scanlines on a display device is
114989c78134SAlan Cox  *	defined as VSYNC + VBP + VACT + VFP.The first scanline is defined as
115089c78134SAlan Cox  *	the first line of V Sync and is denoted as Line 0.
115189c78134SAlan Cox  *	When in Sleep Mode, the value returned by get_scanline is undefined.
115289c78134SAlan Cox  */
115389c78134SAlan Cox 
115489c78134SAlan Cox /* MCS or Generic COMMANDS */
115589c78134SAlan Cox /* MCS/generic data type */
115689c78134SAlan Cox #define GEN_SHORT_WRITE_0	0x03  /* generic short write, no parameters */
115789c78134SAlan Cox #define GEN_SHORT_WRITE_1	0x13  /* generic short write, 1 parameters */
115889c78134SAlan Cox #define GEN_SHORT_WRITE_2	0x23  /* generic short write, 2 parameters */
115989c78134SAlan Cox #define GEN_READ_0		0x04  /* generic read, no parameters */
116089c78134SAlan Cox #define GEN_READ_1		0x14  /* generic read, 1 parameters */
116189c78134SAlan Cox #define GEN_READ_2		0x24  /* generic read, 2 parameters */
116289c78134SAlan Cox #define GEN_LONG_WRITE		0x29  /* generic long write */
116389c78134SAlan Cox #define MCS_SHORT_WRITE_0	0x05  /* MCS short write, no parameters */
116489c78134SAlan Cox #define MCS_SHORT_WRITE_1	0x15  /* MCS short write, 1 parameters */
116589c78134SAlan Cox #define MCS_READ		0x06  /* MCS read, no parameters */
116689c78134SAlan Cox #define MCS_LONG_WRITE		0x39  /* MCS long write */
116789c78134SAlan Cox /* MCS/generic commands */
116889c78134SAlan Cox /* TPO MCS */
116989c78134SAlan Cox #define write_display_profile		0x50
117089c78134SAlan Cox #define write_display_brightness	0x51
117189c78134SAlan Cox #define write_ctrl_display		0x53
117289c78134SAlan Cox #define write_ctrl_cabc			0x55
117389c78134SAlan Cox   #define UI_IMAGE		0x01
117489c78134SAlan Cox   #define STILL_IMAGE		0x02
117589c78134SAlan Cox   #define MOVING_IMAGE		0x03
117689c78134SAlan Cox #define write_hysteresis		0x57
117789c78134SAlan Cox #define write_gamma_setting		0x58
117889c78134SAlan Cox #define write_cabc_min_bright		0x5e
117989c78134SAlan Cox #define write_kbbc_profile		0x60
118089c78134SAlan Cox /* TMD MCS */
118189c78134SAlan Cox #define tmd_write_display_brightness 0x8c
118289c78134SAlan Cox 
118389c78134SAlan Cox /*
118489c78134SAlan Cox  *	This command is used to control ambient light, panel backlight
118589c78134SAlan Cox  *	brightness and gamma settings.
118689c78134SAlan Cox  */
118789c78134SAlan Cox #define BRIGHT_CNTL_BLOCK_ON	(1 << 5)
118889c78134SAlan Cox #define AMBIENT_LIGHT_SENSE_ON	(1 << 4)
118989c78134SAlan Cox #define DISPLAY_DIMMING_ON	(1 << 3)
119089c78134SAlan Cox #define BACKLIGHT_ON		(1 << 2)
119189c78134SAlan Cox #define DISPLAY_BRIGHTNESS_AUTO	(1 << 1)
119289c78134SAlan Cox #define GAMMA_AUTO		(1 << 0)
119389c78134SAlan Cox 
119489c78134SAlan Cox /* DCS Interface Pixel Formats */
119589c78134SAlan Cox #define DCS_PIXEL_FORMAT_3BPP	0x1
119689c78134SAlan Cox #define DCS_PIXEL_FORMAT_8BPP	0x2
119789c78134SAlan Cox #define DCS_PIXEL_FORMAT_12BPP	0x3
119889c78134SAlan Cox #define DCS_PIXEL_FORMAT_16BPP	0x5
119989c78134SAlan Cox #define DCS_PIXEL_FORMAT_18BPP	0x6
120089c78134SAlan Cox #define DCS_PIXEL_FORMAT_24BPP	0x7
120189c78134SAlan Cox /* ONE PARAMETER READ DATA */
120289c78134SAlan Cox #define addr_mode_data		0xfc
120389c78134SAlan Cox #define diag_res_data		0x00
120489c78134SAlan Cox #define disp_mode_data		0x23
120589c78134SAlan Cox #define pxl_fmt_data		0x77
120689c78134SAlan Cox #define pwr_mode_data		0x74
120789c78134SAlan Cox #define sig_mode_data		0x00
120889c78134SAlan Cox /* TWO PARAMETERS READ DATA */
120989c78134SAlan Cox #define scanline_data1		0xff
121089c78134SAlan Cox #define scanline_data2		0xff
121189c78134SAlan Cox #define NON_BURST_MODE_SYNC_PULSE	0x01	/* Non Burst Mode
121289c78134SAlan Cox 						 * with Sync Pulse
121389c78134SAlan Cox 						 */
121489c78134SAlan Cox #define NON_BURST_MODE_SYNC_EVENTS	0x02	/* Non Burst Mode
121589c78134SAlan Cox 						 * with Sync events
121689c78134SAlan Cox 						 */
121789c78134SAlan Cox #define BURST_MODE			0x03	/* Burst Mode */
121889c78134SAlan Cox #define DBI_COMMAND_BUFFER_SIZE		0x240   /* 0x32 */    /* 0x120 */
121989c78134SAlan Cox 						/* Allocate at least
122089c78134SAlan Cox 						 * 0x100 Byte with 32
122189c78134SAlan Cox 						 * byte alignment
122289c78134SAlan Cox 						 */
122389c78134SAlan Cox #define DBI_DATA_BUFFER_SIZE		0x120	/* Allocate at least
122489c78134SAlan Cox 						 * 0x100 Byte with 32
122589c78134SAlan Cox 						 * byte alignment
122689c78134SAlan Cox 						 */
122789c78134SAlan Cox #define DBI_CB_TIME_OUT			0xFFFF
122889c78134SAlan Cox 
122989c78134SAlan Cox #define GEN_FB_TIME_OUT			2000
123089c78134SAlan Cox 
123189c78134SAlan Cox #define SKU_83				0x01
123289c78134SAlan Cox #define SKU_100				0x02
123389c78134SAlan Cox #define SKU_100L			0x04
123489c78134SAlan Cox #define SKU_BYPASS			0x08
123589c78134SAlan Cox 
123689c78134SAlan Cox /* Some handy macros for playing with bitfields. */
123789c78134SAlan Cox #define PSB_MASK(high, low) (((1<<((high)-(low)+1))-1)<<(low))
123889c78134SAlan Cox #define SET_FIELD(value, field) (((value) << field ## _SHIFT) & field ## _MASK)
123989c78134SAlan Cox #define GET_FIELD(word, field) (((word)  & field ## _MASK) >> field ## _SHIFT)
124089c78134SAlan Cox 
124189c78134SAlan Cox #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
124289c78134SAlan Cox 
124389c78134SAlan Cox /* PCI config space */
124489c78134SAlan Cox 
124589c78134SAlan Cox #define SB_PCKT         0x02100 /* cedarview */
124689c78134SAlan Cox # define SB_OPCODE_MASK                         PSB_MASK(31, 16)
124789c78134SAlan Cox # define SB_OPCODE_SHIFT                        16
124889c78134SAlan Cox # define SB_OPCODE_READ                         0
124989c78134SAlan Cox # define SB_OPCODE_WRITE                        1
125089c78134SAlan Cox # define SB_DEST_MASK                           PSB_MASK(15, 8)
125189c78134SAlan Cox # define SB_DEST_SHIFT                          8
125289c78134SAlan Cox # define SB_DEST_DPLL                           0x88
125389c78134SAlan Cox # define SB_BYTE_ENABLE_MASK                    PSB_MASK(7, 4)
125489c78134SAlan Cox # define SB_BYTE_ENABLE_SHIFT                   4
125589c78134SAlan Cox # define SB_BUSY                                (1 << 0)
125689c78134SAlan Cox 
125709016a11SAlan Cox #define DSPCLK_GATE_D		0x6200
125809016a11SAlan Cox # define VRHUNIT_CLOCK_GATE_DISABLE		(1 << 28) /* Fixed value on CDV */
125909016a11SAlan Cox # define DPOUNIT_CLOCK_GATE_DISABLE		(1 << 11)
126009016a11SAlan Cox # define DPIOUNIT_CLOCK_GATE_DISABLE		(1 << 6)
12619a9f5786SZhao Yakui # define DPUNIT_PIPEB_GATE_DISABLE		(1 << 30)
12629a9f5786SZhao Yakui # define DPUNIT_PIPEA_GATE_DISABLE		(1 << 25)
12639a9f5786SZhao Yakui # define DPCUNIT_CLOCK_GATE_DISABLE		(1 << 24)
12649a9f5786SZhao Yakui # define DPLSUNIT_CLOCK_GATE_DISABLE		(1 << 13)
126509016a11SAlan Cox 
126609016a11SAlan Cox #define RAMCLK_GATE_D		0x6210
126789c78134SAlan Cox 
126889c78134SAlan Cox /* 32-bit value read/written from the DPIO reg. */
126989c78134SAlan Cox #define SB_DATA		0x02104 /* cedarview */
127089c78134SAlan Cox /* 32-bit address of the DPIO reg to be read/written. */
127189c78134SAlan Cox #define SB_ADDR		0x02108 /* cedarview */
127289c78134SAlan Cox #define DPIO_CFG	0x02110 /* cedarview */
127389c78134SAlan Cox # define DPIO_MODE_SELECT_1			(1 << 3)
127489c78134SAlan Cox # define DPIO_MODE_SELECT_0			(1 << 2)
127589c78134SAlan Cox # define DPIO_SFR_BYPASS			(1 << 1)
127689c78134SAlan Cox /* reset is active low */
127789c78134SAlan Cox # define DPIO_CMN_RESET_N			(1 << 0)
127889c78134SAlan Cox 
127989c78134SAlan Cox /* Cedarview sideband registers */
128089c78134SAlan Cox #define _SB_M_A			0x8008
128189c78134SAlan Cox #define _SB_M_B			0x8028
128289c78134SAlan Cox #define SB_M(pipe) _PIPE(pipe, _SB_M_A, _SB_M_B)
128389c78134SAlan Cox # define SB_M_DIVIDER_MASK			(0xFF << 24)
128489c78134SAlan Cox # define SB_M_DIVIDER_SHIFT			24
128589c78134SAlan Cox 
128689c78134SAlan Cox #define _SB_N_VCO_A		0x8014
128789c78134SAlan Cox #define _SB_N_VCO_B		0x8034
128889c78134SAlan Cox #define SB_N_VCO(pipe) _PIPE(pipe, _SB_N_VCO_A, _SB_N_VCO_B)
128989c78134SAlan Cox #define SB_N_VCO_SEL_MASK			PSB_MASK(31, 30)
129089c78134SAlan Cox #define SB_N_VCO_SEL_SHIFT			30
129189c78134SAlan Cox #define SB_N_DIVIDER_MASK			PSB_MASK(29, 26)
129289c78134SAlan Cox #define SB_N_DIVIDER_SHIFT			26
129389c78134SAlan Cox #define SB_N_CB_TUNE_MASK			PSB_MASK(25, 24)
129489c78134SAlan Cox #define SB_N_CB_TUNE_SHIFT			24
129589c78134SAlan Cox 
1296acd7ef92SAlan Cox /* the bit 14:13 is used to select between the different reference clock for Pipe A/B */
1297acd7ef92SAlan Cox #define SB_REF_DPLLA		0x8010
1298acd7ef92SAlan Cox #define SB_REF_DPLLB		0x8030
1299acd7ef92SAlan Cox #define	REF_CLK_MASK		(0x3 << 13)
1300acd7ef92SAlan Cox #define REF_CLK_CORE		(0 << 13)
1301acd7ef92SAlan Cox #define REF_CLK_DPLL		(1 << 13)
1302acd7ef92SAlan Cox #define REF_CLK_DPLLA		(2 << 13)
1303acd7ef92SAlan Cox /* For the DPLL B, it will use the reference clk from DPLL A when using (2 << 13) */
1304acd7ef92SAlan Cox 
130589c78134SAlan Cox #define _SB_REF_A		0x8018
130689c78134SAlan Cox #define _SB_REF_B		0x8038
130789c78134SAlan Cox #define SB_REF_SFR(pipe)	_PIPE(pipe, _SB_REF_A, _SB_REF_B)
130889c78134SAlan Cox 
130989c78134SAlan Cox #define _SB_P_A			0x801c
131089c78134SAlan Cox #define _SB_P_B			0x803c
131189c78134SAlan Cox #define SB_P(pipe) _PIPE(pipe, _SB_P_A, _SB_P_B)
131289c78134SAlan Cox #define SB_P2_DIVIDER_MASK			PSB_MASK(31, 30)
131389c78134SAlan Cox #define SB_P2_DIVIDER_SHIFT			30
131489c78134SAlan Cox #define SB_P2_10				0 /* HDMI, DP, DAC */
131589c78134SAlan Cox #define SB_P2_5				1 /* DAC */
131689c78134SAlan Cox #define SB_P2_14				2 /* LVDS single */
131789c78134SAlan Cox #define SB_P2_7				3 /* LVDS double */
131889c78134SAlan Cox #define SB_P1_DIVIDER_MASK			PSB_MASK(15, 12)
131989c78134SAlan Cox #define SB_P1_DIVIDER_SHIFT			12
132089c78134SAlan Cox 
132189c78134SAlan Cox #define PSB_LANE0		0x120
132289c78134SAlan Cox #define PSB_LANE1		0x220
132389c78134SAlan Cox #define PSB_LANE2		0x2320
132489c78134SAlan Cox #define PSB_LANE3		0x2420
132589c78134SAlan Cox 
132689c78134SAlan Cox #define LANE_PLL_MASK		(0x7 << 20)
132789c78134SAlan Cox #define LANE_PLL_ENABLE		(0x3 << 20)
1328d235e64aSAlan Cox #define LANE_PLL_PIPE(p)	(((p) == 0) ? (1 << 21) : (0 << 21))
132989c78134SAlan Cox 
13308695b612SAlan Cox #define DP_B				0x64100
13318695b612SAlan Cox #define DP_C				0x64200
13328695b612SAlan Cox 
13338695b612SAlan Cox #define   DP_PORT_EN			(1 << 31)
13348695b612SAlan Cox #define   DP_PIPEB_SELECT		(1 << 30)
13358695b612SAlan Cox #define   DP_PIPE_MASK			(1 << 30)
13368695b612SAlan Cox 
13378695b612SAlan Cox /* Link training mode - select a suitable mode for each stage */
13388695b612SAlan Cox #define   DP_LINK_TRAIN_PAT_1		(0 << 28)
13398695b612SAlan Cox #define   DP_LINK_TRAIN_PAT_2		(1 << 28)
13408695b612SAlan Cox #define   DP_LINK_TRAIN_PAT_IDLE	(2 << 28)
13418695b612SAlan Cox #define   DP_LINK_TRAIN_OFF		(3 << 28)
13428695b612SAlan Cox #define   DP_LINK_TRAIN_MASK		(3 << 28)
13438695b612SAlan Cox #define   DP_LINK_TRAIN_SHIFT		28
13448695b612SAlan Cox 
13458695b612SAlan Cox /* Signal voltages. These are mostly controlled by the other end */
13468695b612SAlan Cox #define   DP_VOLTAGE_0_4		(0 << 25)
13478695b612SAlan Cox #define   DP_VOLTAGE_0_6		(1 << 25)
13488695b612SAlan Cox #define   DP_VOLTAGE_0_8		(2 << 25)
13498695b612SAlan Cox #define   DP_VOLTAGE_1_2		(3 << 25)
13508695b612SAlan Cox #define   DP_VOLTAGE_MASK		(7 << 25)
13518695b612SAlan Cox #define   DP_VOLTAGE_SHIFT		25
13528695b612SAlan Cox 
13538695b612SAlan Cox /* Signal pre-emphasis levels, like voltages, the other end tells us what
13548695b612SAlan Cox  * they want
13558695b612SAlan Cox  */
13568695b612SAlan Cox #define   DP_PRE_EMPHASIS_0		(0 << 22)
13578695b612SAlan Cox #define   DP_PRE_EMPHASIS_3_5		(1 << 22)
13588695b612SAlan Cox #define   DP_PRE_EMPHASIS_6		(2 << 22)
13598695b612SAlan Cox #define   DP_PRE_EMPHASIS_9_5		(3 << 22)
13608695b612SAlan Cox #define   DP_PRE_EMPHASIS_MASK		(7 << 22)
13618695b612SAlan Cox #define   DP_PRE_EMPHASIS_SHIFT		22
13628695b612SAlan Cox 
13638695b612SAlan Cox /* How many wires to use. I guess 3 was too hard */
13648695b612SAlan Cox #define   DP_PORT_WIDTH_1		(0 << 19)
13658695b612SAlan Cox #define   DP_PORT_WIDTH_2		(1 << 19)
13668695b612SAlan Cox #define   DP_PORT_WIDTH_4		(3 << 19)
13678695b612SAlan Cox #define   DP_PORT_WIDTH_MASK		(7 << 19)
13688695b612SAlan Cox 
13698695b612SAlan Cox /* Mystic DPCD version 1.1 special mode */
13708695b612SAlan Cox #define   DP_ENHANCED_FRAMING		(1 << 18)
13718695b612SAlan Cox 
13728695b612SAlan Cox /** locked once port is enabled */
13738695b612SAlan Cox #define   DP_PORT_REVERSAL		(1 << 15)
13748695b612SAlan Cox 
13758695b612SAlan Cox /** sends the clock on lane 15 of the PEG for debug */
13768695b612SAlan Cox #define   DP_CLOCK_OUTPUT_ENABLE	(1 << 13)
13778695b612SAlan Cox 
13788695b612SAlan Cox #define   DP_SCRAMBLING_DISABLE		(1 << 12)
13798695b612SAlan Cox #define   DP_SCRAMBLING_DISABLE_IRONLAKE	(1 << 7)
13808695b612SAlan Cox 
13818695b612SAlan Cox /** limit RGB values to avoid confusing TVs */
13828695b612SAlan Cox #define   DP_COLOR_RANGE_16_235		(1 << 8)
13838695b612SAlan Cox 
13848695b612SAlan Cox /** Turn on the audio link */
13858695b612SAlan Cox #define   DP_AUDIO_OUTPUT_ENABLE	(1 << 6)
13868695b612SAlan Cox 
13878695b612SAlan Cox /** vs and hs sync polarity */
13888695b612SAlan Cox #define   DP_SYNC_VS_HIGH		(1 << 4)
13898695b612SAlan Cox #define   DP_SYNC_HS_HIGH		(1 << 3)
13908695b612SAlan Cox 
13918695b612SAlan Cox /** A fantasy */
13928695b612SAlan Cox #define   DP_DETECTED			(1 << 2)
13938695b612SAlan Cox 
13948695b612SAlan Cox /** The aux channel provides a way to talk to the
13958695b612SAlan Cox  * signal sink for DDC etc. Max packet size supported
13968695b612SAlan Cox  * is 20 bytes in each direction, hence the 5 fixed
13978695b612SAlan Cox  * data registers
13988695b612SAlan Cox  */
13998695b612SAlan Cox #define DPB_AUX_CH_CTL			0x64110
14008695b612SAlan Cox #define DPB_AUX_CH_DATA1		0x64114
14018695b612SAlan Cox #define DPB_AUX_CH_DATA2		0x64118
14028695b612SAlan Cox #define DPB_AUX_CH_DATA3		0x6411c
14038695b612SAlan Cox #define DPB_AUX_CH_DATA4		0x64120
14048695b612SAlan Cox #define DPB_AUX_CH_DATA5		0x64124
14058695b612SAlan Cox 
14068695b612SAlan Cox #define DPC_AUX_CH_CTL			0x64210
14078695b612SAlan Cox #define DPC_AUX_CH_DATA1		0x64214
14088695b612SAlan Cox #define DPC_AUX_CH_DATA2		0x64218
14098695b612SAlan Cox #define DPC_AUX_CH_DATA3		0x6421c
14108695b612SAlan Cox #define DPC_AUX_CH_DATA4		0x64220
14118695b612SAlan Cox #define DPC_AUX_CH_DATA5		0x64224
14128695b612SAlan Cox 
14138695b612SAlan Cox #define   DP_AUX_CH_CTL_SEND_BUSY	    (1 << 31)
14148695b612SAlan Cox #define   DP_AUX_CH_CTL_DONE		    (1 << 30)
14158695b612SAlan Cox #define   DP_AUX_CH_CTL_INTERRUPT	    (1 << 29)
14168695b612SAlan Cox #define   DP_AUX_CH_CTL_TIME_OUT_ERROR	    (1 << 28)
14178695b612SAlan Cox #define   DP_AUX_CH_CTL_TIME_OUT_400us	    (0 << 26)
14188695b612SAlan Cox #define   DP_AUX_CH_CTL_TIME_OUT_600us	    (1 << 26)
14198695b612SAlan Cox #define   DP_AUX_CH_CTL_TIME_OUT_800us	    (2 << 26)
14208695b612SAlan Cox #define   DP_AUX_CH_CTL_TIME_OUT_1600us	    (3 << 26)
14218695b612SAlan Cox #define   DP_AUX_CH_CTL_TIME_OUT_MASK	    (3 << 26)
14228695b612SAlan Cox #define   DP_AUX_CH_CTL_RECEIVE_ERROR	    (1 << 25)
14238695b612SAlan Cox #define   DP_AUX_CH_CTL_MESSAGE_SIZE_MASK    (0x1f << 20)
14248695b612SAlan Cox #define   DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT   20
14258695b612SAlan Cox #define   DP_AUX_CH_CTL_PRECHARGE_2US_MASK   (0xf << 16)
14268695b612SAlan Cox #define   DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT  16
14278695b612SAlan Cox #define   DP_AUX_CH_CTL_AUX_AKSV_SELECT	    (1 << 15)
14288695b612SAlan Cox #define   DP_AUX_CH_CTL_MANCHESTER_TEST	    (1 << 14)
14298695b612SAlan Cox #define   DP_AUX_CH_CTL_SYNC_TEST	    (1 << 13)
14308695b612SAlan Cox #define   DP_AUX_CH_CTL_DEGLITCH_TEST	    (1 << 12)
14318695b612SAlan Cox #define   DP_AUX_CH_CTL_PRECHARGE_TEST	    (1 << 11)
14328695b612SAlan Cox #define   DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK    (0x7ff)
14338695b612SAlan Cox #define   DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT   0
14348695b612SAlan Cox 
14358695b612SAlan Cox /*
14368695b612SAlan Cox  * Computing GMCH M and N values for the Display Port link
14378695b612SAlan Cox  *
14388695b612SAlan Cox  * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
14398695b612SAlan Cox  *
14408695b612SAlan Cox  * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
14418695b612SAlan Cox  *
14428695b612SAlan Cox  * The GMCH value is used internally
14438695b612SAlan Cox  *
14448695b612SAlan Cox  * bytes_per_pixel is the number of bytes coming out of the plane,
14458695b612SAlan Cox  * which is after the LUTs, so we want the bytes for our color format.
14468695b612SAlan Cox  * For our current usage, this is always 3, one byte for R, G and B.
14478695b612SAlan Cox  */
14488695b612SAlan Cox 
14498695b612SAlan Cox #define _PIPEA_GMCH_DATA_M			0x70050
14508695b612SAlan Cox #define _PIPEB_GMCH_DATA_M			0x71050
14518695b612SAlan Cox 
14528695b612SAlan Cox /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
14538695b612SAlan Cox #define   PIPE_GMCH_DATA_M_TU_SIZE_MASK		(0x3f << 25)
14548695b612SAlan Cox #define   PIPE_GMCH_DATA_M_TU_SIZE_SHIFT	25
14558695b612SAlan Cox 
14568695b612SAlan Cox #define   PIPE_GMCH_DATA_M_MASK			(0xffffff)
14578695b612SAlan Cox 
14588695b612SAlan Cox #define _PIPEA_GMCH_DATA_N			0x70054
14598695b612SAlan Cox #define _PIPEB_GMCH_DATA_N			0x71054
14608695b612SAlan Cox #define   PIPE_GMCH_DATA_N_MASK			(0xffffff)
14618695b612SAlan Cox 
14628695b612SAlan Cox /*
14638695b612SAlan Cox  * Computing Link M and N values for the Display Port link
14648695b612SAlan Cox  *
14658695b612SAlan Cox  * Link M / N = pixel_clock / ls_clk
14668695b612SAlan Cox  *
14678695b612SAlan Cox  * (the DP spec calls pixel_clock the 'strm_clk')
14688695b612SAlan Cox  *
14698695b612SAlan Cox  * The Link value is transmitted in the Main Stream
14708695b612SAlan Cox  * Attributes and VB-ID.
14718695b612SAlan Cox  */
14728695b612SAlan Cox 
14738695b612SAlan Cox #define _PIPEA_DP_LINK_M				0x70060
14748695b612SAlan Cox #define _PIPEB_DP_LINK_M				0x71060
14758695b612SAlan Cox #define   PIPEA_DP_LINK_M_MASK			(0xffffff)
14768695b612SAlan Cox 
14778695b612SAlan Cox #define _PIPEA_DP_LINK_N				0x70064
14788695b612SAlan Cox #define _PIPEB_DP_LINK_N				0x71064
14798695b612SAlan Cox #define   PIPEA_DP_LINK_N_MASK			(0xffffff)
14808695b612SAlan Cox 
14818695b612SAlan Cox #define PIPE_GMCH_DATA_M(pipe) _PIPE(pipe, _PIPEA_GMCH_DATA_M, _PIPEB_GMCH_DATA_M)
14828695b612SAlan Cox #define PIPE_GMCH_DATA_N(pipe) _PIPE(pipe, _PIPEA_GMCH_DATA_N, _PIPEB_GMCH_DATA_N)
14838695b612SAlan Cox #define PIPE_DP_LINK_M(pipe) _PIPE(pipe, _PIPEA_DP_LINK_M, _PIPEB_DP_LINK_M)
14848695b612SAlan Cox #define PIPE_DP_LINK_N(pipe) _PIPE(pipe, _PIPEA_DP_LINK_N, _PIPEB_DP_LINK_N)
148589c78134SAlan Cox 
1486d112a816SZhao Yakui #define   PIPE_BPC_MASK				(7 << 5)
1487d112a816SZhao Yakui #define   PIPE_8BPC				(0 << 5)
1488d112a816SZhao Yakui #define   PIPE_10BPC				(1 << 5)
1489d112a816SZhao Yakui #define   PIPE_6BPC				(2 << 5)
1490d112a816SZhao Yakui 
149189c78134SAlan Cox #endif
1492