diff options
author | Rakesh Bodla <rbodla@nvidia.com> | 2011-02-28 21:27:04 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-02-28 13:59:52 -0800 |
commit | c755dcd29cf7d7034623849239c94bad7eca6a00 (patch) | |
tree | 08f626185ec54e526f31cd82f8fcbc5f32581e07 | |
parent | c84fe51418ba33776a9dc188c8314c334e0c302e (diff) |
arm: tegra: fsl: correcting the vbus status
When device resumes vbus_active status should be set.
Also, correcting the spin_lock_irqsave calls.
Bug 770041 791252
Reviewed-on: http://git-master/r/20529
(cherry picked from commit f17ce7e1a68be7410e8b7a2bde9736ffc0f4b14e)
Change-Id: I1b65a875005233a7cbce0c754b9a3ee25beb108f
Reviewed-on: http://git-master/r/20966
Reviewed-by: Rakesh Bodla <rbodla@nvidia.com>
Tested-by: Rakesh Bodla <rbodla@nvidia.com>
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r-- | drivers/usb/gadget/fsl_udc_core.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 8ad167503696..5318bbcd1fa5 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -1202,12 +1202,12 @@ static int fsl_vbus_session(struct usb_gadget *gadget, int is_active) unsigned long flags; udc = container_of(gadget, struct fsl_udc, gadget); - spin_lock_irqsave(&udc->lock, flags); VDBG("VBUS %s", is_active ? "on" : "off"); if (udc->transceiver) { if (udc->vbus_active && !is_active) { + spin_lock_irqsave(&udc->lock, flags); /* reset all internal Queues and inform client driver */ reset_queues(udc); /* stop the controller and turn off the clocks */ @@ -1218,7 +1218,6 @@ static int fsl_vbus_session(struct usb_gadget *gadget, int is_active) udc->vbus_active = 0; udc->usb_state = USB_STATE_DEFAULT; } else if (!udc->vbus_active && is_active) { - spin_unlock_irqrestore(&udc->lock, flags); fsl_udc_clk_resume(); /* setup the controller in the device mode */ dr_controller_setup(udc); @@ -1235,6 +1234,7 @@ static int fsl_vbus_session(struct usb_gadget *gadget, int is_active) return 0; } + spin_lock_irqsave(&udc->lock, flags); udc->vbus_active = (is_active != 0); if (can_pullup(udc)) fsl_writel((fsl_readl(&dr_regs->usbcmd) | USB_CMD_RUN_STOP), @@ -1983,16 +1983,17 @@ static void reset_irq(struct fsl_udc *udc) */ static void fsl_udc_restart(struct fsl_udc *udc) { - /* setup the controller in the device mode */ - dr_controller_setup(udc); - /* setup EP0 for setup packet */ - ep0_setup(udc); - /* start the controller */ - dr_controller_run(udc); - /* initialize the USB and EP states */ - udc->usb_state = USB_STATE_ATTACHED; - udc->ep0_state = WAIT_FOR_SETUP; - udc->ep0_dir = 0; + /* setup the controller in the device mode */ + dr_controller_setup(udc); + /* setup EP0 for setup packet */ + ep0_setup(udc); + /* start the controller */ + dr_controller_run(udc); + /* initialize the USB and EP states */ + udc->usb_state = USB_STATE_ATTACHED; + udc->ep0_state = WAIT_FOR_SETUP; + udc->ep0_dir = 0; + udc->vbus_active = 1; } #endif |