When using the A/B session valid override bits, also bypass the
debounce filter. There's no points in deboucing, while forcing
session. This solves some connect issue seen on stm32mp1, as forcing
session races with the controller initialization in reconfig_usbd().

Fixes: 5739ef2bcb6d ("usb: dwc2: add "u-boot,force-vbus-detection" for stm32")
Signed-off-by: Fabrice Gasnier <[email protected]>
---
 drivers/usb/gadget/dwc2_udc_otg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/dwc2_udc_otg.c 
b/drivers/usb/gadget/dwc2_udc_otg.c
index 570fed347c9e..2129bfa1edb6 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -1129,7 +1129,8 @@ static int dwc2_udc_otg_probe(struct udevice *dev)
                if (plat->force_b_session_valid &&
                    !plat->force_vbus_detection) {
                        /* Override VBUS detection: enable then value*/
-                       setbits_le32(&usbotg_reg->global_regs.gotgctl, 
GOTGCTL_VBVALOEN);
+                       setbits_le32(&usbotg_reg->global_regs.gotgctl,
+                                    GOTGCTL_VBVALOEN | 
GOTGCTL_DBNCE_FLTR_BYPASS);
                        setbits_le32(&usbotg_reg->global_regs.gotgctl, 
GOTGCTL_VBVALOVAL);
                } else {
                        /* Enable VBUS sensing */
@@ -1139,7 +1140,7 @@ static int dwc2_udc_otg_probe(struct udevice *dev)
                if (plat->force_b_session_valid) {
                        /* Override B session bits: enable then value */
                        setbits_le32(&usbotg_reg->global_regs.gotgctl,
-                                    GOTGCTL_AVALOEN | GOTGCTL_BVALOEN);
+                                    GOTGCTL_AVALOEN | GOTGCTL_BVALOEN | 
GOTGCTL_DBNCE_FLTR_BYPASS);
                        setbits_le32(&usbotg_reg->global_regs.gotgctl,
                                     GOTGCTL_AVALOVAL | GOTGCTL_BVALOVAL);
                } else {

-- 
2.43.0

Reply via email to