mfd: kempld-core: Fix potential hang-up during boot
authorGuenter Roeck <linux@roeck-us.net>
Thu, 20 Mar 2014 15:12:28 +0000 (08:12 -0700)
committerLee Jones <lee.jones@linaro.org>
Thu, 20 Mar 2014 15:58:25 +0000 (15:58 +0000)
On PXT and COMe-cPC2 boards it is observed that the hardware
mutex is acquired but not being released during initialization.
This can result in a hang-up during boot if the driver is built
into the kernel.

Releasing the mutex twice if it was acquired fixes the problem.
Subsequent request/release cycles work as expected, so the fix is
only needed during initialization.

Cc: <stable@vger.kernel.org>
Reviewed-by: Michael Brunner <michael.brunner@kontron.com>
Tested-by: Michael Brunner <michael.brunner@kontron.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/kempld-core.c

index 20a6afcfb36cf63c6e1ae8ccf6dc08db791dc491..07692604e119123a1f9b311b2611c5d0103daa78 100644 (file)
@@ -322,9 +322,12 @@ static int kempld_detect_device(struct kempld_device_data *pld)
                return -ENODEV;
        }
 
-       /* Release hardware mutex if aquired */
-       if (!(index_reg & KEMPLD_MUTEX_KEY))
+       /* Release hardware mutex if acquired */
+       if (!(index_reg & KEMPLD_MUTEX_KEY)) {
                iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
+               /* PXT and COMe-cPC2 boards may require a second release */
+               iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
+       }
 
        mutex_unlock(&pld->lock);