usb: gadget: fsl driver pullup fix
authorSuresh Gupta <suresh.gupta@freescale.com>
Fri, 21 Mar 2014 11:08:12 +0000 (16:38 +0530)
committerFelipe Balbi <balbi@ti.com>
Thu, 17 Apr 2014 15:25:07 +0000 (10:25 -0500)
This fix the fsl usb gadget driver in a way that the usb device
will be only "pulled up" on requests only when vbus is powered

Signed-off-by: Suresh Gupta <suresh.gupta@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/fsl_udc_core.c

index dcd0b07ae3a02035ecf8fbd1550bcc3ac5f0ba8b..a2f26cdb56fef07a0a15e8bb329c089413efab6a 100644 (file)
@@ -1219,6 +1219,10 @@ static int fsl_pullup(struct usb_gadget *gadget, int is_on)
        struct fsl_udc *udc;
 
        udc = container_of(gadget, struct fsl_udc, gadget);
+
+       if (!udc->vbus_active)
+               return -EOPNOTSUPP;
+
        udc->softconnect = (is_on != 0);
        if (can_pullup(udc))
                fsl_writel((fsl_readl(&dr_regs->usbcmd) | USB_CMD_RUN_STOP),