}
}
+static void intel_c10_msgbus_access_begin(struct intel_encoder *encoder,
+ u8 lane_mask)
+{
+ if (!intel_encoder_is_c10phy(encoder))
+ return;
+
+ intel_cx0_rmw(encoder, lane_mask, PHY_C10_VDR_CONTROL(1),
+ 0, C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+}
+
+static void intel_c10_msgbus_access_commit(struct intel_encoder *encoder,
+ u8 lane_mask, bool master_lane)
+{
+ u8 val = C10_VDR_CTRL_UPDATE_CFG;
+
+ if (!intel_encoder_is_c10phy(encoder))
+ return;
+
+ if (master_lane)
+ val |= C10_VDR_CTRL_MASTER_LANE;
+
+ intel_cx0_rmw(encoder, lane_mask, PHY_C10_VDR_CONTROL(1),
+ 0, val, MB_WRITE_COMMITTED);
+}
+
void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state)
{
return;
}
+ intel_c10_msgbus_access_begin(encoder, owned_lane_mask);
+
if (intel_encoder_is_c10phy(encoder)) {
- intel_cx0_rmw(encoder, owned_lane_mask, PHY_C10_VDR_CONTROL(1),
- 0, C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
intel_cx0_rmw(encoder, owned_lane_mask, PHY_C10_VDR_CMN(3),
C10_CMN3_TXVBOOST_MASK,
C10_CMN3_TXVBOOST(intel_c10_get_tx_vboost_lvl(crtc_state)),
0, PHY_C10_VDR_OVRD_TX1 | PHY_C10_VDR_OVRD_TX2,
MB_WRITE_COMMITTED);
- if (intel_encoder_is_c10phy(encoder))
- intel_cx0_rmw(encoder, owned_lane_mask, PHY_C10_VDR_CONTROL(1),
- 0, C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);
+ intel_c10_msgbus_access_commit(encoder, owned_lane_mask, false);
intel_cx0_phy_transaction_end(encoder, wakeref);
}
* According to C10 VDR Register programming Sequence we need
* to do this to read PHY internal registers from MsgBus.
*/
- intel_cx0_rmw(encoder, lane, PHY_C10_VDR_CONTROL(1),
- 0, C10_VDR_CTRL_MSGBUS_ACCESS,
- MB_WRITE_COMMITTED);
+ intel_c10_msgbus_access_begin(encoder, lane);
for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
pll_state->pll[i] = intel_cx0_read(encoder, lane, PHY_C10_VDR_PLL(i));
{
int i;
- intel_cx0_rmw(encoder, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),
- 0, C10_VDR_CTRL_MSGBUS_ACCESS,
- MB_WRITE_COMMITTED);
+ intel_c10_msgbus_access_begin(encoder, INTEL_CX0_BOTH_LANES);
/* Program the pll values only for the master lane */
for (i = 0; i < ARRAY_SIZE(pll_state->pll); i++)
intel_cx0_rmw(encoder, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CUSTOM_WIDTH,
C10_VDR_CUSTOM_WIDTH_MASK, C10_VDR_CUSTOM_WIDTH_8_10,
MB_WRITE_COMMITTED);
- intel_cx0_rmw(encoder, INTEL_CX0_LANE0, PHY_C10_VDR_CONTROL(1),
- 0, C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG,
- MB_WRITE_COMMITTED);
+
+ intel_c10_msgbus_access_commit(encoder, INTEL_CX0_LANE0, true);
}
static void intel_c10pll_dump_hw_state(struct intel_display *display,
bool dp_alt_mode = intel_tc_port_in_dp_alt_mode(enc_to_dig_port(encoder));
u8 owned_lane_mask = intel_cx0_get_owned_lane_mask(encoder);
- if (intel_encoder_is_c10phy(encoder))
- intel_cx0_rmw(encoder, owned_lane_mask,
- PHY_C10_VDR_CONTROL(1), 0,
- C10_VDR_CTRL_MSGBUS_ACCESS,
- MB_WRITE_COMMITTED);
+ intel_c10_msgbus_access_begin(encoder, owned_lane_mask);
if (lane_reversal)
disables = REG_GENMASK8(3, 0) >> lane_count;
MB_WRITE_COMMITTED);
}
- if (intel_encoder_is_c10phy(encoder))
- intel_cx0_rmw(encoder, owned_lane_mask,
- PHY_C10_VDR_CONTROL(1), 0,
- C10_VDR_CTRL_UPDATE_CFG,
- MB_WRITE_COMMITTED);
+ intel_c10_msgbus_access_commit(encoder, owned_lane_mask, false);
}
static u32 intel_cx0_get_pclk_pll_request(u8 lane_mask)
wakeref = intel_cx0_phy_transaction_begin(encoder);
- if (intel_encoder_is_c10phy(encoder))
- intel_cx0_rmw(encoder, owned_lane_mask, PHY_C10_VDR_CONTROL(1), 0,
- C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);
+ intel_c10_msgbus_access_begin(encoder, owned_lane_mask);
for (i = 0; i < 4; i++) {
int tx = i % 2 + 1;