60 lines
2.0 KiB
Diff
60 lines
2.0 KiB
Diff
From git@z Thu Jan 1 00:00:00 1970
|
|
Subject: [PATCH v13 15/35] phy: rockchip: usbdp: Cleanup DP lane selection
|
|
function
|
|
From: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Date: Tue, 14 Jul 2026 21:26:16 +0200
|
|
Message-Id: <20260714-rockchip-usbdp-cleanup-v13-15-6cb3e769d4c5@collabora.com>
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Use FIELD_PREP_WM16() helpers to simplify the DP lane selection
|
|
logic.
|
|
|
|
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
|
|
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
---
|
|
drivers/phy/rockchip/phy-rockchip-usbdp.c | 28 +++++++---------------------
|
|
1 file changed, 7 insertions(+), 21 deletions(-)
|
|
|
|
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
|
|
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
|
|
@@ -548,30 +548,16 @@ static void rk_udphy_usb_bvalid_enable(s
|
|
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)
|