ARM: pxa: register static mmp_pdma device

Drop the init call to the properietary dma subsystem and register the
mmp_pdma device.

Signed-off-by: Daniel Mack <zonque@gmail.com>
ARM: mmp: register static mmp_pdma device

Drop the init call to the properietary dma subsystem and register
the mmp_pdma device.

Signed-off-by: Daniel Mack <zonque@gmail.com>
ARM: pxa: remove old DMA implementation

Signed-off-by: Daniel Mack <zonque@gmail.com>
spi: spi-pxa2xx: remove legacy PXA DMA bits

Generic DMA support was already implemented by commit cd7bed00
("spi/pxa2xx: break out the private DMA API usage into a separate
file") which moved all the legacy PXA DMA implementation code into
its own file.

With generic DMA available for PXA, we can now just trash this
file.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Revert "mtd: nand: pxa3xx: Support command buffer #3"

This reverts commit fbd70cb71103051699c7c49b08d5e107736e3a75.
mtd: pxa3xx-nand: replace pxa_request_dma with dmaengine

[zonque@gmail.com: rebased in top of l2-mtd.git. The newly introduced
ARCH_HAS_DMA hack was changed into a check for CONFIG_HAS_DMA]

Signed-off-by: Zhangfei Gao <zhangfei.gao@marvell.com>
Signed-off-by: Daniel Mack <zonque@gmail.com>
mtd: pxa3xx-nand: use mmp_pdma_filter_fn and dma_request_slave_channel_compat

Signed-off-by: Daniel Mack <zonque@gmail.com>
mtd: pxa3xx-nand: HACK for ndcb3 removal
dma: mmp_pdma: add protect when alloc/free phy channels

In mmp pdma, phy channels are allocated/freed dynamically
and frequently. But no proper protection is added.
Conflict will happen when multi-users are requesting phy
channels at the same time. Use spinlock to protect.

Signed-off-by: Xiang Wang <wangx@marvell.com>
dma: mmp_pdma: clear DRCMR when free a phy channel

In mmp pdma, phy channels are allocated/freed dynamically.
The mapping from DMA request to DMA channel number in DRCMR
should be cleared when a phy channel is freed. Otherwise
conflicts will happen when:
1. A is using channel 2 and free it after finished, but A
still maps to channel 2 in DRCMR of A.
2. Now another one B gets channel 2. So B maps to channel 2
too in DRCMR of B.
In the datasheet, it is described that "Do not map two active
requests to the same channel since it produces unpredictable
results" and we can observe that during test.

Signed-off-by: Xiang Wang <wangx@marvell.com>
dma: mmp_pdma: factor out DRCMR register calculation

The exact same calculation is done twice, so let's factor it out to a
macro.

Signed-off-by: Daniel Mack <zonque@gmail.com>
dma: mmp_pdma: add filter function

PXA peripherals need to obtain specific DMA request ids which will
eventually be stored in the DRCMR register.

Currently, clients are expected to store that number inside the slave
config block as slave_id, which is unfortunately incompatible with the
way DMA resources are handled in DT environments.

This patch adds a filter function which stores the filter parameter
passed in by of-dma.c into the channel's drcmr register.

For backward compatability, cfg->slave_id is still used if set to
a non-zero value.

Signed-off-by: Daniel Mack <zonque@gmail.com>
dma: mmp_pdma: make the controller a DMA provider

This patch makes the mmp_pdma controller able to provide DMA resources
in DT environments.

Signed-off-by: Daniel Mack <zonque@gmail.com>
dma: mmp-pdma: print the number of channels at probe time

That helps check the provided runtime information.

Signed-off-by: Daniel Mack <zonque@gmail.com>
dma: mmp_pdma: remove duplicate assignment

The DMA_SLAVE is currently set twice.

Signed-off-by: Daniel Mack <zonque@gmail.com>
dma: mmp_pdma: add support for byte-aligned transfers

The PXA DMA controller has a DALGN register which allows for
byte-aligned DMA transfers. Use it in case any of the transfer
descriptors is not aligned to a mask of ~0x7.

Signed-off-by: Daniel Mack <zonque@gmail.com>
dma: mmp_pdma: implement DMA_PAUSE and DMA_RESUME

This is needed at least for audio operation.

Signed-off-by: Daniel Mack <zonque@gmail.com>
dma: mmp_pdma: add support for cyclic DMA descriptors

This is needed for audio operation.

Signed-off-by: Daniel Mack <zonque@gmail.com>
dma: mmp_pdma: add support for residue reporting

Signed-off-by: Daniel Mack <zonque@gmail.com>
arm: pxa: arch/ssp: switch to dma_chan usage

Signed-off-by: Daniel Mack <zonque@gmail.com>