diff options
author | Tero Kristo <t-kristo@ti.com> | 2014-03-04 11:19:02 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2014-05-16 00:34:17 -0400 |
commit | 250e27ee950bf67ceeb812eb4c8f2fea58d3e2b6 (patch) | |
tree | 59254e7c448a2b5b69c54ff730ccb8fd2e400783 /arch/arm/mach-omap2/prcm-common.h | |
parent | b21be7bcd8871014a5e446886ea7fb9ae9d6e591 (diff) |
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 @@ | |||
429 | # ifndef __ASSEMBLER__ | 429 | # ifndef __ASSEMBLER__ |
430 | 430 | ||
431 | /** | 431 | /** |
432 | * omap_test_timeout - busy-loop, testing a condition | ||
433 | * @cond: condition to test until it evaluates to true | ||
434 | * @timeout: maximum number of microseconds in the timeout | ||
435 | * @index: loop index (integer) | ||
436 | * | ||
437 | * Loop waiting for @cond to become true or until at least @timeout | ||
438 | * microseconds have passed. To use, define some integer @index in the | ||
439 | * calling code. After running, if @index == @timeout, then the loop has | ||
440 | * timed out. | ||
441 | */ | ||
442 | #define omap_test_timeout(cond, timeout, index) \ | ||
443 | ({ \ | ||
444 | for (index = 0; index < timeout; index++) { \ | ||
445 | if (cond) \ | ||
446 | break; \ | ||
447 | udelay(1); \ | ||
448 | } \ | ||
449 | }) | ||
450 | |||
451 | /** | ||
432 | * struct omap_prcm_irq - describes a PRCM interrupt bit | 452 | * struct omap_prcm_irq - describes a PRCM interrupt bit |
433 | * @name: a short name describing the interrupt type, e.g. "wkup" or "io" | 453 | * @name: a short name describing the interrupt type, e.g. "wkup" or "io" |
434 | * @offset: the bit shift of the interrupt inside the IRQ{ENABLE,STATUS} regs | 454 | * @offset: the bit shift of the interrupt inside the IRQ{ENABLE,STATUS} regs |