On 01/28/2014 02:05 PM, Russell King - ARM Linux wrote:
On Tue, Jan 28, 2014 at 12:37:43PM +0000, Mark Brown wrote:
On Tue, Jan 28, 2014 at 01:06:29PM +0100, Lars-Peter Clausen wrote:
The virt_dma helper functions already take care of some of the cyclic specific details. And more can probably be added. E.g. what comes to mind is the tracking of whether a descriptor is cyclic and which segment of the descriptor to submit next. All users of virt_dma already implement these in almost the same fashion. So this would not only to allow to factor out the handling for the cyclic case, but also for the non cyclic case. And for all users of those helpers cyclic support would essentially be free.
OK, I had a brief look and that does seem like the way forwards - I had been remembering the last time this was discussed when the DMA guys were pretty uncomfortable with the idea of doing things there but it seems things are different now.
I don't want virt_dma to do any tracking of which part of the descriptor is to be submitted next, because that needlessly makes virt_dma harder to use on hardware which you can generate the scatterlist in memory and have the hardware walk it, only notifying when it reaches the end of the list.
Or maybe make it a lib orthogonal to or on top of virt_dma. A soft sg lib for devices that don't have hardware support for scatterlist is definitely something that would be beneficial to the dmaengine framework as there are quite a few of those driver which all have more or less the same code over and over again. With such a lib cyclic support comes for free.
- Lars