linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: bInterval quirk for TI TUSB73x0
@ 2017-03-09  8:47 Roger Quadros
  2017-03-09  9:44 ` Sergei Shtylyov
  0 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2017-03-09  8:47 UTC (permalink / raw)
  To: mathias.nyman; +Cc: linux-usb, linux-kernel, Roger Quadros

As per [1] issue #4,
"The periodic EP scheduler always tries to schedule the EPs
that have large intervals (interval equal to or greater than
128 microframes) into different microframes. So it maintains
an internal counter and increments for each large interval
EP added. When the counter is greater than 128, the scheduler
rejects the new EP. So when the hub re-enumerated 128 times,
it trigged this condition."

This results in Bandwidth error when devices with periodic
endpoints (ISO/INT) having bInterval > 7 are plugged an
unplugged several times on a TUSB73x0 xhci host.

Workaround this issue by limiting the bInterval to 7
(i.e. interval to 6) for High-speed or faster periodic endpoints.

[1] - http://www.ti.com/lit/er/sllz076/sllz076.pdf

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/host/xhci-mem.c | 11 +++++++++++
 drivers/usb/host/xhci-pci.c |  3 +++
 drivers/usb/host/xhci.h     |  1 +
 3 files changed, 15 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index ba1853f4..05fb3f6 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1502,6 +1502,17 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
 	 */
 	max_esit_payload = xhci_get_max_esit_payload(udev, ep);
 	interval = xhci_get_endpoint_interval(udev, ep);
+
+	/* Periodic endpoint bInterval limit quirk */
+	if (usb_endpoint_xfer_int(&ep->desc) ||
+	    usb_endpoint_xfer_isoc(&ep->desc)) {
+		if ((xhci->quirks & XHCI_LIMIT_ENDPOINT_INTERVAL_7) &&
+		    udev->speed >= USB_SPEED_HIGH &&
+		    interval >= 7) {
+			interval = 6;
+		}
+	}
+
 	mult = xhci_get_endpoint_mult(udev, ep);
 	max_packet = usb_endpoint_maxp(&ep->desc);
 	max_burst = xhci_get_endpoint_max_burst(udev, ep);
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index fc99f51..7b86508 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -199,6 +199,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 			pdev->device == 0x1042)
 		xhci->quirks |= XHCI_BROKEN_STREAMS;
 
+	if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
+		xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
+
 	if (xhci->quirks & XHCI_RESET_ON_RESUME)
 		xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
 				"QUIRK: Resetting on resume");
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index da3eb69..2496bd6 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1818,6 +1818,7 @@ struct xhci_hcd {
 #define XHCI_MISSING_CAS	(1 << 24)
 /* For controller with a broken Port Disable implementation */
 #define XHCI_BROKEN_PORT_PED	(1 << 25)
+#define XHCI_LIMIT_ENDPOINT_INTERVAL_7	(1 << 26)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
-- 
2.7.4

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

* Re: [PATCH] usb: xhci: bInterval quirk for TI TUSB73x0
  2017-03-09  8:47 [PATCH] usb: xhci: bInterval quirk for TI TUSB73x0 Roger Quadros
@ 2017-03-09  9:44 ` Sergei Shtylyov
  2017-03-10 16:04   ` Roger Quadros
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2017-03-09  9:44 UTC (permalink / raw)
  To: Roger Quadros, mathias.nyman; +Cc: linux-usb, linux-kernel

Hello!

On 3/9/2017 11:47 AM, Roger Quadros wrote:

> As per [1] issue #4,
> "The periodic EP scheduler always tries to schedule the EPs
> that have large intervals (interval equal to or greater than
> 128 microframes) into different microframes. So it maintains
> an internal counter and increments for each large interval
> EP added. When the counter is greater than 128, the scheduler
> rejects the new EP. So when the hub re-enumerated 128 times,
> it trigged this condition."

    Triggered.

> This results in Bandwidth error when devices with periodic
> endpoints (ISO/INT) having bInterval > 7 are plugged an
> unplugged several times on a TUSB73x0 xhci host.
>
> Workaround this issue by limiting the bInterval to 7
> (i.e. interval to 6) for High-speed or faster periodic endpoints.
>
> [1] - http://www.ti.com/lit/er/sllz076/sllz076.pdf
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
[...]

MBR, Sergei

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

* Re: [PATCH] usb: xhci: bInterval quirk for TI TUSB73x0
  2017-03-09  9:44 ` Sergei Shtylyov
@ 2017-03-10 16:04   ` Roger Quadros
  2017-03-13  8:11     ` [PATCH v2] " Roger Quadros
  0 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2017-03-10 16:04 UTC (permalink / raw)
  To: Sergei Shtylyov, mathias.nyman; +Cc: linux-usb, linux-kernel

On 09/03/17 11:44, Sergei Shtylyov wrote:
> Hello!
> 
> On 3/9/2017 11:47 AM, Roger Quadros wrote:
> 
>> As per [1] issue #4,
>> "The periodic EP scheduler always tries to schedule the EPs
>> that have large intervals (interval equal to or greater than
>> 128 microframes) into different microframes. So it maintains
>> an internal counter and increments for each large interval
>> EP added. When the counter is greater than 128, the scheduler
>> rejects the new EP. So when the hub re-enumerated 128 times,
>> it trigged this condition."
> 
>    Triggered.

Should be "triggers" actually.
Will fix it. Thanks.

> 
>> This results in Bandwidth error when devices with periodic
>> endpoints (ISO/INT) having bInterval > 7 are plugged an
>> unplugged several times on a TUSB73x0 xhci host.
>>
>> Workaround this issue by limiting the bInterval to 7
>> (i.e. interval to 6) for High-speed or faster periodic endpoints.
>>
>> [1] - http://www.ti.com/lit/er/sllz076/sllz076.pdf
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
> [...]
> 
> MBR, Sergei
> 

-- 
cheers,
-roger

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

* [PATCH v2] usb: xhci: bInterval quirk for TI TUSB73x0
  2017-03-10 16:04   ` Roger Quadros
@ 2017-03-13  8:11     ` Roger Quadros
  2017-03-13  8:44       ` Sergei Shtylyov
  2017-03-22 11:43       ` [PATCH v3] " Roger Quadros
  0 siblings, 2 replies; 7+ messages in thread
From: Roger Quadros @ 2017-03-13  8:11 UTC (permalink / raw)
  To: mathias.nyman; +Cc: Sergei Shtylyov, linux-usb, linux-kernel, rogerq

As per [1] issue #4,
"The periodic EP scheduler always tries to schedule the EPs
that have large intervals (interval equal to or greater than
128 microframes) into different microframes. So it maintains
an internal counter and increments for each large interval
EP added. When the counter is greater than 128, the scheduler
rejects the new EP. So when the hub re-enumerated 128 times,
it triggers this condition."

This results in Bandwidth error when devices with periodic
endpoints (ISO/INT) having bInterval > 7 are plugged an
unplugged several times on a TUSB73x0 xhci host.

Workaround this issue by limiting the bInterval to 7
(i.e. interval to 6) for High-speed or faster periodic endpoints.

[1] - http://www.ti.com/lit/er/sllz076/sllz076.pdf

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
v2:
-fixed typo in commit message

 drivers/usb/host/xhci-mem.c | 11 +++++++++++
 drivers/usb/host/xhci-pci.c |  3 +++
 drivers/usb/host/xhci.h     |  1 +
 3 files changed, 15 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index ba1853f4..05fb3f6 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1502,6 +1502,17 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
 	 */
 	max_esit_payload = xhci_get_max_esit_payload(udev, ep);
 	interval = xhci_get_endpoint_interval(udev, ep);
+
+	/* Periodic endpoint bInterval limit quirk */
+	if (usb_endpoint_xfer_int(&ep->desc) ||
+	    usb_endpoint_xfer_isoc(&ep->desc)) {
+		if ((xhci->quirks & XHCI_LIMIT_ENDPOINT_INTERVAL_7) &&
+		    udev->speed >= USB_SPEED_HIGH &&
+		    interval >= 7) {
+			interval = 6;
+		}
+	}
+
 	mult = xhci_get_endpoint_mult(udev, ep);
 	max_packet = usb_endpoint_maxp(&ep->desc);
 	max_burst = xhci_get_endpoint_max_burst(udev, ep);
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index fc99f51..7b86508 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -199,6 +199,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 			pdev->device == 0x1042)
 		xhci->quirks |= XHCI_BROKEN_STREAMS;
 
+	if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
+		xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
+
 	if (xhci->quirks & XHCI_RESET_ON_RESUME)
 		xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
 				"QUIRK: Resetting on resume");
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index da3eb69..2496bd6 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1818,6 +1818,7 @@ struct xhci_hcd {
 #define XHCI_MISSING_CAS	(1 << 24)
 /* For controller with a broken Port Disable implementation */
 #define XHCI_BROKEN_PORT_PED	(1 << 25)
+#define XHCI_LIMIT_ENDPOINT_INTERVAL_7	(1 << 26)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
-- 
2.7.4

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

* Re: [PATCH v2] usb: xhci: bInterval quirk for TI TUSB73x0
  2017-03-13  8:11     ` [PATCH v2] " Roger Quadros
@ 2017-03-13  8:44       ` Sergei Shtylyov
  2017-03-22 11:43       ` [PATCH v3] " Roger Quadros
  1 sibling, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2017-03-13  8:44 UTC (permalink / raw)
  To: Roger Quadros, mathias.nyman; +Cc: linux-usb, linux-kernel

Hello!

On 3/13/2017 11:11 AM, Roger Quadros wrote:

> As per [1] issue #4,
> "The periodic EP scheduler always tries to schedule the EPs
> that have large intervals (interval equal to or greater than
> 128 microframes) into different microframes. So it maintains
> an internal counter and increments for each large interval
> EP added. When the counter is greater than 128, the scheduler
> rejects the new EP. So when the hub re-enumerated 128 times,
> it triggers this condition."
>
> This results in Bandwidth error when devices with periodic
> endpoints (ISO/INT) having bInterval > 7 are plugged an

    s/an/and/.

> unplugged several times on a TUSB73x0 xhci host.

    xHCI.

> Workaround this issue by limiting the bInterval to 7
> (i.e. interval to 6) for High-speed or faster periodic endpoints.
>
> [1] - http://www.ti.com/lit/er/sllz076/sllz076.pdf
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
[...]

MBR, Sergei

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

* [PATCH v3] usb: xhci: bInterval quirk for TI TUSB73x0
  2017-03-13  8:11     ` [PATCH v2] " Roger Quadros
  2017-03-13  8:44       ` Sergei Shtylyov
@ 2017-03-22 11:43       ` Roger Quadros
  2017-03-22 13:06         ` Mathias Nyman
  1 sibling, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2017-03-22 11:43 UTC (permalink / raw)
  To: mathias.nyman; +Cc: Sergei Shtylyov, linux-usb, linux-kernel, rogerq

As per [1] issue #4,
"The periodic EP scheduler always tries to schedule the EPs
that have large intervals (interval equal to or greater than
128 microframes) into different microframes. So it maintains
an internal counter and increments for each large interval
EP added. When the counter is greater than 128, the scheduler
rejects the new EP. So when the hub re-enumerated 128 times,
it triggers this condition."

This results in Bandwidth error when devices with periodic
endpoints (ISO/INT) having bInterval > 7 are plugged and
unplugged several times on a TUSB73x0 XHCI host.

Workaround this issue by limiting the bInterval to 7
(i.e. interval to 6) for High-speed or faster periodic endpoints.

[1] - http://www.ti.com/lit/er/sllz076/sllz076.pdf

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
v3:
-fixed some more typos in commit message

v2:
-fixed typo in commit message

 drivers/usb/host/xhci-mem.c | 11 +++++++++++
 drivers/usb/host/xhci-pci.c |  3 +++
 drivers/usb/host/xhci.h     |  1 +
 3 files changed, 15 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index ba1853f4..05fb3f6 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1502,6 +1502,17 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
 	 */
 	max_esit_payload = xhci_get_max_esit_payload(udev, ep);
 	interval = xhci_get_endpoint_interval(udev, ep);
+
+	/* Periodic endpoint bInterval limit quirk */
+	if (usb_endpoint_xfer_int(&ep->desc) ||
+	    usb_endpoint_xfer_isoc(&ep->desc)) {
+		if ((xhci->quirks & XHCI_LIMIT_ENDPOINT_INTERVAL_7) &&
+		    udev->speed >= USB_SPEED_HIGH &&
+		    interval >= 7) {
+			interval = 6;
+		}
+	}
+
 	mult = xhci_get_endpoint_mult(udev, ep);
 	max_packet = usb_endpoint_maxp(&ep->desc);
 	max_burst = xhci_get_endpoint_max_burst(udev, ep);
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index fc99f51..7b86508 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -199,6 +199,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 			pdev->device == 0x1042)
 		xhci->quirks |= XHCI_BROKEN_STREAMS;
 
+	if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
+		xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
+
 	if (xhci->quirks & XHCI_RESET_ON_RESUME)
 		xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
 				"QUIRK: Resetting on resume");
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index da3eb69..2496bd6 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1818,6 +1818,7 @@ struct xhci_hcd {
 #define XHCI_MISSING_CAS	(1 << 24)
 /* For controller with a broken Port Disable implementation */
 #define XHCI_BROKEN_PORT_PED	(1 << 25)
+#define XHCI_LIMIT_ENDPOINT_INTERVAL_7	(1 << 26)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
-- 
2.7.4

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

* Re: [PATCH v3] usb: xhci: bInterval quirk for TI TUSB73x0
  2017-03-22 11:43       ` [PATCH v3] " Roger Quadros
@ 2017-03-22 13:06         ` Mathias Nyman
  0 siblings, 0 replies; 7+ messages in thread
From: Mathias Nyman @ 2017-03-22 13:06 UTC (permalink / raw)
  To: Roger Quadros, mathias.nyman; +Cc: Sergei Shtylyov, linux-usb, linux-kernel

On 22.03.2017 13:43, Roger Quadros wrote:
> As per [1] issue #4,
> "The periodic EP scheduler always tries to schedule the EPs
> that have large intervals (interval equal to or greater than
> 128 microframes) into different microframes. So it maintains
> an internal counter and increments for each large interval
> EP added. When the counter is greater than 128, the scheduler
> rejects the new EP. So when the hub re-enumerated 128 times,
> it triggers this condition."
>
> This results in Bandwidth error when devices with periodic
> endpoints (ISO/INT) having bInterval > 7 are plugged and
> unplugged several times on a TUSB73x0 XHCI host.
>
> Workaround this issue by limiting the bInterval to 7
> (i.e. interval to 6) for High-speed or faster periodic endpoints.
>
> [1] - http://www.ti.com/lit/er/sllz076/sllz076.pdf
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---

Added to my for-usb-next queue.

Thanks
-Mathias

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

end of thread, other threads:[~2017-03-22 13:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09  8:47 [PATCH] usb: xhci: bInterval quirk for TI TUSB73x0 Roger Quadros
2017-03-09  9:44 ` Sergei Shtylyov
2017-03-10 16:04   ` Roger Quadros
2017-03-13  8:11     ` [PATCH v2] " Roger Quadros
2017-03-13  8:44       ` Sergei Shtylyov
2017-03-22 11:43       ` [PATCH v3] " Roger Quadros
2017-03-22 13:06         ` Mathias Nyman

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