diff options
author | Nico Huber <nico.h@gmx.de> | 2012-11-05 21:46:33 +0100 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2017-06-22 11:14:15 +0000 |
commit | 8624e8cfa88ebd17ecf3bfd55c8dc1a799f47573 (patch) | |
tree | f61a16e60f193b5e3f13a377a81d1308b1b4f0ad /mcp6x_spi.c | |
parent | 2d62572d1dd0c37eb626fd8faa17b26690f20b15 (diff) | |
download | flashrom-8624e8cfa88ebd17ecf3bfd55c8dc1a799f47573.tar.gz flashrom-8624e8cfa88ebd17ecf3bfd55c8dc1a799f47573.tar.bz2 flashrom-8624e8cfa88ebd17ecf3bfd55c8dc1a799f47573.zip |
udelay: Use clock_gettime() if available and precise
Instead of calibrating our busy loop against a coarse clock, check if
a precise clock is available and loop against that. The former is unre-
liable by definition on any modern system that may dynamically reclock
the processor.
v2: Apparently _POSIX_MONOTONIC_CLOCK being defined only means that
the library knows about CLOCK_MONOTONIC. So check for its support
at runtime and fall back to CLOCK_REALTIME if it's missing.
TEST=Manually added a 10s loop and compared to real time. Run
on Linux RPi3, Linux x86 and my original use case Linux in
VirtualBox (Linux host).
Change-Id: I85ad359823875237ada9cd027af3017d62e9a235
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/19391
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'mcp6x_spi.c')
0 files changed, 0 insertions, 0 deletions