#include <linux/err.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/dmaengine.h>
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/platform_data/mmp_dma.h>
#include <linux/dmapool.h>
#include <linux/of_dma.h>
#include <linux/of.h>
#include "dmaengine.h"
#define DCSR …
#define DALGN …
#define DINT …
#define DDADR …
#define DSADR(n) …
#define DTADR(n) …
#define DCMD …
#define DCSR_RUN …
#define DCSR_NODESC …
#define DCSR_STOPIRQEN …
#define DCSR_REQPEND …
#define DCSR_STOPSTATE …
#define DCSR_ENDINTR …
#define DCSR_STARTINTR …
#define DCSR_BUSERR …
#define DCSR_EORIRQEN …
#define DCSR_EORJMPEN …
#define DCSR_EORSTOPEN …
#define DCSR_SETCMPST …
#define DCSR_CLRCMPST …
#define DCSR_CMPST …
#define DCSR_EORINTR …
#define DRCMR(n) …
#define DRCMR_MAPVLD …
#define DRCMR_CHLNUM …
#define DDADR_DESCADDR …
#define DDADR_STOP …
#define DCMD_INCSRCADDR …
#define DCMD_INCTRGADDR …
#define DCMD_FLOWSRC …
#define DCMD_FLOWTRG …
#define DCMD_STARTIRQEN …
#define DCMD_ENDIRQEN …
#define DCMD_ENDIAN …
#define DCMD_BURST8 …
#define DCMD_BURST16 …
#define DCMD_BURST32 …
#define DCMD_WIDTH1 …
#define DCMD_WIDTH2 …
#define DCMD_WIDTH4 …
#define DCMD_LENGTH …
#define PDMA_MAX_DESC_BYTES …
struct mmp_pdma_desc_hw { … } __aligned(…);
struct mmp_pdma_desc_sw { … };
struct mmp_pdma_phy;
struct mmp_pdma_chan { … };
struct mmp_pdma_phy { … };
struct mmp_pdma_device { … };
#define tx_to_mmp_pdma_desc(tx) …
#define to_mmp_pdma_desc(lh) …
#define to_mmp_pdma_chan(dchan) …
#define to_mmp_pdma_dev(dmadev) …
static int mmp_pdma_config_write(struct dma_chan *dchan,
struct dma_slave_config *cfg,
enum dma_transfer_direction direction);
static void set_desc(struct mmp_pdma_phy *phy, dma_addr_t addr)
{ … }
static void enable_chan(struct mmp_pdma_phy *phy)
{ … }
static void disable_chan(struct mmp_pdma_phy *phy)
{ … }
static int clear_chan_irq(struct mmp_pdma_phy *phy)
{ … }
static irqreturn_t mmp_pdma_chan_handler(int irq, void *dev_id)
{ … }
static irqreturn_t mmp_pdma_int_handler(int irq, void *dev_id)
{ … }
static struct mmp_pdma_phy *lookup_phy(struct mmp_pdma_chan *pchan)
{ … }
static void mmp_pdma_free_phy(struct mmp_pdma_chan *pchan)
{ … }
static void start_pending_queue(struct mmp_pdma_chan *chan)
{ … }
static dma_cookie_t mmp_pdma_tx_submit(struct dma_async_tx_descriptor *tx)
{ … }
static struct mmp_pdma_desc_sw *
mmp_pdma_alloc_descriptor(struct mmp_pdma_chan *chan)
{ … }
static int mmp_pdma_alloc_chan_resources(struct dma_chan *dchan)
{ … }
static void mmp_pdma_free_desc_list(struct mmp_pdma_chan *chan,
struct list_head *list)
{ … }
static void mmp_pdma_free_chan_resources(struct dma_chan *dchan)
{ … }
static struct dma_async_tx_descriptor *
mmp_pdma_prep_memcpy(struct dma_chan *dchan,
dma_addr_t dma_dst, dma_addr_t dma_src,
size_t len, unsigned long flags)
{ … }
static struct dma_async_tx_descriptor *
mmp_pdma_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
unsigned int sg_len, enum dma_transfer_direction dir,
unsigned long flags, void *context)
{ … }
static struct dma_async_tx_descriptor *
mmp_pdma_prep_dma_cyclic(struct dma_chan *dchan,
dma_addr_t buf_addr, size_t len, size_t period_len,
enum dma_transfer_direction direction,
unsigned long flags)
{ … }
static int mmp_pdma_config_write(struct dma_chan *dchan,
struct dma_slave_config *cfg,
enum dma_transfer_direction direction)
{ … }
static int mmp_pdma_config(struct dma_chan *dchan,
struct dma_slave_config *cfg)
{ … }
static int mmp_pdma_terminate_all(struct dma_chan *dchan)
{ … }
static unsigned int mmp_pdma_residue(struct mmp_pdma_chan *chan,
dma_cookie_t cookie)
{ … }
static enum dma_status mmp_pdma_tx_status(struct dma_chan *dchan,
dma_cookie_t cookie,
struct dma_tx_state *txstate)
{ … }
static void mmp_pdma_issue_pending(struct dma_chan *dchan)
{ … }
static void dma_do_tasklet(struct tasklet_struct *t)
{ … }
static void mmp_pdma_remove(struct platform_device *op)
{ … }
static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev, int idx, int irq)
{ … }
static const struct of_device_id mmp_pdma_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, mmp_pdma_dt_ids);
static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma)
{ … }
static int mmp_pdma_probe(struct platform_device *op)
{ … }
static const struct platform_device_id mmp_pdma_id_table[] = …;
static struct platform_driver mmp_pdma_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;