[PATCH v13 19/35] phy: rockchip: usbdp: Re-init the PHY on orientation change

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Jul 14 13:09:39 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The USB3 port is not re-enabled in the system GRF when the PHY dynamically transitions from DP-only to DP+USB mode, permanently breaking SuperSpeed USB functionality.
--

--- Patch [19]: [PATCH v13 19/35] phy: rockchip: usbdp: Re-init the PHY on orientation change ---
commit dd525747df45e57b3edc64db460c26dd4373c3df
Author: Sebastian Reichel <sebastian.reichel at collabora.com>

phy: rockchip: usbdp: Re-init the PHY on orientation change

Changing the cable orientation reconfigures the lane muxing, which
requires re-initializing the PHY. Without this DP functionality
breaks, if the cable is re-plugged with swapped orientation.

> diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> index e44d19c9d1193..4b454798c4ed4 100644
> --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> @@ -620,6 +620,7 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw,
>  				 enum typec_orientation orien)
>  {
>  	struct rk_udphy *udphy = typec_switch_get_drvdata(sw);
> +	bool flipped = orien == TYPEC_ORIENTATION_REVERSE;
>  
>  	mutex_lock(&udphy->mutex);
>  
> @@ -631,7 +632,10 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw,
>  		goto unlock_ret;
>  	}
>  
> -	udphy->flip = orien == TYPEC_ORIENTATION_REVERSE;
> +	if (udphy->flip != flipped)
> +		udphy->phy_needs_reinit = true;

[Severity: High]
This is a pre-existing issue, but does setting phy_needs_reinit to true expose
a bug in rk_udphy_power_on() where the USB3 port is not re-enabled when
transitioning from DP-only to DP+USB mode?

If the Type-C connection dynamically transitions from DP-only (where the U3 port
is disabled via rk_udphy_u3_port_disable(udphy, true)) to DP+USB
(UDPHY_MODE_DP_USB), rk_udphy_power_on() takes this branch:

drivers/phy/rockchip/phy-rockchip-usbdp.c:rk_udphy_power_on() {
    ...
	} else if (udphy->phy_needs_reinit) {
		if (udphy->mode == UDPHY_MODE_DP)
			rk_udphy_u3_port_disable(udphy, true);

		ret = rk_udphy_init(udphy);
    ...
}

It explicitly disables the U3 port if the new mode is DP-only, but it
completely lacks the logic to re-enable the port
(rk_udphy_u3_port_disable(udphy, false)) if the mode includes USB.

Could this cause SuperSpeed USB traffic to fail because the U3 port remains
disabled in the usbgrf register?

> +
> +	udphy->flip = flipped;
>  	rk_udphy_set_typec_default_mapping(udphy);
>  	rk_udphy_usb_bvalid_enable(udphy, true);
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260714-rockchip-usbdp-cleanup-v13-0-6cb3e769d4c5@collabora.com?part=19



More information about the linux-phy mailing list