usb: dwc3: xhci: Add quirk for defective Port Enable/disable
Subsystems (3)
cover usb: dwc3: xhci: Add quirk for defective Port Enable/disable
Hi,
Some devices from Texas Instruments suffer from a silicon bug where XHCI 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 DWC3 USB IP and this affects all known versions up to 3.00a
We add a BROKEN_PE quirk in xhci.h to deal with this issue and add a corresponding bit in xhci platform_data.
I've only updated Felipe's e-mail id in the patches and re-based them to v4.5 + balbi/next.
--
cheers,
-roger
Felipe Balbi (5):
usb: xhci: add quirk flag for broken PED bits
usb: dwc3: core: define macros for newest revisions
usb: host: xhci: add broken pe quirk flag to pdata
usb: host: xhci-plat: enable BROKEN_PE quirk if platform requested
usb: dwc3: host: pass BROKEN_PE flag for known broken revisions
drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 12 ++++++++++++ drivers/usb/host/xhci-hub.c | 6 ++++++ drivers/usb/host/xhci-plat.c | 3 +++ drivers/usb/host/xhci.h | 2 ++ include/linux/usb/xhci_pdriver.h | 2 ++ 6 files changed, 27 insertions(+)
Signature · 1 line
2.5.0
PATCH 2/5 usb: dwc3: core: define macros for newest revisions
From: Felipe Balbi <[email protected]>
dwc3 has released two other versions (2.90a and 3.00a), this patch just adds revision macros.
--- drivers/usb/dwc3/core.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/core.h +2 -0
@@ -812,6 +812,8 @@ struct dwc3 {#define DWC3_REVISION_260A 0x5533260a#define DWC3_REVISION_270A 0x5533270a#define DWC3_REVISION_280A 0x5533280a +#define DWC3_REVISION_290A 0x5533290a +#define DWC3_REVISION_300A 0x5533300a/* * NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really
Signature · 1 line
2.5.0
PATCH 3/5 usb: host: xhci: add broken pe quirk flag to pdata
In reply to Roger QuadrosFrom: Felipe Balbi <[email protected]>
Let platform_data users pass broken pe flag to
xhci driver.
--- include/linux/usb/xhci_pdriver.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/usb/xhci_pdriver.h +2 -0
@@ -18,10 +18,12 @@* * @usb3_lpm_capable: determines if this xhci platform supports USB3 * LPM capability +* @quirk_port_broken_pe: If true, XHCI will not use Port Disable. * */ struct usb_xhci_pdata {unsigned usb3_lpm_capable:1 ; +unsigned quirk_port_broken_pe:1 ; };#endif /* __USB_CORE_XHCI_PDRIVER_H */
Signature · 1 line
2.5.0
PATCH 5/5 usb: dwc3: host: pass BROKEN_PE flag for known broken revisions
In reply to Roger QuadrosFrom: Felipe Balbi <[email protected]>
Now that we have a broken pe quirk flag, dwc3 can tell XHCI core about it.
--- drivers/usb/dwc3/host.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/dwc3/host.c +12 -0
@@ -51,6 +51,18 @@ int dwc3_host_init(struct dwc3 *dwc) pdata.usb3_lpm_capable = dwc->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 ) + pdata.quirk_port_broken_pe = true; + ret =platform_device_add_data (xhci, &pdata,sizeof (pdata));if (ret) {dev_err (dwc->dev,"couldn't add platform data to xHCI device\n" );
Signature · 1 line
2.5.0
PATCH 4/5 usb: host: xhci-plat: enable BROKEN_PE quirk if platform requested
In reply to Roger QuadrosFrom: Felipe Balbi <[email protected]>
In case a broken pe flag is passed in via pdata, we should enable the corresponding BROKEN_PE quirk flag for XHCI core.
--- drivers/usb/host/xhci-plat.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/host/xhci-plat.c +3 -0
@@ -209,6 +209,9 @@ static int xhci_plat_probe(struct platform_device *pdev) (pdata && pdata->usb3_lpm_capable)) xhci->quirks |=XHCI_LPM_SUPPORT ; +if (pdata && pdata->quirk_port_broken_pe) + xhci->quirks |=XHCI_BROKEN_PORT_PE ; +if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ;
Signature · 1 line
2.5.0
PATCH 1/5 usb: xhci: add quirk flag for broken PED bits
In reply to Roger QuadrosFrom: Felipe Balbi <[email protected]>
Some devices from Texas Instruments 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.
--- drivers/usb/host/xhci-hub.c | 6 ++++++ drivers/usb/host/xhci.h | 2 ++ 2 files changed, 8 insertions(+)
drivers/usb/host/xhci-hub.c +6 -0
@@ -455,6 +455,12 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,return ; } +if (xhci->quirks &XHCI_BROKEN_PORT_PE ) { +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 +2 -0
@@ -1641,6 +1641,8 @@ struct xhci_hcd {#define XHCI_PME_STUCK_QUIRK (1 << 20)#define XHCI_MTK_HOST (1 << 21)#define XHCI_SSIC_PORT_UNUSED (1 << 22) +/* For controller with a broken Port Disable implementation */ +#define XHCI_BROKEN_PORT_PE (1 << 23)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.5.0
Mathias,
Quoted 22 lines · Roger Quadros
Some devices from Texas Instruments suffer from a silicon bug where XHCI 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 DWC3 USB IP and this affects all known versions up to 3.00a
We add a
BROKEN_PEquirk inxhci.hto deal with this issue and add a corresponding bit in xhciplatform_data.I've only updated Felipe's e-mail id in the patches and re-based them to v4.5 + balbi/next.
--
cheers,
-roger
Quoted 6 lines
Felipe Balbi (5):
usb: xhci: add quirk flag for broken PED bits
usb: dwc3: core: define macros for newest revisions
usb: host: xhci: add broken pe quirk flag to pdata
usb: host: xhci-plat: enableBROKEN_PEquirk if platform requested
usb: dwc3: host: passBROKEN_PEflag for known broken revisions
this series has changes on both dwc3 and xhci. Let me know how you wanna handle these.
Signature · 1 line
balbi