[RFC/PATCH 4/4] add phy low power suspend for older chipidea core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Matthieu CASTET <matthieu.castet@xxxxxxxxxx>
---
 drivers/usb/host/ehci-hub.c |   46 +++++++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index b70fca6..3b3f201 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -33,34 +33,46 @@
 
 static void tdi_phy_lpm_clear(struct ehci_hcd *ehci, int port)
 {
+	u32 temp;
+	u32 __iomem *reg;
+	u32 bit;
 	if (ehci->has_hostpc) {
-		u32 __iomem	*hostpc_reg;
-		u32		temp;
-
-		hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
+		reg = (u32 __iomem *)((u8 *) ehci->regs
 				+ HOSTPC0 + 4 * port);
-		temp = ehci_readl(ehci, hostpc_reg);
-		ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg);
+		bit = HOSTPC_PHCD;
+	}
+	else {
+		reg = &ehci->regs->port_status[port];
+		bit = HOSTPC_PHCD << 1;
 	}
+
+	temp = ehci_readl(ehci, reg);
+	ehci_writel(ehci, temp & ~bit, reg);
 }
 
 static void tdi_phy_lpm_set(struct ehci_hcd *ehci, int port)
 {
-	if (ehci->has_hostpc) {
-		u32 __iomem	*hostpc_reg;
-		u32		t3;
+	u32 __iomem *reg;
+	u32		t3;
+	u32 bit;
 
-		hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
+	if (ehci->has_hostpc) {
+		reg = (u32 __iomem *)((u8 *) ehci->regs
 				+ HOSTPC0 + 4 * port);
-		t3 = ehci_readl(ehci, hostpc_reg);
-		ehci_writel(ehci, t3 | HOSTPC_PHCD, hostpc_reg);
-		t3 = ehci_readl(ehci, hostpc_reg);
-		ehci_dbg(ehci, "Port %d phy low-power mode %s\n",
-				port, (t3 & HOSTPC_PHCD) ?
-				"succeeded" : "failed");
+		bit = HOSTPC_PHCD;
+	}
+	else {
+		reg = &ehci->regs->port_status[port];
+		bit = HOSTPC_PHCD << 1;
 	}
-}
 
+	t3 = ehci_readl(ehci, reg);
+	ehci_writel(ehci, t3 | bit, reg);
+	t3 = ehci_readl(ehci, reg);
+	ehci_dbg(ehci, "Port %d phy low-power mode %s\n",
+			port, (t3 & bit) ?
+			"succeeded" : "failed");
+}
 
 #ifdef	CONFIG_PM
 
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux