Re: [PATCHv4] DMAEngine: Define interleaved transfer request api

From: Vinod Koul
Date: Mon Oct 10 2011 - 03:01:00 EST


On Fri, 2011-10-07 at 20:08 +0530, Jassi Brar wrote:
> On 7 October 2011 19:49, Vinod Koul <vinod.koul@xxxxxxxxx> wrote:
> > On Fri, 2011-10-07 at 16:57 +0530, Jassi Brar wrote:
>
> >> > I would still argue that if we split this on same lines as current
> >> > mechanism, we have clean way to convey all details for both cases.
> >> >
> >> Do you mean to have separate interleaved transfer apis for Slave
> >> and Mem->Mem ? Please clarify.
> > If we can make API cleaner and well defined that way then Yes :)
> >
> I assume if you suggest you already have an idea....
> Please do tell roughly how the api should look for Slave and for Mem->Mem ?
Okay, I think at this point we have discussed the parameters and agree
on them. Only issue being direction, which makes sense in slave, and
doesn't matter to be passed/dudeced in memcpy cases by dmac driver
What we can do is like below or tweaks to it:

+struct dmaxfer_memcpy_template {
+ dma_addr_t src_start;
+ dma_addr_t dst_start;
+ bool src_inc;
+ bool dst_inc;
+ bool src_sgl;
+ bool dst_sgl;
+ size_t numf;
+ size_t frame_size;
+ struct data_chunk sgl[0];
+};
+
+struct dmaxfer_slave_template {
+ dma_addr_t mem;
+ bool mem_inc;
+ size_t numf;
+ size_t frame_size;
+ struct data_chunk sgl[0];
+};
/* last transaction type for creation of the capabilities mask */
#define DMA_TX_TYPE_END (DMA_CYCLIC + 1)

@@ -495,6 +521,13 @@ struct dma_device {
struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
size_t period_len, enum dma_data_direction direction);
+ struct dma_async_tx_descriptor *(*device_prep_interleaved_memcpy)(
+ struct dma_chan *chan, struct dmaxfer_memcpy_template,
+ unsigned long flags);
+ struct dma_async_tx_descriptor *(*device_prep_interleaved_slave)(
+ struct dma_chan *chan, struct dmaxfer_slave_template,
+ enum dma_data_direction direction, unsigned long flags);
+
int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
unsigned long arg);

I was tempted to create a single dmaxfer structure which can be common
to both slave and memcpy. In former you pass this along with direction
and in latter you can pass pair of these to describe src and dstn.

I will leave the choice to you :)

The point is that it makes it simpler to understand what we are doing
rather than resort to parsing to find out if its memcpy or slave and
what is the direction.

--
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/