#include <linux/clk.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_dma.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include "virt-dma.h"
#define ADMA_CH_CMD …
#define ADMA_CH_STATUS …
#define ADMA_CH_STATUS_XFER_EN …
#define ADMA_CH_STATUS_XFER_PAUSED …
#define ADMA_CH_INT_STATUS …
#define ADMA_CH_INT_STATUS_XFER_DONE …
#define ADMA_CH_INT_CLEAR …
#define ADMA_CH_CTRL …
#define ADMA_CH_CTRL_DIR(val) …
#define ADMA_CH_CTRL_DIR_AHUB2MEM …
#define ADMA_CH_CTRL_DIR_MEM2AHUB …
#define ADMA_CH_CTRL_MODE_CONTINUOUS …
#define ADMA_CH_CTRL_FLOWCTRL_EN …
#define ADMA_CH_CTRL_XFER_PAUSE_SHIFT …
#define ADMA_CH_CONFIG …
#define ADMA_CH_CONFIG_SRC_BUF(val) …
#define ADMA_CH_CONFIG_TRG_BUF(val) …
#define ADMA_CH_CONFIG_BURST_SIZE_SHIFT …
#define ADMA_CH_CONFIG_MAX_BURST_SIZE …
#define ADMA_CH_CONFIG_WEIGHT_FOR_WRR(val) …
#define ADMA_CH_CONFIG_MAX_BUFS …
#define TEGRA186_ADMA_CH_CONFIG_OUTSTANDING_REQS(reqs) …
#define ADMA_CH_FIFO_CTRL …
#define ADMA_CH_TX_FIFO_SIZE_SHIFT …
#define ADMA_CH_RX_FIFO_SIZE_SHIFT …
#define ADMA_CH_LOWER_SRC_ADDR …
#define ADMA_CH_LOWER_TRG_ADDR …
#define ADMA_CH_TC …
#define ADMA_CH_TC_COUNT_MASK …
#define ADMA_CH_XFER_STATUS …
#define ADMA_CH_XFER_STATUS_COUNT_MASK …
#define ADMA_GLOBAL_CMD …
#define ADMA_GLOBAL_SOFT_RESET …
#define TEGRA_ADMA_BURST_COMPLETE_TIME …
#define ADMA_CH_REG_FIELD_VAL(val, mask, shift) …
struct tegra_adma;
struct tegra_adma_chip_data { … };
struct tegra_adma_chan_regs { … };
struct tegra_adma_desc { … };
struct tegra_adma_chan { … };
struct tegra_adma { … };
static inline void tdma_write(struct tegra_adma *tdma, u32 reg, u32 val)
{ … }
static inline u32 tdma_read(struct tegra_adma *tdma, u32 reg)
{ … }
static inline void tdma_ch_write(struct tegra_adma_chan *tdc, u32 reg, u32 val)
{ … }
static inline u32 tdma_ch_read(struct tegra_adma_chan *tdc, u32 reg)
{ … }
static inline struct tegra_adma_chan *to_tegra_adma_chan(struct dma_chan *dc)
{ … }
static inline struct tegra_adma_desc *to_tegra_adma_desc(
struct dma_async_tx_descriptor *td)
{ … }
static inline struct device *tdc2dev(struct tegra_adma_chan *tdc)
{ … }
static void tegra_adma_desc_free(struct virt_dma_desc *vd)
{ … }
static int tegra_adma_slave_config(struct dma_chan *dc,
struct dma_slave_config *sconfig)
{ … }
static int tegra_adma_init(struct tegra_adma *tdma)
{ … }
static int tegra_adma_request_alloc(struct tegra_adma_chan *tdc,
enum dma_transfer_direction direction)
{ … }
static void tegra_adma_request_free(struct tegra_adma_chan *tdc)
{ … }
static u32 tegra_adma_irq_status(struct tegra_adma_chan *tdc)
{ … }
static u32 tegra_adma_irq_clear(struct tegra_adma_chan *tdc)
{ … }
static void tegra_adma_stop(struct tegra_adma_chan *tdc)
{ … }
static void tegra_adma_start(struct tegra_adma_chan *tdc)
{ … }
static unsigned int tegra_adma_get_residue(struct tegra_adma_chan *tdc)
{ … }
static irqreturn_t tegra_adma_isr(int irq, void *dev_id)
{ … }
static void tegra_adma_issue_pending(struct dma_chan *dc)
{ … }
static bool tegra_adma_is_paused(struct tegra_adma_chan *tdc)
{ … }
static int tegra_adma_pause(struct dma_chan *dc)
{ … }
static int tegra_adma_resume(struct dma_chan *dc)
{ … }
static int tegra_adma_terminate_all(struct dma_chan *dc)
{ … }
static enum dma_status tegra_adma_tx_status(struct dma_chan *dc,
dma_cookie_t cookie,
struct dma_tx_state *txstate)
{ … }
static unsigned int tegra210_adma_get_burst_config(unsigned int burst_size)
{ … }
static unsigned int tegra186_adma_get_burst_config(unsigned int burst_size)
{ … }
static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
struct tegra_adma_desc *desc,
dma_addr_t buf_addr,
enum dma_transfer_direction direction)
{ … }
static struct dma_async_tx_descriptor *tegra_adma_prep_dma_cyclic(
struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_len,
size_t period_len, enum dma_transfer_direction direction,
unsigned long flags)
{ … }
static int tegra_adma_alloc_chan_resources(struct dma_chan *dc)
{ … }
static void tegra_adma_free_chan_resources(struct dma_chan *dc)
{ … }
static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma)
{ … }
static int __maybe_unused tegra_adma_runtime_suspend(struct device *dev)
{ … }
static int __maybe_unused tegra_adma_runtime_resume(struct device *dev)
{ … }
static const struct tegra_adma_chip_data tegra210_chip_data = …;
static const struct tegra_adma_chip_data tegra186_chip_data = …;
static const struct of_device_id tegra_adma_of_match[] = …;
MODULE_DEVICE_TABLE(of, tegra_adma_of_match);
static int tegra_adma_probe(struct platform_device *pdev)
{ … }
static void tegra_adma_remove(struct platform_device *pdev)
{ … }
static const struct dev_pm_ops tegra_adma_dev_pm_ops = …;
static struct platform_driver tegra_admac_driver = …;
module_platform_driver(…) …;
MODULE_ALIAS(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;