diff options
author | Tero Kristo <t-kristo@ti.com> | 2014-03-04 18:19:02 +0200 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2014-05-15 22:34:17 -0600 |
commit | 250e27ee950bf67ceeb812eb4c8f2fea58d3e2b6 (patch) | |
tree | 59254e7c448a2b5b69c54ff730ccb8fd2e400783 /arch/arm/mach-omap2/prcm-common.h | |
parent | b21be7bcd8871014a5e446886ea7fb9ae9d6e591 (diff) | |
download | blackbird-obmc-linux-250e27ee950bf67ceeb812eb4c8f2fea58d3e2b6.tar.gz blackbird-obmc-linux-250e27ee950bf67ceeb812eb4c8f2fea58d3e2b6.zip |
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>
Diffstat (limited to 'arch/arm/mach-omap2/prcm-common.h')
-rw-r--r-- | arch/arm/mach-omap2/prcm-common.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h index 0e841fd9498a..e982598386a5 100644 --- a/arch/arm/mach-omap2/prcm-common.h +++ b/arch/arm/mach-omap2/prcm-common.h @@ -429,6 +429,26 @@ # 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 * @name: a short name describing the interrupt type, e.g. "wkup" or "io" * @offset: the bit shift of the interrupt inside the IRQ{ENABLE,STATUS} regs |