mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
phy: rockchip: usbdp: Cleanup DP lane selection function
Use FIELD_PREP_WM16() helpers to simplify the DP lane selection logic. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Tested-by: Igor Paunovic <royalnet026@gmail.com> # Orange Pi 5 Plus Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260915-rockchip-usbdp-cleanup-v15-15-80e2c11d1ce8@collabora.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
e8e7f3d875
commit
9235d03d5e
|
|
@ -547,30 +547,16 @@ static void rk_udphy_usb_bvalid_enable(struct rk_udphy *udphy, u8 enable)
|
|||
static void rk_udphy_dp_lane_select(struct rk_udphy *udphy)
|
||||
{
|
||||
const struct rk_udphy_cfg *cfg = udphy->cfgs;
|
||||
u32 value = 0;
|
||||
u32 value = FIELD_PREP_WM16(DP_LANE_SEL_ALL, 0);
|
||||
int i;
|
||||
|
||||
switch (udphy->dp_lanes) {
|
||||
case 4:
|
||||
value |= 3 << udphy->dp_lane_sel[3] * 2;
|
||||
value |= 2 << udphy->dp_lane_sel[2] * 2;
|
||||
fallthrough;
|
||||
for (i = 0; i < udphy->dp_lanes; i++)
|
||||
value |= field_prep(DP_LANE_SEL_N(udphy->dp_lane_sel[i]), i);
|
||||
|
||||
case 2:
|
||||
value |= 1 << udphy->dp_lane_sel[1] * 2;
|
||||
fallthrough;
|
||||
value |= FIELD_PREP_WM16(DP_AUX_DIN_SEL, udphy->dp_aux_din_sel);
|
||||
value |= FIELD_PREP_WM16(DP_AUX_DOUT_SEL, udphy->dp_aux_dout_sel);
|
||||
|
||||
case 1:
|
||||
value |= 0 << udphy->dp_lane_sel[0] * 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
regmap_write(udphy->vogrf, cfg->vogrfcfg[udphy->id].dp_lane_reg,
|
||||
((DP_AUX_DIN_SEL | DP_AUX_DOUT_SEL | DP_LANE_SEL_ALL) << 16) |
|
||||
FIELD_PREP(DP_AUX_DIN_SEL, udphy->dp_aux_din_sel) |
|
||||
FIELD_PREP(DP_AUX_DOUT_SEL, udphy->dp_aux_dout_sel) | value);
|
||||
regmap_write(udphy->vogrf, cfg->vogrfcfg[udphy->id].dp_lane_reg, value);
|
||||
}
|
||||
|
||||
static void rk_udphy_dp_lane_enable(struct rk_udphy *udphy, int dp_lanes)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user