From d0e8f174dd01d809f1834b1d68d4ead30c53f368 Mon Sep 17 00:00:00 2001 From: Zhang Yubing Date: Wed, 19 Jun 2024 11:38:16 +0800 Subject: [PATCH] phy: rockchip: usbdp: use correct flag to init phy mode If the rockchip,dp-lane-mux property is config in dts, it mean DP function is used, but the USB function may not be used. It may be cause cmn ana lcpll lock timeout when initialize phy but USB function is not used. So just init the phy mode with USB function when u3-port node is enabled. If the rockchip,dp-lane-mux property is not in dts, it mean USB function is used, but the DP function is depend on DP Alt mode support by sink. If not sink device is disconnected and force to access DPTX controller register after initialize phy, The DP function should config, if not config the DPTX controller register can't be access. So if dp-port node is enabled, init the phy mode with DP function. Change-Id: I8aa7ab41d962a50dcdf6dffcf27070a6c6112efe Signed-off-by: Zhang Yubing --- drivers/phy/rockchip/phy-rockchip-usbdp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c index 89ddc07c5b78..0bb4b6a521e0 100644 --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c @@ -945,7 +945,6 @@ static int udphy_parse_lane_mux_data(struct rockchip_udphy *udphy, struct device udphy->mode = UDPHY_MODE_DP; udphy->dp_lanes = num_lanes; if (num_lanes == 1 || num_lanes == 2) { - udphy->mode |= UDPHY_MODE_USB; udphy->flip = udphy->lane_mux_sel[0] == PHY_LANE_MUX_DP ? true : false; } @@ -1570,6 +1569,7 @@ static int rockchip_udphy_probe(struct platform_device *pdev) } if (device_property_present(dev, "svid")) { + udphy->mode |= UDPHY_MODE_DP; ret = udphy_setup_typec_mux(udphy); if (ret) return ret; @@ -1592,6 +1592,7 @@ static int rockchip_udphy_probe(struct platform_device *pdev) phy_set_bus_width(phy, udphy->dp_lanes); phy->attrs.max_link_rate = udphy_dp_get_max_link_rate(udphy, child_np); } else if (of_node_name_eq(child_np, "u3-port")) { + udphy->mode |= UDPHY_MODE_USB; phy = devm_phy_create(dev, child_np, &rockchip_u3phy_ops); if (IS_ERR(phy)) { dev_err(dev, "failed to create usb phy: %pOFn\n", child_np);