* question about using DMA for davinci SPI controller
@ 2010-05-10 8:17 Bi Junxiao
0 siblings, 0 replies; only message in thread
From: Bi Junxiao @ 2010-05-10 8:17 UTC (permalink / raw)
To: davinci-linux-open-source; +Cc: linux-kernel
Hi all,
I am trying to fix a bug about full duplex DMA transfer for SPI
controller hang on ti-omapl138 ref borad.
I read the DMA setting code of davinci SPI controller. It's in
drivers/spi/davinci_spi.c:davinci_spi_bufs_dma().
There is a code snippet which I don't understand. List below:
--------------------------------------------------------------------------------
if (t->tx_buf) {
t->tx_dma = dma_map_single(&spi->dev, (void *)t->tx_buf, count,
DMA_TO_DEVICE);
if (dma_mapping_error(&spi->dev, t->tx_dma)) {
dev_dbg(sdev, "Unable to DMA map a %d bytes"
" TX buffer\n", count);
return -ENOMEM;
}
temp_count = count;
} else {
/* We need TX clocking for RX transaction */
t->tx_dma = dma_map_single(&spi->dev,
(void *)davinci_spi->tmp_buf, count + 1,
DMA_TO_DEVICE);
if (dma_mapping_error(&spi->dev, t->tx_dma)) {
dev_dbg(sdev, "Unable to DMA map a %d bytes"
" TX tmp buffer\n", count);
return -ENOMEM;
}
temp_count = count + 1;
}
----------------------------------------------------------------------------------
My question is why the transfer count in else logic is count+1 but in if
logic it's only count?
When I changed it from count+1 to count and use a test program to read
a spi flash, I found the DMA rx interrupt can not be triggered.
The test program hung for ever.
Would anybody have any idea about this?
Thanks.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-05-10 8:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 8:17 question about using DMA for davinci SPI controller Bi Junxiao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.