[PATCH] dmaengine: add CSR SiRFprimaII DMAC driver

Jassi Brar jassisinghbrar at gmail.com
Wed Sep 14 03:11:26 EDT 2011


On Wed, Sep 14, 2011 at 12:16 PM, Barry Song <21cnbao at gmail.com> wrote:

>> Anyways, every case can be easily expressed using the generic api
>> I proposed. See 'struct xfer_template' in https://lkml.org/lkml/2011/8/12/128
>>
>> Roughly speaking, the following should be done...
>> Client driver :-
>> **************
>> For a 'Rectangular' transfer (2d-dma.PNG) :-
>>      xfer_template.numf = Ylen;  /* height of rectangle */
>>      xfer_template.frame_size = 1;
>>      xfer_template.sgl[0].size = Xlen; /* width of rectangle */
>>      xfer_template.sgl[0].icg = start_addr_Y(n) - end_addr_Y(n-1);
>
> For prima2:
>
> xfer_template.numf = ylen + 1
> xfer_template.frame_size = 1;
> xfer_template.sgl[0].size = xlen;
> xfer_template.sgl[0].icg = dma_width - xlen;
>
All is same as I suggested except for 'numf'.
You might want to keep 'numf' same as well. Because the client
driver shouldn't need to know that the DMAC's register expect "+1" value.
Remember the client is supposed to be reusable over other DMACs as well.
So, rather in the DMAC driver, please do
    schan->ylen = xfer_template.numf + 1;


>> DMAC driver :-
>> ***************
>>      if (xfer_template.frame_size == 1) {
>>           /* rectangle */
>>           schan->xlen = xfer_template.sgl[0].size;
>>           schan->width = schan->xlen + xfer_template.sgl[0].icg;
>>      } else if (xfer_template.frame_size == 2 &&
>>                  xfer_template.numf == 1 &&
>>                  xfer_template.sgl[1].size == xfer_template.sgl[0].icg){
>>           /* a line and some */
>>           schan->xlen = xfer_template.sgl[0].size +  xfer_template.sgl[1].size.
>>           schan->width = xfer_template.sgl[0].size;
>>      } else {
>>           /* _Hardware_ doesn't support the transfer as such. *
>>           return -EINVAL;
>>      }
>>      schan->ylen = xfer_template.numf /* -1? */;
>>
>
> For prima2:
> xfer_template.frame_size is always 1, then
> schan->xlen = xfer_template.sgl[0].size;
> schan->width = schan->xlen + xfer_template.sgl[0].icg;
>
Ok, you don't need the 'else if' clause because as you said
{xlen > width} is not an option.
But you do need the other two checks, so that the DMAC driver
cleanly rejects any interleaved-format that it doesn't support.

Point being, the clients and DMAC drivers are supposed to be
very 'promiscuous' - any Client could be 'riding' any DMAC ;)



More information about the linux-arm-kernel mailing list