drm/i915/chv: Handle video DIP registers on CHV
[pandora-kernel.git] / drivers / gpu / drm / i915 / i915_reg.h
index 5122254..242df99 100644 (file)
@@ -29,8 +29,8 @@
 #define _TRANSCODER(tran, a, b) ((a) + (tran)*((b)-(a)))
 
 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
-#define _PIPE3(pipe, a, b, c) (pipe < 2 ? _PIPE(pipe, a, b) : c)
-#define _PORT3(port, a, b, c) (port < 2 ? _PORT(port, a, b) : c)
+#define _PIPE3(pipe, a, b, c) ((pipe) == PIPE_A ? (a) : \
+                              (pipe) == PIPE_B ? (b) : (c))
 
 #define _MASKED_BIT_ENABLE(a) (((a) << 16) | (a))
 #define _MASKED_BIT_DISABLE(a) ((a) << 16)
@@ -529,6 +529,16 @@ enum punit_power_well {
 #define PUNIT_FUSE_BUS2                                0xf6 /* bits 47:40 */
 #define PUNIT_FUSE_BUS1                                0xf5 /* bits 55:48 */
 
+#define PUNIT_GPU_STATUS_REG                   0xdb
+#define PUNIT_GPU_STATUS_MAX_FREQ_SHIFT        16
+#define PUNIT_GPU_STATUS_MAX_FREQ_MASK         0xff
+#define PUNIT_GPU_STATIS_GFX_MIN_FREQ_SHIFT    8
+#define PUNIT_GPU_STATUS_GFX_MIN_FREQ_MASK     0xff
+
+#define PUNIT_GPU_DUTYCYCLE_REG                0xdf
+#define PUNIT_GPU_DUTYCYCLE_RPE_FREQ_SHIFT     8
+#define PUNIT_GPU_DUTYCYCLE_RPE_FREQ_MASK      0xff
+
 #define IOSF_NC_FB_GFX_FREQ_FUSE               0x1c
 #define   FB_GFX_MAX_FREQ_FUSE_SHIFT           3
 #define   FB_GFX_MAX_FREQ_FUSE_MASK            0x000007f8
@@ -761,6 +771,8 @@ enum punit_power_well {
 
 #define _VLV_PCS_DW8_CH0               0x8220
 #define _VLV_PCS_DW8_CH1               0x8420
+#define   CHV_PCS_USEDCLKCHANNEL_OVRRIDE       (1 << 20)
+#define   CHV_PCS_USEDCLKCHANNEL               (1 << 21)
 #define VLV_PCS_DW8(ch) _PORT(ch, _VLV_PCS_DW8_CH0, _VLV_PCS_DW8_CH1)
 
 #define _VLV_PCS01_DW8_CH0             0x0220
@@ -869,6 +881,16 @@ enum punit_power_well {
 #define   DPIO_CHV_PROP_COEFF_SHIFT    0
 #define CHV_PLL_DW6(ch) _PIPE(ch, _CHV_PLL_DW6_CH0, _CHV_PLL_DW6_CH1)
 
+#define _CHV_CMN_DW5_CH0               0x8114
+#define   CHV_BUFRIGHTENA1_DISABLE     (0 << 20)
+#define   CHV_BUFRIGHTENA1_NORMAL      (1 << 20)
+#define   CHV_BUFRIGHTENA1_FORCE       (3 << 20)
+#define   CHV_BUFRIGHTENA1_MASK                (3 << 20)
+#define   CHV_BUFLEFTENA1_DISABLE      (0 << 22)
+#define   CHV_BUFLEFTENA1_NORMAL       (1 << 22)
+#define   CHV_BUFLEFTENA1_FORCE                (3 << 22)
+#define   CHV_BUFLEFTENA1_MASK         (3 << 22)
+
 #define _CHV_CMN_DW13_CH0              0x8134
 #define _CHV_CMN_DW0_CH1               0x8080
 #define   DPIO_CHV_S1_DIV_SHIFT                21
@@ -883,8 +905,21 @@ enum punit_power_well {
 #define _CHV_CMN_DW1_CH1               0x8084
 #define   DPIO_AFC_RECAL               (1 << 14)
 #define   DPIO_DCLKP_EN                        (1 << 13)
+#define   CHV_BUFLEFTENA2_DISABLE      (0 << 17) /* CL2 DW1 only */
+#define   CHV_BUFLEFTENA2_NORMAL       (1 << 17) /* CL2 DW1 only */
+#define   CHV_BUFLEFTENA2_FORCE                (3 << 17) /* CL2 DW1 only */
+#define   CHV_BUFLEFTENA2_MASK         (3 << 17) /* CL2 DW1 only */
+#define   CHV_BUFRIGHTENA2_DISABLE     (0 << 19) /* CL2 DW1 only */
+#define   CHV_BUFRIGHTENA2_NORMAL      (1 << 19) /* CL2 DW1 only */
+#define   CHV_BUFRIGHTENA2_FORCE       (3 << 19) /* CL2 DW1 only */
+#define   CHV_BUFRIGHTENA2_MASK                (3 << 19) /* CL2 DW1 only */
 #define CHV_CMN_DW14(ch) _PIPE(ch, _CHV_CMN_DW14_CH0, _CHV_CMN_DW1_CH1)
 
+#define _CHV_CMN_DW19_CH0              0x814c
+#define _CHV_CMN_DW6_CH1               0x8098
+#define   CHV_CMN_USEDCLKCHANNEL       (1 << 13)
+#define CHV_CMN_DW19(ch) _PIPE(ch, _CHV_CMN_DW19_CH0, _CHV_CMN_DW6_CH1)
+
 #define CHV_CMN_DW30                   0x8178
 #define   DPIO_LRC_BYPASS              (1 << 3)
 
@@ -933,6 +968,7 @@ enum punit_power_well {
 #define   SANDYBRIDGE_FENCE_PITCH_SHIFT        32
 #define   GEN7_FENCE_MAX_PITCH_VAL     0x0800
 
+
 /* control register for cpu gtt access */
 #define TILECTL                                0x101000
 #define   TILECTL_SWZCTL                       (1 << 0)
@@ -1167,6 +1203,8 @@ enum punit_power_well {
 #define VLV_IMR                (VLV_DISPLAY_BASE + 0x20a8)
 #define VLV_ISR                (VLV_DISPLAY_BASE + 0x20ac)
 #define VLV_PCBR       (VLV_DISPLAY_BASE + 0x2120)
+#define VLV_PCBR_ADDR_SHIFT    12
+
 #define   DISPLAY_PLANE_FLIP_PENDING(plane) (1<<(11-(plane))) /* A and B only */
 #define EIR            0x020b0
 #define EMR            0x020b4
@@ -1179,7 +1217,7 @@ enum punit_power_well {
 #define   I915_ERROR_INSTRUCTION                       (1<<0)
 #define INSTPM         0x020c0
 #define   INSTPM_SELF_EN (1<<12) /* 915GM only */
-#define   INSTPM_AGPBUSY_DIS (1<<11) /* gen3: when disabled, pending interrupts
+#define   INSTPM_AGPBUSY_INT_EN (1<<11) /* gen3: when disabled, pending interrupts
                                        will not assert AGPBUSY# and will only
                                        be delivered when out of C3. */
 #define   INSTPM_FORCE_ORDERING                                (1<<7) /* GEN6+ */
@@ -1260,6 +1298,10 @@ enum punit_power_well {
 #define   MI_ARB_DISPLAY_PRIORITY_A_B          (0 << 0)        /* display A > display B */
 #define   MI_ARB_DISPLAY_PRIORITY_B_A          (1 << 0)        /* display B > display A */
 
+#define MI_STATE       0x020e4 /* gen2 only */
+#define   MI_AGPBUSY_INT_EN                    (1 << 1) /* 85x only */
+#define   MI_AGPBUSY_830_MODE                  (1 << 0) /* 85x only */
+
 #define CACHE_MODE_0   0x02120 /* 915+ only */
 #define   CM0_PIPELINED_RENDER_FLUSH_DISABLE (1<<8)
 #define   CM0_IZ_OPT_DISABLE      (1<<6)
@@ -1563,11 +1605,10 @@ enum punit_power_well {
 /*
  * Clock control & power management
  */
-#define DPLL_A_OFFSET 0x6014
-#define DPLL_B_OFFSET 0x6018
-#define CHV_DPLL_C_OFFSET 0x6030
-#define DPLL(pipe) (dev_priv->info.dpll_offsets[pipe] + \
-                   dev_priv->info.display_mmio_offset)
+#define _DPLL_A (dev_priv->info.display_mmio_offset + 0x6014)
+#define _DPLL_B (dev_priv->info.display_mmio_offset + 0x6018)
+#define _CHV_DPLL_C (dev_priv->info.display_mmio_offset + 0x6030)
+#define DPLL(pipe) _PIPE3((pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C)
 
 #define VGA0   0x6000
 #define VGA1   0x6004
@@ -1655,11 +1696,10 @@ enum punit_power_well {
 #define   SDVO_MULTIPLIER_SHIFT_HIRES          4
 #define   SDVO_MULTIPLIER_SHIFT_VGA            0
 
-#define DPLL_A_MD_OFFSET 0x601c /* 965+ only */
-#define DPLL_B_MD_OFFSET 0x6020 /* 965+ only */
-#define CHV_DPLL_C_MD_OFFSET 0x603c
-#define DPLL_MD(pipe) (dev_priv->info.dpll_md_offsets[pipe] + \
-                      dev_priv->info.display_mmio_offset)
+#define _DPLL_A_MD (dev_priv->info.display_mmio_offset + 0x601c)
+#define _DPLL_B_MD (dev_priv->info.display_mmio_offset + 0x6020)
+#define _CHV_DPLL_C_MD (dev_priv->info.display_mmio_offset + 0x603c)
+#define DPLL_MD(pipe) _PIPE3((pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD)
 
 /*
  * UDI pixel divider, controlling how many pixels are stuffed into a packet.
@@ -4869,8 +4909,7 @@ enum punit_power_well {
 #define _PCH_TRANSA_LINK_M2    0xe0048
 #define _PCH_TRANSA_LINK_N2    0xe004c
 
-/* Per-transcoder DIP controls */
-
+/* Per-transcoder DIP controls (PCH) */
 #define _VIDEO_DIP_CTL_A         0xe0200
 #define _VIDEO_DIP_DATA_A        0xe0208
 #define _VIDEO_DIP_GCP_A         0xe0210
@@ -4883,6 +4922,7 @@ enum punit_power_well {
 #define TVIDEO_DIP_DATA(pipe) _PIPE(pipe, _VIDEO_DIP_DATA_A, _VIDEO_DIP_DATA_B)
 #define TVIDEO_DIP_GCP(pipe) _PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B)
 
+/* Per-transcoder DIP controls (VLV) */
 #define VLV_VIDEO_DIP_CTL_A            (VLV_DISPLAY_BASE + 0x60200)
 #define VLV_VIDEO_DIP_DATA_A           (VLV_DISPLAY_BASE + 0x60208)
 #define VLV_VIDEO_DIP_GDCP_PAYLOAD_A   (VLV_DISPLAY_BASE + 0x60210)
@@ -4891,12 +4931,19 @@ enum punit_power_well {
 #define VLV_VIDEO_DIP_DATA_B           (VLV_DISPLAY_BASE + 0x61174)
 #define VLV_VIDEO_DIP_GDCP_PAYLOAD_B   (VLV_DISPLAY_BASE + 0x61178)
 
+#define CHV_VIDEO_DIP_CTL_C            (VLV_DISPLAY_BASE + 0x611f0)
+#define CHV_VIDEO_DIP_DATA_C           (VLV_DISPLAY_BASE + 0x611f4)
+#define CHV_VIDEO_DIP_GDCP_PAYLOAD_C   (VLV_DISPLAY_BASE + 0x611f8)
+
 #define VLV_TVIDEO_DIP_CTL(pipe) \
-        _PIPE(pipe, VLV_VIDEO_DIP_CTL_A, VLV_VIDEO_DIP_CTL_B)
+       _PIPE3((pipe), VLV_VIDEO_DIP_CTL_A, \
+              VLV_VIDEO_DIP_CTL_B, CHV_VIDEO_DIP_CTL_C)
 #define VLV_TVIDEO_DIP_DATA(pipe) \
-        _PIPE(pipe, VLV_VIDEO_DIP_DATA_A, VLV_VIDEO_DIP_DATA_B)
+       _PIPE3((pipe), VLV_VIDEO_DIP_DATA_A, \
+              VLV_VIDEO_DIP_DATA_B, CHV_VIDEO_DIP_DATA_C)
 #define VLV_TVIDEO_DIP_GCP(pipe) \
-       _PIPE(pipe, VLV_VIDEO_DIP_GDCP_PAYLOAD_A, VLV_VIDEO_DIP_GDCP_PAYLOAD_B)
+       _PIPE3((pipe), VLV_VIDEO_DIP_GDCP_PAYLOAD_A, \
+               VLV_VIDEO_DIP_GDCP_PAYLOAD_B, CHV_VIDEO_DIP_GDCP_PAYLOAD_C)
 
 /* Haswell DIP controls */
 #define HSW_VIDEO_DIP_CTL_A            0x60200
@@ -6407,9 +6454,5 @@ enum punit_power_well {
 /* For UMS only (deprecated): */
 #define _PALETTE_A (dev_priv->info.display_mmio_offset + 0xa000)
 #define _PALETTE_B (dev_priv->info.display_mmio_offset + 0xa800)
-#define _DPLL_A (dev_priv->info.display_mmio_offset + 0x6014)
-#define _DPLL_B (dev_priv->info.display_mmio_offset + 0x6018)
-#define _DPLL_A_MD (dev_priv->info.display_mmio_offset + 0x601c)
-#define _DPLL_B_MD (dev_priv->info.display_mmio_offset + 0x6020)
 
 #endif /* _I915_REG_H_ */