Commit 8cee664d authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Andi Shyti

drm/i915: use proper helper for register updates

There is special helper for register read/modify/write.
Signed-off-by: default avatarAndrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221006163200.2803722-5-andrzej.hajda@intel.com
parent 06b975d5
...@@ -408,14 +408,9 @@ static bool adl_tc_phy_take_ownership(struct intel_digital_port *dig_port, ...@@ -408,14 +408,9 @@ static bool adl_tc_phy_take_ownership(struct intel_digital_port *dig_port,
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
struct intel_uncore *uncore = &i915->uncore; struct intel_uncore *uncore = &i915->uncore;
enum port port = dig_port->base.port; enum port port = dig_port->base.port;
u32 val;
val = intel_uncore_read(uncore, DDI_BUF_CTL(port)); intel_uncore_rmw(uncore, DDI_BUF_CTL(port), DDI_BUF_CTL_TC_PHY_OWNERSHIP,
if (take) take ? DDI_BUF_CTL_TC_PHY_OWNERSHIP : 0);
val |= DDI_BUF_CTL_TC_PHY_OWNERSHIP;
else
val &= ~DDI_BUF_CTL_TC_PHY_OWNERSHIP;
intel_uncore_write(uncore, DDI_BUF_CTL(port), val);
return true; return true;
} }
......
This diff is collapsed.
...@@ -895,19 +895,14 @@ static void pnv_update_wm(struct drm_i915_private *dev_priv) ...@@ -895,19 +895,14 @@ static void pnv_update_wm(struct drm_i915_private *dev_priv)
wm = intel_calculate_wm(pixel_rate, &pnv_cursor_wm, wm = intel_calculate_wm(pixel_rate, &pnv_cursor_wm,
pnv_display_wm.fifo_size, pnv_display_wm.fifo_size,
4, latency->cursor_sr); 4, latency->cursor_sr);
reg = intel_uncore_read(&dev_priv->uncore, DSPFW3); intel_uncore_rmw(&dev_priv->uncore, DSPFW3, DSPFW_CURSOR_SR_MASK,
reg &= ~DSPFW_CURSOR_SR_MASK; FW_WM(wm, CURSOR_SR));
reg |= FW_WM(wm, CURSOR_SR);
intel_uncore_write(&dev_priv->uncore, DSPFW3, reg);
/* Display HPLL off SR */ /* Display HPLL off SR */
wm = intel_calculate_wm(pixel_rate, &pnv_display_hplloff_wm, wm = intel_calculate_wm(pixel_rate, &pnv_display_hplloff_wm,
pnv_display_hplloff_wm.fifo_size, pnv_display_hplloff_wm.fifo_size,
cpp, latency->display_hpll_disable); cpp, latency->display_hpll_disable);
reg = intel_uncore_read(&dev_priv->uncore, DSPFW3); intel_uncore_rmw(&dev_priv->uncore, DSPFW3, DSPFW_HPLL_SR_MASK, FW_WM(wm, HPLL_SR));
reg &= ~DSPFW_HPLL_SR_MASK;
reg |= FW_WM(wm, HPLL_SR);
intel_uncore_write(&dev_priv->uncore, DSPFW3, reg);
/* cursor HPLL off SR */ /* cursor HPLL off SR */
wm = intel_calculate_wm(pixel_rate, &pnv_cursor_hplloff_wm, wm = intel_calculate_wm(pixel_rate, &pnv_cursor_hplloff_wm,
...@@ -3480,7 +3475,6 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv, ...@@ -3480,7 +3475,6 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv,
{ {
struct ilk_wm_values *previous = &dev_priv->display.wm.hw; struct ilk_wm_values *previous = &dev_priv->display.wm.hw;
unsigned int dirty; unsigned int dirty;
u32 val;
dirty = ilk_compute_wm_dirty(dev_priv, previous, results); dirty = ilk_compute_wm_dirty(dev_priv, previous, results);
if (!dirty) if (!dirty)
...@@ -3496,31 +3490,19 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv, ...@@ -3496,31 +3490,19 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv,
intel_uncore_write(&dev_priv->uncore, WM0_PIPE_ILK(PIPE_C), results->wm_pipe[2]); intel_uncore_write(&dev_priv->uncore, WM0_PIPE_ILK(PIPE_C), results->wm_pipe[2]);
if (dirty & WM_DIRTY_DDB) { if (dirty & WM_DIRTY_DDB) {
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
val = intel_uncore_read(&dev_priv->uncore, WM_MISC); intel_uncore_rmw(&dev_priv->uncore, WM_MISC, WM_MISC_DATA_PARTITION_5_6,
if (results->partitioning == INTEL_DDB_PART_1_2) results->partitioning == INTEL_DDB_PART_1_2 ? 0 :
val &= ~WM_MISC_DATA_PARTITION_5_6; WM_MISC_DATA_PARTITION_5_6);
else
val |= WM_MISC_DATA_PARTITION_5_6;
intel_uncore_write(&dev_priv->uncore, WM_MISC, val);
} else {
val = intel_uncore_read(&dev_priv->uncore, DISP_ARB_CTL2);
if (results->partitioning == INTEL_DDB_PART_1_2)
val &= ~DISP_DATA_PARTITION_5_6;
else else
val |= DISP_DATA_PARTITION_5_6; intel_uncore_rmw(&dev_priv->uncore, DISP_ARB_CTL2, DISP_DATA_PARTITION_5_6,
intel_uncore_write(&dev_priv->uncore, DISP_ARB_CTL2, val); results->partitioning == INTEL_DDB_PART_1_2 ? 0 :
} DISP_DATA_PARTITION_5_6);
} }
if (dirty & WM_DIRTY_FBC) { if (dirty & WM_DIRTY_FBC)
val = intel_uncore_read(&dev_priv->uncore, DISP_ARB_CTL); intel_uncore_rmw(&dev_priv->uncore, DISP_ARB_CTL, DISP_FBC_WM_DIS,
if (results->enable_fbc_wm) results->enable_fbc_wm ? 0 : DISP_FBC_WM_DIS);
val &= ~DISP_FBC_WM_DIS;
else
val |= DISP_FBC_WM_DIS;
intel_uncore_write(&dev_priv->uncore, DISP_ARB_CTL, val);
}
if (dirty & WM_DIRTY_LP(1) && if (dirty & WM_DIRTY_LP(1) &&
previous->wm_lp_spr[0] != results->wm_lp_spr[0]) previous->wm_lp_spr[0] != results->wm_lp_spr[0])
...@@ -4131,7 +4113,7 @@ static void g4x_disable_trickle_feed(struct drm_i915_private *dev_priv) ...@@ -4131,7 +4113,7 @@ static void g4x_disable_trickle_feed(struct drm_i915_private *dev_priv)
intel_uncore_read(&dev_priv->uncore, DSPCNTR(pipe)) | intel_uncore_read(&dev_priv->uncore, DSPCNTR(pipe)) |
DISP_TRICKLE_FEED_DISABLE); DISP_TRICKLE_FEED_DISABLE);
intel_uncore_write(&dev_priv->uncore, DSPSURF(pipe), intel_uncore_read(&dev_priv->uncore, DSPSURF(pipe))); intel_uncore_rmw(&dev_priv->uncore, DSPSURF(pipe), 0, 0);
intel_uncore_posting_read(&dev_priv->uncore, DSPSURF(pipe)); intel_uncore_posting_read(&dev_priv->uncore, DSPSURF(pipe));
} }
} }
...@@ -4339,8 +4321,8 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv, ...@@ -4339,8 +4321,8 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
u32 val; u32 val;
/* WaTempDisableDOPClkGating:bdw */ /* WaTempDisableDOPClkGating:bdw */
misccpctl = intel_uncore_read(&dev_priv->uncore, GEN7_MISCCPCTL); misccpctl = intel_uncore_rmw(&dev_priv->uncore, GEN7_MISCCPCTL, ~GEN7_DOP_CLOCK_GATE_ENABLE,
intel_uncore_write(&dev_priv->uncore, GEN7_MISCCPCTL, misccpctl & ~GEN7_DOP_CLOCK_GATE_ENABLE); 0);
val = intel_uncore_read(&dev_priv->uncore, GEN8_L3SQCREG1); val = intel_uncore_read(&dev_priv->uncore, GEN8_L3SQCREG1);
val &= ~L3_PRIO_CREDITS_MASK; val &= ~L3_PRIO_CREDITS_MASK;
...@@ -4620,8 +4602,6 @@ static void hsw_init_clock_gating(struct drm_i915_private *dev_priv) ...@@ -4620,8 +4602,6 @@ static void hsw_init_clock_gating(struct drm_i915_private *dev_priv)
static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) static void ivb_init_clock_gating(struct drm_i915_private *dev_priv)
{ {
u32 snpcr;
intel_uncore_write(&dev_priv->uncore, ILK_DSPCLK_GATE_D, ILK_VRHUNIT_CLOCK_GATE_DISABLE); intel_uncore_write(&dev_priv->uncore, ILK_DSPCLK_GATE_D, ILK_VRHUNIT_CLOCK_GATE_DISABLE);
/* WaFbcAsynchFlipDisableFbcQueue:ivb */ /* WaFbcAsynchFlipDisableFbcQueue:ivb */
...@@ -4659,10 +4639,8 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv) ...@@ -4659,10 +4639,8 @@ static void ivb_init_clock_gating(struct drm_i915_private *dev_priv)
g4x_disable_trickle_feed(dev_priv); g4x_disable_trickle_feed(dev_priv);
snpcr = intel_uncore_read(&dev_priv->uncore, GEN6_MBCUNIT_SNPCR); intel_uncore_rmw(&dev_priv->uncore, GEN6_MBCUNIT_SNPCR, GEN6_MBC_SNPCR_MASK,
snpcr &= ~GEN6_MBC_SNPCR_MASK; GEN6_MBC_SNPCR_MED);
snpcr |= GEN6_MBC_SNPCR_MED;
intel_uncore_write(&dev_priv->uncore, GEN6_MBCUNIT_SNPCR, snpcr);
if (!HAS_PCH_NOP(dev_priv)) if (!HAS_PCH_NOP(dev_priv))
cpt_init_clock_gating(dev_priv); cpt_init_clock_gating(dev_priv);
......
...@@ -194,7 +194,6 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *i915) ...@@ -194,7 +194,6 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *i915)
{ {
struct vlv_s0ix_state *s = i915->vlv_s0ix_state; struct vlv_s0ix_state *s = i915->vlv_s0ix_state;
struct intel_uncore *uncore = &i915->uncore; struct intel_uncore *uncore = &i915->uncore;
u32 val;
int i; int i;
if (!s) if (!s)
...@@ -262,15 +261,11 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *i915) ...@@ -262,15 +261,11 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *i915)
* be restored, as they are used to control the s0ix suspend/resume * be restored, as they are used to control the s0ix suspend/resume
* sequence by the caller. * sequence by the caller.
*/ */
val = intel_uncore_read(uncore, VLV_GTLC_WAKE_CTRL); intel_uncore_rmw(uncore, VLV_GTLC_WAKE_CTRL, ~VLV_GTLC_ALLOWWAKEREQ,
val &= VLV_GTLC_ALLOWWAKEREQ; s->gtlc_wake_ctrl & ~VLV_GTLC_ALLOWWAKEREQ);
val |= s->gtlc_wake_ctrl & ~VLV_GTLC_ALLOWWAKEREQ;
intel_uncore_write(uncore, VLV_GTLC_WAKE_CTRL, val);
val = intel_uncore_read(uncore, VLV_GTLC_SURVIVABILITY_REG); intel_uncore_rmw(uncore, VLV_GTLC_SURVIVABILITY_REG, ~VLV_GFX_CLK_FORCE_ON_BIT,
val &= VLV_GFX_CLK_FORCE_ON_BIT; s->gtlc_survive & ~VLV_GFX_CLK_FORCE_ON_BIT);
val |= s->gtlc_survive & ~VLV_GFX_CLK_FORCE_ON_BIT;
intel_uncore_write(uncore, VLV_GTLC_SURVIVABILITY_REG, val);
intel_uncore_write(uncore, VLV_PMWGICZ, s->pmwgicz); intel_uncore_write(uncore, VLV_PMWGICZ, s->pmwgicz);
...@@ -308,14 +303,10 @@ static int vlv_wait_for_pw_status(struct drm_i915_private *i915, ...@@ -308,14 +303,10 @@ static int vlv_wait_for_pw_status(struct drm_i915_private *i915,
static int vlv_force_gfx_clock(struct drm_i915_private *i915, bool force_on) static int vlv_force_gfx_clock(struct drm_i915_private *i915, bool force_on)
{ {
struct intel_uncore *uncore = &i915->uncore; struct intel_uncore *uncore = &i915->uncore;
u32 val;
int err; int err;
val = intel_uncore_read(uncore, VLV_GTLC_SURVIVABILITY_REG); intel_uncore_rmw(uncore, VLV_GTLC_SURVIVABILITY_REG, VLV_GFX_CLK_FORCE_ON_BIT,
val &= ~VLV_GFX_CLK_FORCE_ON_BIT; force_on ? VLV_GFX_CLK_FORCE_ON_BIT : 0);
if (force_on)
val |= VLV_GFX_CLK_FORCE_ON_BIT;
intel_uncore_write(uncore, VLV_GTLC_SURVIVABILITY_REG, val);
if (!force_on) if (!force_on)
return 0; return 0;
...@@ -340,11 +331,8 @@ static int vlv_allow_gt_wake(struct drm_i915_private *i915, bool allow) ...@@ -340,11 +331,8 @@ static int vlv_allow_gt_wake(struct drm_i915_private *i915, bool allow)
u32 val; u32 val;
int err; int err;
val = intel_uncore_read(uncore, VLV_GTLC_WAKE_CTRL); intel_uncore_rmw(uncore, VLV_GTLC_WAKE_CTRL, VLV_GTLC_ALLOWWAKEREQ,
val &= ~VLV_GTLC_ALLOWWAKEREQ; allow ? VLV_GTLC_ALLOWWAKEREQ : 0);
if (allow)
val |= VLV_GTLC_ALLOWWAKEREQ;
intel_uncore_write(uncore, VLV_GTLC_WAKE_CTRL, val);
intel_uncore_posting_read(uncore, VLV_GTLC_WAKE_CTRL); intel_uncore_posting_read(uncore, VLV_GTLC_WAKE_CTRL);
mask = VLV_GTLC_ALLOWWAKEACK; mask = VLV_GTLC_ALLOWWAKEACK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment