linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3]  usb: xhci: Add broken port disable quirk
@ 2016-11-17 15:01 Roger Quadros
  2016-11-17 15:01 ` [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits Roger Quadros
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Roger Quadros @ 2016-11-17 15:01 UTC (permalink / raw)
  To: balbi, mathias.nyman; +Cc: linux-usb, linux-kernel, rogerq

Hi,

Some XHCI controllers e.g. dwc3 based have a broken Port disable [1].

If the attached high-speed device is misbehaving, the USB stack typically
disables the port using the PED bit in PORTSC. For the controllers that
have broken port disable, the port fails to detect further attach/detach
events and so high-speed devices can no longer be enumerated on the
port. The workaround is to prevent port disable using PED on such
controllers.

We add a new BROKEN_PED quirk flag and 'quirk-broken-port-ped' device
property and prevent port disable using PED if we encounter the quirk flag.

[1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
    Section i896— USB xHCI Port Disable Feature Does Not Work

cheers,
-roger

Felipe Balbi (3):
  usb: xhci: add quirk flag for broken PED bits
  usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested
  usb: dwc3: host: pass quirk-broken-port-ped property for known broken
    revisions

 Documentation/devicetree/bindings/usb/usb-xhci.txt |  1 +
 drivers/usb/dwc3/host.c                            | 21 ++++++++++++++++++---
 drivers/usb/host/xhci-hub.c                        |  6 ++++++
 drivers/usb/host/xhci-plat.c                       |  3 +++
 drivers/usb/host/xhci.h                            |  3 +++
 5 files changed, 31 insertions(+), 3 deletions(-)

-- 
2.7.4

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

* [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits
  2016-11-17 15:01 [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
@ 2016-11-17 15:01 ` Roger Quadros
  2016-11-18 10:49   ` Sergei Shtylyov
  2016-11-21 11:51   ` [PATCH v2 " Roger Quadros
  2016-11-17 15:01 ` [PATCH 2/3] usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested Roger Quadros
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 15+ messages in thread
From: Roger Quadros @ 2016-11-17 15:01 UTC (permalink / raw)
  To: balbi, mathias.nyman; +Cc: linux-usb, linux-kernel, rogerq

From: Felipe Balbi <balbi@ti.com>

Some devices from Texas Instruments [1] suffer from
a silicon bug where Port Enabled/Disabled bit
should not be used to silence an erroneous device.

The bug is so that if port is disabled with PED
bit, an IRQ for device removal (or attachment)
will never fire.

Just for the sake of completeness, the actual
problem lies with SNPS USB IP and this affects
all known versions up to 3.00a. A separate
patch will be added to dwc3 to enabled this
quirk flag if version is <= 3.00a.

[1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
Section i896— USB xHCI Port Disable Feature Does Not Work

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/host/xhci-hub.c | 6 ++++++
 drivers/usb/host/xhci.h     | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 0ef1690..c3c051d 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -458,6 +458,12 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
 		return;
 	}
 
+	if (xhci->quirks & XHCI_BROKEN_PORT_PED) {
+		xhci_dbg(xhci, "Broken Port Enabled/Disabled, ignoring "
+				"port disable request.\n");
+		return;
+	}
+
 	/* Write 1 to disable the port */
 	writel(port_status | PORT_PE, addr);
 	port_status = readl(addr);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index f945380..4f724aa 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1656,6 +1656,9 @@ struct xhci_hcd {
 #define XHCI_SSIC_PORT_UNUSED	(1 << 22)
 #define XHCI_NO_64BIT_SUPPORT	(1 << 23)
 #define XHCI_MISSING_CAS	(1 << 24)
+/* For controller with a broken Port Disable implementation */
+#define XHCI_BROKEN_PORT_PED    (1 << 21)
+
 	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

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

* [PATCH 2/3] usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested
  2016-11-17 15:01 [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
  2016-11-17 15:01 ` [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits Roger Quadros
@ 2016-11-17 15:01 ` Roger Quadros
  2016-11-17 15:01 ` [PATCH 3/3] usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisions Roger Quadros
  2017-01-03 12:37 ` [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
  3 siblings, 0 replies; 15+ messages in thread
From: Roger Quadros @ 2016-11-17 15:01 UTC (permalink / raw)
  To: balbi, mathias.nyman; +Cc: linux-usb, linux-kernel, rogerq

From: Felipe Balbi <balbi@ti.com>

In case 'quirk-broken-port-ped' property is passed in via device property,
we should enable the corresponding BROKEN_PED quirk flag for XHCI core.

[rogerq@ti.com] Updated code from platform data to device property
and added DT binding.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 +
 drivers/usb/host/xhci-plat.c                       | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index 966885c..7790c81 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -26,6 +26,7 @@ Required properties:
 Optional properties:
   - clocks: reference to a clock
   - usb3-lpm-capable: determines if platform is USB3 LPM capable
+  - quirk-broken-port-ped: set if the controller has broken port disable mechanism
 
 Example:
 	usb@f0931000 {
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index ed56bf9..e4de741 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -223,6 +223,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	if (device_property_read_bool(&pdev->dev, "usb3-lpm-capable"))
 		xhci->quirks |= XHCI_LPM_SUPPORT;
 
+	if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped"))
+		xhci->quirks |= XHCI_BROKEN_PORT_PED;
+
 	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
 		xhci->shared_hcd->can_do_streams = 1;
 
-- 
2.7.4

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

* [PATCH 3/3] usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisions
  2016-11-17 15:01 [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
  2016-11-17 15:01 ` [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits Roger Quadros
  2016-11-17 15:01 ` [PATCH 2/3] usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested Roger Quadros
@ 2016-11-17 15:01 ` Roger Quadros
  2017-01-03 12:37 ` [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
  3 siblings, 0 replies; 15+ messages in thread
From: Roger Quadros @ 2016-11-17 15:01 UTC (permalink / raw)
  To: balbi, mathias.nyman; +Cc: linux-usb, linux-kernel, rogerq

From: Felipe Balbi <balbi@ti.com>

dwc3 revisions <=3.00a have a limitation where Port Disable command
doesn't work. Set the quirk-broken-port-ped property for such
controllers so XHCI core can do the necessary workaround.

[rogerq@ti.com] Updated code from platform data to device property.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/dwc3/host.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index f6533c6..626d87d 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -21,11 +21,12 @@
 
 int dwc3_host_init(struct dwc3 *dwc)
 {
-	struct property_entry	props[2];
+	struct property_entry	props[3];
 	struct platform_device	*xhci;
 	int			ret, irq;
 	struct resource		*res;
 	struct platform_device	*dwc3_pdev = to_platform_device(dwc->dev);
+	int			prop_idx = 0;
 
 	irq = platform_get_irq_byname(dwc3_pdev, "host");
 	if (irq == -EPROBE_DEFER)
@@ -89,8 +90,22 @@ int dwc3_host_init(struct dwc3 *dwc)
 
 	memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
 
-	if (dwc->usb3_lpm_capable) {
-		props[0].name = "usb3-lpm-capable";
+	if (dwc->usb3_lpm_capable)
+		props[prop_idx++].name = "usb3-lpm-capable";
+
+	/**
+	 * WORKAROUND: dwc3 revisions <=3.00a have a limitation
+	 * where Port Disable command doesn't work.
+	 *
+	 * The suggested workaround is that we avoid Port Disable
+	 * completely.
+	 *
+	 * This following flag tells XHCI to do just that.
+	 */
+	if (dwc->revision <= DWC3_REVISION_300A)
+		props[prop_idx++].name = "quirk-broken-port-ped";
+
+	if (prop_idx) {
 		ret = platform_device_add_properties(xhci, props);
 		if (ret) {
 			dev_err(dwc->dev, "failed to add properties to xHCI\n");
-- 
2.7.4

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

* Re: [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits
  2016-11-17 15:01 ` [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits Roger Quadros
@ 2016-11-18 10:49   ` Sergei Shtylyov
  2016-11-21 11:51     ` Roger Quadros
  2016-11-21 11:51   ` [PATCH v2 " Roger Quadros
  1 sibling, 1 reply; 15+ messages in thread
From: Sergei Shtylyov @ 2016-11-18 10:49 UTC (permalink / raw)
  To: Roger Quadros, balbi, mathias.nyman; +Cc: linux-usb, linux-kernel

Hello.

On 11/17/2016 6:01 PM, Roger Quadros wrote:

> From: Felipe Balbi <balbi@ti.com>
>
> Some devices from Texas Instruments [1] suffer from
> a silicon bug where Port Enabled/Disabled bit
> should not be used to silence an erroneous device.
>
> The bug is so that if port is disabled with PED
> bit, an IRQ for device removal (or attachment)
> will never fire.
>
> Just for the sake of completeness, the actual
> problem lies with SNPS USB IP and this affects
> all known versions up to 3.00a. A separate
> patch will be added to dwc3 to enabled this
> quirk flag if version is <= 3.00a.
>
> [1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
> Section i896— USB xHCI Port Disable Feature Does Not Work
>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/host/xhci-hub.c | 6 ++++++
>  drivers/usb/host/xhci.h     | 3 +++
>  2 files changed, 9 insertions(+)
>
> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
> index 0ef1690..c3c051d 100644
> --- a/drivers/usb/host/xhci-hub.c
> +++ b/drivers/usb/host/xhci-hub.c
> @@ -458,6 +458,12 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
>  		return;
>  	}
>
> +	if (xhci->quirks & XHCI_BROKEN_PORT_PED) {
> +		xhci_dbg(xhci, "Broken Port Enabled/Disabled, ignoring "
> +				"port disable request.\n");

    The messages shouldn't be broken up to facilitate grepping.

[...]
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index f945380..4f724aa 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -1656,6 +1656,9 @@ struct xhci_hcd {
>  #define XHCI_SSIC_PORT_UNUSED	(1 << 22)
>  #define XHCI_NO_64BIT_SUPPORT	(1 << 23)
>  #define XHCI_MISSING_CAS	(1 << 24)
> +/* For controller with a broken Port Disable implementation */
> +#define XHCI_BROKEN_PORT_PED    (1 << 21)

    Indent with tabs as above, please.

[...]

MBR, Sergei

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

* [PATCH v2 1/3] usb: xhci: add quirk flag for broken PED bits
  2016-11-17 15:01 ` [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits Roger Quadros
  2016-11-18 10:49   ` Sergei Shtylyov
@ 2016-11-21 11:51   ` Roger Quadros
  2016-11-21 11:56     ` Felipe Balbi
  2016-11-21 13:09     ` [PATCH v3 " Roger Quadros
  1 sibling, 2 replies; 15+ messages in thread
From: Roger Quadros @ 2016-11-21 11:51 UTC (permalink / raw)
  To: balbi, mathias.nyman; +Cc: linux-usb, linux-kernel, Sergei Shtylyov, rogerq

From: Felipe Balbi <balbi@ti.com>

Some devices from Texas Instruments [1] suffer from
a silicon bug where Port Enabled/Disabled bit
should not be used to silence an erroneous device.

The bug is so that if port is disabled with PED
bit, an IRQ for device removal (or attachment)
will never fire.

Just for the sake of completeness, the actual
problem lies with SNPS USB IP and this affects
all known versions up to 3.00a. A separate
patch will be added to dwc3 to enabled this
quirk flag if version is <= 3.00a.

[1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
Section i896— USB xHCI Port Disable Feature Does Not Work

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/host/xhci-hub.c | 6 ++++++
 drivers/usb/host/xhci.h     | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 0ef1690..1d41637 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -458,6 +458,12 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
 		return;
 	}
 
+	if (xhci->quirks & XHCI_BROKEN_PORT_PED) {
+		xhci_dbg(xhci,
+			 "Broken Port Enabled/Disabled, ignoring port disable request.\n");
+		return;
+	}
+
 	/* Write 1 to disable the port */
 	writel(port_status | PORT_PE, addr);
 	port_status = readl(addr);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index f945380..6553903 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1656,6 +1656,9 @@ struct xhci_hcd {
 #define XHCI_SSIC_PORT_UNUSED	(1 << 22)
 #define XHCI_NO_64BIT_SUPPORT	(1 << 23)
 #define XHCI_MISSING_CAS	(1 << 24)
+/* For controller with a broken Port Disable implementation */
+#define XHCI_BROKEN_PORT_PED	(1 << 21)
+
 	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

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

* Re: [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits
  2016-11-18 10:49   ` Sergei Shtylyov
@ 2016-11-21 11:51     ` Roger Quadros
  0 siblings, 0 replies; 15+ messages in thread
From: Roger Quadros @ 2016-11-21 11:51 UTC (permalink / raw)
  To: Sergei Shtylyov, balbi, mathias.nyman; +Cc: linux-usb, linux-kernel

On 18/11/16 12:49, Sergei Shtylyov wrote:
> Hello.
> 
> On 11/17/2016 6:01 PM, Roger Quadros wrote:
> 
>> From: Felipe Balbi <balbi@ti.com>
>>
>> Some devices from Texas Instruments [1] suffer from
>> a silicon bug where Port Enabled/Disabled bit
>> should not be used to silence an erroneous device.
>>
>> The bug is so that if port is disabled with PED
>> bit, an IRQ for device removal (or attachment)
>> will never fire.
>>
>> Just for the sake of completeness, the actual
>> problem lies with SNPS USB IP and this affects
>> all known versions up to 3.00a. A separate
>> patch will be added to dwc3 to enabled this
>> quirk flag if version is <= 3.00a.
>>
>> [1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
>> Section i896— USB xHCI Port Disable Feature Does Not Work
>>
>> Signed-off-by: Felipe Balbi <balbi@ti.com>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/usb/host/xhci-hub.c | 6 ++++++
>>  drivers/usb/host/xhci.h     | 3 +++
>>  2 files changed, 9 insertions(+)
>>
>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>> index 0ef1690..c3c051d 100644
>> --- a/drivers/usb/host/xhci-hub.c
>> +++ b/drivers/usb/host/xhci-hub.c
>> @@ -458,6 +458,12 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
>>          return;
>>      }
>>
>> +    if (xhci->quirks & XHCI_BROKEN_PORT_PED) {
>> +        xhci_dbg(xhci, "Broken Port Enabled/Disabled, ignoring "
>> +                "port disable request.\n");
> 
>    The messages shouldn't be broken up to facilitate grepping.
> 
> [...]
>> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
>> index f945380..4f724aa 100644
>> --- a/drivers/usb/host/xhci.h
>> +++ b/drivers/usb/host/xhci.h
>> @@ -1656,6 +1656,9 @@ struct xhci_hcd {
>>  #define XHCI_SSIC_PORT_UNUSED    (1 << 22)
>>  #define XHCI_NO_64BIT_SUPPORT    (1 << 23)
>>  #define XHCI_MISSING_CAS    (1 << 24)
>> +/* For controller with a broken Port Disable implementation */
>> +#define XHCI_BROKEN_PORT_PED    (1 << 21)
> 
>    Indent with tabs as above, please.
> 
> [...]
> 

Thanks. I've fixed both issues and sent a v2.

cheers,
-roger

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

* Re: [PATCH v2 1/3] usb: xhci: add quirk flag for broken PED bits
  2016-11-21 11:51   ` [PATCH v2 " Roger Quadros
@ 2016-11-21 11:56     ` Felipe Balbi
  2016-11-21 13:05       ` Roger Quadros
  2016-11-21 13:09     ` [PATCH v3 " Roger Quadros
  1 sibling, 1 reply; 15+ messages in thread
From: Felipe Balbi @ 2016-11-21 11:56 UTC (permalink / raw)
  To: Roger Quadros, mathias.nyman
  Cc: linux-usb, linux-kernel, Sergei Shtylyov, rogerq

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]


Hi,

Roger Quadros <rogerq@ti.com> writes:
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index f945380..6553903 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -1656,6 +1656,9 @@ struct xhci_hcd {
>  #define XHCI_SSIC_PORT_UNUSED	(1 << 22)
>  #define XHCI_NO_64BIT_SUPPORT	(1 << 23)
>  #define XHCI_MISSING_CAS	(1 << 24)
> +/* For controller with a broken Port Disable implementation */
> +#define XHCI_BROKEN_PORT_PED	(1 << 21)

since back when I first wrote this, bit 21 has been taken. You should be
using bit 25 here.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH v2 1/3] usb: xhci: add quirk flag for broken PED bits
  2016-11-21 11:56     ` Felipe Balbi
@ 2016-11-21 13:05       ` Roger Quadros
  0 siblings, 0 replies; 15+ messages in thread
From: Roger Quadros @ 2016-11-21 13:05 UTC (permalink / raw)
  To: Felipe Balbi, mathias.nyman; +Cc: linux-usb, linux-kernel, Sergei Shtylyov


[-- Attachment #1.1: Type: text/plain, Size: 705 bytes --]

On 21/11/16 13:56, Felipe Balbi wrote:
> 
> Hi,
> 
> Roger Quadros <rogerq@ti.com> writes:
>> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
>> index f945380..6553903 100644
>> --- a/drivers/usb/host/xhci.h
>> +++ b/drivers/usb/host/xhci.h
>> @@ -1656,6 +1656,9 @@ struct xhci_hcd {
>>  #define XHCI_SSIC_PORT_UNUSED	(1 << 22)
>>  #define XHCI_NO_64BIT_SUPPORT	(1 << 23)
>>  #define XHCI_MISSING_CAS	(1 << 24)
>> +/* For controller with a broken Port Disable implementation */
>> +#define XHCI_BROKEN_PORT_PED	(1 << 21)
> 
> since back when I first wrote this, bit 21 has been taken. You should be
> using bit 25 here.
> 
My bad. I'll fix this up.

cheers,
-roger


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH v3 1/3] usb: xhci: add quirk flag for broken PED bits
  2016-11-21 11:51   ` [PATCH v2 " Roger Quadros
  2016-11-21 11:56     ` Felipe Balbi
@ 2016-11-21 13:09     ` Roger Quadros
  1 sibling, 0 replies; 15+ messages in thread
From: Roger Quadros @ 2016-11-21 13:09 UTC (permalink / raw)
  To: balbi, mathias.nyman; +Cc: linux-usb, linux-kernel, Sergei Shtylyov

From: Felipe Balbi <balbi@ti.com>

Some devices from Texas Instruments [1] suffer from
a silicon bug where Port Enabled/Disabled bit
should not be used to silence an erroneous device.

The bug is so that if port is disabled with PED
bit, an IRQ for device removal (or attachment)
will never fire.

Just for the sake of completeness, the actual
problem lies with SNPS USB IP and this affects
all known versions up to 3.00a. A separate
patch will be added to dwc3 to enabled this
quirk flag if version is <= 3.00a.

[1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
Section i896— USB xHCI Port Disable Feature Does Not Work

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/host/xhci-hub.c | 6 ++++++
 drivers/usb/host/xhci.h     | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 0ef1690..1d41637 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -458,6 +458,12 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
 		return;
 	}
 
+	if (xhci->quirks & XHCI_BROKEN_PORT_PED) {
+		xhci_dbg(xhci,
+			 "Broken Port Enabled/Disabled, ignoring port disable request.\n");
+		return;
+	}
+
 	/* Write 1 to disable the port */
 	writel(port_status | PORT_PE, addr);
 	port_status = readl(addr);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index f945380..585af71 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1656,6 +1656,9 @@ struct xhci_hcd {
 #define XHCI_SSIC_PORT_UNUSED	(1 << 22)
 #define XHCI_NO_64BIT_SUPPORT	(1 << 23)
 #define XHCI_MISSING_CAS	(1 << 24)
+/* For controller with a broken Port Disable implementation */
+#define XHCI_BROKEN_PORT_PED	(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

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

* Re: [PATCH 0/3] usb: xhci: Add broken port disable quirk
  2016-11-17 15:01 [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
                   ` (2 preceding siblings ...)
  2016-11-17 15:01 ` [PATCH 3/3] usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisions Roger Quadros
@ 2017-01-03 12:37 ` Roger Quadros
  2017-01-03 12:53   ` Felipe Balbi
  3 siblings, 1 reply; 15+ messages in thread
From: Roger Quadros @ 2017-01-03 12:37 UTC (permalink / raw)
  To: balbi, mathias.nyman; +Cc: linux-usb, linux-kernel

Mathias & Felipe,

On 17/11/16 17:01, Roger Quadros wrote:
> Hi,
> 
> Some XHCI controllers e.g. dwc3 based have a broken Port disable [1].
> 
> If the attached high-speed device is misbehaving, the USB stack typically
> disables the port using the PED bit in PORTSC. For the controllers that
> have broken port disable, the port fails to detect further attach/detach
> events and so high-speed devices can no longer be enumerated on the
> port. The workaround is to prevent port disable using PED on such
> controllers.
> 
> We add a new BROKEN_PED quirk flag and 'quirk-broken-port-ped' device
> property and prevent port disable using PED if we encounter the quirk flag.
> 
> [1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
>     Section i896— USB xHCI Port Disable Feature Does Not Work

Any comments on this series?
patch 1 is at v3. Rest 2 are original.

cheers,
-roger

> 
> cheers,
> -roger
> 
> Felipe Balbi (3):
>   usb: xhci: add quirk flag for broken PED bits
>   usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested
>   usb: dwc3: host: pass quirk-broken-port-ped property for known broken
>     revisions
> 
>  Documentation/devicetree/bindings/usb/usb-xhci.txt |  1 +
>  drivers/usb/dwc3/host.c                            | 21 ++++++++++++++++++---
>  drivers/usb/host/xhci-hub.c                        |  6 ++++++
>  drivers/usb/host/xhci-plat.c                       |  3 +++
>  drivers/usb/host/xhci.h                            |  3 +++
>  5 files changed, 31 insertions(+), 3 deletions(-)
> 

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

* Re: [PATCH 0/3] usb: xhci: Add broken port disable quirk
  2017-01-03 12:37 ` [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
@ 2017-01-03 12:53   ` Felipe Balbi
  2017-01-03 16:32     ` Mathias Nyman
  2017-01-24 14:59     ` Roger Quadros
  0 siblings, 2 replies; 15+ messages in thread
From: Felipe Balbi @ 2017-01-03 12:53 UTC (permalink / raw)
  To: Roger Quadros, mathias.nyman; +Cc: linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]


Hi,

Roger Quadros <rogerq@ti.com> writes:
> Mathias & Felipe,
>
> On 17/11/16 17:01, Roger Quadros wrote:
>> Hi,
>> 
>> Some XHCI controllers e.g. dwc3 based have a broken Port disable [1].
>> 
>> If the attached high-speed device is misbehaving, the USB stack typically
>> disables the port using the PED bit in PORTSC. For the controllers that
>> have broken port disable, the port fails to detect further attach/detach
>> events and so high-speed devices can no longer be enumerated on the
>> port. The workaround is to prevent port disable using PED on such
>> controllers.
>> 
>> We add a new BROKEN_PED quirk flag and 'quirk-broken-port-ped' device
>> property and prevent port disable using PED if we encounter the quirk flag.
>> 
>> [1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
>>     Section i896— USB xHCI Port Disable Feature Does Not Work
>
> Any comments on this series?
> patch 1 is at v3. Rest 2 are original.

none from me. Mathias?

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH 0/3] usb: xhci: Add broken port disable quirk
  2017-01-03 12:53   ` Felipe Balbi
@ 2017-01-03 16:32     ` Mathias Nyman
  2017-01-24 14:59     ` Roger Quadros
  1 sibling, 0 replies; 15+ messages in thread
From: Mathias Nyman @ 2017-01-03 16:32 UTC (permalink / raw)
  To: Felipe Balbi, Roger Quadros, mathias.nyman; +Cc: linux-usb, linux-kernel

On 03.01.2017 14:53, Felipe Balbi wrote:
>
> Hi,
>
> Roger Quadros <rogerq@ti.com> writes:
>> Mathias & Felipe,
>>
>> On 17/11/16 17:01, Roger Quadros wrote:
>>> Hi,
>>>
>>> Some XHCI controllers e.g. dwc3 based have a broken Port disable [1].
>>>
>>> If the attached high-speed device is misbehaving, the USB stack typically
>>> disables the port using the PED bit in PORTSC. For the controllers that
>>> have broken port disable, the port fails to detect further attach/detach
>>> events and so high-speed devices can no longer be enumerated on the
>>> port. The workaround is to prevent port disable using PED on such
>>> controllers.
>>>
>>> We add a new BROKEN_PED quirk flag and 'quirk-broken-port-ped' device
>>> property and prevent port disable using PED if we encounter the quirk flag.
>>>
>>> [1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
>>>      Section i896— USB xHCI Port Disable Feature Does Not Work
>>
>> Any comments on this series?
>> patch 1 is at v3. Rest 2 are original.
>
> none from me. Mathias?
>

Looks good to me, I'll add them to the queue

-Mathias

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

* Re: [PATCH 0/3] usb: xhci: Add broken port disable quirk
  2017-01-03 12:53   ` Felipe Balbi
  2017-01-03 16:32     ` Mathias Nyman
@ 2017-01-24 14:59     ` Roger Quadros
  2017-01-26  9:19       ` Felipe Balbi
  1 sibling, 1 reply; 15+ messages in thread
From: Roger Quadros @ 2017-01-24 14:59 UTC (permalink / raw)
  To: Felipe Balbi, mathias.nyman; +Cc: linux-usb, linux-kernel

Felipe,

On 03/01/17 14:53, Felipe Balbi wrote:
> 
> Hi,
> 
> Roger Quadros <rogerq@ti.com> writes:
>> Mathias & Felipe,
>>
>> On 17/11/16 17:01, Roger Quadros wrote:
>>> Hi,
>>>
>>> Some XHCI controllers e.g. dwc3 based have a broken Port disable [1].
>>>
>>> If the attached high-speed device is misbehaving, the USB stack typically
>>> disables the port using the PED bit in PORTSC. For the controllers that
>>> have broken port disable, the port fails to detect further attach/detach
>>> events and so high-speed devices can no longer be enumerated on the
>>> port. The workaround is to prevent port disable using PED on such
>>> controllers.
>>>
>>> We add a new BROKEN_PED quirk flag and 'quirk-broken-port-ped' device
>>> property and prevent port disable using PED if we encounter the quirk flag.
>>>
>>> [1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
>>>     Section i896— USB xHCI Port Disable Feature Does Not Work
>>
>> Any comments on this series?
>> patch 1 is at v3. Rest 2 are original.
> 
> none from me. Mathias?
> 

Mathias has queued patches 1 and 2 for v4.11.
Can you please pick patch 3? Thanks.

cheers,
-roger

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

* Re: [PATCH 0/3] usb: xhci: Add broken port disable quirk
  2017-01-24 14:59     ` Roger Quadros
@ 2017-01-26  9:19       ` Felipe Balbi
  0 siblings, 0 replies; 15+ messages in thread
From: Felipe Balbi @ 2017-01-26  9:19 UTC (permalink / raw)
  To: Roger Quadros, mathias.nyman; +Cc: linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1292 bytes --]


Hi,

Roger Quadros <rogerq@ti.com> writes:
> Felipe,
>
> On 03/01/17 14:53, Felipe Balbi wrote:
>> 
>> Hi,
>> 
>> Roger Quadros <rogerq@ti.com> writes:
>>> Mathias & Felipe,
>>>
>>> On 17/11/16 17:01, Roger Quadros wrote:
>>>> Hi,
>>>>
>>>> Some XHCI controllers e.g. dwc3 based have a broken Port disable [1].
>>>>
>>>> If the attached high-speed device is misbehaving, the USB stack typically
>>>> disables the port using the PED bit in PORTSC. For the controllers that
>>>> have broken port disable, the port fails to detect further attach/detach
>>>> events and so high-speed devices can no longer be enumerated on the
>>>> port. The workaround is to prevent port disable using PED on such
>>>> controllers.
>>>>
>>>> We add a new BROKEN_PED quirk flag and 'quirk-broken-port-ped' device
>>>> property and prevent port disable using PED if we encounter the quirk flag.
>>>>
>>>> [1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
>>>>     Section i896— USB xHCI Port Disable Feature Does Not Work
>>>
>>> Any comments on this series?
>>> patch 1 is at v3. Rest 2 are original.
>> 
>> none from me. Mathias?
>> 
>
> Mathias has queued patches 1 and 2 for v4.11.
> Can you please pick patch 3? Thanks.

done

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2017-01-26  9:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-17 15:01 [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
2016-11-17 15:01 ` [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits Roger Quadros
2016-11-18 10:49   ` Sergei Shtylyov
2016-11-21 11:51     ` Roger Quadros
2016-11-21 11:51   ` [PATCH v2 " Roger Quadros
2016-11-21 11:56     ` Felipe Balbi
2016-11-21 13:05       ` Roger Quadros
2016-11-21 13:09     ` [PATCH v3 " Roger Quadros
2016-11-17 15:01 ` [PATCH 2/3] usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested Roger Quadros
2016-11-17 15:01 ` [PATCH 3/3] usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisions Roger Quadros
2017-01-03 12:37 ` [PATCH 0/3] usb: xhci: Add broken port disable quirk Roger Quadros
2017-01-03 12:53   ` Felipe Balbi
2017-01-03 16:32     ` Mathias Nyman
2017-01-24 14:59     ` Roger Quadros
2017-01-26  9:19       ` Felipe Balbi

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