From 9eb67154eb1d0decf07f33409c2dd1929f899989 Mon Sep 17 00:00:00 2001 From: Meng Dongyang Date: Mon, 28 May 2018 10:11:56 +0800 Subject: [PATCH] phy: rockchip: rockchip-inno-usb2: flush otg work when exit The controller will be reinit when suspend and resume in device mode if not connect to PC. And the U2PHY must be keep in power on state during the init process. But The 'otg_sm_work' may be schedule immediately and power off the U2PHY if system suspend and resume between the delay time of schedule 'otg_sm_work', so it will result in the error when init controller as below: dwc2_core_reset() HANG! Soft Reset GRSTCTL=80000001 So flush the otg work in exit function to finish power control of U2PHY. Change-Id: I79c4b6a877196abd2f2201b2f984c9ea22e48fec Signed-off-by: Meng Dongyang Signed-off-by: Frank Wang --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 9647531ba154..259d2bf0d39f 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -753,6 +753,9 @@ static int rockchip_usb2phy_exit(struct phy *phy) if (rport->port_id == USB2PHY_PORT_HOST) cancel_delayed_work_sync(&rport->sm_work); + else if (rport->port_id == USB2PHY_PORT_OTG && + rport->bvalid_irq > 0) + flush_delayed_work(&rport->otg_sm_work); return 0; }