dt-bindings: usb: dwc3: Add snps,host-vbus-glitches avoiding vbus glitch
Subsystems (3)
PATCH 1/2 dt-bindings: usb: dwc3: Add snps,host-vbus-glitches avoiding vbus glitch
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.
This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3 driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).
--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +7 -0
@@ -273,6 +273,13 @@ properties: with an external supply. type: boolean + snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done. + type: boolean + snps,is-utmi-l1-suspend: description: True when DWC3 asserts output signal utmi_l1_suspend_n, false when
Signature · 1 line
2.34.1
PATCH 2/2 usb: dwc3: Add workaround for host mode VBUS glitch when boot
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register DWC3_GCTL, VBUS (or its control signal) will be turned on immediately on related Root Hub ports. Then, the VBUS is turned off for a little while(15us) when do xhci reset (conducted by xhci driver) and back to normal finally, we can observe a negative glitch of related signal happen.
This VBUS glitch might cause some USB devices enumeration fail if kernel boot with them connected. Such as LS1012AFWRY/LS1043ARDB/LX2160AQDS /LS1088ARDB with Kingston 16GB USB2.0/Kingston USB3.0/JetFlash Transcend 4GB USB2.0 drives. The fail cases include enumerated as full-speed device or report wrong device descriptor, etc.
One SW workaround which can fix this is by programing all xhci PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3 driver (per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c). Then, after xhci reset complete in xhci driver, PORTSC[PP]s' value will back to 1 automatically and VBUS on at that time, no glitch happen and normal enumeration process has no impact.
---
Notes:
Last review at June 06, 2019. Fixed all review comments and sent again.
drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 46 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+)
drivers/usb/dwc3/core.c +2 -0
@@ -1626,6 +1626,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->dis_split_quirk =device_property_read_bool (dev,"snps,dis-split-quirk" ); + dwc->host_vbus_glitches =device_property_read_bool (dev,"snps,host-vbus-glitches" ); + dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis;
drivers/usb/dwc3/core.h +2 -0
@@ -1135,6 +1135,7 @@ struct dwc3_scratchpad_array {* @dis_split_quirk: set to disable split boundary. * @wakeup_configured: set if the device is configured for remote wakeup. * @suspended: set to track suspend event due to U3/L2. +* @host_vbus_glitches: set to avoid vbus glitch during xhci reset. * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. * @max_cfg_eps: current max number of IN eps used across all USB configs.
@@ -1353,6 +1354,7 @@ struct dwc3 { unsigned tx_de_emphasis:2; unsigned dis_metastability_quirk:1; + unsigned host_vbus_glitches:1; unsigned dis_split_quirk:1; unsigned async_callbacks:1;
drivers/usb/dwc3/host.c +46 -0
64 lines not on this page · raw message
Signature · 1 line
2.34.1
Thinh Nguyen
maintainerRe: [PATCH 2/2] usb: dwc3: Add workaround for host mode VBUS glitch when boot
Quoted 41 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will be turned on immediately on related Root Hub ports. Then, the VBUS is turned off for a little while(15us) when do xhci reset (conducted by xhci driver) and back to normal finally, we can observe a negative glitch of related signal happen.This VBUS glitch might cause some USB devices enumeration fail if kernel boot with them connected. Such as LS1012AFWRY/LS1043ARDB/LX2160AQDS /LS1088ARDB with Kingston 16GB USB2.0/Kingston USB3.0/JetFlash Transcend 4GB USB2.0 drives. The fail cases include enumerated as full-speed device or report wrong device descriptor, etc.
One SW workaround which can fix this is by programing all xhci PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3 driver (per signal measurement result, it will be too late to do it in
xhci-plat.corxhci.c). Then, after xhci reset complete in xhci driver, PORTSC[PP]s' value will back to 1 automatically and VBUS on at that time, no glitch happen and normal enumeration process has no impact.Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>---
Notes:
Last review at June 06, 2019. Fixed all review comments and sent again.drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 46 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+)drivers/usb/dwc3/core.c +0
-0
drivers/usb/dwc3/core.c static void dwc3_get_properties(struct dwc3 *dwc) · line 1629
Quoted 4 lines
drivers/usb/dwc3/core.c +1
-0@@ -1626,6 +1626,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->dis_split_quirk =device_property_read_bool (dev,"snps,dis-split-quirk" ); + dwc->host_vbus_glitches =device_property_read_bool (dev,"snps,host-vbus-glitches" );
This is a quirk. The property should be named with "quirk" subfix. But do we need a new quirk? How many different platforms are affected? If it's just 1 or 2, then just use compatible string.
drivers/usb/dwc3/core.h struct dwc3_scratchpad_array { · line 1138
Quoted 13 lines
drivers/usb/dwc3/core.c +1
-0+ dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis;drivers/usb/dwc3/core.h +1
-0@@ -1135,6 +1135,7 @@ struct dwc3_scratchpad_array {* @dis_split_quirk: set to disable split boundary. * @wakeup_configured: set if the device is configured for remote wakeup. * @suspended: set to track suspend event due to U3/L2. +* @host_vbus_glitches: set to avoid vbus glitch during xhci reset.
This is only applicable to the first xhci reset in its initialization and not every xhci reset right? If so, please reword.
Also, please place it correspond to the order of the field.
Quoted 16 lines
drivers/usb/dwc3/core.h +1
-0* @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. * @max_cfg_eps: current max number of IN eps used across all USB configs. @@ -1353,6 +1354,7 @@ struct dwc3 { unsigned tx_de_emphasis:2; unsigned dis_metastability_quirk:1; + unsigned host_vbus_glitches:1; unsigned dis_split_quirk:1; unsigned async_callbacks:1;drivers/usb/dwc3/host.c +0
-0
drivers/usb/dwc3/host.c line 14
Quoted 4 lines
drivers/usb/dwc3/host.c +1
-0@@ -11,6 +11,7 @@#include <linux/of.h> #include <linux/platform_device.h> +#include "../host/xhci.h"
Let's not import the entire xhci.h. If we're going to share some macros from xhci.h, please split them from xhci.h and perhaps create xhci-ports.h for dwc3 to share.
Quoted 49 lines
drivers/usb/dwc3/host.c +38
-0#include "core.h" static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc,@@ -28,6 +29,44 @@ static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc, dwc->xhci_resources[1 ].name = name; } +#define XHCI_HCSPARAMS1 0x4 +#define XHCI_PORTSC_BASE 0x400 + +/* +* dwc3_power_off_all_roothub_ports - Power off all Root hub ports +* @dwc3: Pointer to our controller context structure +*/ +static void dwc3_power_off_all_roothub_ports (struct dwc3 *dwc) +{ +int i, port_num; +u32 reg, op_regs_base, offset; +void __iomem *xhci_regs; + +/* xhci regs is not mapped yet, do it temperary here */ +if (dwc->xhci_resources[0 ].start) { + xhci_regs =ioremap (dwc->xhci_resources[0 ].start, +DWC3_XHCI_REGS_END ); +if (IS_ERR (xhci_regs)) { +dev_err (dwc->dev,"Failed to ioremap xhci_regs\n" ); +return ; + } + + op_regs_base =HC_LENGTH (readl (xhci_regs)); + reg =readl (xhci_regs +XHCI_HCSPARAMS1 ); + port_num =HCS_MAX_PORTS (reg); + +for (i =1 ; i <= port_num; i++) { + offset = op_regs_base +XHCI_PORTSC_BASE +0x10 *(i-1 ); + reg =readl (xhci_regs + offset); + reg &= ~PORT_POWER ; +writel (reg, xhci_regs + offset); + } + +iounmap (xhci_regs); + }else +dev_err (dwc->dev,"xhci base reg invalid\n" ); +} +static int dwc3_host_get_irq (struct dwc3 *dwc) {struct platform_device *dwc3_pdev =to_platform_device (dwc->dev);
drivers/usb/dwc3/host.c int dwc3_host_init(struct dwc3 *dwc) · line 114
Quoted 10 lines
drivers/usb/dwc3/host.c +7
-0@@ -66,6 +105,13 @@ int dwc3_host_init(struct dwc3 *dwc)int ret, irq;int prop_idx =0 ; +/* +* We have to power off all Root hub ports immediately after DWC3 set +* to host mode to avoid VBUS glitch happen when xhci get reset later. +*/ +if (dwc->host_vbus_glitches) +dwc3_power_off_all_roothub_ports (dwc); +
It's part of the dwc3_host_init(), but don't do this in dwc3_host_get_irq(). Place it where it makes sense.
Quoted 6 lines
drivers/usb/dwc3/host.c +0
-0irq =dwc3_host_get_irq (dwc);if (irq <0 )return irq;Signature · 1 line
2.34.1
Please run checkpatch.pl and fix them next time. Regarding PARENTHESIS_ALIGNMENT or line continuation, it can be two indentations or parenthesis aligned, whichever one makes it easier to read.
From checkpatch:
CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #119: FILE: drivers/usb/dwc3/host.c:48:
+ xhci_regs = ioremap(dwc->xhci_resources[0].start,
+ DWC3_XHCI_REGS_END);
CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #130: FILE: drivers/usb/dwc3/host.c:59:
+ offset = op_regs_base + XHCI_PORTSC_BASE + 0x10*(i-1);
^
CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#130: FILE: drivers/usb/dwc3/host.c:59:
+ offset = op_regs_base + XHCI_PORTSC_BASE + 0x10*(i-1);
^
CHECK:BRACES: Unbalanced braces around else statement #137: FILE: drivers/usb/dwc3/host.c:66:
+ } else
total: 0 errors, 0 warnings, 4 checks, 86 lines checked
Thanks,
Thinh
Thinh Nguyen
maintainerRe: [PATCH 2/2] usb: dwc3: Add workaround for host mode VBUS glitch when boot
Quoted 8 lines · Thinh Nguyen
Quoted 8 lines
drivers/usb/dwc3/host.c +1
-0+static int dwc3_host_get_irq (struct dwc3 *dwc) {struct platform_device *dwc3_pdev =to_platform_device (dwc->dev);@@ -66,6 +105,13 @@ int dwc3_host_init(struct dwc3 *dwc)int ret, irq;int prop_idx =0 ;
Quoted 10 lines
drivers/usb/dwc3/host.c int dwc3_host_init(struct dwc3 *dwc) · line 114
Quoted 7 lines
drivers/usb/dwc3/host.c +7
-0+/* +* We have to power off all Root hub ports immediately after DWC3 set +* to host mode to avoid VBUS glitch happen when xhci get reset later. +*/ +if (dwc->host_vbus_glitches) +dwc3_power_off_all_roothub_ports (dwc); +It's part of the
dwc3_host_init(), but don't do this indwc3_host_get_irq(). Place it where it makes sense.
Ignore this comment, I thought it's called from dwc3_host_get_irq(), but it's not.
BR,
Thinh
Quoted 8 lines
Quoted 7 lines
drivers/usb/dwc3/host.c +0
-0irq =dwc3_host_get_irq (dwc);if (irq <0 )return irq;Signature · 1 line
2.34.1
Re: [PATCH 2/2] usb: dwc3: Add workaround for host mode VBUS glitch when boot
In reply to Thinh NguyenQuoted 45 lines · Thinh Nguyen
Quoted 44 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will be turned on immediately on related Root Hub ports. Then, the VBUS is turned off for a little while(15us) when do xhci reset (conducted by xhci driver) and back to normal finally, we can observe a negative glitch of related signal happen.This VBUS glitch might cause some USB devices enumeration fail if kernel boot with them connected. Such as LS1012AFWRY/LS1043ARDB/LX2160AQDS /LS1088ARDB with Kingston 16GB USB2.0/Kingston USB3.0/JetFlash Transcend 4GB USB2.0 drives. The fail cases include enumerated as full-speed device or report wrong device descriptor, etc.
One SW workaround which can fix this is by programing all xhci PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3 driver (per signal measurement result, it will be too late to do it in
xhci-plat.corxhci.c). Then, after xhci reset complete in xhci driver, PORTSC[PP]s' value will back to 1 automatically and VBUS on at that time, no glitch happen and normal enumeration process has no impact.Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>---
Notes:
Last review at June 06, 2019. Fixed all review comments and sent again.drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 46 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+)drivers/usb/dwc3/core.c +0
-0@@ -1626,6 +1626,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->dis_split_quirk =device_property_read_bool (dev,"snps,dis-split-quirk" );
Quoted 5 lines
drivers/usb/dwc3/core.c static void dwc3_get_properties(struct dwc3 *dwc) · line 1629
Quoted 1 line
drivers/usb/dwc3/core.c +1
-0+ dwc->host_vbus_glitches =device_property_read_bool (dev,"snps,host-vbus-glitches" );This is a quirk. The property should be named with "quirk" subfix. But do we need a new quirk? How many different platforms are affected? If it's just 1 or 2, then just use compatible string.
more than 2 platform. I think quirk is more flexible.
Frank
Quoted 140 lines
Quoted 10 lines
drivers/usb/dwc3/core.c +1
-0+ dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis;drivers/usb/dwc3/core.h +0
-0drivers/usb/dwc3/core.h struct dwc3_scratchpad_array { · line 1138
Quoted 4 lines
drivers/usb/dwc3/core.h +1
-0@@ -1135,6 +1135,7 @@ struct dwc3_scratchpad_array {* @dis_split_quirk: set to disable split boundary. * @wakeup_configured: set if the device is configured for remote wakeup. * @suspended: set to track suspend event due to U3/L2. +* @host_vbus_glitches: set to avoid vbus glitch during xhci reset. This is only applicable to the first xhci reset in its initialization and not every xhci reset right? If so, please reword.
Also, please place it correspond to the order of the field.
Quoted 16 lines
drivers/usb/dwc3/core.h +1
-0* @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. * @max_cfg_eps: current max number of IN eps used across all USB configs. @@ -1353,6 +1354,7 @@ struct dwc3 { unsigned tx_de_emphasis:2; unsigned dis_metastability_quirk:1; + unsigned host_vbus_glitches:1; unsigned dis_split_quirk:1; unsigned async_callbacks:1;drivers/usb/dwc3/host.c +0
-0drivers/usb/dwc3/host.c line 14
Quoted 4 lines
drivers/usb/dwc3/host.c +1
-0@@ -11,6 +11,7 @@#include <linux/of.h> #include <linux/platform_device.h> +#include "../host/xhci.h" Let's not import the entire
xhci.h. If we're going to share some macros fromxhci.h, please split them fromxhci.hand perhaps createxhci-ports.hfor dwc3 to share.Quoted 49 lines
drivers/usb/dwc3/host.c +38
-0#include "core.h" static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc,@@ -28,6 +29,44 @@ static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc, dwc->xhci_resources[1 ].name = name; } +#define XHCI_HCSPARAMS1 0x4 +#define XHCI_PORTSC_BASE 0x400 + +/* +* dwc3_power_off_all_roothub_ports - Power off all Root hub ports +* @dwc3: Pointer to our controller context structure +*/ +static void dwc3_power_off_all_roothub_ports (struct dwc3 *dwc) +{ +int i, port_num; +u32 reg, op_regs_base, offset; +void __iomem *xhci_regs; + +/* xhci regs is not mapped yet, do it temperary here */ +if (dwc->xhci_resources[0 ].start) { + xhci_regs =ioremap (dwc->xhci_resources[0 ].start, +DWC3_XHCI_REGS_END ); +if (IS_ERR (xhci_regs)) { +dev_err (dwc->dev,"Failed to ioremap xhci_regs\n" ); +return ; + } + + op_regs_base =HC_LENGTH (readl (xhci_regs)); + reg =readl (xhci_regs +XHCI_HCSPARAMS1 ); + port_num =HCS_MAX_PORTS (reg); + +for (i =1 ; i <= port_num; i++) { + offset = op_regs_base +XHCI_PORTSC_BASE +0x10 *(i-1 ); + reg =readl (xhci_regs + offset); + reg &= ~PORT_POWER ; +writel (reg, xhci_regs + offset); + } + +iounmap (xhci_regs); + }else +dev_err (dwc->dev,"xhci base reg invalid\n" ); +} +static int dwc3_host_get_irq (struct dwc3 *dwc) {struct platform_device *dwc3_pdev =to_platform_device (dwc->dev);drivers/usb/dwc3/host.c int dwc3_host_init(struct dwc3 *dwc) · line 114
Quoted 10 lines
drivers/usb/dwc3/host.c +7
-0@@ -66,6 +105,13 @@ int dwc3_host_init(struct dwc3 *dwc)int ret, irq;int prop_idx =0 ; +/* +* We have to power off all Root hub ports immediately after DWC3 set +* to host mode to avoid VBUS glitch happen when xhci get reset later. +*/ +if (dwc->host_vbus_glitches) +dwc3_power_off_all_roothub_ports (dwc); +It's part of the
dwc3_host_init(), but don't do this indwc3_host_get_irq(). Place it where it makes sense.Quoted 6 lines
drivers/usb/dwc3/host.c +0
-0irq =dwc3_host_get_irq (dwc);if (irq <0 )return irq;Signature · 1 line
2.34.1Please run checkpatch.pl and fix them next time. Regarding
PARENTHESIS_ALIGNMENTor line continuation, it can be two indentations or parenthesis aligned, whichever one makes it easier to read.From checkpatch:
CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #119: FILE:
drivers/usb/dwc3/host.c:48:drivers/usb/dwc3/host.c +2
-0+ xhci_regs =ioremap (dwc->xhci_resources[0 ].start, +DWC3_XHCI_REGS_END );CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #130: FILE:
drivers/usb/dwc3/host.c:59:(quoted diff) +1
-0+ offset = op_regs_base + XHCI_PORTSC_BASE + 0x10*(i-1); ^CHECK:SPACING: spaces preferred around that '-' (ctx:VxV) #130: FILE:
drivers/usb/dwc3/host.c:59:(quoted diff) +1
-0+ offset = op_regs_base + XHCI_PORTSC_BASE + 0x10*(i-1); ^CHECK:BRACES: Unbalanced braces around else statement #137: FILE:
drivers/usb/dwc3/host.c:66:
drivers/usb/dwc3/host.c static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc, · line 66
Quoted 1 line
drivers/usb/dwc3/host.c +1
-0+ }else
Sorry, I too trust original patch author. Will fix next version
Frank
Quoted 5 lines
total: 0 errors, 0 warnings, 4 checks, 86 lines checked
Thanks,
Thinh
Quoted 25 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 9 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +6
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: boolean + snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done. + type: boolean
Why do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Could you explain why this cannot be done unconditionally please?
Thanks,
Conor.
Quoted 7 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ snps,is-utmi-l1-suspend: description: True when DWC3 asserts output signal utmi_l1_suspend_n, false whenSignature · 1 line
2.34.1
Quoted 40 lines · Conor Dooley
Quoted 25 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 9 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +6
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: boolean + snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done. + type: booleanWhy do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Quoted 1 line
Could you explain why this cannot be done unconditionally please?
It depends on board design, not all system vbus can be controller by root hub port. If it is always on, it will not trigger this issue.
Frank
Quoted 11 lines
Thanks,
Conor.Quoted 7 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ snps,is-utmi-l1-suspend: description: True when DWC3 asserts output signal utmi_l1_suspend_n, false whenSignature · 1 line
2.34.1
Quoted 30 lines · Frank Li
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: boolean
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 280
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +5
-0+ snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done.
nit: "will return to"
Quoted 10 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 1 line
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ type: booleanWhy do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Could you explain why this cannot be done unconditionally please?
It depends on board design, not all system vbus can be controller by root hub port. If it is always on, it will not trigger this issue.
Okay, that seems reasonable to have a property for. Can you add that info to the commit message please?
On another note, I like it when the property name explains why you would add it, rather than the thing it is trying to solve.
Named after the disease, rather than the symptoms, if you get me. I tried to come up with a name here, but could not really suggest something good. If you can think of something, that'd be good, but don't stress it.
Thanks,
Conor.
Quoted 45 lines · Conor Dooley
Quoted 30 lines · Frank Li
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: booleanQuoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 280
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +5
-0+ snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done.nit: "will return to"
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 1 line
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ type: booleanWhy do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Could you explain why this cannot be done unconditionally please?
It depends on board design, not all system vbus can be controller by root hub port. If it is always on, it will not trigger this issue.
Okay, that seems reasonable to have a property for. Can you add that info to the commit message please?
By the way, I sent v4 at
https://lore.kernel.org/imx/[email protected]/T/#t
How about add below sentence?
This was only happen when PORTSC[PP} can control vbus. Needn't set it if vbus is always on.
Quoted 7 lines
On another note, I like it when the property name explains why you would add it, rather than the thing it is trying to solve.
Named after the disease, rather than the symptoms, if you get me. I tried to come up with a name here, but could not really suggest something good. If you can think of something, that'd be good, but don't stress it.
snps,host-vbus-glitches change to snps,host-vbus-glitches-quirk.
How about use below description:
When set, power off all Root Hub ports immediately after setting host mode to avoid vbus (negative) glitch happen in later xhci reset. That may cause some USB devices emuration fail when kernel boot with device connected and PORTSC[PP] control vbus in board desgin.
Frank
Quoted 4 lines
Thanks,
Conor.
Quoted 48 lines · Frank Li
Quoted 47 lines · Conor Dooley
Quoted 30 lines · Frank Li
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: booleanQuoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 280
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +5
-0+ snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done.nit: "will return to"
Quoted 8 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 1 line
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ type: booleanWhy do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Could you explain why this cannot be done unconditionally please?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
It depends on board design, not all system vbus can be controller by root hub port. If it is always on, it will not trigger this issue.
Okay, that seems reasonable to have a property for. Can you add that info to the commit message please?
By the way, I sent v4 at
https://lore.kernel.org/imx/[email protected]/T/#t
I see.
Quoted 4 lines
How about add below sentence?
This was only happen when PORTSC[PP} can control vbus. Needn't set it if vbus is always on.
"This can only happen when ... controls vbus, if vbus is always on, omit this property".
Just a wee grammatical nitpicking.
Quoted 8 lines
Quoted 6 lines
On another note, I like it when the property name explains why you would add it, rather than the thing it is trying to solve.
Named after the disease, rather than the symptoms, if you get me. I tried to come up with a name here, but could not really suggest something good. If you can think of something, that'd be good, but don't stress it.snps,host-vbus-glitches change to snps,host-vbus-glitches-quirk.
I don't think adding "quirk" moves the needle.
Quoted 6 lines
How about use below description:
When set, power off all Root Hub ports immediately after setting host mode to avoid vbus (negative) glitch happen in later xhci reset. That may cause some USB devices emuration fail when kernel boot with device connected and PORTSC[PP] control vbus in board desgin.
"When set, all root hub ports should be powered off immediately after enabling host mode, to avoid Vbus (negative) glitches that may happen during xHCI reset. These glitches can cause enumeration of some USB devices to fail when PORTSC[PP] controls Vbus. If Vbus is always on, omit this property."
How's that?
Quoted 77 lines · Conor Dooley
Quoted 48 lines · Frank Li
Quoted 47 lines · Conor Dooley
Quoted 30 lines · Frank Li
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: booleanQuoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 280
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +5
-0+ snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done.nit: "will return to"
Quoted 8 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 1 line
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ type: booleanWhy do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Could you explain why this cannot be done unconditionally please?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
It depends on board design, not all system vbus can be controller by root hub port. If it is always on, it will not trigger this issue.
Okay, that seems reasonable to have a property for. Can you add that info to the commit message please?
By the way, I sent v4 at
https://lore.kernel.org/imx/[email protected]/T/#tI see.
Quoted 4 lines
How about add below sentence?
This was only happen when PORTSC[PP} can control vbus. Needn't set it if vbus is always on.
"This can only happen when ... controls vbus, if vbus is always on, omit this property".
Just a wee grammatical nitpicking.
Quoted 7 lines
Quoted 6 lines
On another note, I like it when the property name explains why you would add it, rather than the thing it is trying to solve.
Named after the disease, rather than the symptoms, if you get me. I tried to come up with a name here, but could not really suggest something good. If you can think of something, that'd be good, but don't stress it.
Quoted 3 lines
Quoted 1 line
snps,host-vbus-glitches change to snps,host-vbus-glitches-quirk.
I don't think adding "quirk" moves the needle.
I think "quirk" is reasonable because it is workaround.
Frank
Quoted 15 lines
Quoted 7 lines
How about use below description:
When set, power off all Root Hub ports immediately after setting host mode to avoid vbus (negative) glitch happen in later xhci reset. That may cause some USB devices emuration fail when kernel boot with device connected and PORTSC[PP] control vbus in board desgin.
"When set, all root hub ports should be powered off immediately after enabling host mode, to avoid Vbus (negative) glitches that may happen during xHCI reset. These glitches can cause enumeration of some USB devices to fail when PORTSC[PP] controls Vbus. If Vbus is always on, omit this property."
How's that?
Quoted 7 lines · Frank Li
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
On another note, I like it when the property name explains why you would add it, rather than the thing it is trying to solve.
Named after the disease, rather than the symptoms, if you get me. I tried to come up with a name here, but could not really suggest something good. If you can think of something, that'd be good, but don't stress it.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
snps,host-vbus-glitches change to snps,host-vbus-glitches-quirk.
I don't think adding "quirk" moves the needle.
I think "quirk" is reasonable because it is workaround.
Workaround is what the software will do. In the binding we just describe what the problem is.
Rob Herring
maintainerQuoted 45 lines · Conor Dooley
Quoted 30 lines · Frank Li
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: booleanQuoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 280
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +5
-0+ snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done.nit: "will return to"
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 1 line
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ type: booleanWhy do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Could you explain why this cannot be done unconditionally please?
It depends on board design, not all system vbus can be controller by root hub port. If it is always on, it will not trigger this issue.
Okay, that seems reasonable to have a property for. Can you add that info to the commit message please?
But if vbus is always on, then applying the work-around would be a NOP, right? So you could just apply this unconditionally.
Rob
Quoted 48 lines · Rob Herring
Quoted 47 lines · Conor Dooley
Quoted 30 lines · Frank Li
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: booleanQuoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 280
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +5
-0+ snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done.nit: "will return to"
Quoted 8 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 1 line
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ type: booleanWhy do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Could you explain why this cannot be done unconditionally please?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
It depends on board design, not all system vbus can be controller by root hub port. If it is always on, it will not trigger this issue.
Okay, that seems reasonable to have a property for. Can you add that info to the commit message please?
But if vbus is always on, then applying the work-around would be a NOP, right? So you could just apply this unconditionally.
Supposed yes. But I have not confidence to apply this unconditionaly. There are too much difference SOC and dwc3 version. Not sure if it brokes something. I think it should apply workround as less as possible.
Frank
Quoted 2 lines
Rob
Thinh Nguyen
maintainerQuoted 55 lines · Frank Li
Quoted 54 lines · Rob Herring
Quoted 52 lines · Conor Dooley
Quoted 30 lines · Frank Li
Quoted 29 lines · Conor Dooley
Quoted 28 lines · Frank Li
From: Ran Wang <[email protected]>
When DWC3 is set to host mode by programming register
DWC3_GCTL, VBUS (or its control signal) will turn on immediately on related Root Hub ports. Then the VBUS will be de-asserted for a little while during xhci reset (conducted by xhci driver) for a little while and back to normal.This VBUS glitch might cause some USB devices emuration fail if kernel boot with them connected. One SW workaround which can fix this is to program all PORTSC[PP] to 0 to turn off VBUS immediately after setting host mode in DWC3
driver(per signal measurement result, it will be too late to do it in xhci-plat.c or xhci.c).Signed-off-by Ran Wang <[email protected]>Reviewed-by Peter Chen <[email protected]>Signed-off-by Frank Li <[email protected]>--- Documentation/devicetree/bindings/usb/snps,dwc3.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/usb/snps,dwc3.yaml +0
-0@@ -273,6 +273,13 @@ properties: with an external supply. type: booleanQuoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 280
Quoted 5 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +5
-0+ snps,host-vbus-glitches: + description: + When set, power off all Root Hub ports immediately after + setting host mode to avoid vbus (negative) glitch happen in later + xhci reset. And the vbus will back to 5V automatically when reset done.nit: "will return to"
Quoted 10 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/snps,dwc3.yaml properties: · line 281
Quoted 1 line
Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1
-0+ type: booleanWhy do we want to have a property for this at all? The commit message seems to describe a problem that's limited to specific configurations and appears to be somethng the driver should do unconditionally.
Could you explain why this cannot be done unconditionally please?
It depends on board design, not all system vbus can be controller by root hub port. If it is always on, it will not trigger this issue.
Okay, that seems reasonable to have a property for. Can you add that info to the commit message please?
Quoted 7 lines
Quoted 2 lines
But if vbus is always on, then applying the work-around would be a NOP, right? So you could just apply this unconditionally.
Supposed yes. But I have not confidence to apply this unconditionaly. There are too much difference SOC and dwc3 version. Not sure if it brokes something. I think it should apply workround as less as possible.
I can't confirm if there will be negative effect to any platform in the market. But from review, IMHO functionally it should be fine applying this unconditionally.
BR,
Thinh