Skip to content

Commit 87ed257

Browse files
Xu Yanggregkh
authored andcommitted
usb: phy: mxs: disconnect line when USB charger is attached
For mxs PHY, if there is a vbus but the bus is not enumerated, we need to force the dp/dm as SE0 from the controller side. If not, there is possible USB wakeup due to unstable dp/dm, since there is possible no pull on dp/dm, such as there is a USB charger on the port. Signed-off-by: Xu Yang <[email protected]> Acked-by: Peter Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5eda42a commit 87ed257

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/usb/phy/phy-mxs-usb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy)
395395
static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
396396
{
397397
bool vbus_is_on = false;
398+
enum usb_phy_events last_event = mxs_phy->phy.last_event;
398399

399400
/* If the SoCs don't need to disconnect line without vbus, quit */
400401
if (!(mxs_phy->data->flags & MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS))
@@ -406,7 +407,8 @@ static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
406407

407408
vbus_is_on = mxs_phy_get_vbus_status(mxs_phy);
408409

409-
if (on && !vbus_is_on && !mxs_phy_is_otg_host(mxs_phy))
410+
if (on && ((!vbus_is_on && !mxs_phy_is_otg_host(mxs_phy))
411+
|| (last_event == USB_EVENT_VBUS)))
410412
__mxs_phy_disconnect_line(mxs_phy, true);
411413
else
412414
__mxs_phy_disconnect_line(mxs_phy, false);

0 commit comments

Comments
 (0)