Roman Volkov wrote:
Clemens Ladisch clemens@ladisch.de пишет:
The SPI transaction will not be finished for the first 30 µs or so, so polling is not needed for that time.
We may switch the context and force CPU to execute useful code, using something like usleep, msleep. However, this may block the thread for too long time. Please suggest something how to optimize this.
Actually, SPI transactions could use 2 bytes or a faster clock, so I don't think this needs to be optimized.
With the wait coming after the transaction, it makes more sense to have the busy check not before but after the udelay.
Okay, this will be:
for (count = 100; count > 0; count--) { udelay(4); if ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & OXYGEN_SPI_BUSY) == 0) return 0; }
Yes.
Regards, Clemens