drm/i915: Parametrize fence registers
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / i915 / i915_reg.h
index 83a0888756d68402af1c4211b51372edba53f19d..d5a07906721f8937d345ecc6766ef9a5ca3b0211 100644 (file)
  */
 #define MI_LOAD_REGISTER_IMM(x)        MI_INSTR(0x22, 2*(x)-1)
 #define   MI_LRI_FORCE_POSTED          (1<<12)
-#define MI_STORE_REGISTER_MEM(x) MI_INSTR(0x24, 2*(x)-1)
-#define MI_STORE_REGISTER_MEM_GEN8(x) MI_INSTR(0x24, 3*(x)-1)
+#define MI_STORE_REGISTER_MEM        MI_INSTR(0x24, 1)
+#define MI_STORE_REGISTER_MEM_GEN8   MI_INSTR(0x24, 2)
 #define   MI_SRM_LRM_GLOBAL_GTT                (1<<22)
 #define MI_FLUSH_DW            MI_INSTR(0x26, 1) /* for GEN6 */
 #define   MI_FLUSH_DW_STORE_INDEX      (1<<21)
 #define   MI_INVALIDATE_BSD            (1<<7)
 #define   MI_FLUSH_DW_USE_GTT          (1<<2)
 #define   MI_FLUSH_DW_USE_PPGTT                (0<<2)
-#define MI_LOAD_REGISTER_MEM(x) MI_INSTR(0x29, 2*(x)-1)
-#define MI_LOAD_REGISTER_MEM_GEN8(x) MI_INSTR(0x29, 3*(x)-1)
+#define MI_LOAD_REGISTER_MEM      MI_INSTR(0x29, 1)
+#define MI_LOAD_REGISTER_MEM_GEN8  MI_INSTR(0x29, 2)
 #define MI_BATCH_BUFFER                MI_INSTR(0x30, 1)
 #define   MI_BATCH_NON_SECURE          (1)
 /* for snb/ivb/vlv this also means "batch in ppgtt" when ppgtt is enabled. */
