From 364f8d1cf478a94acdb1bec96614372da0ec883b Mon Sep 17 00:00:00 2001 From: Rakesh Bodla Date: Wed, 17 Oct 2012 11:36:21 +0530 Subject: usb: gadget: tegra:change condition for vbus check 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 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 GVS: Gerrit_Virtual_Submit Reviewed-by: Matthew Pedro Reviewed-by: Winnie Hsu --- drivers/usb/gadget/tegra_udc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/tegra_udc.c b/drivers/usb/gadget/tegra_udc.c index 9af22ebe8b58..c130dae3a8e9 100644 --- a/drivers/usb/gadget/tegra_udc.c +++ b/drivers/usb/gadget/tegra_udc.c @@ -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; @@ -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; @@ -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; @@ -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; @@ -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", -- cgit v1.2.3