[coreboot-gerrit] New patch to review for coreboot: e21a91f chromeec: use stopwatch API
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Fri Mar 20 13:07:42 CET 2015
Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8816
-gerrit
commit e21a91fa70a4f56a3ddd40f8e1291c194ba71e02
Author: Aaron Durbin <adurbin at chromium.org>
Date: Tue Sep 23 16:30:53 2014 -0500
chromeec: use stopwatch API
Simplify the SPI timeout by using the stopwatch.
BUG=None
BRANCH=None
TEST=Built nyan. Confirmed stopwatch works independently.
Change-Id: Ida26a0748d4b5a6a28aa8f6e2b92fe2ee4cbe17f
Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
Original-Commit-Id: 900d7ac826b76d49290033c87849bf776684f2c1
Original-Change-Id: I84b7949060326b7c6cc1872420b93bd44604c4d3
Original-Signed-off-by: Aaron Durbin <adurbin at chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/219493
Original-Reviewed-by: Julius Werner <jwerner at chromium.org>
Original-Reviewed-by: Furquan Shaikh <furquan at chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix at chromium.org>
---
src/ec/google/chromeec/ec_spi.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/ec/google/chromeec/ec_spi.c b/src/ec/google/chromeec/ec_spi.c
index f1bdd3c..ad9a338 100644
--- a/src/ec/google/chromeec/ec_spi.c
+++ b/src/ec/google/chromeec/ec_spi.c
@@ -40,9 +40,9 @@ static int crosec_spi_io(uint8_t *write_bytes, size_t write_size,
}
uint8_t byte;
- struct mono_time start;
- struct rela_time rt;
- timer_monotonic_get(&start);
+ struct stopwatch sw;
+ // Wait 1s for a framing byte.
+ stopwatch_init_usecs_expire(&sw, USECS_PER_SEC);
while (1) {
if (spi_xfer(slave, NULL, 0, &byte, sizeof(byte))) {
printk(BIOS_ERR, "%s: Failed to receive byte.\n",
@@ -53,9 +53,7 @@ static int crosec_spi_io(uint8_t *write_bytes, size_t write_size,
if (byte == EcFramingByte)
break;
- // Wait 1s for a framing byte.
- rt = current_time_from(&start);
- if (rela_time_in_microseconds(&rt) > 1000 * 1000) {
+ if (stopwatch_expired(&sw)) {
printk(BIOS_ERR,
"%s: Timeout waiting for framing byte.\n",
__func__);
More information about the coreboot-gerrit
mailing list