Re: [PATCH v3] dmaengine: add CSR SiRFprimaII DMAC driver

From: Barry Song
Date: Mon Oct 17 2011 - 10:46:10 EST


2011/10/17 Vinod Koul <vinod.koul@xxxxxxxxx>:
>> +static struct dma_async_tx_descriptor *sirfsoc_dma_prep_interleaved(
>> + Â Â struct dma_chan *chan, struct dma_interleaved_template *xt)
>> +{
>> + Â Â struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(chan);
>> + Â Â struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
>> + Â Â struct sirfsoc_dma_desc *sdesc = NULL;
>> + Â Â unsigned long iflags;
>> + Â Â int ret;
>> +
>> + Â Â if ((xt->dir != MEM_TO_DEV) || (xt->dir != DEV_TO_MEM)) {
>> + Â Â Â Â Â Â ret = -EINVAL;
>> + Â Â Â Â Â Â goto err_dir;
>> + Â Â }
>> +
>> + Â Â /* Get free descriptor */
>> + Â Â spin_lock_irqsave(&schan->lock, iflags);
>> + Â Â if (!list_empty(&schan->free)) {
>> + Â Â Â Â Â Â sdesc = list_first_entry(&schan->free, struct sirfsoc_dma_desc,
>> + Â Â Â Â Â Â Â Â Â Â node);
>> + Â Â Â Â Â Â list_del(&sdesc->node);
>> + Â Â }
>> + Â Â spin_unlock_irqrestore(&schan->lock, iflags);
>> +
>> + Â Â if (!sdesc) {
>> + Â Â Â Â Â Â /* try to free completed descriptors */
>> + Â Â Â Â Â Â sirfsoc_dma_process_completed(sdma);
>> + Â Â Â Â Â Â ret = 0;
>> + Â Â Â Â Â Â goto no_desc;
>> + Â Â }
>> +
>> + Â Â /* Place descriptor in prepared list */
>> + Â Â spin_lock_irqsave(&schan->lock, iflags);
>> + Â Â if ((xt->frame_size == 1) && (xt->numf > 0)) {
> what does this mean?

@numf: Number of frames in this template.
@frame_size: Number of chunks in a frame i.e, size of sgl[].

frame_size==1 means prima2 only support 1 chunk. numf > 0 means
ylen(line number -1) is at least 0 and frame number is at least 1.

>> + Â Â Â Â Â Â sdesc->cyclic = 0;
>> + Â Â Â Â Â Â sdesc->xlen = xt->sgl[0].size / 4;
>> + Â Â Â Â Â Â sdesc->width = (xt->sgl[0].size + xt->sgl[0].icg) / 4;

-barry
--
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/