devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* usb:xhci: support disable usb2 LPM Remote Wakeup
@ 2016-12-04 12:42 Thang Q. Nguyen
       [not found] ` <1480855321-5047-1-git-send-email-tqnguyen-qTEPVZfXA3Y@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Thang Q. Nguyen @ 2016-12-04 12:42 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Mathias Nyman, Greg Kroah-Hartman,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
  Cc: Thang Nguyen, Phong Vo, Loc Ho, Vu Nguyen, patches-qTEPVZfXA3Y

From: Thang Nguyen <tqnguyen-qTEPVZfXA3Y@public.gmane.org>

As per USB 2.0 link power management addendum ECN, table 1-2, page 4,
device or host initiated via resume signaling; device-initiated resumes
can be optionally enabled/disabled by software. This patch adds support
to control enabling the USB2 RWE feature via DT/ACPI attribute.

Signed-off-by: Vu Nguyen <vnguyen-qTEPVZfXA3Y@public.gmane.org>
Signed-off-by: Thang Nguyen <tqnguyen-qTEPVZfXA3Y@public.gmane.org>
---
 Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 +
 drivers/usb/host/xhci-plat.c                       | 3 +++
 drivers/usb/host/xhci.c                            | 5 ++++-
 drivers/usb/host/xhci.h                            | 1 +
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index 966885c..9b4cd14 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -25,6 +25,7 @@ Required properties:
 
 Optional properties:
   - clocks: reference to a clock
+  - usb2-rwe-disable: disable USB2 LPM Remote Wakeup capable
   - usb3-lpm-capable: determines if platform is USB3 LPM capable
 
 Example:
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index ed56bf9..15c540d 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -220,6 +220,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
 		goto disable_clk;
 	}
 
+	if (device_property_read_bool(&pdev->dev, "usb2-rwe-disable"))
+		xhci->quirks |= XHCI_RWE_DISABLE;
+
 	if (device_property_read_bool(&pdev->dev, "usb3-lpm-capable"))
 		xhci->quirks |= XHCI_LPM_SUPPORT;
 
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 1a4ca02..f804868 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4183,7 +4183,10 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
 		}
 
 		pm_val &= ~PORT_HIRD_MASK;
-		pm_val |= PORT_HIRD(hird) | PORT_RWE | PORT_L1DS(udev->slot_id);
+		if ((xhci->quirks & XHCI_RWE_DISABLE) && (xhci->hci_version <= 0x100))
+			pm_val |= PORT_HIRD(hird) | PORT_L1DS(udev->slot_id);
+		else
+			pm_val |= PORT_HIRD(hird) | PORT_RWE | PORT_L1DS(udev->slot_id);
 		writel(pm_val, pm_addr);
 		pm_val = readl(pm_addr);
 		pm_val |= PORT_HLE;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index f945380..2b9bc33 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1656,6 +1656,7 @@ struct xhci_hcd {
 #define XHCI_SSIC_PORT_UNUSED	(1 << 22)
 #define XHCI_NO_64BIT_SUPPORT	(1 << 23)
 #define XHCI_MISSING_CAS	(1 << 24)
+#define XHCI_RWE_DISABLE	(1 << 25)
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
 	/* There are two roothubs to keep track of bus suspend info for */
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-01-09 10:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-04 12:42 usb:xhci: support disable usb2 LPM Remote Wakeup Thang Q. Nguyen
     [not found] ` <1480855321-5047-1-git-send-email-tqnguyen-qTEPVZfXA3Y@public.gmane.org>
2016-12-06  6:59   ` Thang Q. Nguyen
     [not found]     ` <CAKrQpSvyYKSAXurDkQXkASd9ELOUUEQmd6VF5TOKPkitRTTmOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-06  7:06       ` Greg Kroah-Hartman
2016-12-09 21:36   ` Rob Herring
2016-12-12  4:00     ` Thang Q. Nguyen
     [not found]       ` <CAKrQpStd4+ZZjdYyq93zq-wnqQCiQmSi5jJrYbuiZX5kVH74YA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-12  8:37         ` Felipe Balbi
     [not found]           ` <87lgvliluh.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-12-12  8:55             ` Thang Q. Nguyen
2016-12-12 13:00       ` Mathias Nyman
2017-01-09 10:15         ` Thang Q. Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).