2014-09-23 21:18:11 +07:00
|
|
|
/*
|
|
|
|
* Driver for the Synopsys DesignWare DMA Controller
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Atmel Corporation
|
|
|
|
* Copyright (C) 2010-2011 ST Microelectronics
|
2014-09-23 21:18:15 +07:00
|
|
|
* Copyright (C) 2014 Intel Corporation
|
2014-09-23 21:18:11 +07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#ifndef _DMA_DW_H
|
|
|
|
#define _DMA_DW_H
|
|
|
|
|
2014-09-23 21:18:15 +07:00
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/device.h>
|
2014-09-23 21:18:11 +07:00
|
|
|
#include <linux/dmaengine.h>
|
|
|
|
|
2014-09-23 21:18:15 +07:00
|
|
|
#include <linux/platform_data/dma-dw.h>
|
|
|
|
|
|
|
|
struct dw_dma;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct dw_dma_chip - representation of DesignWare DMA controller hardware
|
|
|
|
* @dev: struct device of the DMA controller
|
|
|
|
* @irq: irq line
|
|
|
|
* @regs: memory mapped I/O space
|
|
|
|
* @clk: hclk clock
|
|
|
|
* @dw: struct dw_dma that is filed by dw_dma_probe()
|
2016-04-27 18:15:40 +07:00
|
|
|
* @pdata: pointer to platform data
|
2014-09-23 21:18:15 +07:00
|
|
|
*/
|
|
|
|
struct dw_dma_chip {
|
|
|
|
struct device *dev;
|
|
|
|
int irq;
|
|
|
|
void __iomem *regs;
|
|
|
|
struct clk *clk;
|
|
|
|
struct dw_dma *dw;
|
2016-04-27 18:15:40 +07:00
|
|
|
|
|
|
|
const struct dw_dma_platform_data *pdata;
|
2014-09-23 21:18:15 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Export to the platform drivers */
|
2016-08-17 23:20:23 +07:00
|
|
|
#if IS_ENABLED(CONFIG_DW_DMAC_CORE)
|
2016-04-27 18:15:40 +07:00
|
|
|
int dw_dma_probe(struct dw_dma_chip *chip);
|
2014-09-23 21:18:15 +07:00
|
|
|
int dw_dma_remove(struct dw_dma_chip *chip);
|
2016-08-17 23:20:23 +07:00
|
|
|
#else
|
|
|
|
static inline int dw_dma_probe(struct dw_dma_chip *chip) { return -ENODEV; }
|
|
|
|
static inline int dw_dma_remove(struct dw_dma_chip *chip) { return 0; }
|
|
|
|
#endif /* CONFIG_DW_DMAC_CORE */
|
2014-09-23 21:18:15 +07:00
|
|
|
|
2014-09-23 21:18:11 +07:00
|
|
|
/* DMA API extensions */
|
|
|
|
struct dw_desc;
|
|
|
|
|
|
|
|
struct dw_cyclic_desc {
|
|
|
|
struct dw_desc **desc;
|
|
|
|
unsigned long periods;
|
|
|
|
void (*period_callback)(void *param);
|
|
|
|
void *period_callback_param;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
|
|
|
|
dma_addr_t buf_addr, size_t buf_len, size_t period_len,
|
|
|
|
enum dma_transfer_direction direction);
|
|
|
|
void dw_dma_cyclic_free(struct dma_chan *chan);
|
|
|
|
int dw_dma_cyclic_start(struct dma_chan *chan);
|
|
|
|
void dw_dma_cyclic_stop(struct dma_chan *chan);
|
|
|
|
|
|
|
|
dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
|
|
|
|
|
|
|
|
dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
|
|
|
|
|
|
|
|
#endif /* _DMA_DW_H */
|