After sending the USB Bus reset, Host waits for High Speed Chirps. If the soft-disconnect and soft-connect happens during this chirp time, then Host doesn't detect this disconnect. Host treats this as Full Speed Device as there are no chirps. To avoid this Full Speed Enumeration, soft-disconnect and soft-connect should have a 500 milliseconds gap when USB cable is connected. Signed-off-by: Ajay Jawade <ajay.jawade@xxxxxxxxxxxxxx> Acked-by: srinidhi kasagar <srinidhi.kasagar@xxxxxxxxxxxxxx> --- drivers/usb/musb/musb_gadget.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index f7194cf..1ff1bde 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1743,6 +1743,7 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) { struct musb *musb = gadget_to_musb(gadget); unsigned long flags; + u8 devctl; is_on = !!is_on; @@ -1751,6 +1752,28 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) /* NOTE: this assumes we are sensing vbus; we'd rather * not pullup unless the B-session is active. */ + + /* After sending the USB Bus reset, Host waits for + * High Speed Chirps. If the soft-disconnect and soft-connect + * happens during this chirp time, then Host doesn't + * detect this disconnecr. Host treats this as Full Speed + * Device as there are no chirps. To avoid this Full Speed + * Enumeration, soft-disconnect and soft-connect should have + * a 500 milliseconds delay when USB cable is connected. + */ + if (is_on && (is_on != musb->softconnect)) { + + /* USB cable presence is decided by reading the VBUS + * Level bits of DevCtl register. + */ + devctl = musb_readb(musb->mregs, MUSB_DEVCTL); + devctl = (devctl & MUSB_DEVCTL_VBUS) >> MUSB_DEVCTL_VBUS_SHIFT; + if (devctl != 0) { + /* USB Cable is attached. Delay the soft-connect */ + msleep(500); + } + } + spin_lock_irqsave(&musb->lock, flags); if (is_on != musb->softconnect) { musb->softconnect = is_on; -- 1.7.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html