]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00211329-2 add mutex for otg wake up enable
authorTony LIU <junjie.liu@freescale.com>
Fri, 1 Jun 2012 09:56:48 +0000 (17:56 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:34:45 +0000 (08:34 +0200)
- For the system dump issue of usb unhandled irq,
  the root cause is the shared resource being lack of protection
  add mutex to protect the shared access.

Signed-off-by: Tony LIU <junjie.liu@freescale.com>
arch/arm/mach-mx6/usb_dr.c

index 0a15a8ce3327f1b85268d3d0aa2de5e243761783..4f4df221b0a1007fe7eb0f0230a5a87b3dab5a9d 100644 (file)
@@ -28,6 +28,8 @@
 #include "devices-imx6q.h"
 #include "regs-anadig.h"
 #include "usb.h"
+
+DEFINE_MUTEX(otg_wakeup_enable_mutex);
 static int usbotg_init_ext(struct platform_device *pdev);
 static void usbotg_uninit_ext(struct platform_device *pdev);
 static void usbotg_clock_gate(bool on);
@@ -331,6 +333,7 @@ static void __wakeup_irq_enable(struct fsl_usb2_platform_data *pdata, bool on, i
        /* otg host and device share the OWIE bit, only when host and device
         * all enable the wakeup irq, we can enable the OWIE bit
         */
+       mutex_lock(&otg_wakeup_enable_mutex);
        if (on) {
 #ifdef CONFIG_USB_OTG
                wakeup_irq_enable_src |= source;
@@ -347,6 +350,7 @@ static void __wakeup_irq_enable(struct fsl_usb2_platform_data *pdata, bool on, i
                 * cycles of the standby clock(32k Hz) , that is 0.094 ms*/
                udelay(100);
        }
+       mutex_unlock(&otg_wakeup_enable_mutex);
 }
 
 /* The wakeup operation for DR port, it will clear the wakeup irq status