From 6269118e0aa8e92a40050b080b87fad2592995ac Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Thu, 16 May 2024 16:37:48 +0800 Subject: [PATCH] usb: dwc2: notify the usb role to usb2 phy Notify the usb role to usb2 phy when we received role_switch set from the TCPM (Type-C Port Manager) to escape BC1.2 charge detection at host mode in usb2 phy driver. Signed-off-by: Frank Wang Change-Id: Id41df3d25b29771d4461cfd1106ca3f3c2572a18 --- drivers/usb/dwc2/drd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/dwc2/drd.c b/drivers/usb/dwc2/drd.c index b72cce35a346..0520b8fb2e15 100644 --- a/drivers/usb/dwc2/drd.c +++ b/drivers/usb/dwc2/drd.c @@ -117,6 +117,14 @@ static int dwc2_drd_role_sw_set(struct usb_role_switch *sw, enum usb_role role) return ret; } + /* + * Notify the usb role to usb phy when we received role_switch set + * from the TCPM (Type-C Port Manager) to escape BC1.2 charge detection + * at host mode in usb phy driver. + */ + if (IS_ENABLED(CONFIG_ARCH_ROCKCHIP)) + phy_set_mode_ext(hsotg->phy, PHY_MODE_USB_OTG, role); + spin_lock_irqsave(&hsotg->lock, flags); if (role == USB_ROLE_NONE) {