Commit 204747c970c0d568721c76ab8a57dde0e5dcf0d5

Authored by Guenter Roeck
Committed by Lee Jones
1 parent 5a78401623

mfd: kempld-core: Fix potential hang-up during boot

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>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

drivers/mfd/kempld-core.c
... ... @@ -322,9 +322,12 @@
322 322 return -ENODEV;
323 323 }
324 324  
325   - /* Release hardware mutex if aquired */
326   - if (!(index_reg & KEMPLD_MUTEX_KEY))
  325 + /* Release hardware mutex if acquired */
  326 + if (!(index_reg & KEMPLD_MUTEX_KEY)) {
327 327 iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
  328 + /* PXT and COMe-cPC2 boards may require a second release */
  329 + iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
  330 + }
328 331  
329 332 mutex_unlock(&pld->lock);
330 333