Skip to contentSkip to conversation

drm/i915/display: Implement new combo phy initialization step

PATCH Superseded José Roberto de Souza 2 participants 6 messages Jun 24, 2020 – Jul 7, 2020

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915/display: Implement new combo phy initialization step

This is new step that was recently added to the combo phy initialization.

v2:
- using intel_de_rmw()

BSpec: 49291

---
 .../gpu/drm/i915/display/intel_combo_phy.c    | 23 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h               |  7 ++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_combo_phy.c +23 -0
index 77b04bb3ec62..115069833348 100644
@@ -264,6 +264,18 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 	if (!icl_combo_phy_enabled(dev_priv, phy))
 		return false;
 
+	if (INTEL_GEN(dev_priv) >= 12) {
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);
+
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+	}
+
 	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
 
 	if (phy_is_master(dev_priv, phy)) {
@@ -375,6 +387,17 @@ static void icl_combo_phys_init(struct drm_i915_private *dev_priv)
 		intel_de_write(dev_priv, ICL_PHY_MISC(phy), val);
 
 skip_phy_misc:
+		if (INTEL_GEN(dev_priv) >= 12) {
+			intel_de_rmw(dev_priv, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);
+
+			intel_de_rmw(dev_priv, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+		}
+
 		cnl_set_procmon_ref_values(dev_priv, phy);
 
 		if (phy_is_master(dev_priv, phy)) {
drivers/gpu/drm/i915/i915_reg.h +7 -0
index f09120cac89a..5469c9029f6d 100644
@@ -1974,6 +1974,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define ICL_PORT_PCS_DW1_AUX(phy)	_MMIO(_ICL_PORT_PCS_DW_AUX(1, phy))
 #define ICL_PORT_PCS_DW1_GRP(phy)	_MMIO(_ICL_PORT_PCS_DW_GRP(1, phy))
 #define ICL_PORT_PCS_DW1_LN0(phy)	_MMIO(_ICL_PORT_PCS_DW_LN(1, 0, phy))
+#define   DCC_MODE_SELECT_MASK		(0x3 << 20)
+#define   DCC_MODE_SELECT_CONTINUOSLY	(0x3 << 20)
 #define   COMMON_KEEPER_EN		(1 << 26)
 #define   LATENCY_OPTIM_MASK		(0x3 << 2)
 #define   LATENCY_OPTIM_VAL(x)		((x) << 2)
@@ -2072,6 +2074,11 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define   N_SCALAR(x)			((x) << 24)
 #define   N_SCALAR_MASK			(0x7F << 24)
 
+#define ICL_PORT_TX_DW8_GRP(phy)		_MMIO(_ICL_PORT_TX_DW_GRP(8, phy))
+#define ICL_PORT_TX_DW8_ODCC_CLK_SEL		REG_BIT(31)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK	REG_GENMASK(30, 29)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2	REG_FIELD_PREP(ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK, 0x1)
+
 #define _ICL_DPHY_CHKN_REG			0x194
 #define ICL_DPHY_CHKN(port)			_MMIO(_ICL_COMBOPHY(port) + _ICL_DPHY_CHKN_REG)
 #define   ICL_DPHY_CHKN_AFE_OVER_PPI_STRAP	REG_BIT(7)
Signature · 6 lines
2.27.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 5 lines · José Roberto de Souza

This is new step that was recently added to the combo phy initialization.

v2:
- using intel_de_rmw()

Actually, I'm not sure whether this is valid; I believe we always have to read from a lane register and can only write to the group registers:

"Reads using a port group address usually cannot return correct data. For read/modify/write to a group, the read should be to one of the lane addresses, then the write to the group address."

Quoted 14 lines

BSpec: 49291

---
 .../gpu/drm/i915/display/intel_combo_phy.c    | 23 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h               |  7 ++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_combo_phy.c +0 -0
index 77b04bb3ec62..115069833348 100644

drivers/gpu/drm/i915/display/intel_combo_phy.c static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, · line 272

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
@@ -264,6 +264,18 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 	if (!icl_combo_phy_enabled(dev_priv, phy))
 		return false;
 
+	if (INTEL_GEN(dev_priv) >= 12) {
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

If I'm reading the bspec correctly, it looks like both 00 and 01 represent div2 for this register. So maybe rather than looking for 01 exactly here we should just check that bit 30 is off?

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+	}
+
 	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
 
 	if (phy_is_master(dev_priv, phy)) {

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 390

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +1 -0
@@ -375,6 +387,17 @@ static void icl_combo_phys_init(struct drm_i915_private *dev_priv)
 		intel_de_write(dev_priv, ICL_PHY_MISC(phy), val);
 
 skip_phy_misc:
+		if (INTEL_GEN(dev_priv) >= 12) {

We may want to keep an eye on this part of the bspec; there seems to be something a bit off with the bspec tagging of this block and I'm not 100% sure it was actually intended to apply to RKL too or not.

It seems like the bspec has these steps as the very first thing, even before the "check whether the PHY is already initialized" step. But since we're checking that the bits are set the way we want in the verify function too, I don't think the ordering should matter.

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 394

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +4 -0
+			intel_de_rmw(dev_priv, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

As noted above, maybe we should just clear bit 30 and leave bit 29 set however it already was?

Matt

Quoted 41 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+			intel_de_rmw(dev_priv, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+		}
+
 		cnl_set_procmon_ref_values(dev_priv, phy);
 
 		if (phy_is_master(dev_priv, phy)) {
drivers/gpu/drm/i915/i915_reg.h +7 -0
index f09120cac89a..5469c9029f6d 100644
@@ -1974,6 +1974,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define ICL_PORT_PCS_DW1_AUX(phy)	_MMIO(_ICL_PORT_PCS_DW_AUX(1, phy))
 #define ICL_PORT_PCS_DW1_GRP(phy)	_MMIO(_ICL_PORT_PCS_DW_GRP(1, phy))
 #define ICL_PORT_PCS_DW1_LN0(phy)	_MMIO(_ICL_PORT_PCS_DW_LN(1, 0, phy))
+#define   DCC_MODE_SELECT_MASK		(0x3 << 20)
+#define   DCC_MODE_SELECT_CONTINUOSLY	(0x3 << 20)
 #define   COMMON_KEEPER_EN		(1 << 26)
 #define   LATENCY_OPTIM_MASK		(0x3 << 2)
 #define   LATENCY_OPTIM_VAL(x)		((x) << 2)
@@ -2072,6 +2074,11 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define   N_SCALAR(x)			((x) << 24)
 #define   N_SCALAR_MASK			(0x7F << 24)
 
+#define ICL_PORT_TX_DW8_GRP(phy)		_MMIO(_ICL_PORT_TX_DW_GRP(8, phy))
+#define ICL_PORT_TX_DW8_ODCC_CLK_SEL		REG_BIT(31)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK	REG_GENMASK(30, 29)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2	REG_FIELD_PREP(ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK, 0x1)
+
 #define _ICL_DPHY_CHKN_REG			0x194
 #define ICL_DPHY_CHKN(port)			_MMIO(_ICL_COMBOPHY(port) + _ICL_DPHY_CHKN_REG)
 #define   ICL_DPHY_CHKN_AFE_OVER_PPI_STRAP	REG_BIT(7)
Signature · 6 lines
2.27.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 9 lines
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 7 lines · Matt Roper
Quoted 5 lines · José Roberto de Souza

This is new step that was recently added to the combo phy initialization.

v2:
- using intel_de_rmw()

Quoted 6 lines

Actually, I'm not sure whether this is valid; I believe we always have to read from a lane register and can only write to the group registers:

"Reads using a port group address usually cannot return correct data. For read/modify/write to a group, the read should be to one of the lane addresses, then the write to the group address."

Yep, v3 is doing the right thing: https://patchwork.freedesktop.org/series/78796/

Quoted 101 lines
Quoted 14 lines

BSpec: 49291

---
 .../gpu/drm/i915/display/intel_combo_phy.c    | 23 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h               |  7 ++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_combo_phy.c +0 -0
index 77b04bb3ec62..115069833348 100644

drivers/gpu/drm/i915/display/intel_combo_phy.c static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, · line 272

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
@@ -264,6 +264,18 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 	if (!icl_combo_phy_enabled(dev_priv, phy))
 		return false;
 
+	if (INTEL_GEN(dev_priv) >= 12) {
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

If I'm reading the bspec correctly, it looks like both 00 and 01 represent div2 for this register. So maybe rather than looking for 01 exactly here we should just check that bit 30 is off?

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+	}
+
 	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
 
 	if (phy_is_master(dev_priv, phy)) {

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 390

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +1 -0
@@ -375,6 +387,17 @@ static void icl_combo_phys_init(struct drm_i915_private *dev_priv)
 		intel_de_write(dev_priv, ICL_PHY_MISC(phy), val);
 
 skip_phy_misc:
+		if (INTEL_GEN(dev_priv) >= 12) {

We may want to keep an eye on this part of the bspec; there seems to be something a bit off with the bspec tagging of this block and I'm not 100% sure it was actually intended to apply to RKL too or not.

It seems like the bspec has these steps as the very first thing, even before the "check whether the PHY is already initialized" step. But since we're checking that the bits are set the way we want in the verify function too, I don't think the ordering should matter.

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 394

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +4 -0
+			intel_de_rmw(dev_priv, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

As noted above, maybe we should just clear bit 30 and leave bit 29 set however it already was?

Matt

Quoted 37 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+			intel_de_rmw(dev_priv, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+		}
+
 		cnl_set_procmon_ref_values(dev_priv, phy);
 
 		if (phy_is_master(dev_priv, phy)) {
drivers/gpu/drm/i915/i915_reg.h +7 -0
index f09120cac89a..5469c9029f6d 100644
@@ -1974,6 +1974,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define ICL_PORT_PCS_DW1_AUX(phy)	_MMIO(_ICL_PORT_PCS_DW_AUX(1, phy))
 #define ICL_PORT_PCS_DW1_GRP(phy)	_MMIO(_ICL_PORT_PCS_DW_GRP(1, phy))
 #define ICL_PORT_PCS_DW1_LN0(phy)	_MMIO(_ICL_PORT_PCS_DW_LN(1, 0, phy))
+#define   DCC_MODE_SELECT_MASK		(0x3 << 20)
+#define   DCC_MODE_SELECT_CONTINUOSLY	(0x3 << 20)
 #define   COMMON_KEEPER_EN		(1 << 26)
 #define   LATENCY_OPTIM_MASK		(0x3 << 2)
 #define   LATENCY_OPTIM_VAL(x)		((x) << 2)
@@ -2072,6 +2074,11 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define   N_SCALAR(x)			((x) << 24)
 #define   N_SCALAR_MASK			(0x7F << 24)
 
+#define ICL_PORT_TX_DW8_GRP(phy)		_MMIO(_ICL_PORT_TX_DW_GRP(8, phy))
+#define ICL_PORT_TX_DW8_ODCC_CLK_SEL		REG_BIT(31)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK	REG_GENMASK(30, 29)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2	REG_FIELD_PREP(ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK, 0x1)
+
 #define _ICL_DPHY_CHKN_REG			0x194
 #define ICL_DPHY_CHKN(port)			_MMIO(_ICL_COMBOPHY(port) + _ICL_DPHY_CHKN_REG)
 #define   ICL_DPHY_CHKN_AFE_OVER_PPI_STRAP	REG_BIT(7)
Signature · 1 line
2.27.0
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 8 lines · Jose
Quoted 7 lines · Matt Roper
Quoted 5 lines · José Roberto de Souza

This is new step that was recently added to the combo phy initialization.

v2:
- using intel_de_rmw()

Quoted 8 lines
Quoted 6 lines

Actually, I'm not sure whether this is valid; I believe we always have to read from a lane register and can only write to the group registers:

"Reads using a port group address usually cannot return correct data. For read/modify/write to a group, the read should be to one of the lane addresses, then the write to the group address."

Yep, v3 is doing the right thing: https://patchwork.freedesktop.org/series/78796/

Ah, I overlooked that, thanks. I think my other comments below may still apply to v3 though.

Matt

Quoted 106 lines
Quoted 106 lines
Quoted 15 lines

BSpec: 49291

---
 .../gpu/drm/i915/display/intel_combo_phy.c    | 23 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h               |  7 ++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_combo_phy.c +0 -0
index 77b04bb3ec62..115069833348 100644

drivers/gpu/drm/i915/display/intel_combo_phy.c static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, · line 272

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
@@ -264,6 +264,18 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 	if (!icl_combo_phy_enabled(dev_priv, phy))
 		return false;
 
+	if (INTEL_GEN(dev_priv) >= 12) {
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

If I'm reading the bspec correctly, it looks like both 00 and 01 represent div2 for this register. So maybe rather than looking for 01 exactly here we should just check that bit 30 is off?

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+	}
+
 	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
 
 	if (phy_is_master(dev_priv, phy)) {

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 390

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +1 -0
@@ -375,6 +387,17 @@ static void icl_combo_phys_init(struct drm_i915_private *dev_priv)
 		intel_de_write(dev_priv, ICL_PHY_MISC(phy), val);
 
 skip_phy_misc:
+		if (INTEL_GEN(dev_priv) >= 12) {

We may want to keep an eye on this part of the bspec; there seems to be something a bit off with the bspec tagging of this block and I'm not 100% sure it was actually intended to apply to RKL too or not.

It seems like the bspec has these steps as the very first thing, even before the "check whether the PHY is already initialized" step. But since we're checking that the bits are set the way we want in the verify function too, I don't think the ordering should matter.

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 394

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +4 -0
+			intel_de_rmw(dev_priv, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

As noted above, maybe we should just clear bit 30 and leave bit 29 set however it already was?

Matt

Quoted 41 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+			intel_de_rmw(dev_priv, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+		}
+
 		cnl_set_procmon_ref_values(dev_priv, phy);
 
 		if (phy_is_master(dev_priv, phy)) {
drivers/gpu/drm/i915/i915_reg.h +7 -0
index f09120cac89a..5469c9029f6d 100644
@@ -1974,6 +1974,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define ICL_PORT_PCS_DW1_AUX(phy)	_MMIO(_ICL_PORT_PCS_DW_AUX(1, phy))
 #define ICL_PORT_PCS_DW1_GRP(phy)	_MMIO(_ICL_PORT_PCS_DW_GRP(1, phy))
 #define ICL_PORT_PCS_DW1_LN0(phy)	_MMIO(_ICL_PORT_PCS_DW_LN(1, 0, phy))
+#define   DCC_MODE_SELECT_MASK		(0x3 << 20)
+#define   DCC_MODE_SELECT_CONTINUOSLY	(0x3 << 20)
 #define   COMMON_KEEPER_EN		(1 << 26)
 #define   LATENCY_OPTIM_MASK		(0x3 << 2)
 #define   LATENCY_OPTIM_VAL(x)		((x) << 2)
@@ -2072,6 +2074,11 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define   N_SCALAR(x)			((x) << 24)
 #define   N_SCALAR_MASK			(0x7F << 24)
 
+#define ICL_PORT_TX_DW8_GRP(phy)		_MMIO(_ICL_PORT_TX_DW_GRP(8, phy))
+#define ICL_PORT_TX_DW8_ODCC_CLK_SEL		REG_BIT(31)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK	REG_GENMASK(30, 29)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2	REG_FIELD_PREP(ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK, 0x1)
+
 #define _ICL_DPHY_CHKN_REG			0x194
 #define ICL_DPHY_CHKN(port)			_MMIO(_ICL_COMBOPHY(port) + _ICL_DPHY_CHKN_REG)
 #define   ICL_DPHY_CHKN_AFE_OVER_PPI_STRAP	REG_BIT(7)
Signature · 6 lines
2.27.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 9 lines
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 12 lines · Matt Roper
Quoted 11 lines · Jose
Quoted 10 lines · Matt Roper
Quoted 5 lines · José Roberto de Souza

This is new step that was recently added to the combo phy initialization.

v2:
- using intel_de_rmw()

Actually, I'm not sure whether this is valid; I believe we always have to read from a lane register and can only write to the group registers:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

"Reads using a port group address usually cannot return correct data. For read/modify/write to a group, the read should be to one of the lane addresses, then the write to the group address."

Yep, v3 is doing the right thing: https://patchwork.freedesktop.org/series/78796/

Ah, I overlooked that, thanks. I think my other comments below may still apply to v3 though.

Ops missed those, answers bellow.

Quoted 30 lines

Matt

Quoted 26 lines
Quoted 26 lines
Quoted 13 lines

BSpec: 49291

---
 .../gpu/drm/i915/display/intel_combo_phy.c    | 23 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h               |  7 ++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_combo_phy.c +0 -0
index 77b04bb3ec62..115069833348 100644

drivers/gpu/drm/i915/display/intel_combo_phy.c static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, · line 272

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
@@ -264,6 +264,18 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 	if (!icl_combo_phy_enabled(dev_priv, phy))
 		return false;
 
+	if (INTEL_GEN(dev_priv) >= 12) {
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

If I'm reading the bspec correctly, it looks like both 00 and 01 represent div2 for this register. So maybe rather than looking for 01 exactly here we should just check that bit 30 is off?

That is a micro optimization that would cause loss in code readability, someone casually reading might get confused of why only bit 30 is checked, also we would need to add a different macro? Don't look worthy.
The default value of bit 31 is off so it will trigger the phy reprogram anyways.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+	}
+
 	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
 
 	if (phy_is_master(dev_priv, phy)) {
@@ -375,6 +387,17 @@ static void icl_combo_phys_init(struct drm_i915_private *dev_priv)
 		intel_de_write(dev_priv, ICL_PHY_MISC(phy), val);
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 390

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +1 -0
 skip_phy_misc:
+		if (INTEL_GEN(dev_priv) >= 12) {

We may want to keep an eye on this part of the bspec; there seems to be something a bit off with the bspec tagging of this block and I'm not 100% sure it was actually intended to apply to RKL too or not.

Ok, I'm receiving notifications of this page, will update if needed but it would be odd only RKL not needing this sequence while TGL and DG1 need it.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

It seems like the bspec has these steps as the very first thing, even before the "check whether the PHY is already initialized" step. But since we're checking that the bits are set the way we want in the verify function too, I don't think the ordering should matter.

Yep, re program it each time is a waste of time.

Quoted 49 lines
Quoted 49 lines
Quoted 49 lines

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 394

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +4 -0
+			intel_de_rmw(dev_priv, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

As noted above, maybe we should just clear bit 30 and leave bit 29 set however it already was?

Matt

Quoted 37 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+			intel_de_rmw(dev_priv, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+		}
+
 		cnl_set_procmon_ref_values(dev_priv, phy);
 
 		if (phy_is_master(dev_priv, phy)) {
drivers/gpu/drm/i915/i915_reg.h +7 -0
index f09120cac89a..5469c9029f6d 100644
@@ -1974,6 +1974,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define ICL_PORT_PCS_DW1_AUX(phy)	_MMIO(_ICL_PORT_PCS_DW_AUX(1, phy))
 #define ICL_PORT_PCS_DW1_GRP(phy)	_MMIO(_ICL_PORT_PCS_DW_GRP(1, phy))
 #define ICL_PORT_PCS_DW1_LN0(phy)	_MMIO(_ICL_PORT_PCS_DW_LN(1, 0, phy))
+#define   DCC_MODE_SELECT_MASK		(0x3 << 20)
+#define   DCC_MODE_SELECT_CONTINUOSLY	(0x3 << 20)
 #define   COMMON_KEEPER_EN		(1 << 26)
 #define   LATENCY_OPTIM_MASK		(0x3 << 2)
 #define   LATENCY_OPTIM_VAL(x)		((x) << 2)
@@ -2072,6 +2074,11 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define   N_SCALAR(x)			((x) << 24)
 #define   N_SCALAR_MASK			(0x7F << 24)
 
+#define ICL_PORT_TX_DW8_GRP(phy)		_MMIO(_ICL_PORT_TX_DW_GRP(8, phy))
+#define ICL_PORT_TX_DW8_ODCC_CLK_SEL		REG_BIT(31)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK	REG_GENMASK(30, 29)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2	REG_FIELD_PREP(ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK, 0x1)
+
 #define _ICL_DPHY_CHKN_REG			0x194
 #define ICL_DPHY_CHKN(port)			_MMIO(_ICL_COMBOPHY(port) + _ICL_DPHY_CHKN_REG)
 #define   ICL_DPHY_CHKN_AFE_OVER_PPI_STRAP	REG_BIT(7)
Signature · 1 line
2.27.0
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by
#5 lore raw
Quoted 55 lines · Jose
Quoted 12 lines · Matt Roper
Quoted 11 lines · Jose
Quoted 10 lines · Matt Roper
Quoted 5 lines · José Roberto de Souza

This is new step that was recently added to the combo phy initialization.

v2:
- using intel_de_rmw()

Actually, I'm not sure whether this is valid; I believe we always have to read from a lane register and can only write to the group registers:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

"Reads using a port group address usually cannot return correct data. For read/modify/write to a group, the read should be to one of the lane addresses, then the write to the group address."

Yep, v3 is doing the right thing: https://patchwork.freedesktop.org/series/78796/

Ah, I overlooked that, thanks. I think my other comments below may still apply to v3 though.

Ops missed those, answers bellow.

Quoted 30 lines

Matt

Quoted 26 lines
Quoted 26 lines
Quoted 13 lines

BSpec: 49291

---
 .../gpu/drm/i915/display/intel_combo_phy.c    | 23 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h               |  7 ++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_combo_phy.c +0 -0
index 77b04bb3ec62..115069833348 100644

drivers/gpu/drm/i915/display/intel_combo_phy.c static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, · line 272

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
@@ -264,6 +264,18 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
 	if (!icl_combo_phy_enabled(dev_priv, phy))
 		return false;
 
+	if (INTEL_GEN(dev_priv) >= 12) {
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

If I'm reading the bspec correctly, it looks like both 00 and 01 represent div2 for this register. So maybe rather than looking for 01 exactly here we should just check that bit 30 is off?

Quoted 3 lines

That is a micro optimization that would cause loss in code readability, someone casually reading might get confused of why only bit 30 is checked, also we would need to add a different macro? Don't look worthy.
The default value of bit 31 is off so it will trigger the phy reprogram anyways.

My main thinking was that the BIOS might have already programmed this register according to the new bspec directions, but chosen 00 instead of 01 as its value. So testing a "CLK_DIV_SEL_HIGHDIV" rather than CLK_SEL_MASK would allow us to avoid an unnecessary reprogram. But as you said, it probably doesn't hurt anything to reprogram more often than we need to, so we can probably leave it as-is.

Might be worth adding some extra explanation about that to the commit message. But otherwise,

Quoted 85 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+		ret &= check_phy_reg(dev_priv, phy, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+	}
+
 	ret = cnl_verify_procmon_ref_values(dev_priv, phy);
 
 	if (phy_is_master(dev_priv, phy)) {
@@ -375,6 +387,17 @@ static void icl_combo_phys_init(struct drm_i915_private *dev_priv)
 		intel_de_write(dev_priv, ICL_PHY_MISC(phy), val);
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 390

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +1 -0
 skip_phy_misc:
+		if (INTEL_GEN(dev_priv) >= 12) {

We may want to keep an eye on this part of the bspec; there seems to be something a bit off with the bspec tagging of this block and I'm not 100% sure it was actually intended to apply to RKL too or not.

Ok, I'm receiving notifications of this page, will update if needed but it would be odd only RKL not needing this sequence while TGL and DG1 need it.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

It seems like the bspec has these steps as the very first thing, even before the "check whether the PHY is already initialized" step. But since we're checking that the bits are set the way we want in the verify function too, I don't think the ordering should matter.

Yep, re program it each time is a waste of time.

Quoted 53 lines
Quoted 53 lines
Quoted 53 lines

drivers/gpu/drm/i915/display/intel_combo_phy.c static void icl_combo_phys_init(struct drm_i915_private *dev_priv) · line 394

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +4 -0
+			intel_de_rmw(dev_priv, ICL_PORT_TX_DW8_GRP(phy),
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
+				     ICL_PORT_TX_DW8_ODCC_CLK_SEL |
+				     ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2);

As noted above, maybe we should just clear bit 30 and leave bit 29 set however it already was?

Matt

Quoted 41 lines
drivers/gpu/drm/i915/display/intel_combo_phy.c +6 -0
+
+			intel_de_rmw(dev_priv, ICL_PORT_PCS_DW1_GRP(phy),
+				     DCC_MODE_SELECT_MASK,
+				     DCC_MODE_SELECT_CONTINUOSLY);
+		}
+
 		cnl_set_procmon_ref_values(dev_priv, phy);
 
 		if (phy_is_master(dev_priv, phy)) {
drivers/gpu/drm/i915/i915_reg.h +7 -0
index f09120cac89a..5469c9029f6d 100644
@@ -1974,6 +1974,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define ICL_PORT_PCS_DW1_AUX(phy)	_MMIO(_ICL_PORT_PCS_DW_AUX(1, phy))
 #define ICL_PORT_PCS_DW1_GRP(phy)	_MMIO(_ICL_PORT_PCS_DW_GRP(1, phy))
 #define ICL_PORT_PCS_DW1_LN0(phy)	_MMIO(_ICL_PORT_PCS_DW_LN(1, 0, phy))
+#define   DCC_MODE_SELECT_MASK		(0x3 << 20)
+#define   DCC_MODE_SELECT_CONTINUOSLY	(0x3 << 20)
 #define   COMMON_KEEPER_EN		(1 << 26)
 #define   LATENCY_OPTIM_MASK		(0x3 << 2)
 #define   LATENCY_OPTIM_VAL(x)		((x) << 2)
@@ -2072,6 +2074,11 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define   N_SCALAR(x)			((x) << 24)
 #define   N_SCALAR_MASK			(0x7F << 24)
 
+#define ICL_PORT_TX_DW8_GRP(phy)		_MMIO(_ICL_PORT_TX_DW_GRP(8, phy))
+#define ICL_PORT_TX_DW8_ODCC_CLK_SEL		REG_BIT(31)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK	REG_GENMASK(30, 29)
+#define ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_DIV2	REG_FIELD_PREP(ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK, 0x1)
+
 #define _ICL_DPHY_CHKN_REG			0x194
 #define ICL_DPHY_CHKN(port)			_MMIO(_ICL_COMBOPHY(port) + _ICL_DPHY_CHKN_REG)
 #define   ICL_DPHY_CHKN_AFE_OVER_PPI_STRAP	REG_BIT(7)
Signature · 6 lines
2.27.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 9 lines
Matt Roper
Graphics Software Engineer
VTT-OSGC Platform Enablement
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx