[PATCH RFC 5/5] xHCI port PM: set U1/U2 timeout

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

 



>From c59d7180fc61161d5a14fc8e66e1524d91678b91 Mon Sep 17 00:00:00 2001
From: Andiry Xu <andiry.xu@xxxxxxx>
Date: Wed, 3 Mar 2010 16:47:04 +0800
Subject: [PATCH 5/5] xHCI port PM: set U1/U2 timeout

This patch sets U1/U2 timeout field of PORT PMSC when a device is addressed.
Note that PORT PMSC has different meanings for USB2/USB3 protocol ports.

Disable the actual setting by now, since some chips may have HW issues.

Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
Signed-off-by: Libin Yang <libin.yang@xxxxxxx>
---
 drivers/usb/host/xhci-hcd.c |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci-hcd.c
index adb29df..bf35c11 100644
--- a/drivers/usb/host/xhci-hcd.c
+++ b/drivers/usb/host/xhci-hcd.c
@@ -1954,6 +1954,11 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
 	struct xhci_slot_ctx *slot_ctx;
 	struct xhci_input_control_ctx *ctrl_ctx;
 	u64 temp_64;
+#if 0
+	u32 __iomem *addr;
+	u32 temp;
+	int ports, port;
+#endif
 
 	if (!udev->slot_id) {
 		xhci_dbg(xhci, "Bad Slot ID %d\n", udev->slot_id);
@@ -2046,7 +2051,38 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
 	xhci_dbg(xhci, "Device address = %d\n", udev->devnum);
 	/* XXX Meh, not sure if anyone else but choose_address uses this. */
 	set_bit(udev->devnum, udev->bus->devmap.devicemap);
-
+#if 0
+	/* Set PORT PMSC */
+	ports = HCS_MAX_PORTS(xhci->hcs_params1);
+	port = udev->portnum;
+	if ((port <= 0) || (port > ports)) {
+		xhci_warn(xhci, "Invalid port id %d\n", port);
+		return 0;
+	}
+	addr = &xhci->op_regs->port_power_base + NUM_PORT_REGS * (port - 1);
+	temp = xhci_readl(xhci, addr);
+
+	switch (udev->speed) {
+	case USB_SPEED_SUPER:
+		/* Set U1/U2 timeout */
+		/* FIXME: how to decide appropriate value? */
+		temp |= PORT_U1_TIMEOUT(0x7f);
+		temp |= PORT_U2_TIMEOUT(0xff);
+		xhci_writel(xhci, temp, addr);
+		xhci_dbg(xhci, "Set SS port %d U1/U2 timeout\n", port);
+		break;
+	case USB_SPEED_HIGH:
+	case USB_SPEED_FULL:
+	case USB_SPEED_LOW:
+		/* Enable Remote Wakeup */
+		temp |= PORT_RWE;
+		xhci_writel(xhci, temp, addr);
+		xhci_dbg(xhci, "Enable HS port %d remote wakeup\n", port);
+		break;
+	default:
+		break;
+	}
+#endif
 	return 0;
 }
 
-- 
1.6.0.4



--
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