* spi-imx: wait_for_completion should timeout even in non-DMA transfer cases
@ 2015-09-18 12:38 Jean-Michel Hautbois
2015-09-19 17:56 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Michel Hautbois @ 2015-09-18 12:38 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-spi, linux-kernel
Hi,
I am wondering why in spi-imx the spi_imx_pio_transfer() function is
calling wait_for_completion() and not wait_for_completion_timeout() as
in the spi_imx_dma_transfer() one.
I can't see a good reason for this, maybe should it be calculated
based on the spi clock and transfer->len, or at least be the same as
IMX_DMA_TIMEOUT which is 3 seconds ?
If you want it, I have a patch, just tell me if you are interested and
if you prefer a calculated timeout or even something else ?
Thanks,
JM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: spi-imx: wait_for_completion should timeout even in non-DMA transfer cases
2015-09-18 12:38 spi-imx: wait_for_completion should timeout even in non-DMA transfer cases Jean-Michel Hautbois
@ 2015-09-19 17:56 ` Mark Brown
2015-09-21 9:08 ` Jean-Michel Hautbois
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2015-09-19 17:56 UTC (permalink / raw)
To: Jean-Michel Hautbois; +Cc: linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 626 bytes --]
On Fri, Sep 18, 2015 at 02:38:27PM +0200, Jean-Michel Hautbois wrote:
> Hi,
>
> I am wondering why in spi-imx the spi_imx_pio_transfer() function is
> calling wait_for_completion() and not wait_for_completion_timeout() as
> in the spi_imx_dma_transfer() one.
> I can't see a good reason for this, maybe should it be calculated
> based on the spi clock and transfer->len, or at least be the same as
> IMX_DMA_TIMEOUT which is 3 seconds ?
> If you want it, I have a patch, just tell me if you are interested and
> if you prefer a calculated timeout or even something else ?
A calculated timeout is probably best.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: spi-imx: wait_for_completion should timeout even in non-DMA transfer cases
2015-09-19 17:56 ` Mark Brown
@ 2015-09-21 9:08 ` Jean-Michel Hautbois
2015-09-22 17:29 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Michel Hautbois @ 2015-09-21 9:08 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-spi, linux-kernel
2015-09-19 19:56 GMT+02:00 Mark Brown <broonie@kernel.org>:
> On Fri, Sep 18, 2015 at 02:38:27PM +0200, Jean-Michel Hautbois wrote:
>> Hi,
>>
>> I am wondering why in spi-imx the spi_imx_pio_transfer() function is
>> calling wait_for_completion() and not wait_for_completion_timeout() as
>> in the spi_imx_dma_transfer() one.
>> I can't see a good reason for this, maybe should it be calculated
>> based on the spi clock and transfer->len, or at least be the same as
>> IMX_DMA_TIMEOUT which is 3 seconds ?
>> If you want it, I have a patch, just tell me if you are interested and
>> if you prefer a calculated timeout or even something else ?
>
> A calculated timeout is probably best.
Well, it depends...
If you have a 20MHz clock, then you can transfer a byte in 4µs.
As most of the time pio_transfer is used for 8 to 32 bytes max, it
would be irrelevant to use such a small timeout.
I can obviously do it, but not sure if using a small (say, 100ms)
timeout would not be better.
JM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: spi-imx: wait_for_completion should timeout even in non-DMA transfer cases
2015-09-21 9:08 ` Jean-Michel Hautbois
@ 2015-09-22 17:29 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2015-09-22 17:29 UTC (permalink / raw)
To: Jean-Michel Hautbois; +Cc: linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 651 bytes --]
On Mon, Sep 21, 2015 at 11:08:55AM +0200, Jean-Michel Hautbois wrote:
> 2015-09-19 19:56 GMT+02:00 Mark Brown <broonie@kernel.org>:
> > A calculated timeout is probably best.
> Well, it depends...
> If you have a 20MHz clock, then you can transfer a byte in 4µs.
> As most of the time pio_transfer is used for 8 to 32 bytes max, it
> would be irrelevant to use such a small timeout.
> I can obviously do it, but not sure if using a small (say, 100ms)
> timeout would not be better.
You want a minimum threashold, yes, but you also need to be able toc ope
with larger transfers too so need to be able to raise that where
appropriate.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-22 17:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-18 12:38 spi-imx: wait_for_completion should timeout even in non-DMA transfer cases Jean-Michel Hautbois
2015-09-19 17:56 ` Mark Brown
2015-09-21 9:08 ` Jean-Michel Hautbois
2015-09-22 17:29 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®