From: Bi Junxiao <junxiao.bi@windriver.com>
To: davinci-linux-open-source@linux.davincidsp.com
Cc: linux-kernel@vger.kernel.org
Subject: question about using DMA for davinci SPI controller
Date: Mon, 10 May 2010 16:17:03 +0800 [thread overview]
Message-ID: <4BE7C0FF.8070406@windriver.com> (raw)
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.
reply other threads:[~2010-05-10 8:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BE7C0FF.8070406@windriver.com \
--to=junxiao.bi@windriver.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox