From deb1d0181e713cb8cb8bc3ad96a79b6799d9c2b4 Mon Sep 17 00:00:00 2001 From: Ajay Gupta Date: Tue, 4 Jun 2013 10:11:43 -0700 Subject: usb: xhci: tegra: set SNPS owner only if no hs connected Commit "usb: xhci: tegra: set SNPS as owner to save power" cause reset error when SS hub is connected as bus_suspend is called while HS part of hub is connected. Fixing by checking if any HS device connected before setting port owner as SNPS Bug 1275290 Change-Id: I9d5e7f41bc48f017f76a0f41d8f5a70355bc0399 Signed-off-by: Ajay Gupta Reviewed-on: http://git-master/r/235513 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Ashutosh Jha --- drivers/usb/host/xhci-tegra.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index 6fc16db951b3..29e96ea15d84 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -262,6 +262,24 @@ static inline void must_have_sync_lock(struct tegra_xhci_hcd *tegra) static inline void must_have_sync_lock(struct tegra_xhci_hcd *tegra) #endif +static bool is_any_hs_connected(struct xhci_hcd *xhci) +{ + __le32 __iomem *addr; + int i; + int ports; + u32 portsc; + + ports = HCS_MAX_PORTS(xhci->hcs_params1); + addr = &xhci->op_regs->port_status_base; + for (i = 0; i < ports; i++) { + portsc = xhci_readl(xhci, addr); + if ((portsc & PORT_CONNECT) && DEV_HIGHSPEED(portsc)) + return true; + addr += NUM_PORT_REGS; + } + return false; +} + static void debug_print_portsc(struct xhci_hcd *xhci) { __le32 __iomem *addr; @@ -2368,8 +2386,9 @@ done: if (xhci->main_hcd == hcd) { utmi_phy_pad_disable(); utmi_phy_iddq_override(true); - /* set port ownership to SNPS to save power */ - tegra_xhci_release_port_ownership(tegra, true); + /* port ownership to SNPS when no HS connected to save power */ + if (!is_any_hs_connected(xhci)) + tegra_xhci_release_port_ownership(tegra, true); } else if (xhci->shared_hcd == hcd) { /* save leakage power when SS not in use. * This is also done when fw mbox message is received for freq -- cgit v1.2.3