Skip to content

Commit

Permalink
usb: gadget: tegra:change condition for vbus check
Browse files Browse the repository at this point in the history
Changing the condition for vbus check. VBUS will be
present when OTG cable is connected, hence vbus
status will be reflected wrong. Correct status
is tracked through vbus_active variable.

Bug 1158853
Bug 1214802

Change-Id: Ic904beb5919ddafef5becf39ddac1767cdda79cd
Signed-off-by: Rakesh Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/145148
(cherry picked from commit 00777683b05af76f15daa0152fb014183a32fa28)
Reviewed-on: http://git-master/r/190673
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Preetham Chandru <pchandru@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
  • Loading branch information
Rakesh Bodla authored and Matthew Pedro committed Jan 14, 2013
1 parent 185f345 commit 364f8d1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/usb/gadget/tegra_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ static int tegra_ep_disable(struct usb_ep *_ep)
ep_num = ep_index(ep);

/* Touch the registers if cable is connected and phy is on */
if (vbus_enabled(udc)) {
if (udc->vbus_active) {
epctrl = udc_readl(udc, EP_CONTROL_REG_OFFSET + (ep_num * 4));
if (ep_is_in(ep))
epctrl &= ~EPCTRL_TX_ENABLE;
Expand Down Expand Up @@ -995,7 +995,7 @@ static int tegra_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
ep_num = ep_index(ep);

/* Touch the registers if cable is connected and phy is on */
if (vbus_enabled(udc)) {
if (udc->vbus_active) {
epctrl = udc_readl(udc, EP_CONTROL_REG_OFFSET + (ep_num * 4));
if (ep_is_in(ep))
epctrl &= ~EPCTRL_TX_ENABLE;
Expand Down Expand Up @@ -1046,7 +1046,7 @@ static int tegra_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
/* Enable EP */
out:
/* Touch the registers if cable is connected and phy is on */
if (vbus_enabled(udc)) {
if (udc->vbus_active) {
epctrl = udc_readl(udc, EP_CONTROL_REG_OFFSET + (ep_num * 4));
if (ep_is_in(ep))
epctrl |= EPCTRL_TX_ENABLE;
Expand Down Expand Up @@ -1168,7 +1168,7 @@ static void tegra_ep_fifo_flush(struct usb_ep *_ep)
bits = 1 << ep_num;

/* Touch the registers if cable is connected and phy is on */
if (!vbus_enabled(udc))
if (!udc->vbus_active)
return;

timeout = jiffies + UDC_FLUSH_TIMEOUT_MS;
Expand Down Expand Up @@ -2363,14 +2363,13 @@ static int tegra_udc_start(struct usb_gadget_driver *driver,
goto out;
}


/* Enable DR IRQ reg and Set usbcmd reg Run bit */
if (vbus_enabled(udc)) {
dr_controller_run(udc);
udc->usb_state = USB_STATE_ATTACHED;
udc->ep0_state = WAIT_FOR_SETUP;
udc->ep0_dir = 0;
udc->vbus_active = vbus_enabled(udc);
udc->vbus_active = 1;
}

printk(KERN_INFO "%s: bind to driver %s\n",
Expand Down

0 comments on commit 364f8d1

Please sign in to comment.