usb: dwc2: hcd: call dwc2_is_controller_alive under spinlock 11/198911/1 accepted/tizen/5.0/unified/20190213.070121 accepted/tizen/unified/20190131.161530 submit/tizen/20190131.075243 submit/tizen_5.0/20190213.011623
authorJaehoon Chung <jh80.chung@samsung.com>
Tue, 29 Jan 2019 01:42:24 +0000 (10:42 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Thu, 31 Jan 2019 04:34:04 +0000 (13:34 +0900)
This patch is referred to Robert's commit cf54772b913b.
(usb: dwc2: call dwc2_is_controller_alive() under spinlock)

Below is commit message:

    This patch fixes the following problem: data transmission in direction
    IN break unless the GSNPSID register access is done with spinlock held.
    This issue occurs at least in Exynos4412 SoC, probably in many SoC's
    from Exynos familly.

    The problem is described here:
    https://lkml.org/lkml/2014/12/22/185
    And there is linux mailing list discussion:
    https://lkml.org/lkml/2015/1/14/17

The one of SDB hang issues should be fixed with this patch.
(Issue -  Not triggered usb interrupt.)

Change-Id: If97516bc94d84df611663f902267a5e3b75815f7
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/usb/dwc2/hcd_intr.c

index e0c613d000ca8674a7662962b48484f513dc520c..ce3f1bb10e7c894ff09f81072cd7992aa12509d6 100644 (file)
@@ -2137,13 +2137,13 @@ irqreturn_t dwc2_handle_hcd_intr(struct dwc2_hsotg *hsotg)
        u32 gintsts, dbg_gintsts;
        irqreturn_t retval = IRQ_NONE;
 
+       spin_lock(&hsotg->lock);
+
        if (!dwc2_is_controller_alive(hsotg)) {
                dev_warn(hsotg->dev, "Controller is dead\n");
-               return retval;
+               goto out;
        }
 
-       spin_lock(&hsotg->lock);
-
        /* Check if HOST Mode */
        if (dwc2_is_host_mode(hsotg)) {
                gintsts = dwc2_read_core_intr(hsotg);
@@ -2191,6 +2191,7 @@ irqreturn_t dwc2_handle_hcd_intr(struct dwc2_hsotg *hsotg)
                }
        }
 
+out:
        spin_unlock(&hsotg->lock);
 
        return retval;