[#5352] bfin_sport.c setup 2D DMA
Submitted By: Jeppe Ledet-Pedersen
Open Date
2009-07-14 03:02:34 Close Date
2009-11-17 22:14:40
Priority:
Medium Assignee:
Cliff Cai
Status:
Closed Fixed In Release:
N/A
Found In Release:
2010R1 Release:
2009R1-RC1
Category:
Drivers Board:
N/A
Processor:
ALL Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Fixed
Uboot version or rev.:
Toolchain version or rev.:
blackfin-toolchain-uclinux-SVN
App binary format:
N/A
Summary: bfin_sport.c setup 2D DMA
Details:
The bfin_sport.c driver seems to contain a bug in the sport_read (line 530-536) and sport_write (line 608-614) functions. I have checked out the newest svn revision (2009R1 branch, rev. 8488). When using DMA for transfers of more than 0x8000 words, the 2D DMA is enabled in the following way:
xcount = count / word_bytes;
ycount = 0;
if (xcount > 0x8000) {
ycount = xcount >> 15;
xcount = 0x8000;
dma_config |= DMA2D;
}
As both xcount and ycount are defined as uint16_t, xcount >> 15 can max be 1 thus transferring only 0x8000 words. We have fixed it in the following way:
xcount = count / word_bytes;
ycount = 0;
if ((count / word_bytes) > 0x8000) {
ycount = (count/word_bytes) >> 15;
xcount = 0x8000;
dma_config |= DMA2D;
}
This will of course only allow 2D DMA transfers of a multiple of 0x8000 words. Another question is why the driver does not use 1D DMA for data less than 0x10000? A better solution could be to use the code from the bf53x_sport.c sound driver, which does not require the data to be a multiple of 0x8000 words and only uses 2D for data greater than 0x10000. Perhaps one of the developers can come up with a better solution. I have attached my attempt at creating a patch.
Best regards,
Jeppe
Follow-ups
--- Cliff Cai 2009-11-06 04:59:21
Applied,thanks.
The DMA engine support up to 64k*64k elements,So,in theory,0x10000 for 1D DMA
is allowed.
Cliff
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
bfin_sport.patch text/x-patch 784 Jeppe Ledet-Pedersen