[ARM/tegra] dma: add transfer count query. Checking interrupt pending status.
authorJay Cheng <jacheng@nvidia.com>
Sat, 16 Oct 2010 03:55:02 +0000 (23:55 -0400)
committerColin Cross <ccross@android.com>
Mon, 18 Oct 2010 22:44:51 +0000 (15:44 -0700)
commitfc84cd7dbaf41b6164aea1554130d0143436340e
tree8fe5b075ddd25b199b384f5238e3fedf2348f0c3
parent831bbd76da80cf5c7986262e39c872dfc0262a95
[ARM/tegra] dma: add transfer count query. Checking interrupt pending status.
 Stopping Dma after last req transfer.

add an API to return the completed transfer count of a pending, active
or finished DMA request

originally fixed by Gary King <gking@nvidia.com>

It is observed that the dma interrupt has the lower priority then
its client interupt priority. When client's isr calls dma get transfer,
the dma status has not been upated as dma isr have not been served yet.
So before reading the status, explicitly checking the interrupt status and
handling accordingly.

The another issue which is observed is that if dma has transferred the data
of amount = requested -4 and if it moves to invalid requestor before stopping
then status got reset and tarnsfered bytes becomes 0. This seems the apb dma
hw behavior. Following is the suggestion to overcome this issue:
- Disable global enable bit.
- Read status.
- Stop dma.
- Enable global status bit.

Added this workaround and it worked fine.

originally fixed by Laxman Dewangan <ldewangan@nvidia.com>

In continous mode, dma should stop after last transfer completed and
if there is no more req pending.
If there is pending req then it should check whether it has updated
in hw for next transfer or not and if it has not started then stop dma
and start new req immediatley.

originally fixed by Laxman Dewangan <ldewangan@nvidia.com>

Change-Id: I49c97c96eacdf4060de6b21cec0e71d940d33f00
arch/arm/mach-tegra/dma.c