diff options
author | Martin Sperl <kernel@martin.sperl.org> | 2015-04-06 20:16:30 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-04-10 21:50:52 +0300 |
commit | 704f32d48af221fd6d6ffcafe679f04ddcf5e7f6 (patch) | |
tree | 1c9854a3b250b9fe1783a3c7a866eba7a2d2185d /drivers/spi/spi-atmel.c | |
parent | a30a555d7435a440fab06fe5960cf3448d8cedd3 (diff) | |
download | linux-704f32d48af221fd6d6ffcafe679f04ddcf5e7f6.tar.xz |
spi: bcm2835: enabling polling mode for transfers shorter than 30us
In cases of short transfer times the CPU is spending lots of time
in the interrupt handler and scheduler to reschedule the worker thread.
Measurements show that we have times where it takes 29.32us to between
the last clock change and the time that the worker-thread is running again
returning from wait_for_completion_timeout().
During this time the interrupt-handler is running calling complete()
and then also the scheduler is rescheduling the worker thread.
This time can vary depending on how much of the code is still in
CPU-caches, when there is a burst of spi transfers the subsequent delays
are in the order of 25us, so the value of 30us seems reasonable.
With polling the whole transfer of 4 bytes at 10MHz finishes after 6.16us
(CS down to up) with the real transfer (clock running) taking 3.56us.
So the efficiency has much improved and is also freeing CPU cycles,
reducing interrupts and context switches.
Because of the above 30us seems to be a reasonable limit for polling.
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-atmel.c')
0 files changed, 0 insertions, 0 deletions