* [PATCH v1 1/1] dmaengine: stm32-dma: check whether length is aligned on FIFO threshold
@ 2018-09-11 7:31 Pierre-Yves MORDRET
2018-10-02 15:02 ` Vinod
0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Yves MORDRET @ 2018-09-11 7:31 UTC (permalink / raw)
To: Dan Williams, Vinod Koul, Maxime Coquelin, Alexandre Torgue,
dmaengine, linux-arm-kernel, linux-kernel
Cc: Pierre-Yves MORDRET
When a period length is not multiple of FIFO some data may be stuck
within FIFO.
Burst/FIFO Threshold/Period or buffer length check has to be hardened
In any case DMA will grant any request from client but will degraded
any parameters whether awkward.
Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
---
Version history:
v1:
* Initial
---
---
drivers/dma/stm32-dma.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
index 379e8d5..4903a40 100644
--- a/drivers/dma/stm32-dma.c
+++ b/drivers/dma/stm32-dma.c
@@ -308,20 +308,12 @@ static bool stm32_dma_fifo_threshold_is_allowed(u32 burst, u32 threshold,
static bool stm32_dma_is_burst_possible(u32 buf_len, u32 threshold)
{
- switch (threshold) {
- case STM32_DMA_FIFO_THRESHOLD_FULL:
- if (buf_len >= STM32_DMA_MAX_BURST)
- return true;
- else
- return false;
- case STM32_DMA_FIFO_THRESHOLD_HALFFULL:
- if (buf_len >= STM32_DMA_MAX_BURST / 2)
- return true;
- else
- return false;
- default:
- return false;
- }
+ /*
+ * Buffer or period length has to be aligned on FIFO depth.
+ * Otherwise bytes may be stuck within FIFO at buffer or period
+ * length.
+ */
+ return ((buf_len % ((threshold + 1) * 4)) == 0);
}
static u32 stm32_dma_get_best_burst(u32 buf_len, u32 max_burst, u32 threshold,
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] dmaengine: stm32-dma: check whether length is aligned on FIFO threshold
2018-09-11 7:31 [PATCH v1 1/1] dmaengine: stm32-dma: check whether length is aligned on FIFO threshold Pierre-Yves MORDRET
@ 2018-10-02 15:02 ` Vinod
0 siblings, 0 replies; 2+ messages in thread
From: Vinod @ 2018-10-02 15:02 UTC (permalink / raw)
To: Pierre-Yves MORDRET
Cc: Dan Williams, Maxime Coquelin, Alexandre Torgue, dmaengine,
linux-arm-kernel, linux-kernel
On 11-09-18, 09:31, Pierre-Yves MORDRET wrote:
> When a period length is not multiple of FIFO some data may be stuck
> within FIFO.
>
> Burst/FIFO Threshold/Period or buffer length check has to be hardened
>
> In any case DMA will grant any request from client but will degraded
> any parameters whether awkward.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-02 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11 7:31 [PATCH v1 1/1] dmaengine: stm32-dma: check whether length is aligned on FIFO threshold Pierre-Yves MORDRET
2018-10-02 15:02 ` Vinod
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).