lkml.org 
[lkml]   [2011]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] dmaengine: add CSR SiRFprimaII DMAC driver
2011/9/14 Jassi Brar <jassisinghbrar@gmail.com>:
> 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;

clients should not know any thing like xlen, ylen, dma_width, which
are all dmac driver cares. clients only need to know the generic xfer.
here i am just listing the relationship between client and dmac driver
to get the confirmation from you and make sure i haven't
misunderstood your api :-)

>
>
>>> 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 ;)

yes. of course.

>

-barry
--
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 11:51    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site