summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorsgadagottu <sgadagottu@nvidia.com>2010-03-03 19:35:14 +0530
committerGary King <gking@nvidia.com>2010-03-03 19:56:49 -0800
commit17f12ae875e3afedaaaca474b46d3ccd5150bea0 (patch)
treeccdac45f6da36bbe0b0460d512b219c8141fbf2e /drivers
parent7a44e354c4cf1f369978efe679e7be888a7b47a4 (diff)
tegra usb: Making USB busy hints off on resume, when there is no adb
cable/usb device connection Currently on resume from LP1, though there is no adb cable/USB device connected to USB1/USB3 then also usb busy hints are getting on. With this change on resume: For gadget driver, if cable is not connected then busy hints made off. For host driver, if device(s) are not connected then busy hints are off. Code Clean-up for power improvement Tested on : Whistler board USB1 OTG + USB3 host Tested with all possible connection on USB1 and USB3 Change-Id: I6d210bba1264d9c0134d586d3f67ff609ba2b3fe Reviewed-on: http://git-master/r/745 Reviewed-by: Narendra Damahe <ndamahe@nvidia.com> Tested-by: Narendra Damahe <ndamahe@nvidia.com> Reviewed-by: Gary King <gking@nvidia.com> Tested-by: Gary King <gking@nvidia.com>
Diffstat (limited to 'drivers')
-rwxr-xr-xdrivers/usb/gadget/fsl_udc_core.c5
-rwxr-xr-xdrivers/usb/host/ehci-tegra.c16
2 files changed, 20 insertions, 1 deletions
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 33502502c67e..f30912b62fca 100755
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2764,6 +2764,11 @@ static int fsl_udc_resume(struct platform_device *pdev)
udc_controller->usb_state = USB_STATE_ATTACHED;
udc_controller->ep0_state = WAIT_FOR_SETUP;
udc_controller->ep0_dir = 0;
+
+ /* Power down the phy if cable is not connected */
+ if (!(fsl_readl(&usb_sys_regs->vbus_wakeup) & USB_SYS_VBUS_STATUS))
+ platform_udc_clk_suspend();
+
return 0;
}
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index cc1e51581c8f..b2469e5fbab8 100755
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -320,11 +320,13 @@ static int tegra_ehci_bus_resume(struct usb_hcd *hcd)
{
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
int err_status = 0;
+ u32 status;
-#ifdef CONFIG_USB_OTG_UTILS
struct tegra_hcd_platform_data *pdata;
/* initialize the platform data pointer */
pdata = hcd->self.controller->platform_data;
+
+#ifdef CONFIG_USB_OTG_UTILS
if ((pdata->pUsbProperty->UsbMode == NvOdmUsbModeType_OTG)
&& ehci->transceiver) {
if (ehci->transceiver->state != OTG_STATE_A_HOST) {
@@ -338,6 +340,18 @@ static int tegra_ehci_bus_resume(struct usb_hcd *hcd)
tegra_ehci_power_up(hcd);
err_status = ehci_bus_resume(hcd);
}
+
+ if ((pdata->pUsbProperty->UsbMode != NvOdmUsbModeType_OTG)
+ && (pdata->pUsbProperty->IdPinDetectionType ==
+ NvOdmUsbIdPinType_CableId)) {
+ /* read otgsc register for ID pin status */
+ status = readl(hcd->regs + TEGRA_USB_PHY_WAKEUP_REG_OFFSET);
+ writel(status, (hcd->regs + TEGRA_USB_PHY_WAKEUP_REG_OFFSET));
+ /* If no Id pin then disable the power */
+ if (status & TEGRA_USB_ID_PIN_STATUS) {
+ tegra_ehci_power_down(hcd);
+ }
+ }
return err_status;
}