diff options
author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2018-05-21 20:25:48 -0400 |
---|---|---|
committer | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2018-06-14 17:54:39 -0400 |
commit | 1fa11ee2d9d0ccd58a6b56a9e490e336c99e98bf (patch) | |
tree | b733f213d2b9bd106bade944beed00c286e92827 | |
parent | 00c92d929ac36848fbe88567ef14af947ab636e4 (diff) |
drm/i915/icl: start adding the TBT pll
This commit just adds the register addresses and the basic skeleton of
the code. The next commits will expand on more specific functions.
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180522002558.29262-15-paulo.r.zanoni@intel.com
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ddi.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dpll_mgr.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dpll_mgr.h | 14 |
4 files changed, 47 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 140f6a27d696..dd6076188319 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -8836,6 +8836,10 @@ enum skl_power_gate { | |||
8836 | #define DDI_CLK_SEL(port) PORT_CLK_SEL(port) | 8836 | #define DDI_CLK_SEL(port) PORT_CLK_SEL(port) |
8837 | #define DDI_CLK_SEL_NONE (0x0 << 28) | 8837 | #define DDI_CLK_SEL_NONE (0x0 << 28) |
8838 | #define DDI_CLK_SEL_MG (0x8 << 28) | 8838 | #define DDI_CLK_SEL_MG (0x8 << 28) |
8839 | #define DDI_CLK_SEL_TBT_162 (0xC << 28) | ||
8840 | #define DDI_CLK_SEL_TBT_270 (0xD << 28) | ||
8841 | #define DDI_CLK_SEL_TBT_540 (0xE << 28) | ||
8842 | #define DDI_CLK_SEL_TBT_810 (0xF << 28) | ||
8839 | #define DDI_CLK_SEL_MASK (0xF << 28) | 8843 | #define DDI_CLK_SEL_MASK (0xF << 28) |
8840 | 8844 | ||
8841 | /* Transcoder clock selection */ | 8845 | /* Transcoder clock selection */ |
@@ -8985,6 +8989,8 @@ enum skl_power_gate { | |||
8985 | #define PLL_POWER_STATE (1 << 26) | 8989 | #define PLL_POWER_STATE (1 << 26) |
8986 | #define CNL_DPLL_ENABLE(pll) _MMIO_PLL(pll, DPLL0_ENABLE, DPLL1_ENABLE) | 8990 | #define CNL_DPLL_ENABLE(pll) _MMIO_PLL(pll, DPLL0_ENABLE, DPLL1_ENABLE) |
8987 | 8991 | ||
8992 | #define TBT_PLL_ENABLE _MMIO(0x46020) | ||
8993 | |||
8988 | #define _MG_PLL1_ENABLE 0x46030 | 8994 | #define _MG_PLL1_ENABLE 0x46030 |
8989 | #define _MG_PLL2_ENABLE 0x46034 | 8995 | #define _MG_PLL2_ENABLE 0x46034 |
8990 | #define _MG_PLL3_ENABLE 0x46038 | 8996 | #define _MG_PLL3_ENABLE 0x46038 |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 936ff5a0b522..ce153b11c765 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -1062,6 +1062,8 @@ static uint32_t hsw_pll_to_ddi_pll_sel(const struct intel_shared_dpll *pll) | |||
1062 | static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder, | 1062 | static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder, |
1063 | const struct intel_shared_dpll *pll) | 1063 | const struct intel_shared_dpll *pll) |
1064 | { | 1064 | { |
1065 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); | ||
1066 | int clock = crtc->config->port_clock; | ||
1065 | const enum intel_dpll_id id = pll->info->id; | 1067 | const enum intel_dpll_id id = pll->info->id; |
1066 | 1068 | ||
1067 | switch (id) { | 1069 | switch (id) { |
@@ -1070,6 +1072,20 @@ static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder, | |||
1070 | case DPLL_ID_ICL_DPLL0: | 1072 | case DPLL_ID_ICL_DPLL0: |
1071 | case DPLL_ID_ICL_DPLL1: | 1073 | case DPLL_ID_ICL_DPLL1: |
1072 | return DDI_CLK_SEL_NONE; | 1074 | return DDI_CLK_SEL_NONE; |
1075 | case DPLL_ID_ICL_TBTPLL: | ||
1076 | switch (clock) { | ||
1077 | case 162000: | ||
1078 | return DDI_CLK_SEL_TBT_162; | ||
1079 | case 270000: | ||
1080 | return DDI_CLK_SEL_TBT_270; | ||
1081 | case 540000: | ||
1082 | return DDI_CLK_SEL_TBT_540; | ||
1083 | case 810000: | ||
1084 | return DDI_CLK_SEL_TBT_810; | ||
1085 | default: | ||
1086 | MISSING_CASE(clock); | ||
1087 | break; | ||
1088 | } | ||
1073 | case DPLL_ID_ICL_MGPLL1: | 1089 | case DPLL_ID_ICL_MGPLL1: |
1074 | case DPLL_ID_ICL_MGPLL2: | 1090 | case DPLL_ID_ICL_MGPLL2: |
1075 | case DPLL_ID_ICL_MGPLL3: | 1091 | case DPLL_ID_ICL_MGPLL3: |
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c index 07bdbf2582ba..132fe63e042a 100644 --- a/drivers/gpu/drm/i915/intel_dpll_mgr.c +++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c | |||
@@ -2857,10 +2857,17 @@ icl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state, | |||
2857 | case PORT_D: | 2857 | case PORT_D: |
2858 | case PORT_E: | 2858 | case PORT_E: |
2859 | case PORT_F: | 2859 | case PORT_F: |
2860 | min = icl_port_to_mg_pll_id(port); | 2860 | if (0 /* TODO: TBT PLLs */) { |
2861 | max = min; | 2861 | min = DPLL_ID_ICL_TBTPLL; |
2862 | ret = icl_calc_mg_pll_state(crtc_state, encoder, clock, | 2862 | max = min; |
2863 | &pll_state); | 2863 | ret = icl_calc_dpll_state(crtc_state, encoder, clock, |
2864 | &pll_state); | ||
2865 | } else { | ||
2866 | min = icl_port_to_mg_pll_id(port); | ||
2867 | max = min; | ||
2868 | ret = icl_calc_mg_pll_state(crtc_state, encoder, clock, | ||
2869 | &pll_state); | ||
2870 | } | ||
2864 | break; | 2871 | break; |
2865 | default: | 2872 | default: |
2866 | MISSING_CASE(port); | 2873 | MISSING_CASE(port); |
@@ -2893,6 +2900,8 @@ static i915_reg_t icl_pll_id_to_enable_reg(enum intel_dpll_id id) | |||
2893 | case DPLL_ID_ICL_DPLL0: | 2900 | case DPLL_ID_ICL_DPLL0: |
2894 | case DPLL_ID_ICL_DPLL1: | 2901 | case DPLL_ID_ICL_DPLL1: |
2895 | return CNL_DPLL_ENABLE(id); | 2902 | return CNL_DPLL_ENABLE(id); |
2903 | case DPLL_ID_ICL_TBTPLL: | ||
2904 | return TBT_PLL_ENABLE; | ||
2896 | case DPLL_ID_ICL_MGPLL1: | 2905 | case DPLL_ID_ICL_MGPLL1: |
2897 | case DPLL_ID_ICL_MGPLL2: | 2906 | case DPLL_ID_ICL_MGPLL2: |
2898 | case DPLL_ID_ICL_MGPLL3: | 2907 | case DPLL_ID_ICL_MGPLL3: |
@@ -2920,6 +2929,7 @@ static bool icl_pll_get_hw_state(struct drm_i915_private *dev_priv, | |||
2920 | switch (id) { | 2929 | switch (id) { |
2921 | case DPLL_ID_ICL_DPLL0: | 2930 | case DPLL_ID_ICL_DPLL0: |
2922 | case DPLL_ID_ICL_DPLL1: | 2931 | case DPLL_ID_ICL_DPLL1: |
2932 | case DPLL_ID_ICL_TBTPLL: | ||
2923 | hw_state->cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(id)); | 2933 | hw_state->cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(id)); |
2924 | hw_state->cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(id)); | 2934 | hw_state->cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(id)); |
2925 | break; | 2935 | break; |
@@ -3006,6 +3016,7 @@ static void icl_pll_enable(struct drm_i915_private *dev_priv, | |||
3006 | switch (id) { | 3016 | switch (id) { |
3007 | case DPLL_ID_ICL_DPLL0: | 3017 | case DPLL_ID_ICL_DPLL0: |
3008 | case DPLL_ID_ICL_DPLL1: | 3018 | case DPLL_ID_ICL_DPLL1: |
3019 | case DPLL_ID_ICL_TBTPLL: | ||
3009 | icl_dpll_write(dev_priv, pll); | 3020 | icl_dpll_write(dev_priv, pll); |
3010 | break; | 3021 | break; |
3011 | case DPLL_ID_ICL_MGPLL1: | 3022 | case DPLL_ID_ICL_MGPLL1: |
@@ -3104,6 +3115,7 @@ static const struct intel_shared_dpll_funcs icl_pll_funcs = { | |||
3104 | static const struct dpll_info icl_plls[] = { | 3115 | static const struct dpll_info icl_plls[] = { |
3105 | { "DPLL 0", &icl_pll_funcs, DPLL_ID_ICL_DPLL0, 0 }, | 3116 | { "DPLL 0", &icl_pll_funcs, DPLL_ID_ICL_DPLL0, 0 }, |
3106 | { "DPLL 1", &icl_pll_funcs, DPLL_ID_ICL_DPLL1, 0 }, | 3117 | { "DPLL 1", &icl_pll_funcs, DPLL_ID_ICL_DPLL1, 0 }, |
3118 | { "TBT PLL", &icl_pll_funcs, DPLL_ID_ICL_TBTPLL, 0 }, | ||
3107 | { "MG PLL 1", &icl_pll_funcs, DPLL_ID_ICL_MGPLL1, 0 }, | 3119 | { "MG PLL 1", &icl_pll_funcs, DPLL_ID_ICL_MGPLL1, 0 }, |
3108 | { "MG PLL 2", &icl_pll_funcs, DPLL_ID_ICL_MGPLL2, 0 }, | 3120 | { "MG PLL 2", &icl_pll_funcs, DPLL_ID_ICL_MGPLL2, 0 }, |
3109 | { "MG PLL 3", &icl_pll_funcs, DPLL_ID_ICL_MGPLL3, 0 }, | 3121 | { "MG PLL 3", &icl_pll_funcs, DPLL_ID_ICL_MGPLL3, 0 }, |
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.h b/drivers/gpu/drm/i915/intel_dpll_mgr.h index 78915057d2e6..ba925c7ee482 100644 --- a/drivers/gpu/drm/i915/intel_dpll_mgr.h +++ b/drivers/gpu/drm/i915/intel_dpll_mgr.h | |||
@@ -114,23 +114,27 @@ enum intel_dpll_id { | |||
114 | */ | 114 | */ |
115 | DPLL_ID_ICL_DPLL1 = 1, | 115 | DPLL_ID_ICL_DPLL1 = 1, |
116 | /** | 116 | /** |
117 | * @DPLL_ID_ICL_TBTPLL: ICL TBT PLL | ||
118 | */ | ||
119 | DPLL_ID_ICL_TBTPLL = 2, | ||
120 | /** | ||
117 | * @DPLL_ID_ICL_MGPLL1: ICL MG PLL 1 port 1 (C) | 121 | * @DPLL_ID_ICL_MGPLL1: ICL MG PLL 1 port 1 (C) |
118 | */ | 122 | */ |
119 | DPLL_ID_ICL_MGPLL1 = 2, | 123 | DPLL_ID_ICL_MGPLL1 = 3, |
120 | /** | 124 | /** |
121 | * @DPLL_ID_ICL_MGPLL2: ICL MG PLL 1 port 2 (D) | 125 | * @DPLL_ID_ICL_MGPLL2: ICL MG PLL 1 port 2 (D) |
122 | */ | 126 | */ |
123 | DPLL_ID_ICL_MGPLL2 = 3, | 127 | DPLL_ID_ICL_MGPLL2 = 4, |
124 | /** | 128 | /** |
125 | * @DPLL_ID_ICL_MGPLL3: ICL MG PLL 1 port 3 (E) | 129 | * @DPLL_ID_ICL_MGPLL3: ICL MG PLL 1 port 3 (E) |
126 | */ | 130 | */ |
127 | DPLL_ID_ICL_MGPLL3 = 4, | 131 | DPLL_ID_ICL_MGPLL3 = 5, |
128 | /** | 132 | /** |
129 | * @DPLL_ID_ICL_MGPLL4: ICL MG PLL 1 port 4 (F) | 133 | * @DPLL_ID_ICL_MGPLL4: ICL MG PLL 1 port 4 (F) |
130 | */ | 134 | */ |
131 | DPLL_ID_ICL_MGPLL4 = 5, | 135 | DPLL_ID_ICL_MGPLL4 = 6, |
132 | }; | 136 | }; |
133 | #define I915_NUM_PLLS 6 | 137 | #define I915_NUM_PLLS 7 |
134 | 138 | ||
135 | struct intel_dpll_hw_state { | 139 | struct intel_dpll_hw_state { |
136 | /* i9xx, pch plls */ | 140 | /* i9xx, pch plls */ |