phy: rockchip: usbdp: Avoid access usb grf during dp phy power on

The power domain of the usb grf belongs to PD_USB
on both RK3576 and RK3588 platforms. The PD_USB is
managed by the USB controller driver, and it maybe
powered down if USB is not working.

Test on RK3576 EVB2 which supports Type-A USB3.1 +
DP 2xLanes, connect DP to Display screen, meanwhile,
USB not used, SError happens with the following log:

[  224.958079][    C0] Kernel panic - not syncing: Asynchronous SError Interrupt
[  224.958084][    C0] CPU: 0 PID: 132 Comm: kworker/0:2 Tainted: G           O       6.1.57 #11
[  224.958089][    C0] Hardware name: Rockchip RK3576 EVB2 V10 Android Board (DT)
[  224.958092][    C0] Workqueue: events dw_dp_hpd_work
[  224.958101][    C0] Call trace:
[  224.958103][    C0]  dump_backtrace+0xf4/0x114
[  224.958115][    C0]  show_stack+0x18/0x24
[  224.958122][    C0]  dump_stack_lvl+0x6c/0x90
[  224.958132][    C0]  dump_stack+0x18/0x38
[  224.958137][    C0]  panic+0x14c/0x338
[  224.958145][    C0]  check_panic_on_warn+0x0/0x90
[  224.958155][    C0]  arm64_serror_panic+0x68/0x74
[  224.958160][    C0]  do_serror+0xc4/0xcc
...
[  224.958218][    C0]  regmap_write+0x54/0x78
[  224.958224][    C0]  udphy_power_on+0x16c/0x1b0
[  224.958233][    C0]  rockchip_dp_phy_power_on+0x58/0x1bc
[  224.958240][    C0]  phy_power_on+0x8c/0x108
[  224.958248][    C0]  dw_dp_bridge_detect+0x58/0x348
[  224.958256][    C0]  drm_bridge_detect+0x28/0x34
[  224.958264][    C0]  dw_dp_connector_detect+0x34/0x4c
[  224.958272][    C0]  drm_helper_probe_detect+0xd0/0x1a0
[  224.958281][    C0]  check_connector_changed+0x50/0x1b0
[  224.958288][    C0]  drm_helper_hpd_irq_event+0x78/0x134
[  224.958295][    C0]  dw_dp_hpd_work+0x58/0x818

This patch moves udphy_u3_port_disable() from the
udphy_power_on() to rockchip_u3phy_init(), it can
avoid access usb grf during dp phy power on, and
the rockchip_u3phy_init() is called from the USB
controller driver, this can make sure the PD_USB
is powered on if it access usb grf in the USBDP
PHY driver.

Change-Id: I434b2efbbbb5b513ec668bca1c8800d0f7f18e12
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2024-04-28 17:05:54 +08:00
committed by Tao Huang
parent 601aff2337
commit 0b1d72b40c

View File

@@ -1063,14 +1063,9 @@ static int udphy_power_on(struct rockchip_udphy *udphy, u8 mode)
ret = udphy_setup(udphy);
if (ret)
return ret;
if (udphy->mode & UDPHY_MODE_USB)
udphy_u3_port_disable(udphy, false);
} else if (udphy->mode_change) {
udphy->mode_change = false;
udphy->status = UDPHY_MODE_NONE;
if (udphy->mode == UDPHY_MODE_DP)
udphy_u3_port_disable(udphy, true);
ret = udphy_disable(udphy);
if (ret)
@@ -1331,6 +1326,8 @@ static int rockchip_u3phy_init(struct phy *phy)
if (!(udphy->mode & UDPHY_MODE_USB) || udphy->hs) {
udphy_u3_port_disable(udphy, true);
goto unlock;
} else {
udphy_u3_port_disable(udphy, false);
}
ret = udphy_power_on(udphy, UDPHY_MODE_USB);