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-11-11 23:01:23 +0000
commitde4cd35477ff6d93c98bde950cd1320dfd0b76db (patch)
tree5d3bdf1fc6354ad82a167c3ba6d96e9b02cf169b
parente8088266227333a16785579613ce01f88c30596c (diff)
downloadchrome-ec-de4cd35477ff6d93c98bde950cd1320dfd0b76db.tar.gz
CHERRY-PICK: 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> Original-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> Change-Id: Iacd0485511e9e01325bd7b11943880ea067be795 Reviewed-on: https://chromium-review.googlesource.com/229154 Reviewed-by: Mohammed Habibulla <moch@chromium.org> Commit-Queue: Mohammed Habibulla <moch@chromium.org> Tested-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