diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2020-07-24 11:16:56 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-28 01:03:17 +0000 |
commit | b7c6726e22181f57d92e0069c0fc3c4b12b9a773 (patch) | |
tree | 909cc2f040e23cfa0f0c7108194b5e81d0d356be /include/util.h | |
parent | 00d3f2d0d6e864236c217330659dd7801adf8670 (diff) | |
download | chrome-ec-b7c6726e22181f57d92e0069c0fc3c4b12b9a773.tar.gz |
Make wait_for_ready available for all
wait_for_ready is a generic function which loops until bits in a
register are set. This patch move it to util.c to make it available
for all.
There are more places where the function is applicable but this CL
keeps the scope under chip/stm32/clock-stm32. There is no
functionality change.
BUG=none
BRANCH=none
TEST=buildall
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I796599344c1d86ab7144d1d6b434ec54cf1cc55d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317887
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'include/util.h')
-rw-r--r-- | include/util.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h index 7c7e356592..5594a4a706 100644 --- a/include/util.h +++ b/include/util.h @@ -299,6 +299,15 @@ static inline uint64_t mulaa32(uint32_t a, uint32_t b, uint32_t c, uint32_t d) } #endif +/** + * Set enable bit(s) in register and wait for ready bit(s) + * + * @param reg Register to be get and set for enable and ready + * @param enable Bit(s) to be enabled + * @param ready Bit(s) to be read for readiness + */ +void wait_for_ready(volatile uint32_t *reg, uint32_t enable, uint32_t ready); + #ifdef __cplusplus } #endif |