Thread (15 messages) flat view 15 messages, 4 authors, 2013-10-06

Re: [PATCH RFC v2 0/5] MPC512x DMA slave s/g support, OF DMA lookup

From: Alexander Popov <hidden>
Date: 2013-07-16 09:27:23
Also in: linux-devicetree

Hello everyone!

Hello Gerhard!
Thanks for your work.

2013/7/14 Gerhard Sittig [off-list ref]:
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help