diff options
author | Vinod Koul <vkoul@kernel.org> | 2018-10-24 10:16:33 +0200 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2018-10-24 10:16:33 +0200 |
commit | 71f021cf6de822ac49a790509683fbb4a06ce4bf (patch) | |
tree | 5a8b32252f76c53915f4196ec8d0e468079e0d4a /drivers/dma | |
parent | Merge branch 'topic/sprd' into for-linus (diff) | |
parent | dmaengine: stm32-dma: check whether length is aligned on FIFO threshold (diff) | |
download | linux-71f021cf6de822ac49a790509683fbb4a06ce4bf.tar.xz linux-71f021cf6de822ac49a790509683fbb4a06ce4bf.zip |
Merge branch 'topic/stm' into for-linus
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/stm32-dma.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index 379e8d534e61..4903a408fc14 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, |