phy: rockchip: usbdp: Fix Generic PHY reference counting
authorJonas Karlman <jonas@kwiboo.se>
Mon, 21 Jul 2025 22:07:10 +0000 (22:07 +0000)
committerKever Yang <kever.yang@rock-chips.com>
Sat, 30 Aug 2025 16:48:15 +0000 (00:48 +0800)
commit0336e97b1187f7f54e11c6cb9f3fa938cc11204e
tree777ea625df0180bb0b539621a9c8fa876b98680b
parentffa1485c8173668424ca0ad87020966658092772
phy: rockchip: usbdp: Fix Generic PHY reference counting

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@fc400000: 2 USB Device(s) found
         scanning usb for storage devices... 1 Storage Device(s) found

  => usb reset
  resetting USB...
  [...]
  rockchip_udphy phy@fed90000: cmn ana lcpll lock timeout
  rockchip_udphy phy@fed90000: failed to init usbdp combophy
  rockchip_udphy phy@fed90000: PHY: Failed to init phy@fed90000: -110.
  Can't init PHY1
  Bus usb@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@fc400000: 2 USB Device(s) found
         scanning usb for storage devices... 1 Storage Device(s) found

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
drivers/phy/rockchip/phy-rockchip-usbdp.c