Patch "usb: dwc2: drd: fix dwc2_force_mode call in dwc2_ovr_init" has been added to the 5.10-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: dwc2: drd: fix dwc2_force_mode call in dwc2_ovr_init

to the 5.10-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-dwc2-drd-fix-dwc2_force_mode-call-in-dwc2_ovr_in.patch
and it can be found in the queue-5.10 subdirectory.

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



commit ad8b94326b4177407c4ed9d598a536bab9e894e1
Author: Amelie Delaunay <amelie.delaunay@xxxxxxxxxxx>
Date:   Tue Oct 5 11:53:03 2021 +0200

    usb: dwc2: drd: fix dwc2_force_mode call in dwc2_ovr_init
    
    [ Upstream commit b2cab2a24fb5d13ce1d384ecfb6de827fa08a048 ]
    
    Instead of forcing the role to Device, check the dr_mode configuration.
    If the core is Host only, force the mode to Host, this to avoid the
    dwc2_force_mode warning:
    WARNING: CPU: 1 PID: 21 at drivers/usb/dwc2/core.c:615 dwc2_drd_init+0x104/0x17c
    
    When forcing mode to Host, dwc2_force_mode may sleep the time the host
    role is applied. To avoid sleeping while atomic context, move the call
    to dwc2_force_mode after spin_unlock_irqrestore. It is safe, as
    interrupts are not yet unmasked here.
    
    Fixes: 17f934024e84 ("usb: dwc2: override PHY input signals with usb role switch support")
    Acked-by: Minas Harutyunyan <Minas.Harutyunyan@xxxxxxxxxxxx>
    Signed-off-by: Amelie Delaunay <amelie.delaunay@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211005095305.66397-2-amelie.delaunay@xxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/dwc2/drd.c b/drivers/usb/dwc2/drd.c
index 2d4176f5788eb..80eae88d76dda 100644
--- a/drivers/usb/dwc2/drd.c
+++ b/drivers/usb/dwc2/drd.c
@@ -25,9 +25,9 @@ static void dwc2_ovr_init(struct dwc2_hsotg *hsotg)
 	gotgctl &= ~(GOTGCTL_BVALOVAL | GOTGCTL_AVALOVAL | GOTGCTL_VBVALOVAL);
 	dwc2_writel(hsotg, gotgctl, GOTGCTL);
 
-	dwc2_force_mode(hsotg, false);
-
 	spin_unlock_irqrestore(&hsotg->lock, flags);
+
+	dwc2_force_mode(hsotg, (hsotg->dr_mode == USB_DR_MODE_HOST));
 }
 
 static int dwc2_ovr_avalid(struct dwc2_hsotg *hsotg, bool valid)



[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