diff mbox series

[4/5] drm/i915/icl: Skip init for an already enabled combo PHY

Message ID 20181102180706.16582-5-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/icl: Fix combo PHY HW context loss | expand

Commit Message

Imre Deak Nov. 2, 2018, 6:07 p.m. UTC
Bspec says we should skip the initialization of combo PHYs that are
already initialized. We'll need to reinit the PHYs more frequently
when exiting from DC6 (after the next patch), so let's make sure the
uninit sequence complies with the spec. For safety skip the init only if
all the PHY register fields have their expected values.

Bspec: 21257
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_combo_phy.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Rodrigo Vivi Nov. 2, 2018, 7:28 p.m. UTC | #1
On Fri, Nov 02, 2018 at 08:07:05PM +0200, Imre Deak wrote:
> Bspec says we should skip the initialization of combo PHYs that are
> already initialized. We'll need to reinit the PHYs more frequently
> when exiting from DC6 (after the next patch), so let's make sure the
> uninit sequence complies with the spec. For safety skip the init only if
> all the PHY register fields have their expected values.
> 
> Bspec: 21257
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_combo_phy.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_combo_phy.c b/drivers/gpu/drm/i915/intel_combo_phy.c
> index 1522e2a25390..7b911702f834 100644
> --- a/drivers/gpu/drm/i915/intel_combo_phy.c
> +++ b/drivers/gpu/drm/i915/intel_combo_phy.c
> @@ -220,6 +220,12 @@ void icl_combo_phys_init(struct drm_i915_private *dev_priv)
>  	for (port = PORT_A; port <= PORT_B; port++) {
>  		u32 val;
>  
> +		if (icl_combo_phy_verify_state(dev_priv, port)) {
> +			DRM_DEBUG_DRIVER("Port-%c combo PHY already enabled, won't reprogram it.\n",
> +					 port_name(port));

Note since I didn't rv-b the previous patch:
I have checked the previous patch that introduces this and it is indeed correct:

"If PORT_COMP_DW0 Comp Init == 1b, skip the rest of this sequence since it is already initialized"

so,

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> +			continue;
> +		}
> +
>  		val = I915_READ(ICL_PHY_MISC(port));
>  		val &= ~ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN;
>  		I915_WRITE(ICL_PHY_MISC(port), val);
> -- 
> 2.13.2
>
Souza, Jose Nov. 2, 2018, 9:29 p.m. UTC | #2
On Fri, 2018-11-02 at 20:07 +0200, Imre Deak wrote:
> Bspec says we should skip the initialization of combo PHYs that are
> already initialized. We'll need to reinit the PHYs more frequently
> when exiting from DC6 (after the next patch), so let's make sure the
> uninit sequence complies with the spec. For safety skip the init only
> if
> all the PHY register fields have their expected values.
> 
> Bspec: 21257
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_combo_phy.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_combo_phy.c
> b/drivers/gpu/drm/i915/intel_combo_phy.c
> index 1522e2a25390..7b911702f834 100644
> --- a/drivers/gpu/drm/i915/intel_combo_phy.c
> +++ b/drivers/gpu/drm/i915/intel_combo_phy.c
> @@ -220,6 +220,12 @@ void icl_combo_phys_init(struct drm_i915_private
> *dev_priv)
>  	for (port = PORT_A; port <= PORT_B; port++) {
>  		u32 val;
>  
> +		if (icl_combo_phy_verify_state(dev_priv, port)) {
> +			DRM_DEBUG_DRIVER("Port-%c combo PHY already
> enabled, won't reprogram it.\n",
> +					 port_name(port));
> +			continue;
> +		}
> +
>  		val = I915_READ(ICL_PHY_MISC(port));
>  		val &= ~ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN;
>  		I915_WRITE(ICL_PHY_MISC(port), val);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_combo_phy.c b/drivers/gpu/drm/i915/intel_combo_phy.c
index 1522e2a25390..7b911702f834 100644
--- a/drivers/gpu/drm/i915/intel_combo_phy.c
+++ b/drivers/gpu/drm/i915/intel_combo_phy.c
@@ -220,6 +220,12 @@  void icl_combo_phys_init(struct drm_i915_private *dev_priv)
 	for (port = PORT_A; port <= PORT_B; port++) {
 		u32 val;
 
+		if (icl_combo_phy_verify_state(dev_priv, port)) {
+			DRM_DEBUG_DRIVER("Port-%c combo PHY already enabled, won't reprogram it.\n",
+					 port_name(port));
+			continue;
+		}
+
 		val = I915_READ(ICL_PHY_MISC(port));
 		val &= ~ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN;
 		I915_WRITE(ICL_PHY_MISC(port), val);