[PATCH 01/10] phy: rockchip: usbdp: Fix Generic PHY reference counting
Kever Yang
kever.yang at rock-chips.com
Sat Aug 30 18:45:38 CEST 2025
On 2025/7/22 06:07, Jonas Karlman wrote:
> Generic PHY reference counting helps ensure driver ops for init/exit and
> power on/off are called at correct state. For this to work the PHY
> driver must initialize PHY-id to a persistent value in of_xlate ops.
>
> The Rockchip USBDP PHY driver does not initialize the PHY-id field, this
> typically lead to use of unshared reference counting among different
> struct phy instances.
>
> Initialize the PHY-id in of_xlate ops to ensure use of shared reference
> counting among all struct phy instances.
>
> E.g. on a ROCK 5B following could be observed:
>
> => usb start
> starting USB...
> [...]
> Bus usb at fc400000: 2 USB Device(s) found
> scanning usb for storage devices... 1 Storage Device(s) found
>
> => usb reset
> resetting USB...
> [...]
> rockchip_udphy phy at fed90000: cmn ana lcpll lock timeout
> rockchip_udphy phy at fed90000: failed to init usbdp combophy
> rockchip_udphy phy at fed90000: PHY: Failed to init phy at fed90000: -110.
> Can't init PHY1
> Bus usb at fc400000: probe failed, error -110
> scanning usb for storage devices... 0 Storage Device(s) found
>
> With shared reference counting this is fixed:
>
> => usb reset
> resetting USB...
> [...]
> Bus usb at fc400000: 2 USB Device(s) found
> scanning usb for storage devices... 1 Storage Device(s) found
>
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
Reviewed-by: Kever Yang <kever.yang at rock-chips.com>
Thanks,
- Kever
> ---
> drivers/phy/rockchip/phy-rockchip-usbdp.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> index 9deec47ae462..56963c87183e 100644
> --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> @@ -587,12 +587,16 @@ static int udphy_power_off(struct rockchip_udphy *udphy, u8 mode)
> static int rockchip_u3phy_of_xlate(struct phy *phy,
> struct ofnode_phandle_args *args)
> {
> + struct rockchip_udphy *udphy = dev_get_priv(phy->dev);
> +
> if (args->args_count == 0)
> return -EINVAL;
>
> if (args->args[0] != PHY_TYPE_USB3)
> return -EINVAL;
>
> + phy->id = udphy->id;
> +
> return 0;
> }
>
More information about the U-Boot
mailing list