@@ -1099,6 +1099,12 @@ enum skl_disp_power_wells {
 #define  DPIO_CHV_INT_LOCK_THRESHOLD_SEL_COARSE        1 /* 1: coarse & 0 : fine  */
 #define CHV_PLL_DW9(ch) _PIPE(ch, _CHV_PLL_DW9_CH0, _CHV_PLL_DW9_CH1)
 
+#define _CHV_CMN_DW0_CH0               0x8100
+#define   DPIO_ALLDL_POWERDOWN_SHIFT_CH0       19
+#define   DPIO_ANYDL_POWERDOWN_SHIFT_CH0       18
+#define   DPIO_ALLDL_POWERDOWN                 (1 << 1)
+#define   DPIO_ANYDL_POWERDOWN                 (1 << 0)
+
 #define _CHV_CMN_DW5_CH0               0x8114
 #define   CHV_BUFRIGHTENA1_DISABLE     (0 << 20)
 #define   CHV_BUFRIGHTENA1_NORMAL      (1 << 20)
@@ -1135,10 +1141,23 @@ enum skl_disp_power_wells {
 
 #define _CHV_CMN_DW19_CH0              0x814c
 #define _CHV_CMN_DW6_CH1               0x8098
+#define   DPIO_ALLDL_POWERDOWN_SHIFT_CH1       30 /* CL2 DW6 only */
+#define   DPIO_ANYDL_POWERDOWN_SHIFT_CH1       29 /* CL2 DW6 only */
+#define   DPIO_DYNPWRDOWNEN_CH1                (1 << 28) /* CL2 DW6 only */
 #define   CHV_CMN_USEDCLKCHANNEL       (1 << 13)
+
 #define CHV_CMN_DW19(ch) _PIPE(ch, _CHV_CMN_DW19_CH0, _CHV_CMN_DW6_CH1)
 
+#define CHV_CMN_DW28                   0x8170
+#define   DPIO_CL1POWERDOWNEN          (1 << 23)
+#define   DPIO_DYNPWRDOWNEN_CH0                (1 << 22)
+#define   DPIO_SUS_CLK_CONFIG_ON               (0 << 0)
+#define   DPIO_SUS_CLK_CONFIG_CLKREQ           (1 << 0)
+#define   DPIO_SUS_CLK_CONFIG_GATE             (2 << 0)
+#define   DPIO_SUS_CLK_CONFIG_GATE_CLKREQ      (3 << 0)
+
 #define CHV_CMN_DW30                   0x8178
+#define   DPIO_CL2_LDOFUSE_PWRENB      (1 << 6)
 #define   DPIO_LRC_BYPASS              (1 << 3)
 
 #define _TXLANE(ch, lane, offset) ((ch ? 0x2400 : 0) + \
@@ -1376,7 +1395,8 @@ enum skl_disp_power_wells {
 #define BXT_PORT_TX_DW3_LN0(port)      _PORT3(port, _PORT_TX_DW3_LN0_A,  \
                                                     _PORT_TX_DW3_LN0_B,  \
                                                     _PORT_TX_DW3_LN0_C)
-#define   UNIQE_TRANGE_EN_METHOD       (1 << 27)
+#define   SCALE_DCOMP_METHOD           (1 << 26)
+#define   UNIQUE_TRANGE_EN_METHOD      (1 << 27)
 
 #define _PORT_TX_DW4_LN0_A             0x162510
 #define _PORT_TX_DW4_LN0_B             0x6C510
@@ -1417,9 +1437,15 @@ enum skl_disp_power_wells {
 
 /*
  * Fence registers
+ * [0-7]  @ 0x2000 gen2,gen3
+ * [8-15] @ 0x3000 945,g33,pnv
+ *
+ * [0-15] @ 0x3000 gen4,gen5
+ *
+ * [0-15] @ 0x100000 gen6,vlv,chv
+ * [0-31] @ 0x100000 gen7+
  */
-#define FENCE_REG_830_0                        0x2000
-#define FENCE_REG_945_8                        0x3000
+#define FENCE_REG(i)                   (0x2000 + (((i) & 8) << 9) + ((i) & 7) * 4)
 #define   I830_FENCE_START_MASK                0x07f80000
 #define   I830_FENCE_TILING_Y_SHIFT    12
 #define   I830_FENCE_SIZE_BITS(size)   ((ffs((size) >> 19) - 1) << 8)
@@ -1432,14 +1458,16 @@ enum skl_disp_power_wells {
 #define   I915_FENCE_START_MASK                0x0ff00000
 #define   I915_FENCE_SIZE_BITS(size)   ((ffs((size) >> 20) - 1) << 8)
 
-#define FENCE_REG_965_0                        0x03000
+#define FENCE_REG_965_LO(i)            (0x03000 + (i) * 8)
+#define FENCE_REG_965_HI(i)            (0x03000 + (i) * 8 + 4)
 #define   I965_FENCE_PITCH_SHIFT       2
 #define   I965_FENCE_TILING_Y_SHIFT    1
 #define   I965_FENCE_REG_VALID         (1<<0)
 #define   I965_FENCE_MAX_PITCH_VAL     0x0400
 
-#define FENCE_REG_SANDYBRIDGE_0                0x100000
-#define   SANDYBRIDGE_FENCE_PITCH_SHIFT        32
+#define FENCE_REG_GEN6_LO(i)   (0x100000 + (i) * 8)
+#define FENCE_REG_GEN6_HI(i)   (0x100000 + (i) * 8 + 4)
+#define   GEN6_FENCE_PITCH_SHIFT       32
 #define   GEN7_FENCE_MAX_PITCH_VAL     0x0800
 
 
@@ -1508,7 +1536,7 @@ enum skl_disp_power_wells {
 #define GEN7_GFX_PEND_TLB0     0x4034
 #define GEN7_GFX_PEND_TLB1     0x4038
 /* L3, CVS, ZTLB, RCC, CASC LRA min, max values */
-#define GEN7_LRA_LIMITS_BASE   0x403C
+#define GEN7_LRA_LIMITS(i)     (0x403C + (i) * 4)
 #define GEN7_LRA_LIMITS_REG_NUM        13
 #define GEN7_MEDIA_MAX_REQ_COUNT       0x4070
 #define GEN7_GFX_MAX_REQ_COUNT         0x4074
@@ -1674,11 +1702,18 @@ enum skl_disp_power_wells {
 #define GFX_MODE_GEN7  0x0229c
 #define RING_MODE_GEN7(ring)   ((ring)->mmio_base+0x29c)
 #define   GFX_RUN_LIST_ENABLE          (1<<15)
+#define   GFX_INTERRUPT_STEERING       (1<<14)
 #define   GFX_TLB_INVALIDATE_EXPLICIT  (1<<13)
 #define   GFX_SURFACE_FAULT_ENABLE     (1<<12)
 #define   GFX_REPLAY_MODE              (1<<11)
 #define   GFX_PSMI_GRANULARITY         (1<<10)
 #define   GFX_PPGTT_ENABLE             (1<<9)
+#define   GEN8_GFX_PPGTT_48B           (1<<7)
+
+#define   GFX_FORWARD_VBLANK_MASK      (3<<5)
+#define   GFX_FORWARD_VBLANK_NEVER     (0<<5)
+#define   GFX_FORWARD_VBLANK_ALWAYS    (1<<5)
+#define   GFX_FORWARD_VBLANK_COND      (2<<5)
 
 #define VLV_DISPLAY_BASE 0x180000
 #define VLV_MIPI_BASE VLV_DISPLAY_BASE
@@ -1985,7 +2020,7 @@ enum skl_disp_power_wells {
 #define   FBC_CTL_CPU_FENCE    (1<<1)
 #define   FBC_CTL_PLANE(plane) ((plane)<<0)
 #define FBC_FENCE_OFF          0x03218 /* BSpec typo has 321Bh */
-#define FBC_TAG                        0x03300
+#define FBC_TAG(i)             (0x03300 + (i) * 4)
 
 #define FBC_STATUS2            0x43214
 #define  FBC_COMPRESSION_MASK  0x7ff
@@ -2185,16 +2220,20 @@ enum skl_disp_power_wells {
 #define DPIO_PHY_STATUS                        (VLV_DISPLAY_BASE + 0x6240)
 #define   DPLL_PORTD_READY_MASK                (0xf)
 #define DISPLAY_PHY_CONTROL (VLV_DISPLAY_BASE + 0x60100)
+#define   PHY_CH_POWER_DOWN_OVRD_EN(phy, ch)   (1 << (2*(phy)+(ch)+27))
 #define   PHY_LDO_DELAY_0NS                    0x0
 #define   PHY_LDO_DELAY_200NS                  0x1
 #define   PHY_LDO_DELAY_600NS                  0x2
 #define   PHY_LDO_SEQ_DELAY(delay, phy)                ((delay) << (2*(phy)+23))
+#define   PHY_CH_POWER_DOWN_OVRD(mask, phy, ch)        ((mask) << (8*(phy)+4*(ch)+11))
 #define   PHY_CH_SU_PSR                                0x1
 #define   PHY_CH_DEEP_PSR                      0x7
 #define   PHY_CH_POWER_MODE(mode, phy, ch)     ((mode) << (6*(phy)+3*(ch)+2))
 #define   PHY_COM_LANE_RESET_DEASSERT(phy)     (1 << (phy))
 #define DISPLAY_PHY_STATUS (VLV_DISPLAY_BASE + 0x60104)
 #define   PHY_POWERGOOD(phy)   (((phy) == DPIO_PHY0) ? (1<<31) : (1<<30))
+#define   PHY_STATUS_CMN_LDO(phy, ch)                   (1 << (6-(6*(phy)+3*(ch))))
+#define   PHY_STATUS_SPLINE_LDO(phy, ch, spline)        (1 << (8-(6*(phy)+3*(ch)+(spline))))
 
 /*
  * The i830 generation, in LVDS mode, defines P1 as the bit number set within
@@ -2464,6 +2503,11 @@ enum skl_disp_power_wells {
 
 #define MCHBAR_MIRROR_BASE_SNB 0x140000
 
+#define CTG_STOLEN_RESERVED            (MCHBAR_MIRROR_BASE + 0x34)
+#define ELK_STOLEN_RESERVED            (MCHBAR_MIRROR_BASE + 0x48)
+#define G4X_STOLEN_RESERVED_ADDR1_MASK (0xFFFF << 16)
+#define G4X_STOLEN_RESERVED_ADDR2_MASK (0xFFF << 4)
+
 /* Memory controller frequency in MCHBAR for Haswell (possible SNB+) */
 #define DCLK (MCHBAR_MIRROR_BASE_SNB + 0x5e04)
 
@@ -2544,7 +2588,7 @@ enum skl_disp_power_wells {
 #define   TSFS_INTR_MASK       0x000000ff
 
 #define CRSTANDVID             0x11100
-#define PXVFREQ_BASE           0x11110 /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
+#define PXVFREQ(i)             (0x11110 + (i) * 4) /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
 #define   PXVFREQ_PX_MASK      0x7f000000
 #define   PXVFREQ_PX_SHIFT     24
 #define VIDFREQ_BASE           0x11110
@@ -2728,8 +2772,8 @@ enum skl_disp_power_wells {
 #define CSIEW0                 0x11250
 #define CSIEW1                 0x11254
 #define CSIEW2                 0x11258
-#define PEW                    0x1125c
-#define DEW                    0x11270
+#define PEW(i)                 (0x1125c + (i) * 4) /* 5 registers */
+#define DEW(i)                 (0x11270 + (i) * 4) /* 3 registers */
 #define MCHAFE                 0x112c0
 #define CSIEC                  0x112e0
 #define DMIEC                  0x112e4
@@ -2753,8 +2797,8 @@ enum skl_disp_power_wells {
 #define EG5                    0x11624
 #define EG6                    0x11628
 #define EG7                    0x1162c
-#define PXW                    0x11664
-#define PXWL                   0x11680
+#define PXW(i)                 (0x11664 + (i) * 4) /* 4 registers */
+#define PXWL(i)                        (0x11680 + (i) * 4) /* 8 registers */
 #define LCFUSE02               0x116c0
 #define   LCFUSE_HIV_MASK      0x000000ff
 #define CSIPLL0                        0x12c10
@@ -4047,14 +4091,10 @@ enum skl_disp_power_wells {
 # define TV_CC_DATA_1_MASK             0x0000007f
 # define TV_CC_DATA_1_SHIFT            0
 
-#define TV_H_LUMA_0            0x68100
-#define TV_H_LUMA_59           0x681ec
-#define TV_H_CHROMA_0          0x68200
-#define TV_H_CHROMA_59         0x682ec
-#define TV_V_LUMA_0            0x68300
-#define TV_V_LUMA_42           0x683a8
-#define TV_V_CHROMA_0          0x68400
-#define TV_V_CHROMA_42         0x684a8
+#define TV_H_LUMA(i)           (0x68100 + (i) * 4) /* 60 registers */
+#define TV_H_CHROMA(i)         (0x68200 + (i) * 4) /* 60 registers */
+#define TV_V_LUMA(i)           (0x68300 + (i) * 4) /* 43 registers */
+#define TV_V_CHROMA(i)         (0x68400 + (i) * 4) /* 43 registers */
 
 /* Display Port */
 #define DP_A                           0x64000 /* eDP */
@@ -4107,6 +4147,7 @@ enum skl_disp_power_wells {
 /* How many wires to use. I guess 3 was too hard */
 #define   DP_PORT_WIDTH(width)         (((width) - 1) << 19)
 #define   DP_PORT_WIDTH_MASK           (7 << 19)
+#define   DP_PORT_WIDTH_SHIFT          19
 
 /* Mystic DPCD version 1.1 special mode */
 #define   DP_ENHANCED_FRAMING          (1 << 18)
@@ -4617,6 +4658,7 @@ enum skl_disp_power_wells {
 
 #define CBR1_VLV                       (VLV_DISPLAY_BASE + 0x70400)
 #define  CBR_PND_DEADLINE_DISABLE      (1<<31)
+#define  CBR_PWM_CLOCK_MUX_SELECT      (1<<30)
 
 /* FIFO watermark sizes etc */
 #define G4X_FIFO_LINE_SIZE     64
@@ -5363,15 +5405,17 @@ enum skl_disp_power_wells {
 
 #define CPU_VGACNTRL   0x41000
 
-#define DIGITAL_PORT_HOTPLUG_CNTRL      0x44030
-#define  DIGITAL_PORTA_HOTPLUG_ENABLE           (1 << 4)
-#define  DIGITAL_PORTA_SHORT_PULSE_2MS          (0 << 2)
-#define  DIGITAL_PORTA_SHORT_PULSE_4_5MS        (1 << 2)
-#define  DIGITAL_PORTA_SHORT_PULSE_6MS          (2 << 2)
-#define  DIGITAL_PORTA_SHORT_PULSE_100MS        (3 << 2)
-#define  DIGITAL_PORTA_NO_DETECT                (0 << 0)
-#define  DIGITAL_PORTA_LONG_PULSE_DETECT_MASK   (1 << 1)
-#define  DIGITAL_PORTA_SHORT_PULSE_DETECT_MASK  (1 << 0)
+#define DIGITAL_PORT_HOTPLUG_CNTRL     0x44030
+#define  DIGITAL_PORTA_HOTPLUG_ENABLE          (1 << 4)
+#define  DIGITAL_PORTA_PULSE_DURATION_2ms      (0 << 2) /* pre-HSW */
+#define  DIGITAL_PORTA_PULSE_DURATION_4_5ms    (1 << 2) /* pre-HSW */
+#define  DIGITAL_PORTA_PULSE_DURATION_6ms      (2 << 2) /* pre-HSW */
+#define  DIGITAL_PORTA_PULSE_DURATION_100ms    (3 << 2) /* pre-HSW */
+#define  DIGITAL_PORTA_PULSE_DURATION_MASK     (3 << 2) /* pre-HSW */
+#define  DIGITAL_PORTA_HOTPLUG_STATUS_MASK     (3 << 0)
+#define  DIGITAL_PORTA_HOTPLUG_NO_DETECT       (0 << 0)
+#define  DIGITAL_PORTA_HOTPLUG_SHORT_DETECT    (1 << 0)
+#define  DIGITAL_PORTA_HOTPLUG_LONG_DETECT     (2 << 0)
 
 /* refresh rate hardware control */
 #define RR_HW_CTL       0x45300
@@ -5693,11 +5737,12 @@ enum skl_disp_power_wells {
 #define GEN8_GT_IIR(which) (0x44308 + (0x10 * (which)))
 #define GEN8_GT_IER(which) (0x4430c + (0x10 * (which)))
 
-#define GEN8_BCS_IRQ_SHIFT 16
 #define GEN8_RCS_IRQ_SHIFT 0
-#define GEN8_VCS2_IRQ_SHIFT 16
+#define GEN8_BCS_IRQ_SHIFT 16
 #define GEN8_VCS1_IRQ_SHIFT 0
+#define GEN8_VCS2_IRQ_SHIFT 16
 #define GEN8_VECS_IRQ_SHIFT 0
+#define GEN8_WD_IRQ_SHIFT 16
 
 #define GEN8_DE_PIPE_ISR(pipe) (0x44400 + (0x10 * (pipe)))
 #define GEN8_DE_PIPE_IMR(pipe) (0x44404 + (0x10 * (pipe)))
@@ -5763,21 +5808,6 @@ enum skl_disp_power_wells {
 #define GEN8_PCU_IIR 0x444e8
 #define GEN8_PCU_IER 0x444ec
 
-/* BXT hotplug control */
-#define BXT_HOTPLUG_CTL                        0xC4030
-#define   BXT_DDIA_HPD_ENABLE          (1 << 28)
-#define   BXT_DDIA_HPD_STATUS          (3 << 24)
-#define   BXT_DDIC_HPD_ENABLE          (1 << 12)
-#define   BXT_DDIC_HPD_STATUS          (3 << 8)
-#define   BXT_DDIB_HPD_ENABLE          (1 << 4)
-#define   BXT_DDIB_HPD_STATUS          (3 << 0)
-#define   BXT_HOTPLUG_CTL_MASK         (BXT_DDIA_HPD_ENABLE | \
-                                        BXT_DDIB_HPD_ENABLE | \
-                                        BXT_DDIC_HPD_ENABLE)
-#define   BXT_HPD_STATUS_MASK          (BXT_DDIA_HPD_STATUS | \
-                                        BXT_DDIB_HPD_STATUS | \
-                                        BXT_DDIC_HPD_STATUS)
-
 #define ILK_DISPLAY_CHICKEN2   0x42004
 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
 #define  ILK_ELPIN_409_SELECT  (1 << 25)
@@ -5950,6 +5980,7 @@ enum skl_disp_power_wells {
 #define SDE_AUXB_CPT           (1 << 25)
 #define SDE_AUX_MASK_CPT       (7 << 25)
 #define SDE_PORTE_HOTPLUG_SPT  (1 << 25)
+#define SDE_PORTA_HOTPLUG_SPT  (1 << 24)
 #define SDE_PORTD_HOTPLUG_CPT  (1 << 23)
 #define SDE_PORTC_HOTPLUG_CPT  (1 << 22)
 #define SDE_PORTB_HOTPLUG_CPT  (1 << 21)
@@ -5963,7 +5994,8 @@ enum skl_disp_power_wells {
 #define SDE_HOTPLUG_MASK_SPT   (SDE_PORTE_HOTPLUG_SPT |        \
                                 SDE_PORTD_HOTPLUG_CPT |        \
                                 SDE_PORTC_HOTPLUG_CPT |        \
-                                SDE_PORTB_HOTPLUG_CPT)
+                                SDE_PORTB_HOTPLUG_CPT |        \
+                                SDE_PORTA_HOTPLUG_SPT)
 #define SDE_GMBUS_CPT          (1 << 17)
 #define SDE_ERROR_CPT          (1 << 16)
 #define SDE_AUDIO_CP_REQ_C_CPT (1 << 10)
@@ -5998,46 +6030,46 @@ enum skl_disp_power_wells {
 #define  SERR_INT_TRANS_FIFO_UNDERRUN(pipe)    (1<<(pipe*3))
 
 /* digital port hotplug */
-#define PCH_PORT_HOTPLUG        0xc4030                /* SHOTPLUG_CTL */
-#define BXT_PORTA_HOTPLUG_ENABLE       (1 << 28)
-#define BXT_PORTA_HOTPLUG_STATUS_MASK  (0x3 << 24)
-#define  BXT_PORTA_HOTPLUG_NO_DETECT   (0 << 24)
-#define  BXT_PORTA_HOTPLUG_SHORT_DETECT        (1 << 24)
-#define  BXT_PORTA_HOTPLUG_LONG_DETECT (2 << 24)
-#define PORTD_HOTPLUG_ENABLE            (1 << 20)
-#define PORTD_PULSE_DURATION_2ms        (0)
-#define PORTD_PULSE_DURATION_4_5ms      (1 << 18)
-#define PORTD_PULSE_DURATION_6ms        (2 << 18)
-#define PORTD_PULSE_DURATION_100ms      (3 << 18)
-#define PORTD_PULSE_DURATION_MASK      (3 << 18)
-#define PORTD_HOTPLUG_STATUS_MASK      (0x3 << 16)
+#define PCH_PORT_HOTPLUG               0xc4030 /* SHOTPLUG_CTL */
+#define  PORTA_HOTPLUG_ENABLE          (1 << 28) /* LPT:LP+ & BXT */
+#define  PORTA_HOTPLUG_STATUS_MASK     (3 << 24) /* SPT+ & BXT */
+#define  PORTA_HOTPLUG_NO_DETECT       (0 << 24) /* SPT+ & BXT */
+#define  PORTA_HOTPLUG_SHORT_DETECT    (1 << 24) /* SPT+ & BXT */
+#define  PORTA_HOTPLUG_LONG_DETECT     (2 << 24) /* SPT+ & BXT */
+#define  PORTD_HOTPLUG_ENABLE          (1 << 20)
+#define  PORTD_PULSE_DURATION_2ms      (0 << 18) /* pre-LPT */
+#define  PORTD_PULSE_DURATION_4_5ms    (1 << 18) /* pre-LPT */
+#define  PORTD_PULSE_DURATION_6ms      (2 << 18) /* pre-LPT */
+#define  PORTD_PULSE_DURATION_100ms    (3 << 18) /* pre-LPT */
+#define  PORTD_PULSE_DURATION_MASK     (3 << 18) /* pre-LPT */
+#define  PORTD_HOTPLUG_STATUS_MASK     (3 << 16)
 #define  PORTD_HOTPLUG_NO_DETECT       (0 << 16)
 #define  PORTD_HOTPLUG_SHORT_DETECT    (1 << 16)
 #define  PORTD_HOTPLUG_LONG_DETECT     (2 << 16)
-#define PORTC_HOTPLUG_ENABLE            (1 << 12)
-#define PORTC_PULSE_DURATION_2ms        (0)
-#define PORTC_PULSE_DURATION_4_5ms      (1 << 10)
-#define PORTC_PULSE_DURATION_6ms        (2 << 10)
-#define PORTC_PULSE_DURATION_100ms      (3 << 10)
-#define PORTC_PULSE_DURATION_MASK      (3 << 10)
-#define PORTC_HOTPLUG_STATUS_MASK      (0x3 << 8)
+#define  PORTC_HOTPLUG_ENABLE          (1 << 12)
+#define  PORTC_PULSE_DURATION_2ms      (0 << 10) /* pre-LPT */
+#define  PORTC_PULSE_DURATION_4_5ms    (1 << 10) /* pre-LPT */
+#define  PORTC_PULSE_DURATION_6ms      (2 << 10) /* pre-LPT */
+#define  PORTC_PULSE_DURATION_100ms    (3 << 10) /* pre-LPT */
+#define  PORTC_PULSE_DURATION_MASK     (3 << 10) /* pre-LPT */
+#define  PORTC_HOTPLUG_STATUS_MASK     (3 << 8)
 #define  PORTC_HOTPLUG_NO_DETECT       (0 << 8)
 #define  PORTC_HOTPLUG_SHORT_DETECT    (1 << 8)
 #define  PORTC_HOTPLUG_LONG_DETECT     (2 << 8)
-#define PORTB_HOTPLUG_ENABLE            (1 << 4)
-#define PORTB_PULSE_DURATION_2ms        (0)
-#define PORTB_PULSE_DURATION_4_5ms      (1 << 2)
-#define PORTB_PULSE_DURATION_6ms        (2 << 2)
-#define PORTB_PULSE_DURATION_100ms      (3 << 2)
-#define PORTB_PULSE_DURATION_MASK      (3 << 2)
-#define PORTB_HOTPLUG_STATUS_MASK      (0x3 << 0)
+#define  PORTB_HOTPLUG_ENABLE          (1 << 4)
+#define  PORTB_PULSE_DURATION_2ms      (0 << 2) /* pre-LPT */
+#define  PORTB_PULSE_DURATION_4_5ms    (1 << 2) /* pre-LPT */
+#define  PORTB_PULSE_DURATION_6ms      (2 << 2) /* pre-LPT */
+#define  PORTB_PULSE_DURATION_100ms    (3 << 2) /* pre-LPT */
+#define  PORTB_PULSE_DURATION_MASK     (3 << 2) /* pre-LPT */
+#define  PORTB_HOTPLUG_STATUS_MASK     (3 << 0)
 #define  PORTB_HOTPLUG_NO_DETECT       (0 << 0)
 #define  PORTB_HOTPLUG_SHORT_DETECT    (1 << 0)
 #define  PORTB_HOTPLUG_LONG_DETECT     (2 << 0)
 
-#define PCH_PORT_HOTPLUG2        0xc403C               /* SHOTPLUG_CTL2 */
-#define PORTE_HOTPLUG_ENABLE            (1 << 4)
-#define PORTE_HOTPLUG_STATUS_MASK      (0x3 << 0)
+#define PCH_PORT_HOTPLUG2              0xc403C /* SHOTPLUG_CTL2 SPT+ */
+#define  PORTE_HOTPLUG_ENABLE          (1 << 4)
+#define  PORTE_HOTPLUG_STATUS_MASK     (3 << 0)
 #define  PORTE_HOTPLUG_NO_DETECT       (0 << 0)
 #define  PORTE_HOTPLUG_SHORT_DETECT    (1 << 0)
 #define  PORTE_HOTPLUG_LONG_DETECT     (2 << 0)
@@ -6304,9 +6336,11 @@ enum skl_disp_power_wells {
 #define  FDI_PHASE_SYNC_OVR(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_OVR - ((pipe) * 2)))
 #define  FDI_PHASE_SYNC_EN(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_EN - ((pipe) * 2)))
 #define  FDI_BC_BIFURCATION_SELECT     (1 << 12)
+#define  SPT_PWM_GRANULARITY           (1<<0)
 #define SOUTH_CHICKEN2         0xc2004
 #define  FDI_MPHY_IOSFSB_RESET_STATUS  (1<<13)
 #define  FDI_MPHY_IOSFSB_RESET_CTL     (1<<12)
+#define  LPT_PWM_GRANULARITY           (1<<5)
 #define  DPLS_EDP_PPS_FIX_DIS          (1<<0)
 
 #define _FDI_RXA_CHICKEN         0xc200c
@@ -6784,7 +6818,7 @@ enum skl_disp_power_wells {
                                                 GEN6_PM_RP_DOWN_THRESHOLD | \
                                                 GEN6_PM_RP_DOWN_TIMEOUT)
 
-#define GEN7_GT_SCRATCH_BASE                   0x4F100
+#define GEN7_GT_SCRATCH(i)                     (0x4F100 + (i) * 4)
 #define GEN7_GT_SCRATCH_REG_NUM                        8
 
 #define VLV_GTLC_SURVIVABILITY_REG              0x130098
@@ -6870,7 +6904,10 @@ enum skl_disp_power_wells {
 #define   GEN9_PGCTL_SSB_EU311_ACK     (1 << 14)
 
 #define GEN7_MISCCPCTL                 (0x9424)
-#define   GEN7_DOP_CLOCK_GATE_ENABLE   (1<<0)
+#define   GEN7_DOP_CLOCK_GATE_ENABLE           (1<<0)
+#define   GEN8_DOP_CLOCK_GATE_CFCLK_ENABLE     (1<<2)
+#define   GEN8_DOP_CLOCK_GATE_GUC_ENABLE       (1<<4)
+#define   GEN8_DOP_CLOCK_GATE_MEDIA_ENABLE     (1<<6)
 
 #define GEN8_GARBCNTL                   0xB004
 #define   GEN9_GAPS_TSV_CREDIT_DISABLE  (1<<7)
@@ -6916,6 +6953,9 @@ enum skl_disp_power_wells {
 #define HSW_ROW_CHICKEN3               0xe49c
 #define  HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE    (1 << 6)
 
+#define HALF_SLICE_CHICKEN2            0xe180
+#define   GEN8_ST_PO_DISABLE           (1<<13)
+
 #define HALF_SLICE_CHICKEN3            0xe184
 #define   HSW_SAMPLE_C_PERFORMANCE     (1<<9)
 #define   GEN8_CENTROID_PIXEL_OPT_DIS  (1<<8)
@@ -7159,12 +7199,15 @@ enum skl_disp_power_wells {
 #define  DDI_BUF_IS_IDLE                       (1<<7)
 #define  DDI_A_4_LANES                         (1<<4)
 #define  DDI_PORT_WIDTH(width)                 (((width) - 1) << 1)
+#define  DDI_PORT_WIDTH_MASK                   (7 << 1)
+#define  DDI_PORT_WIDTH_SHIFT                  1
 #define  DDI_INIT_DISPLAY_DETECTED             (1<<0)
 
 /* DDI Buffer Translations */
 #define DDI_BUF_TRANS_A                                0x64E00
 #define DDI_BUF_TRANS_B                                0x64E60
-#define DDI_BUF_TRANS(port) _PORT(port, DDI_BUF_TRANS_A, DDI_BUF_TRANS_B)
+#define DDI_BUF_TRANS_LO(port, i) (_PORT(port, DDI_BUF_TRANS_A, DDI_BUF_TRANS_B) + (i) * 8)
+#define DDI_BUF_TRANS_HI(port, i) (_PORT(port, DDI_BUF_TRANS_A, DDI_BUF_TRANS_B) + (i) * 8 + 4)
 
 /* Sideband Interface (SBI) is programmed indirectly, via
  * SBI_ADDR, which contains the register offset; and SBI_DATA,
@@ -7475,6 +7518,44 @@ enum skl_disp_power_wells {
 
 #define _MIPI_PORT(port, a, c) _PORT3(port, a, 0, c)   /* ports A and C only */
 
+/* BXT MIPI mode configure */
+#define  _BXT_MIPIA_TRANS_HACTIVE                      0x6B0F8
+#define  _BXT_MIPIC_TRANS_HACTIVE                      0x6B8F8
+#define  BXT_MIPI_TRANS_HACTIVE(tc)    _MIPI_PORT(tc, \
+               _BXT_MIPIA_TRANS_HACTIVE, _BXT_MIPIC_TRANS_HACTIVE)
+
+#define  _BXT_MIPIA_TRANS_VACTIVE                      0x6B0FC
+#define  _BXT_MIPIC_TRANS_VACTIVE                      0x6B8FC
+#define  BXT_MIPI_TRANS_VACTIVE(tc)    _MIPI_PORT(tc, \
+               _BXT_MIPIA_TRANS_VACTIVE, _BXT_MIPIC_TRANS_VACTIVE)
+
+#define  _BXT_MIPIA_TRANS_VTOTAL                       0x6B100
+#define  _BXT_MIPIC_TRANS_VTOTAL                       0x6B900
+#define  BXT_MIPI_TRANS_VTOTAL(tc)     _MIPI_PORT(tc, \
+               _BXT_MIPIA_TRANS_VTOTAL, _BXT_MIPIC_TRANS_VTOTAL)
+
+#define BXT_DSI_PLL_CTL                        0x161000
+#define  BXT_DSI_PLL_PVD_RATIO_SHIFT   16
+#define  BXT_DSI_PLL_PVD_RATIO_MASK    (3 << BXT_DSI_PLL_PVD_RATIO_SHIFT)
+#define  BXT_DSI_PLL_PVD_RATIO_1       (1 << BXT_DSI_PLL_PVD_RATIO_SHIFT)
+#define  BXT_DSIC_16X_BY2              (1 << 10)
+#define  BXT_DSIC_16X_BY3              (2 << 10)
+#define  BXT_DSIC_16X_BY4              (3 << 10)
+#define  BXT_DSIA_16X_BY2              (1 << 8)
+#define  BXT_DSIA_16X_BY3              (2 << 8)
+#define  BXT_DSIA_16X_BY4              (3 << 8)
+#define  BXT_DSI_FREQ_SEL_SHIFT                8
+#define  BXT_DSI_FREQ_SEL_MASK         (0xF << BXT_DSI_FREQ_SEL_SHIFT)
+
+#define BXT_DSI_PLL_RATIO_MAX          0x7D
+#define BXT_DSI_PLL_RATIO_MIN          0x22
+#define BXT_DSI_PLL_RATIO_MASK         0xFF
+#define BXT_REF_CLOCK_KHZ              19500
+
+#define BXT_DSI_PLL_ENABLE             0x46080
+#define  BXT_DSI_PLL_DO_ENABLE         (1 << 31)
+#define  BXT_DSI_PLL_LOCKED            (1 << 30)
+
 #define _MIPIA_PORT_CTRL                       (VLV_DISPLAY_BASE + 0x61190)
 #define _MIPIC_PORT_CTRL                       (VLV_DISPLAY_BASE + 0x61700)
 #define MIPI_PORT_CTRL(port)   _MIPI_PORT(port, _MIPIA_PORT_CTRL, _MIPIC_PORT_CTRL)
@@ -7888,6 +7969,11 @@ enum skl_disp_power_wells {
 #define  READ_REQUEST_PRIORITY_HIGH                    (3 << 3)
 #define  RGB_FLIP_TO_BGR                               (1 << 2)
 
+#define  BXT_PIPE_SELECT_MASK                          (7 << 7)
+#define  BXT_PIPE_SELECT_C                             (2 << 7)
+#define  BXT_PIPE_SELECT_B                             (1 << 7)
+#define  BXT_PIPE_SELECT_A                             (0 << 7)
+
 #define _MIPIA_DATA_ADDRESS            (dev_priv->mipi_mmio_base + 0xb108)
 #define _MIPIC_DATA_ADDRESS            (dev_priv->mipi_mmio_base + 0xb908)
 #define MIPI_DATA_ADDRESS(port)                _MIPI_PORT(port, _MIPIA_DATA_ADDRESS, \