ARM: OMAP2+: prcm: add omap_test_timeout to prcm-common.h

Done in preparation to move cm/prm to drivers. These will still use
omap_test_timeout, but will not have access to common.h header under
mach-omap2 anymore.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
This commit is contained in:
Tero Kristo 2014-03-04 18:19:02 +02:00 committed by Paul Walmsley
parent b21be7bcd8
commit 250e27ee95
1 changed files with 20 additions and 0 deletions

View File

@ -428,6 +428,26 @@
#define MAX_IOPAD_LATCH_TIME 100 #define MAX_IOPAD_LATCH_TIME 100
# ifndef __ASSEMBLER__ # ifndef __ASSEMBLER__
/**
* omap_test_timeout - busy-loop, testing a condition
* @cond: condition to test until it evaluates to true
* @timeout: maximum number of microseconds in the timeout
* @index: loop index (integer)
*
* Loop waiting for @cond to become true or until at least @timeout
* microseconds have passed. To use, define some integer @index in the
* calling code. After running, if @index == @timeout, then the loop has
* timed out.
*/
#define omap_test_timeout(cond, timeout, index) \
({ \
for (index = 0; index < timeout; index++) { \
if (cond) \
break; \
udelay(1); \
} \
})
/** /**
* struct omap_prcm_irq - describes a PRCM interrupt bit * struct omap_prcm_irq - describes a PRCM interrupt bit
* @name: a short name describing the interrupt type, e.g. "wkup" or "io" * @name: a short name describing the interrupt type, e.g. "wkup" or "io"