Patch "usb: dwc3: core: Do not perform GCTL_CORE_SOFTRESET during bootup" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    usb: dwc3: core: Do not perform GCTL_CORE_SOFTRESET during bootup

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-dwc3-core-do-not-perform-gctl_core_softreset-dur.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 90b420884d9720a10647eecd0615a0ce32b94c6a
Author: Rohith Kollalsi <quic_rkollals@xxxxxxxxxxx>
Date:   Thu Jul 14 10:26:25 2022 +0530

    usb: dwc3: core: Do not perform GCTL_CORE_SOFTRESET during bootup
    
    [ Upstream commit 07903626d98853e605fe63e5ce149f1b7314bbea ]
    
    According to the programming guide, it is recommended to
    perform a GCTL_CORE_SOFTRESET only when switching the mode
    from device to host or host to device. However, it is found
    that during bootup when __dwc3_set_mode() is called for the
    first time, GCTL_CORESOFTRESET is done with suspendable bit(BIT 17)
    of DWC3_GUSB3PIPECTL set. This some times leads to issues
    like controller going into bad state and controller registers
    reading value zero. Until GCTL_CORESOFTRESET is done and
    run/stop bit is set core initialization is not complete.
    Setting suspendable bit of DWC3_GUSB3PIPECTL and then
    performing GCTL_CORESOFTRESET is therefore not recommended.
    Avoid this by only performing the reset if current_dr_role is set,
    that is, when doing subsequent role switching.
    
    Fixes: f88359e1588b ("usb: dwc3: core: Do core softreset when switch mode")
    Signed-off-by: Rohith Kollalsi <quic_rkollals@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220714045625.20377-1-quic_rkollals@xxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 46a3b8941e40..ecec9cdfa0a6 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -157,9 +157,13 @@ static void __dwc3_set_mode(struct work_struct *work)
 		break;
 	}
 
-	/* For DRD host or device mode only */
-	if ((DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC31, 190A)) &&
-	    dwc->desired_dr_role != DWC3_GCTL_PRTCAP_OTG) {
+	/*
+	 * When current_dr_role is not set, there's no role switching.
+	 * Only perform GCTL.CoreSoftReset when there's DRD role switching.
+	 */
+	if (dwc->current_dr_role && ((DWC3_IP_IS(DWC3) ||
+			DWC3_VER_IS_PRIOR(DWC31, 190A)) &&
+			dwc->desired_dr_role != DWC3_GCTL_PRTCAP_OTG)) {
 		reg = dwc3_readl(dwc->regs, DWC3_GCTL);
 		reg |= DWC3_GCTL_CORESOFTRESET;
 		dwc3_writel(dwc->regs, DWC3_GCTL, reg);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux