This patch reworks fsl_pullup() against the background of switching over to udc_start()/udc_stop() style:
Protect function fsl_pullup() with a spin_lock. Also set vbus_active as default to true. This prevents disabling USB controller if there is no driver support for an external transceiver (or GPIO) that detects a VBUS power session starting. Signed-off-by: Christoph Fritz <chf.fr...@googlemail.com> --- drivers/usb/gadget/fsl_udc_core.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 340451d..0a0d6a6 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -1242,8 +1242,10 @@ static int fsl_vbus_draw(struct usb_gadget *gadget, unsigned mA) static int fsl_pullup(struct usb_gadget *gadget, int is_on) { struct fsl_udc *udc; + unsigned long flags; udc = container_of(gadget, struct fsl_udc, gadget); + spin_lock_irqsave(&udc->lock, flags); udc->softconnect = (is_on != 0); if (can_pullup(udc)) fsl_writel((fsl_readl(&dr_regs->usbcmd) | USB_CMD_RUN_STOP), @@ -1251,6 +1253,7 @@ static int fsl_pullup(struct usb_gadget *gadget, int is_on) else fsl_writel((fsl_readl(&dr_regs->usbcmd) & ~USB_CMD_RUN_STOP), &dr_regs->usbcmd); + spin_unlock_irqrestore(&udc->lock, flags); return 0; } @@ -2557,6 +2560,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev) INIT_LIST_HEAD(&udc_controller->gadget.ep_list); udc_controller->gadget.speed = USB_SPEED_UNKNOWN; udc_controller->gadget.name = driver_name; + udc->vbus_active = true; /* Setup gadget.dev and register with kernel */ dev_set_name(&udc_controller->gadget.dev, "gadget"); -- 1.7.2.5 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev