[PATCH RFC v2 0/5] MPC512x DMA slave s/g support, OF DMA lookup
Alexander Popov
a13xp0p0v88 at gmail.com
Tue Jul 16 19:27:23 EST 2013
Hello everyone!
Hello Gerhard!
Thanks for your work.
2013/7/14 Gerhard Sittig <gsi at denx.de>:
> known issues:
> - currently encoded constraints do work for SD card and LPB test suite
> (all known DMA clients ATM), but will need more tuning or support for
> automatic adjustment for transfers of arbitrary length
NBYTES of data is read from / written to DMA client's port in one burst
after DMA controller receives service request from that DMA client.
Different DMA clients want different NBYTES:
SCLPC wants 4 and SD card wants 64, other clients might want something
different.
So having default case with magic number 64 is totally wrong.
What if we simply remove it from [PATCH RFC v2 2/5]:
len = sg_dma_len(sg);
if (mchan->tcd_nunits)
tcd->nbytes = mchan->tcd_nunits * 4;
- else
- tcd->nbytes = 64;
if (!IS_ALIGNED(len, tcd->nbytes))
return NULL;
and make SD card driver use fields
src_addr_width, dst_addr_width and src_maxburst / dst_maxburst
of dma_slave_config which is a part of standard API (dmaengine.h):
#define DEFAULT_WORDS_PER_TRANSFER 16
...
struct dma_slave_config dma_conf = {};
...
if (dma_conf.direction = DMA_MEM_TO_DEV) {
dma_conf.dst_maxburst = DEFAULT_WORDS_PER_TRANSFER;
} else {
dma_conf.src_maxburst = DEFAULT_WORDS_PER_TRANSFER;
}
dma_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
...
if (dma_dev->device_control(chan, DMA_SLAVE_CONFIG,
(unsigned long)&dma_conf)) {
goto err_dma_prep;
}
This code for SD card driver would be very similar to the code from
SCLPC driver.
Best regards,
Alexander
More information about the Linuxppc-dev
mailing list