lkml.org 
[lkml]   [2011]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] dmaengine: add CSR SiRFprimaII DMAC driver
From
On Wed, Sep 14, 2011 at 12:16 PM, Barry Song <21cnbao@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 ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-09-14 09:13    [W:0.125 / U:1.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site