From b052c5d9ffebc48646a76922ed5711bf9a8d41dc Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Wed, 13 Oct 2021 16:57:12 -0700 Subject: timer: Make udelay overridable This patch defines udelay as overridable so that individual projects can implement customized versions. CONFIG_HW_SPECIFIC_UDELAY is no longer needed. BUG=b:218982018,b:200593658 BRANCH=None TEST=buildall; zmake testall (cherry picked from commit 5b4d9332d123f1c7dfca81b1ccaa5a4a39d72572) Change-Id: I291151755c3d714db6863749d66579007eb73ecd Signed-off-by: Daisuke Nojiri Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3508421 --- common/timer.c | 4 +--- include/config.h | 3 --- include/timer.h | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/common/timer.c b/common/timer.c index 117cea4b71..6f31d93b09 100644 --- a/common/timer.c +++ b/common/timer.c @@ -94,8 +94,7 @@ void process_timers(int overflow) } while (next.val <= get_time().val); } -#ifndef CONFIG_HW_SPECIFIC_UDELAY -void udelay(unsigned us) +__overridable void udelay(unsigned us) { unsigned t0 = __hw_clock_source_read(); @@ -112,7 +111,6 @@ void udelay(unsigned us) while (__hw_clock_source_read() - t0 <= us) ; } -#endif int timer_arm(timestamp_t tstamp, task_id_t tskid) { diff --git a/include/config.h b/include/config.h index ba40443870..a090cfe7ec 100644 --- a/include/config.h +++ b/include/config.h @@ -1964,9 +1964,6 @@ */ #undef CONFIG_HIBERNATE_PSL -/* Use a hardware specific udelay(). */ -#undef CONFIG_HW_SPECIFIC_UDELAY - /*****************************************************************************/ /* I2C configuration */ diff --git a/include/timer.h b/include/timer.h index 35e63686d2..26d39a975d 100644 --- a/include/timer.h +++ b/include/timer.h @@ -71,7 +71,7 @@ int timestamp_expired(timestamp_t deadline, const timestamp_t *now); * * @param us Number of microseconds to delay. */ -void udelay(unsigned us); +__override_proto void udelay(unsigned us); /** * Sleep. -- cgit v1.2.1