mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 02:37:15 +00:00
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
This commit is contained in:
parent
553ed8e38b
commit
a74df3f96e
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue