[PATCH] dmaengine: add CSR SiRFprimaII DMAC driver
Barry Song
21cnbao at gmail.com
Wed Sep 14 05:49:20 EDT 2011
2011/9/14 Jassi Brar <jassisinghbrar at gmail.com>:
> 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;
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
More information about the linux-arm-kernel
mailing list