OMAP3: PM: Prevent hang in prcm_interrupt_handler
authorJon Hunter <jon-hunter@ti.com>
Sat, 27 Jun 2009 05:07:25 +0000 (00:07 -0500)
committerKevin Hilman <khilman@deeprootsystems.com>
Mon, 5 Oct 2009 17:50:59 +0000 (10:50 -0700)
commit77da2d910a17e1e6a7e949578723d5aab58568d5
tree4d66e52b5644931c6d1c4808053cf26a0dd39fc1
parent17d857be649a21ca90008c6dc425d849fa83db5c
OMAP3: PM: Prevent hang in prcm_interrupt_handler

There are two scenarios where a race condition could result in a hang
in the prcm_interrupt handler. These are:

1). Waiting for PRM_IRQSTATUS_MPU register to clear.
Bit 0 of the PRM_IRQSTATUS_MPU register indicates that a wake-up event
is pending for the MPU. This bit can only be cleared if the all the
wake-up events latched in the various PM_WKST_x registers have been
cleared. If a wake-up event occurred during the processing of the prcm
interrupt handler, after the corresponding PM_WKST_x register was
checked but before the PRM_IRQSTATUS_MPU was cleared, then the CPU
would be stuck forever waiting for bit 0 in PRM_IRQSTATUS_MPU to be
cleared.

2). Waiting for the PM_WKST_x register to clear.
Some power domains have more than one wake-up source. The PM_WKST_x
registers indicate the source of a wake-up event and need to be cleared
after a wake-up event occurs. When the PM_WKST_x registers are read and
before they are cleared, it is possible that another wake-up event
could occur causing another bit to be set in one of the PM_WKST_x
registers. If this did occur after reading a PM_WKST_x register then
the CPU would miss this event and get stuck forever in a loop waiting
for that PM_WKST_x register to clear.

This patch address the above race conditions that would result in a
hang.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-omap2/pm34xx.c