Skip to content

Commit 41de428

Browse files
srodrig1Anas Nashif
authored andcommitted
drivers: dma_qmsi: Wait few cycles to allow DMA controller changes
Add few nop instructions to allow the DMA controller settle, It takes time after starting the transfer to access the DMA controller registers, so a few cycles are added, the minimal number of cycles needed has been calculated using tests results on c1000 development board. Jira: ZEP-1803 Change-Id: I1f8e8478f0350e1b6e4dd596b783dc4babc2d02b Signed-off-by: Sergio Rodriguez <[email protected]> (cherry picked from commit 381df63)
1 parent 22099d1 commit 41de428

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

drivers/dma/dma_qmsi.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
#include "qm_isr.h"
1818
#include "clk.h"
1919

20+
#define CYCLE_NOP \
21+
__asm__ __volatile__ ("nop"); \
22+
__asm__ __volatile__ ("nop"); \
23+
__asm__ __volatile__ ("nop"); \
24+
__asm__ __volatile__ ("nop")
25+
26+
2027
struct dma_qmsi_config_info {
2128
qm_dma_t instance; /* Controller instance. */
2229
};
@@ -254,16 +261,26 @@ static int dma_qmsi_chan_config(struct device *dev, uint32_t channel,
254261

255262
static int dma_qmsi_transfer_start(struct device *dev, uint32_t channel)
256263
{
264+
int ret;
257265
const struct dma_qmsi_config_info *info = dev->config->config_info;
258266

259-
return qm_dma_transfer_start(info->instance, channel);
267+
ret = qm_dma_transfer_start(info->instance, channel);
268+
269+
CYCLE_NOP;
270+
271+
return ret;
260272
}
261273

262274
static int dma_qmsi_start(struct device *dev, uint32_t channel)
263275
{
276+
int ret;
264277
const struct dma_qmsi_config_info *info = dev->config->config_info;
265278

266-
return qm_dma_transfer_start(info->instance, channel);
279+
ret = qm_dma_transfer_start(info->instance, channel);
280+
281+
CYCLE_NOP;
282+
283+
return ret;
267284
}
268285

269286
static int dma_qmsi_transfer_stop(struct device *dev, uint32_t channel)

0 commit comments

Comments
 (0)