diff options
author | Alexander Motin <mav@FreeBSD.org> | 2023-12-23 23:52:17 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2024-01-19 16:34:58 +0000 |
commit | 354ccf64bf5c5cc2d3276575f6f5537864dc3af8 (patch) | |
tree | bf541c15a7e9309599721de3e1d958c1924d573c | |
parent | 7033c3ddd60ebb6c929f8885b8ec26bbb37c79e2 (diff) |
iicbb: Fix pause_sbt() arguments order
It should make pause interval less strict.
While there, add cpu_spinwait() into a tight spin wait loop to burn
less power and let other SMT thread work more.
MFC after: 1 month
(cherry picked from commit a74df3f96e3ea4cc632088be870d9b0b0198859c)
-rw-r--r-- | sys/dev/iicbus/iicbb.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/iicbus/iicbb.c b/sys/dev/iicbus/iicbb.c index 3948d5d5a9f6..5d6ac48d4543 100644 --- a/sys/dev/iicbus/iicbb.c +++ b/sys/dev/iicbus/iicbb.c @@ -52,6 +52,7 @@ #include <sys/bus.h> #include <sys/sysctl.h> #include <sys/uio.h> +#include <machine/cpu.h> #ifdef FDT #include <dev/ofw/ofw_bus.h> @@ -254,11 +255,12 @@ iicbb_waitforscl(device_t dev) do { if (I2C_GETSCL(dev)) return (0); + cpu_spinwait(); now = sbinuptime(); } while (now < fast_timeout); do { I2C_DEBUG(printf(".")); - pause_sbt("iicbb-scl-low", SBT_1MS, C_PREL(8), 0); + pause_sbt("iicbb-scl-low", SBT_1MS, 0, C_PREL(2)); if (I2C_GETSCL(dev)) return (0); now = sbinuptime(); |