summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenji Chen <kenji.chen@intel.com>2014-10-21 08:03:13 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-23 22:41:08 +0000
commitbe2ed33b1976e407d107b20e90441a194f7b5fb7 (patch)
tree7c456dbb4e6aab5f4dc4879302c0dadb8a5340f6
parenteec85858a88ad89f1bc5ffe11d5d11a355efe157 (diff)
downloadchrome-ec-be2ed33b1976e407d107b20e90441a194f7b5fb7.tar.gz
EC: Ensure the udelay function waits at least the time indicated.
Udelay function might get delay less than the time indicated by the input parameter. udelay(4) sometimes get the tick like, 6->7->7-> 8->8->9->A and then the udelay return. But, the sampling point of 6 could be at the end of 6(close to 7) and the point of A could be right at the beginning of A(close to A). This function could get delay from (us - 1) to (us + 1). This change is to ensure the delay at least over the parameter, us. BRANCH=master BUG=None TEST=Build an EC FW iamge and run on Rambi to ensure at the time duration indicated by the parameter is elaspsed and satisfied. Signed-off-by: Kenji Chen <kenji.chen@intel.com> Change-Id: I797f80c577d7e29e75a304aec1e02d2c750f8a23 Reviewed-on: https://chromium-review.googlesource.com/224660 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Mohammed Habibulla <moch@chromium.org>
-rw-r--r--common/timer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/timer.c b/common/timer.c
index bc36c87c49..96e582575c 100644
--- a/common/timer.c
+++ b/common/timer.c
@@ -109,7 +109,7 @@ void udelay(unsigned us)
* subtraction below can overflow. That's acceptable, because the
* watchdog timer would have tripped long before that anyway.
*/
- while (__hw_clock_source_read() - t0 < us)
+ while (__hw_clock_source_read() - t0 <= us)
;
}
#endif