usb: xhci: Add broken port disable quirk
Subsystems (4)
cover usb: xhci: Add broken port disable quirk
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(-)
Signature · 1 line
2.7.4
PATCH 1/3 usb: xhci: add quirk flag for broken PED bits
From: Felipe Balbi <[email protected]>
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
--- drivers/usb/host/xhci-hub.c | 6 ++++++ drivers/usb/host/xhci.h | 3 +++ 2 files changed, 9 insertions(+)
drivers/usb/host/xhci-hub.c +6 -0
@@ -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);
drivers/usb/host/xhci.h +3 -0
@@ -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 */
Signature · 1 line
2.7.4
Re: [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits
Hello.
Quoted 31 lines · Roger Quadros
From: Felipe Balbi <[email protected]>
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 WorkSigned-off-by Felipe Balbi <[email protected]>Signed-off-by Roger Quadros <[email protected]>--- drivers/usb/host/xhci-hub.c | 6 ++++++ drivers/usb/host/xhci.h | 3 +++ 2 files changed, 9 insertions(+)drivers/usb/host/xhci-hub.c +0
-0
drivers/usb/host/xhci-hub.c static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, · line 463
Quoted 6 lines
drivers/usb/host/xhci-hub.c +3
-0@@ -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.
[...]
drivers/usb/host/xhci.h struct xhci_hcd { · line 1660
Quoted 10 lines
drivers/usb/host/xhci.h +2
-0@@ -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
Re: [PATCH 1/3] usb: xhci: add quirk flag for broken PED bits
Quoted 58 lines · Sergei Shtylyov
Hello.
Quoted 31 lines · Roger Quadros
From: Felipe Balbi <[email protected]>
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 WorkSigned-off-by Felipe Balbi <[email protected]>Signed-off-by Roger Quadros <[email protected]>--- drivers/usb/host/xhci-hub.c | 6 ++++++ drivers/usb/host/xhci.h | 3 +++ 2 files changed, 9 insertions(+)drivers/usb/host/xhci-hub.c +0
-0drivers/usb/host/xhci-hub.c static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, · line 463
Quoted 6 lines
drivers/usb/host/xhci-hub.c +3
-0@@ -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.
[...]
drivers/usb/host/xhci.h struct xhci_hcd { · line 1660
Quoted 10 lines
drivers/usb/host/xhci.h +2
-0@@ -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.
Quoted 2 lines
[...]
Thanks. I've fixed both issues and sent a v2.
cheers,
-roger
PATCH v2 1/3 usb: xhci: add quirk flag for broken PED bits
In reply to Roger QuadrosFrom: Felipe Balbi <[email protected]>
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
--- drivers/usb/host/xhci-hub.c | 6 ++++++ drivers/usb/host/xhci.h | 3 +++ 2 files changed, 9 insertions(+)
drivers/usb/host/xhci-hub.c +6 -0
@@ -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);
drivers/usb/host/xhci.h +3 -0
@@ -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 */
Signature · 1 line
2.7.4
Re: [PATCH v2 1/3] usb: xhci: add quirk flag for broken PED bits
Hi,
drivers/usb/host/xhci.h struct xhci_hcd { · line 1660
Quoted 10 lines · Roger Quadros
drivers/usb/host/xhci.h +2
-0@@ -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.
Signature · 1 line
balbi
Re: [PATCH v2 1/3] usb: xhci: add quirk flag for broken PED bits
Quoted 4 lines · Felipe Balbi
Hi,
Roger Quadros <[email protected]> writes:
Quoted 14 lines
drivers/usb/host/xhci.h struct xhci_hcd { · line 1660
Quoted 10 lines
drivers/usb/host/xhci.h +2
-0@@ -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
PATCH v3 1/3 usb: xhci: add quirk flag for broken PED bits
In reply to Roger QuadrosFrom: Felipe Balbi <[email protected]>
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
--- drivers/usb/host/xhci-hub.c | 6 ++++++ drivers/usb/host/xhci.h | 3 +++ 2 files changed, 9 insertions(+)
drivers/usb/host/xhci-hub.c +6 -0
@@ -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);
drivers/usb/host/xhci.h +3 -0
@@ -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 */
Signature · 1 line
2.7.4
PATCH 2/3 usb: host: xhci-plat: enable BROKEN_PED quirk if platform requested
In reply to Roger QuadrosFrom: Felipe Balbi <[email protected]>
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.
[[email protected]] Updated code from platform data to device property and added DT binding.
--- Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 + drivers/usb/host/xhci-plat.c | 3 +++ 2 files changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/usb-xhci.txt +1 -0
@@ -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 {
drivers/usb/host/xhci-plat.c +3 -0
@@ -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 ;
Signature · 1 line
2.7.4
PATCH 3/3 usb: dwc3: host: pass quirk-broken-port-ped property for known broken revisions
In reply to Roger QuadrosFrom: Felipe Balbi <[email protected]>
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.
[[email protected]] Updated code from platform data to device property.
--- drivers/usb/dwc3/host.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/usb/dwc3/host.c +18 -3
@@ -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" );
Signature · 1 line
2.7.4
Mathias & Felipe,
Quoted 11 lines · Roger Quadros
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.
Quoted 5 lines
We add a new
BROKEN_PEDquirk 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
Quoted 17 lines
cheers,
-rogerFelipe Balbi (3):
usb: xhci: add quirk flag for broken PED bits
usb: host: xhci-plat: enableBROKEN_PEDquirk if platform requested
usb: dwc3: host: pass quirk-broken-port-ped property for known broken
revisionsDocumentation/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(-)
Hi,
Quoted 14 lines · Roger Quadros
Mathias & Felipe,
Quoted 11 lines · Roger Quadros
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.
Quoted 8 lines
Quoted 5 lines
We add a new
BROKEN_PEDquirk 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 WorkAny comments on this series?
patch 1 is at v3. Rest 2 are original.
none from me. Mathias?
Signature · 1 line
balbi
Quoted 21 lines · Felipe Balbi
Hi,
Quoted 17 lines · Roger Quadros
Mathias & Felipe,
Quoted 14 lines · Roger Quadros
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_PEDquirk flag and 'quirk-broken-port-ped' device property and prevent port disable using PED if we encounter the quirk flag.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
[1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
Section i896— USB xHCI Port Disable Feature Does Not WorkAny 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
Felipe,
Quoted 21 lines · Felipe Balbi
Hi,
Quoted 17 lines · Roger Quadros
Mathias & Felipe,
Quoted 14 lines · Roger Quadros
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_PEDquirk flag and 'quirk-broken-port-ped' device property and prevent port disable using PED if we encounter the quirk flag.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
[1] - AM572x Silicon Errata http://www.ti.com/lit/er/sprz429j/sprz429j.pdf
Section i896— USB xHCI Port Disable Feature Does Not WorkAny 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
Hi,
Quoted 27 lines · Roger Quadros
Felipe,
Quoted 24 lines · Felipe Balbi
Hi,
Quoted 20 lines · Roger Quadros
Mathias & Felipe,
Quoted 16 lines · Roger Quadros
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_PEDquirk 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
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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
Signature · 1 line
balbi