This extends the DMA engine driver for the COH 901 318 used in the
U300 platform with the generic PrimeCell interface.
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
drivers/dma/coh901318.c | 146 +++++++++++++++++++++++++++++++++++++++++++
drivers/dma/coh901318_lli.c | 78 ++++++++++++++++++++++-
2 files changed, 221 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index 4233440..1d5ed16 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -21,6 +21,7 @@
#include <linux/uaccess.h>
#include <linux/debugfs.h>
#include <mach/coh901318.h>
+#include <linux/amba/dma.h>
#include "coh901318_lli.h"
@@ -72,6 +73,9 @@ struct coh901318_chan {
unsigned long nbr_active_done;
unsigned long busy;
+ u32 amba_addr;
+ u32 amba_ctrl;
+
struct coh901318_base *base;
};
@@ -190,6 +194,9 @@ static inline struct coh901318_chan *to_coh901318_chan(struct dma_chan *chan)
static inline dma_addr_t
cohc_dev_addr(struct coh901318_chan *cohc)
{
+ /* PrimeCell supplied address will take precedence */
+ if (cohc->amba_addr)
+ return cohc->amba_addr;
return cohc->base->platform->chan_conf[cohc->id].dev_addr;
}
@@ -1055,6 +1062,14 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
params = cohc_chan_param(cohc);
config = params->config;
+ /*
+ * Add primecell-specific control on top, make
+ * sure the bits you set per peripheral channel are
+ * cleared in the default config from the platform.
+ */
+ ctrl_chained |= cohc->amba_ctrl;
+ ctrl_last |= cohc->amba_ctrl;
+ ctrl |= cohc->amba_ctrl;
if (direction == DMA_TO_DEVICE) {
u32 tx_flags = COH901318_CX_CTRL_PRDD_SOURCE |
@@ -1113,6 +1128,12 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
if (ret)
goto err_lli_fill;
+ /*
+ * Set the default ctrl for the channel to the one from the lli,
+ * things may have changed due to odd buffer alignment ...