aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_reg.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_reg.h')
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h238
1 files changed, 221 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 4bfd7a9bd75f..0424e45f88db 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -139,19 +139,35 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
139 return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG); 139 return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
140} 140}
141 141
142/*
143 * Given the first two numbers __a and __b of arbitrarily many evenly spaced
144 * numbers, pick the 0-based __index'th value.
145 *
146 * Always prefer this over _PICK() if the numbers are evenly spaced.
147 */
148#define _PICK_EVEN(__index, __a, __b) ((__a) + (__index) * ((__b) - (__a)))
149
150/*
151 * Given the arbitrary numbers in varargs, pick the 0-based __index'th number.
152 *
153 * Always prefer _PICK_EVEN() over this if the numbers are evenly spaced.
154 */
142#define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index]) 155#define _PICK(__index, ...) (((const u32 []){ __VA_ARGS__ })[__index])
143 156
144#define _PIPE(pipe, a, b) ((a) + (pipe) * ((b) - (a))) 157/*
158 * Named helper wrappers around _PICK_EVEN() and _PICK().
159 */
160#define _PIPE(pipe, a, b) _PICK_EVEN(pipe, a, b)
145#define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b)) 161#define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
146#define _PLANE(plane, a, b) _PIPE(plane, a, b) 162#define _PLANE(plane, a, b) _PICK_EVEN(plane, a, b)
147#define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b) 163#define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
148#define _TRANS(tran, a, b) ((a) + (tran) * ((b) - (a))) 164#define _TRANS(tran, a, b) _PICK_EVEN(tran, a, b)
149#define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b)) 165#define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
150#define _PORT(port, a, b) ((a) + (port) * ((b) - (a))) 166#define _PORT(port, a, b) _PICK_EVEN(port, a, b)
151#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b)) 167#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
152#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c)) 168#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
153#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c)) 169#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))
154#define _PLL(pll, a, b) ((a) + (pll) * ((b) - (a))) 170#define _PLL(pll, a, b) _PICK_EVEN(pll, a, b)
155#define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b)) 171#define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
156#define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__) 172#define _PHY3(phy, ...) _PICK(phy, __VA_ARGS__)
157#define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c)) 173#define _MMIO_PHY3(phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
@@ -1045,13 +1061,13 @@ enum i915_power_well_id {
1045 1061
1046 /* 1062 /*
1047 * HSW/BDW 1063 * HSW/BDW
1048 * - HSW_PWR_WELL_CTL_DRIVER(0) (status bit: id*2, req bit: id*2+1) 1064 * - _HSW_PWR_WELL_CTL1-4 (status bit: id*2, req bit: id*2+1)
1049 */ 1065 */
1050 HSW_DISP_PW_GLOBAL = 15, 1066 HSW_DISP_PW_GLOBAL = 15,
1051 1067
1052 /* 1068 /*
1053 * GEN9+ 1069 * GEN9+
1054 * - HSW_PWR_WELL_CTL_DRIVER(0) (status bit: id*2, req bit: id*2+1) 1070 * - _HSW_PWR_WELL_CTL1-4 (status bit: id*2, req bit: id*2+1)
1055 */ 1071 */
1056 SKL_DISP_PW_MISC_IO = 0, 1072 SKL_DISP_PW_MISC_IO = 0,
1057 SKL_DISP_PW_DDI_A_E, 1073 SKL_DISP_PW_DDI_A_E,
@@ -1075,17 +1091,54 @@ enum i915_power_well_id {
1075 SKL_DISP_PW_2, 1091 SKL_DISP_PW_2,
1076 1092
1077 /* - custom power wells */ 1093 /* - custom power wells */
1078 SKL_DISP_PW_DC_OFF,
1079 BXT_DPIO_CMN_A, 1094 BXT_DPIO_CMN_A,
1080 BXT_DPIO_CMN_BC, 1095 BXT_DPIO_CMN_BC,
1081 GLK_DPIO_CMN_C, /* 19 */ 1096 GLK_DPIO_CMN_C, /* 18 */
1097
1098 /*
1099 * GEN11+
1100 * - _HSW_PWR_WELL_CTL1-4
1101 * (status bit: (id&15)*2, req bit:(id&15)*2+1)
1102 */
1103 ICL_DISP_PW_1 = 0,
1104 ICL_DISP_PW_2,
1105 ICL_DISP_PW_3,
1106 ICL_DISP_PW_4,
1107
1108 /*
1109 * - _HSW_PWR_WELL_CTL_AUX1/2/4
1110 * (status bit: (id&15)*2, req bit:(id&15)*2+1)
1111 */
1112 ICL_DISP_PW_AUX_A = 16,
1113 ICL_DISP_PW_AUX_B,
1114 ICL_DISP_PW_AUX_C,
1115 ICL_DISP_PW_AUX_D,
1116 ICL_DISP_PW_AUX_E,
1117 ICL_DISP_PW_AUX_F,
1118
1119 ICL_DISP_PW_AUX_TBT1 = 24,
1120 ICL_DISP_PW_AUX_TBT2,
1121 ICL_DISP_PW_AUX_TBT3,
1122 ICL_DISP_PW_AUX_TBT4,
1123
1124 /*
1125 * - _HSW_PWR_WELL_CTL_DDI1/2/4
1126 * (status bit: (id&15)*2, req bit:(id&15)*2+1)
1127 */
1128 ICL_DISP_PW_DDI_A = 32,
1129 ICL_DISP_PW_DDI_B,
1130 ICL_DISP_PW_DDI_C,
1131 ICL_DISP_PW_DDI_D,
1132 ICL_DISP_PW_DDI_E,
1133 ICL_DISP_PW_DDI_F, /* 37 */
1082 1134
1083 /* 1135 /*
1084 * Multiple platforms. 1136 * Multiple platforms.
1085 * Must start following the highest ID of any platform. 1137 * Must start following the highest ID of any platform.
1086 * - custom power wells 1138 * - custom power wells
1087 */ 1139 */
1088 I915_DISP_PW_ALWAYS_ON = 20, 1140 SKL_DISP_PW_DC_OFF = 38,
1141 I915_DISP_PW_ALWAYS_ON,
1089}; 1142};
1090 1143
1091#define PUNIT_REG_PWRGT_CTRL 0x60 1144#define PUNIT_REG_PWRGT_CTRL 0x60
@@ -1667,6 +1720,26 @@ enum i915_power_well_id {
1667#define ICL_PORT_CL_DW5(port) _MMIO_PORT(port, _ICL_PORT_CL_DW5_A, \ 1720#define ICL_PORT_CL_DW5(port) _MMIO_PORT(port, _ICL_PORT_CL_DW5_A, \
1668 _ICL_PORT_CL_DW5_B) 1721 _ICL_PORT_CL_DW5_B)
1669 1722
1723#define _CNL_PORT_CL_DW10_A 0x162028
1724#define _ICL_PORT_CL_DW10_B 0x6c028
1725#define ICL_PORT_CL_DW10(port) _MMIO_PORT(port, \
1726 _CNL_PORT_CL_DW10_A, \
1727 _ICL_PORT_CL_DW10_B)
1728#define PG_SEQ_DELAY_OVERRIDE_MASK (3 << 25)
1729#define PG_SEQ_DELAY_OVERRIDE_SHIFT 25
1730#define PG_SEQ_DELAY_OVERRIDE_ENABLE (1 << 24)
1731#define PWR_UP_ALL_LANES (0x0 << 4)
1732#define PWR_DOWN_LN_3_2_1 (0xe << 4)
1733#define PWR_DOWN_LN_3_2 (0xc << 4)
1734#define PWR_DOWN_LN_3 (0x8 << 4)
1735#define PWR_DOWN_LN_2_1_0 (0x7 << 4)
1736#define PWR_DOWN_LN_1_0 (0x3 << 4)
1737#define PWR_DOWN_LN_1 (0x2 << 4)
1738#define PWR_DOWN_LN_3_1 (0xa << 4)
1739#define PWR_DOWN_LN_3_1_0 (0xb << 4)
1740#define PWR_DOWN_LN_MASK (0xf << 4)
1741#define PWR_DOWN_LN_SHIFT 4
1742
1670#define _PORT_CL1CM_DW9_A 0x162024 1743#define _PORT_CL1CM_DW9_A 0x162024
1671#define _PORT_CL1CM_DW9_BC 0x6C024 1744#define _PORT_CL1CM_DW9_BC 0x6C024
1672#define IREF0RC_OFFSET_SHIFT 8 1745#define IREF0RC_OFFSET_SHIFT 8
@@ -1679,6 +1752,13 @@ enum i915_power_well_id {
1679#define IREF1RC_OFFSET_MASK (0xFF << IREF1RC_OFFSET_SHIFT) 1752#define IREF1RC_OFFSET_MASK (0xFF << IREF1RC_OFFSET_SHIFT)
1680#define BXT_PORT_CL1CM_DW10(phy) _BXT_PHY((phy), _PORT_CL1CM_DW10_BC) 1753#define BXT_PORT_CL1CM_DW10(phy) _BXT_PHY((phy), _PORT_CL1CM_DW10_BC)
1681 1754
1755#define _ICL_PORT_CL_DW12_A 0x162030
1756#define _ICL_PORT_CL_DW12_B 0x6C030
1757#define ICL_LANE_ENABLE_AUX (1 << 0)
1758#define ICL_PORT_CL_DW12(port) _MMIO_PORT((port), \
1759 _ICL_PORT_CL_DW12_A, \
1760 _ICL_PORT_CL_DW12_B)
1761
1682#define _PORT_CL1CM_DW28_A 0x162070 1762#define _PORT_CL1CM_DW28_A 0x162070
1683#define _PORT_CL1CM_DW28_BC 0x6C070 1763#define _PORT_CL1CM_DW28_BC 0x6C070
1684#define OCL1_POWER_DOWN_EN (1 << 23) 1764#define OCL1_POWER_DOWN_EN (1 << 23)
@@ -1716,16 +1796,22 @@ enum i915_power_well_id {
1716 _CNL_PORT_PCS_DW1_LN0_D, \ 1796 _CNL_PORT_PCS_DW1_LN0_D, \
1717 _CNL_PORT_PCS_DW1_LN0_AE, \ 1797 _CNL_PORT_PCS_DW1_LN0_AE, \
1718 _CNL_PORT_PCS_DW1_LN0_F)) 1798 _CNL_PORT_PCS_DW1_LN0_F))
1799
1719#define _ICL_PORT_PCS_DW1_GRP_A 0x162604 1800#define _ICL_PORT_PCS_DW1_GRP_A 0x162604
1720#define _ICL_PORT_PCS_DW1_GRP_B 0x6C604 1801#define _ICL_PORT_PCS_DW1_GRP_B 0x6C604
1721#define _ICL_PORT_PCS_DW1_LN0_A 0x162804 1802#define _ICL_PORT_PCS_DW1_LN0_A 0x162804
1722#define _ICL_PORT_PCS_DW1_LN0_B 0x6C804 1803#define _ICL_PORT_PCS_DW1_LN0_B 0x6C804
1804#define _ICL_PORT_PCS_DW1_AUX_A 0x162304
1805#define _ICL_PORT_PCS_DW1_AUX_B 0x6c304
1723#define ICL_PORT_PCS_DW1_GRP(port) _MMIO_PORT(port,\ 1806#define ICL_PORT_PCS_DW1_GRP(port) _MMIO_PORT(port,\
1724 _ICL_PORT_PCS_DW1_GRP_A, \ 1807 _ICL_PORT_PCS_DW1_GRP_A, \
1725 _ICL_PORT_PCS_DW1_GRP_B) 1808 _ICL_PORT_PCS_DW1_GRP_B)
1726#define ICL_PORT_PCS_DW1_LN0(port) _MMIO_PORT(port, \ 1809#define ICL_PORT_PCS_DW1_LN0(port) _MMIO_PORT(port, \
1727 _ICL_PORT_PCS_DW1_LN0_A, \ 1810 _ICL_PORT_PCS_DW1_LN0_A, \
1728 _ICL_PORT_PCS_DW1_LN0_B) 1811 _ICL_PORT_PCS_DW1_LN0_B)
1812#define ICL_PORT_PCS_DW1_AUX(port) _MMIO_PORT(port, \
1813 _ICL_PORT_PCS_DW1_AUX_A, \
1814 _ICL_PORT_PCS_DW1_AUX_B)
1729#define COMMON_KEEPER_EN (1 << 26) 1815#define COMMON_KEEPER_EN (1 << 26)
1730 1816
1731/* CNL Port TX registers */ 1817/* CNL Port TX registers */
@@ -1762,16 +1848,23 @@ enum i915_power_well_id {
1762#define _ICL_PORT_TX_DW2_GRP_B 0x6C688 1848#define _ICL_PORT_TX_DW2_GRP_B 0x6C688
1763#define _ICL_PORT_TX_DW2_LN0_A 0x162888 1849#define _ICL_PORT_TX_DW2_LN0_A 0x162888
1764#define _ICL_PORT_TX_DW2_LN0_B 0x6C888 1850#define _ICL_PORT_TX_DW2_LN0_B 0x6C888
1851#define _ICL_PORT_TX_DW2_AUX_A 0x162388
1852#define _ICL_PORT_TX_DW2_AUX_B 0x6c388
1765#define ICL_PORT_TX_DW2_GRP(port) _MMIO_PORT(port, \ 1853#define ICL_PORT_TX_DW2_GRP(port) _MMIO_PORT(port, \
1766 _ICL_PORT_TX_DW2_GRP_A, \ 1854 _ICL_PORT_TX_DW2_GRP_A, \
1767 _ICL_PORT_TX_DW2_GRP_B) 1855 _ICL_PORT_TX_DW2_GRP_B)
1768#define ICL_PORT_TX_DW2_LN0(port) _MMIO_PORT(port, \ 1856#define ICL_PORT_TX_DW2_LN0(port) _MMIO_PORT(port, \
1769 _ICL_PORT_TX_DW2_LN0_A, \ 1857 _ICL_PORT_TX_DW2_LN0_A, \
1770 _ICL_PORT_TX_DW2_LN0_B) 1858 _ICL_PORT_TX_DW2_LN0_B)
1859#define ICL_PORT_TX_DW2_AUX(port) _MMIO_PORT(port, \
1860 _ICL_PORT_TX_DW2_AUX_A, \
1861 _ICL_PORT_TX_DW2_AUX_B)
1771#define SWING_SEL_UPPER(x) (((x) >> 3) << 15) 1862#define SWING_SEL_UPPER(x) (((x) >> 3) << 15)
1772#define SWING_SEL_UPPER_MASK (1 << 15) 1863#define SWING_SEL_UPPER_MASK (1 << 15)
1773#define SWING_SEL_LOWER(x) (((x) & 0x7) << 11) 1864#define SWING_SEL_LOWER(x) (((x) & 0x7) << 11)
1774#define SWING_SEL_LOWER_MASK (0x7 << 11) 1865#define SWING_SEL_LOWER_MASK (0x7 << 11)
1866#define FRC_LATENCY_OPTIM_MASK (0x7 << 8)
1867#define FRC_LATENCY_OPTIM_VAL(x) ((x) << 8)
1775#define RCOMP_SCALAR(x) ((x) << 0) 1868#define RCOMP_SCALAR(x) ((x) << 0)
1776#define RCOMP_SCALAR_MASK (0xFF << 0) 1869#define RCOMP_SCALAR_MASK (0xFF << 0)
1777 1870
@@ -1787,6 +1880,8 @@ enum i915_power_well_id {
1787#define _ICL_PORT_TX_DW4_LN0_A 0x162890 1880#define _ICL_PORT_TX_DW4_LN0_A 0x162890
1788#define _ICL_PORT_TX_DW4_LN1_A 0x162990 1881#define _ICL_PORT_TX_DW4_LN1_A 0x162990
1789#define _ICL_PORT_TX_DW4_LN0_B 0x6C890 1882#define _ICL_PORT_TX_DW4_LN0_B 0x6C890
1883#define _ICL_PORT_TX_DW4_AUX_A 0x162390
1884#define _ICL_PORT_TX_DW4_AUX_B 0x6c390
1790#define ICL_PORT_TX_DW4_GRP(port) _MMIO_PORT(port, \ 1885#define ICL_PORT_TX_DW4_GRP(port) _MMIO_PORT(port, \
1791 _ICL_PORT_TX_DW4_GRP_A, \ 1886 _ICL_PORT_TX_DW4_GRP_A, \
1792 _ICL_PORT_TX_DW4_GRP_B) 1887 _ICL_PORT_TX_DW4_GRP_B)
@@ -1795,6 +1890,9 @@ enum i915_power_well_id {
1795 _ICL_PORT_TX_DW4_LN0_B) + \ 1890 _ICL_PORT_TX_DW4_LN0_B) + \
1796 ((ln) * (_ICL_PORT_TX_DW4_LN1_A - \ 1891 ((ln) * (_ICL_PORT_TX_DW4_LN1_A - \
1797 _ICL_PORT_TX_DW4_LN0_A))) 1892 _ICL_PORT_TX_DW4_LN0_A)))
1893#define ICL_PORT_TX_DW4_AUX(port) _MMIO_PORT(port, \
1894 _ICL_PORT_TX_DW4_AUX_A, \
1895 _ICL_PORT_TX_DW4_AUX_B)
1798#define LOADGEN_SELECT (1 << 31) 1896#define LOADGEN_SELECT (1 << 31)
1799#define POST_CURSOR_1(x) ((x) << 12) 1897#define POST_CURSOR_1(x) ((x) << 12)
1800#define POST_CURSOR_1_MASK (0x3F << 12) 1898#define POST_CURSOR_1_MASK (0x3F << 12)
@@ -1809,12 +1907,17 @@ enum i915_power_well_id {
1809#define _ICL_PORT_TX_DW5_GRP_B 0x6C694 1907#define _ICL_PORT_TX_DW5_GRP_B 0x6C694
1810#define _ICL_PORT_TX_DW5_LN0_A 0x162894 1908#define _ICL_PORT_TX_DW5_LN0_A 0x162894
1811#define _ICL_PORT_TX_DW5_LN0_B 0x6C894 1909#define _ICL_PORT_TX_DW5_LN0_B 0x6C894
1910#define _ICL_PORT_TX_DW5_AUX_A 0x162394
1911#define _ICL_PORT_TX_DW5_AUX_B 0x6c394
1812#define ICL_PORT_TX_DW5_GRP(port) _MMIO_PORT(port, \ 1912#define ICL_PORT_TX_DW5_GRP(port) _MMIO_PORT(port, \
1813 _ICL_PORT_TX_DW5_GRP_A, \ 1913 _ICL_PORT_TX_DW5_GRP_A, \
1814 _ICL_PORT_TX_DW5_GRP_B) 1914 _ICL_PORT_TX_DW5_GRP_B)
1815#define ICL_PORT_TX_DW5_LN0(port) _MMIO_PORT(port, \ 1915#define ICL_PORT_TX_DW5_LN0(port) _MMIO_PORT(port, \
1816 _ICL_PORT_TX_DW5_LN0_A, \ 1916 _ICL_PORT_TX_DW5_LN0_A, \
1817 _ICL_PORT_TX_DW5_LN0_B) 1917 _ICL_PORT_TX_DW5_LN0_B)
1918#define ICL_PORT_TX_DW5_AUX(port) _MMIO_PORT(port, \
1919 _ICL_PORT_TX_DW5_AUX_A, \
1920 _ICL_PORT_TX_DW5_AUX_B)
1818#define TX_TRAINING_EN (1 << 31) 1921#define TX_TRAINING_EN (1 << 31)
1819#define TAP2_DISABLE (1 << 30) 1922#define TAP2_DISABLE (1 << 30)
1820#define TAP3_DISABLE (1 << 29) 1923#define TAP3_DISABLE (1 << 29)
@@ -2811,7 +2914,6 @@ enum i915_power_well_id {
2811#define I915_DISPLAY_PORT_INTERRUPT (1 << 17) 2914#define I915_DISPLAY_PORT_INTERRUPT (1 << 17)
2812#define I915_DISPLAY_PIPE_C_HBLANK_INTERRUPT (1 << 16) 2915#define I915_DISPLAY_PIPE_C_HBLANK_INTERRUPT (1 << 16)
2813#define I915_MASTER_ERROR_INTERRUPT (1 << 15) 2916#define I915_MASTER_ERROR_INTERRUPT (1 << 15)
2814#define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1 << 15)
2815#define I915_DISPLAY_PIPE_B_HBLANK_INTERRUPT (1 << 14) 2917#define I915_DISPLAY_PIPE_B_HBLANK_INTERRUPT (1 << 14)
2816#define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1 << 14) /* p-state */ 2918#define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1 << 14) /* p-state */
2817#define I915_DISPLAY_PIPE_A_HBLANK_INTERRUPT (1 << 13) 2919#define I915_DISPLAY_PIPE_A_HBLANK_INTERRUPT (1 << 13)
@@ -4044,6 +4146,7 @@ enum {
4044#define EDP_PSR_SKIP_AUX_EXIT (1 << 12) 4146#define EDP_PSR_SKIP_AUX_EXIT (1 << 12)
4045#define EDP_PSR_TP1_TP2_SEL (0 << 11) 4147#define EDP_PSR_TP1_TP2_SEL (0 << 11)
4046#define EDP_PSR_TP1_TP3_SEL (1 << 11) 4148#define EDP_PSR_TP1_TP3_SEL (1 << 11)
4149#define EDP_PSR_CRC_ENABLE (1 << 10) /* BDW+ */
4047#define EDP_PSR_TP2_TP3_TIME_500us (0 << 8) 4150#define EDP_PSR_TP2_TP3_TIME_500us (0 << 8)
4048#define EDP_PSR_TP2_TP3_TIME_100us (1 << 8) 4151#define EDP_PSR_TP2_TP3_TIME_100us (1 << 8)
4049#define EDP_PSR_TP2_TP3_TIME_2500us (2 << 8) 4152#define EDP_PSR_TP2_TP3_TIME_2500us (2 << 8)
@@ -4072,6 +4175,7 @@ enum {
4072 4175
4073#define EDP_PSR_STATUS _MMIO(dev_priv->psr_mmio_base + 0x40) 4176#define EDP_PSR_STATUS _MMIO(dev_priv->psr_mmio_base + 0x40)
4074#define EDP_PSR_STATUS_STATE_MASK (7 << 29) 4177#define EDP_PSR_STATUS_STATE_MASK (7 << 29)
4178#define EDP_PSR_STATUS_STATE_SHIFT 29
4075#define EDP_PSR_STATUS_STATE_IDLE (0 << 29) 4179#define EDP_PSR_STATUS_STATE_IDLE (0 << 29)
4076#define EDP_PSR_STATUS_STATE_SRDONACK (1 << 29) 4180#define EDP_PSR_STATUS_STATE_SRDONACK (1 << 29)
4077#define EDP_PSR_STATUS_STATE_SRDENT (2 << 29) 4181#define EDP_PSR_STATUS_STATE_SRDENT (2 << 29)
@@ -6829,7 +6933,7 @@ enum {
6829#define _PS_ECC_STAT_2B 0x68AD0 6933#define _PS_ECC_STAT_2B 0x68AD0
6830#define _PS_ECC_STAT_1C 0x691D0 6934#define _PS_ECC_STAT_1C 0x691D0
6831 6935
6832#define _ID(id, a, b) ((a) + (id) * ((b) - (a))) 6936#define _ID(id, a, b) _PICK_EVEN(id, a, b)
6833#define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe, \ 6937#define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe, \
6834 _ID(id, _PS_1A_CTRL, _PS_2A_CTRL), \ 6938 _ID(id, _PS_1A_CTRL, _PS_2A_CTRL), \
6835 _ID(id, _PS_1B_CTRL, _PS_2B_CTRL)) 6939 _ID(id, _PS_1B_CTRL, _PS_2B_CTRL))
@@ -7366,6 +7470,14 @@ enum {
7366#define BDW_SCRATCH1 _MMIO(0xb11c) 7470#define BDW_SCRATCH1 _MMIO(0xb11c)
7367#define GEN9_LBS_SLA_RETRY_TIMER_DECREMENT_ENABLE (1 << 2) 7471#define GEN9_LBS_SLA_RETRY_TIMER_DECREMENT_ENABLE (1 << 2)
7368 7472
7473/*GEN11 chicken */
7474#define _PIPEA_CHICKEN 0x70038
7475#define _PIPEB_CHICKEN 0x71038
7476#define _PIPEC_CHICKEN 0x72038
7477#define PER_PIXEL_ALPHA_BYPASS_EN (1 << 7)
7478#define PIPE_CHICKEN(pipe) _MMIO_PIPE(pipe, _PIPEA_CHICKEN,\
7479 _PIPEB_CHICKEN)
7480
7369/* PCH */ 7481/* PCH */
7370 7482
7371/* south display engine interrupt: IBX */ 7483/* south display engine interrupt: IBX */
@@ -7409,7 +7521,7 @@ enum {
7409#define SDE_TRANSA_FIFO_UNDER (1 << 0) 7521#define SDE_TRANSA_FIFO_UNDER (1 << 0)
7410#define SDE_TRANS_MASK (0x3f) 7522#define SDE_TRANS_MASK (0x3f)
7411 7523
7412/* south display engine interrupt: CPT/PPT */ 7524/* south display engine interrupt: CPT - CNP */
7413#define SDE_AUDIO_POWER_D_CPT (1 << 31) 7525#define SDE_AUDIO_POWER_D_CPT (1 << 31)
7414#define SDE_AUDIO_POWER_C_CPT (1 << 30) 7526#define SDE_AUDIO_POWER_C_CPT (1 << 30)
7415#define SDE_AUDIO_POWER_B_CPT (1 << 29) 7527#define SDE_AUDIO_POWER_B_CPT (1 << 29)
@@ -7457,6 +7569,21 @@ enum {
7457 SDE_FDI_RXB_CPT | \ 7569 SDE_FDI_RXB_CPT | \
7458 SDE_FDI_RXA_CPT) 7570 SDE_FDI_RXA_CPT)
7459 7571
7572/* south display engine interrupt: ICP */
7573#define SDE_TC4_HOTPLUG_ICP (1 << 27)
7574#define SDE_TC3_HOTPLUG_ICP (1 << 26)
7575#define SDE_TC2_HOTPLUG_ICP (1 << 25)
7576#define SDE_TC1_HOTPLUG_ICP (1 << 24)
7577#define SDE_GMBUS_ICP (1 << 23)
7578#define SDE_DDIB_HOTPLUG_ICP (1 << 17)
7579#define SDE_DDIA_HOTPLUG_ICP (1 << 16)
7580#define SDE_DDI_MASK_ICP (SDE_DDIB_HOTPLUG_ICP | \
7581 SDE_DDIA_HOTPLUG_ICP)
7582#define SDE_TC_MASK_ICP (SDE_TC4_HOTPLUG_ICP | \
7583 SDE_TC3_HOTPLUG_ICP | \
7584 SDE_TC2_HOTPLUG_ICP | \
7585 SDE_TC1_HOTPLUG_ICP)
7586
7460#define SDEISR _MMIO(0xc4000) 7587#define SDEISR _MMIO(0xc4000)
7461#define SDEIMR _MMIO(0xc4004) 7588#define SDEIMR _MMIO(0xc4004)
7462#define SDEIIR _MMIO(0xc4008) 7589#define SDEIIR _MMIO(0xc4008)
@@ -7517,6 +7644,30 @@ enum {
7517#define PORTE_HOTPLUG_SHORT_DETECT (1 << 0) 7644#define PORTE_HOTPLUG_SHORT_DETECT (1 << 0)
7518#define PORTE_HOTPLUG_LONG_DETECT (2 << 0) 7645#define PORTE_HOTPLUG_LONG_DETECT (2 << 0)
7519 7646
7647/* This register is a reuse of PCH_PORT_HOTPLUG register. The
7648 * functionality covered in PCH_PORT_HOTPLUG is split into
7649 * SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC.
7650 */
7651
7652#define SHOTPLUG_CTL_DDI _MMIO(0xc4030)
7653#define ICP_DDIB_HPD_ENABLE (1 << 7)
7654#define ICP_DDIB_HPD_STATUS_MASK (3 << 4)
7655#define ICP_DDIB_HPD_NO_DETECT (0 << 4)
7656#define ICP_DDIB_HPD_SHORT_DETECT (1 << 4)
7657#define ICP_DDIB_HPD_LONG_DETECT (2 << 4)
7658#define ICP_DDIB_HPD_SHORT_LONG_DETECT (3 << 4)
7659#define ICP_DDIA_HPD_ENABLE (1 << 3)
7660#define ICP_DDIA_HPD_STATUS_MASK (3 << 0)
7661#define ICP_DDIA_HPD_NO_DETECT (0 << 0)
7662#define ICP_DDIA_HPD_SHORT_DETECT (1 << 0)
7663#define ICP_DDIA_HPD_LONG_DETECT (2 << 0)
7664#define ICP_DDIA_HPD_SHORT_LONG_DETECT (3 << 0)
7665
7666#define SHOTPLUG_CTL_TC _MMIO(0xc4034)
7667#define ICP_TC_HPD_ENABLE(tc_port) (8 << (tc_port) * 4)
7668#define ICP_TC_HPD_LONG_DETECT(tc_port) (2 << (tc_port) * 4)
7669#define ICP_TC_HPD_SHORT_DETECT(tc_port) (1 << (tc_port) * 4)
7670
7520#define PCH_GPIOA _MMIO(0xc5010) 7671#define PCH_GPIOA _MMIO(0xc5010)
7521#define PCH_GPIOB _MMIO(0xc5014) 7672#define PCH_GPIOB _MMIO(0xc5014)
7522#define PCH_GPIOC _MMIO(0xc5018) 7673#define PCH_GPIOC _MMIO(0xc5018)
@@ -8555,6 +8706,14 @@ enum {
8555#define _HSW_PWR_WELL_CTL3 0x45408 8706#define _HSW_PWR_WELL_CTL3 0x45408
8556#define _HSW_PWR_WELL_CTL4 0x4540C 8707#define _HSW_PWR_WELL_CTL4 0x4540C
8557 8708
8709#define _ICL_PWR_WELL_CTL_AUX1 0x45440
8710#define _ICL_PWR_WELL_CTL_AUX2 0x45444
8711#define _ICL_PWR_WELL_CTL_AUX4 0x4544C
8712
8713#define _ICL_PWR_WELL_CTL_DDI1 0x45450
8714#define _ICL_PWR_WELL_CTL_DDI2 0x45454
8715#define _ICL_PWR_WELL_CTL_DDI4 0x4545C
8716
8558/* 8717/*
8559 * Each power well control register contains up to 16 (request, status) HW 8718 * Each power well control register contains up to 16 (request, status) HW
8560 * flag tuples. The register index and HW flag shift is determined by the 8719 * flag tuples. The register index and HW flag shift is determined by the
@@ -8564,14 +8723,20 @@ enum {
8564 */ 8723 */
8565#define _HSW_PW_REG_IDX(pw) ((pw) >> 4) 8724#define _HSW_PW_REG_IDX(pw) ((pw) >> 4)
8566#define _HSW_PW_SHIFT(pw) (((pw) & 0xf) * 2) 8725#define _HSW_PW_SHIFT(pw) (((pw) & 0xf) * 2)
8567/* TODO: Add all PWR_WELL_CTL registers below for new platforms */
8568#define HSW_PWR_WELL_CTL_BIOS(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \ 8726#define HSW_PWR_WELL_CTL_BIOS(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \
8569 _HSW_PWR_WELL_CTL1)) 8727 _HSW_PWR_WELL_CTL1, \
8728 _ICL_PWR_WELL_CTL_AUX1, \
8729 _ICL_PWR_WELL_CTL_DDI1))
8570#define HSW_PWR_WELL_CTL_DRIVER(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \ 8730#define HSW_PWR_WELL_CTL_DRIVER(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \
8571 _HSW_PWR_WELL_CTL2)) 8731 _HSW_PWR_WELL_CTL2, \
8732 _ICL_PWR_WELL_CTL_AUX2, \
8733 _ICL_PWR_WELL_CTL_DDI2))
8734/* KVMR doesn't have a reg for AUX or DDI power well control */
8572#define HSW_PWR_WELL_CTL_KVMR _MMIO(_HSW_PWR_WELL_CTL3) 8735#define HSW_PWR_WELL_CTL_KVMR _MMIO(_HSW_PWR_WELL_CTL3)
8573#define HSW_PWR_WELL_CTL_DEBUG(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \ 8736#define HSW_PWR_WELL_CTL_DEBUG(pw) _MMIO(_PICK(_HSW_PW_REG_IDX(pw), \
8574 _HSW_PWR_WELL_CTL4)) 8737 _HSW_PWR_WELL_CTL4, \
8738 _ICL_PWR_WELL_CTL_AUX4, \
8739 _ICL_PWR_WELL_CTL_DDI4))
8575 8740
8576#define HSW_PWR_WELL_CTL_REQ(pw) (1 << (_HSW_PW_SHIFT(pw) + 1)) 8741#define HSW_PWR_WELL_CTL_REQ(pw) (1 << (_HSW_PW_SHIFT(pw) + 1))
8577#define HSW_PWR_WELL_CTL_STATE(pw) (1 << _HSW_PW_SHIFT(pw)) 8742#define HSW_PWR_WELL_CTL_STATE(pw) (1 << _HSW_PW_SHIFT(pw))
@@ -8592,6 +8757,8 @@ enum skl_power_gate {
8592#define SKL_FUSE_DOWNLOAD_STATUS (1 << 31) 8757#define SKL_FUSE_DOWNLOAD_STATUS (1 << 31)
8593/* PG0 (HW control->no power well ID), PG1..PG2 (SKL_DISP_PW1..SKL_DISP_PW2) */ 8758/* PG0 (HW control->no power well ID), PG1..PG2 (SKL_DISP_PW1..SKL_DISP_PW2) */
8594#define SKL_PW_TO_PG(pw) ((pw) - SKL_DISP_PW_1 + SKL_PG1) 8759#define SKL_PW_TO_PG(pw) ((pw) - SKL_DISP_PW_1 + SKL_PG1)
8760/* PG0 (HW control->no power well ID), PG1..PG4 (ICL_DISP_PW1..ICL_DISP_PW4) */
8761#define ICL_PW_TO_PG(pw) ((pw) - ICL_DISP_PW_1 + SKL_PG1)
8595#define SKL_FUSE_PG_DIST_STATUS(pg) (1 << (27 - (pg))) 8762#define SKL_FUSE_PG_DIST_STATUS(pg) (1 << (27 - (pg)))
8596 8763
8597#define _CNL_AUX_REG_IDX(pw) ((pw) - 9) 8764#define _CNL_AUX_REG_IDX(pw) ((pw) - 9)
@@ -9047,6 +9214,7 @@ enum skl_power_gate {
9047#define _MG_REFCLKIN_CTL_PORT3 0x16A92C 9214#define _MG_REFCLKIN_CTL_PORT3 0x16A92C
9048#define _MG_REFCLKIN_CTL_PORT4 0x16B92C 9215#define _MG_REFCLKIN_CTL_PORT4 0x16B92C
9049#define MG_REFCLKIN_CTL_OD_2_MUX(x) ((x) << 8) 9216#define MG_REFCLKIN_CTL_OD_2_MUX(x) ((x) << 8)
9217#define MG_REFCLKIN_CTL_OD_2_MUX_MASK (0x7 << 8)
9050#define MG_REFCLKIN_CTL(port) _MMIO_PORT((port) - PORT_C, \ 9218#define MG_REFCLKIN_CTL(port) _MMIO_PORT((port) - PORT_C, \
9051 _MG_REFCLKIN_CTL_PORT1, \ 9219 _MG_REFCLKIN_CTL_PORT1, \
9052 _MG_REFCLKIN_CTL_PORT2) 9220 _MG_REFCLKIN_CTL_PORT2)
@@ -9056,7 +9224,9 @@ enum skl_power_gate {
9056#define _MG_CLKTOP2_CORECLKCTL1_PORT3 0x16A8D8 9224#define _MG_CLKTOP2_CORECLKCTL1_PORT3 0x16A8D8
9057#define _MG_CLKTOP2_CORECLKCTL1_PORT4 0x16B8D8 9225#define _MG_CLKTOP2_CORECLKCTL1_PORT4 0x16B8D8
9058#define MG_CLKTOP2_CORECLKCTL1_B_DIVRATIO(x) ((x) << 16) 9226#define MG_CLKTOP2_CORECLKCTL1_B_DIVRATIO(x) ((x) << 16)
9227#define MG_CLKTOP2_CORECLKCTL1_B_DIVRATIO_MASK (0xff << 16)
9059#define MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO(x) ((x) << 8) 9228#define MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO(x) ((x) << 8)
9229#define MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO_MASK (0xff << 8)
9060#define MG_CLKTOP2_CORECLKCTL1(port) _MMIO_PORT((port) - PORT_C, \ 9230#define MG_CLKTOP2_CORECLKCTL1(port) _MMIO_PORT((port) - PORT_C, \
9061 _MG_CLKTOP2_CORECLKCTL1_PORT1, \ 9231 _MG_CLKTOP2_CORECLKCTL1_PORT1, \
9062 _MG_CLKTOP2_CORECLKCTL1_PORT2) 9232 _MG_CLKTOP2_CORECLKCTL1_PORT2)
@@ -9066,9 +9236,13 @@ enum skl_power_gate {
9066#define _MG_CLKTOP2_HSCLKCTL_PORT3 0x16A8D4 9236#define _MG_CLKTOP2_HSCLKCTL_PORT3 0x16A8D4
9067#define _MG_CLKTOP2_HSCLKCTL_PORT4 0x16B8D4 9237#define _MG_CLKTOP2_HSCLKCTL_PORT4 0x16B8D4
9068#define MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL(x) ((x) << 16) 9238#define MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL(x) ((x) << 16)
9239#define MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL_MASK (0x1 << 16)
9069#define MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL(x) ((x) << 14) 9240#define MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL(x) ((x) << 14)
9241#define MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL_MASK (0x3 << 14)
9070#define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO(x) ((x) << 12) 9242#define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO(x) ((x) << 12)
9243#define MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_MASK (0x3 << 12)
9071#define MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO(x) ((x) << 8) 9244#define MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO(x) ((x) << 8)
9245#define MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO_MASK (0xf << 8)
9072#define MG_CLKTOP2_HSCLKCTL(port) _MMIO_PORT((port) - PORT_C, \ 9246#define MG_CLKTOP2_HSCLKCTL(port) _MMIO_PORT((port) - PORT_C, \
9073 _MG_CLKTOP2_HSCLKCTL_PORT1, \ 9247 _MG_CLKTOP2_HSCLKCTL_PORT1, \
9074 _MG_CLKTOP2_HSCLKCTL_PORT2) 9248 _MG_CLKTOP2_HSCLKCTL_PORT2)
@@ -9142,12 +9316,18 @@ enum skl_power_gate {
9142#define _MG_PLL_BIAS_PORT3 0x16AA14 9316#define _MG_PLL_BIAS_PORT3 0x16AA14
9143#define _MG_PLL_BIAS_PORT4 0x16BA14 9317#define _MG_PLL_BIAS_PORT4 0x16BA14
9144#define MG_PLL_BIAS_BIAS_GB_SEL(x) ((x) << 30) 9318#define MG_PLL_BIAS_BIAS_GB_SEL(x) ((x) << 30)
9319#define MG_PLL_BIAS_BIAS_GB_SEL_MASK (0x3 << 30)
9145#define MG_PLL_BIAS_INIT_DCOAMP(x) ((x) << 24) 9320#define MG_PLL_BIAS_INIT_DCOAMP(x) ((x) << 24)
9321#define MG_PLL_BIAS_INIT_DCOAMP_MASK (0x3f << 24)
9146#define MG_PLL_BIAS_BIAS_BONUS(x) ((x) << 16) 9322#define MG_PLL_BIAS_BIAS_BONUS(x) ((x) << 16)
9323#define MG_PLL_BIAS_BIAS_BONUS_MASK (0xff << 16)
9147#define MG_PLL_BIAS_BIASCAL_EN (1 << 15) 9324#define MG_PLL_BIAS_BIASCAL_EN (1 << 15)
9148#define MG_PLL_BIAS_CTRIM(x) ((x) << 8) 9325#define MG_PLL_BIAS_CTRIM(x) ((x) << 8)
9326#define MG_PLL_BIAS_CTRIM_MASK (0x1f << 8)
9149#define MG_PLL_BIAS_VREF_RDAC(x) ((x) << 5) 9327#define MG_PLL_BIAS_VREF_RDAC(x) ((x) << 5)
9328#define MG_PLL_BIAS_VREF_RDAC_MASK (0x7 << 5)
9150#define MG_PLL_BIAS_IREFTRIM(x) ((x) << 0) 9329#define MG_PLL_BIAS_IREFTRIM(x) ((x) << 0)
9330#define MG_PLL_BIAS_IREFTRIM_MASK (0x1f << 0)
9151#define MG_PLL_BIAS(port) _MMIO_PORT((port) - PORT_C, _MG_PLL_BIAS_PORT1, \ 9331#define MG_PLL_BIAS(port) _MMIO_PORT((port) - PORT_C, _MG_PLL_BIAS_PORT1, \
9152 _MG_PLL_BIAS_PORT2) 9332 _MG_PLL_BIAS_PORT2)
9153 9333
@@ -9401,6 +9581,22 @@ enum skl_power_gate {
9401#define MIPIO_TXESC_CLK_DIV2 _MMIO(0x160008) 9581#define MIPIO_TXESC_CLK_DIV2 _MMIO(0x160008)
9402#define GLK_TX_ESC_CLK_DIV2_MASK 0x3FF 9582#define GLK_TX_ESC_CLK_DIV2_MASK 0x3FF
9403 9583
9584#define _ICL_DSI_ESC_CLK_DIV0 0x6b090
9585#define _ICL_DSI_ESC_CLK_DIV1 0x6b890
9586#define ICL_DSI_ESC_CLK_DIV(port) _MMIO_PORT((port), \
9587 _ICL_DSI_ESC_CLK_DIV0, \
9588 _ICL_DSI_ESC_CLK_DIV1)
9589#define _ICL_DPHY_ESC_CLK_DIV0 0x162190
9590#define _ICL_DPHY_ESC_CLK_DIV1 0x6C190
9591#define ICL_DPHY_ESC_CLK_DIV(port) _MMIO_PORT((port), \
9592 _ICL_DPHY_ESC_CLK_DIV0, \
9593 _ICL_DPHY_ESC_CLK_DIV1)
9594#define ICL_BYTE_CLK_PER_ESC_CLK_MASK (0x1f << 16)
9595#define ICL_BYTE_CLK_PER_ESC_CLK_SHIFT 16
9596#define ICL_ESC_CLK_DIV_MASK 0x1ff
9597#define ICL_ESC_CLK_DIV_SHIFT 0
9598#define DSI_MAX_ESC_CLK 20000 /* in KHz */
9599
9404/* Gen4+ Timestamp and Pipe Frame time stamp registers */ 9600/* Gen4+ Timestamp and Pipe Frame time stamp registers */
9405#define GEN4_TIMESTAMP _MMIO(0x2358) 9601#define GEN4_TIMESTAMP _MMIO(0x2358)
9406#define ILK_TIMESTAMP_HI _MMIO(0x70070) 9602#define ILK_TIMESTAMP_HI _MMIO(0x70070)
@@ -9535,6 +9731,14 @@ enum skl_power_gate {
9535#define _BXT_MIPIC_PORT_CTRL 0x6B8C0 9731#define _BXT_MIPIC_PORT_CTRL 0x6B8C0
9536#define BXT_MIPI_PORT_CTRL(tc) _MMIO_MIPI(tc, _BXT_MIPIA_PORT_CTRL, _BXT_MIPIC_PORT_CTRL) 9732#define BXT_MIPI_PORT_CTRL(tc) _MMIO_MIPI(tc, _BXT_MIPIA_PORT_CTRL, _BXT_MIPIC_PORT_CTRL)
9537 9733
9734/* ICL DSI MODE control */
9735#define _ICL_DSI_IO_MODECTL_0 0x6B094
9736#define _ICL_DSI_IO_MODECTL_1 0x6B894
9737#define ICL_DSI_IO_MODECTL(port) _MMIO_PORT(port, \
9738 _ICL_DSI_IO_MODECTL_0, \
9739 _ICL_DSI_IO_MODECTL_1)
9740#define COMBO_PHY_MODE_DSI (1 << 0)
9741
9538#define BXT_P_DSI_REGULATOR_CFG _MMIO(0x160020) 9742#define BXT_P_DSI_REGULATOR_CFG _MMIO(0x160020)
9539#define STAP_SELECT (1 << 0) 9743#define STAP_SELECT (1 << 0)
9540 9744