From: Tony Lindgren <tony@xxxxxxxxxxx> commit 049226b9fd7442149dcbcf55f15408f5973cceda upstream. We must let the USB host idle things properly before we switch to debug UART mode. Otherwise the USB host may never idle after disconnecting devices, and that causes the next enumeration to be flakey. Cc: Jacopo Mondi <jacopo@xxxxxxxxxx> Cc: Marcel Partap <mpartap@xxxxxxx> Cc: Merlijn Wajer <merlijn@xxxxxxxxxx> Cc: Michael Scott <hashcode0f@xxxxxxxxx> Cc: NeKit <nekit1000@xxxxxxxxx> Cc: Pavel Machek <pavel@xxxxxx> Cc: Sebastian Reichel <sre@xxxxxxxxxx> Acked-by: Pavel Machek <pavel@xxxxxx> Fixes: 6d6ce40f63af ("phy: cpcap-usb: Add CPCAP PMIC USB support") Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx> Signed-off-by: Kishon Vijay Abraham I <kishon@xxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/phy/motorola/phy-cpcap-usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/phy/motorola/phy-cpcap-usb.c +++ b/drivers/phy/motorola/phy-cpcap-usb.c @@ -283,13 +283,13 @@ static void cpcap_usb_detect(struct work return; } + cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF); + /* Default to debug UART mode */ error = cpcap_usb_set_uart_mode(ddata); if (error) goto out_err; - cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF); - dev_dbg(ddata->dev, "set UART mode\n"); return;