From 9cce7d5ac893e4ce3eb16addefde473aabdb3adb Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Fri, 3 Feb 2023 15:11:14 +0800 Subject: [PATCH] phy: rockchip: inno-usb2: fix incorrect perip_connected The U2PHY sent "peripheral connected" extcon message to DWC3 even if there is no USB cable pluuged when the otg_sm_work is scheduled first time, this would be resumed DWC3 unexpectedly and cause the DWC3 gadget to incorrect state. So initialize the perip_connected to false before send the extcon message to fix it. This can fix the ADB can not be enumerated when plug the USB cable in the first time after the system boot up and the below messages may find in the Kernel log on RK3562-EVB2 board. [ 7.218101] read descriptors [ 7.218191] read strings [ 7.306784] dwc3 fe500000.usb: failed to enable ep0out Fixes: 00168bb5b5aa ("phy: rockchip: inno-usb2: fix otg port with vbus always on") Signed-off-by: Frank Wang Change-Id: I90209f15605d16ca746dd6c44fbaf6d9c1684eaa --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 0536c08e216e..4f545a9db14a 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1291,6 +1291,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work) } else { rphy->chg_state = USB_CHG_STATE_UNDEFINED; rphy->chg_type = POWER_SUPPLY_TYPE_UNKNOWN; + rport->perip_connected = false; mutex_unlock(&rport->mutex); if (!rport->dis_u2_susphy) rockchip_usb2phy_power_off(rport->phy);