blob: e166cac8e870e50f95927fe988b0e6213929b1f6 [file] [log] [blame]
Andy Shevchenko3d588f82014-09-23 17:18:11 +03001/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +03006 * Copyright (C) 2014 Intel Corporation
Andy Shevchenko3d588f82014-09-23 17:18:11 +03007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef _DMA_DW_H
13#define _DMA_DW_H
14
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +030015#include <linux/clk.h>
16#include <linux/device.h>
Andy Shevchenko3d588f82014-09-23 17:18:11 +030017#include <linux/dmaengine.h>
18
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +030019#include <linux/platform_data/dma-dw.h>
20
21struct dw_dma;
22
23/**
24 * struct dw_dma_chip - representation of DesignWare DMA controller hardware
25 * @dev: struct device of the DMA controller
Andy Shevchenko08d62f52017-01-17 13:57:26 +020026 * @id: instance ID
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +030027 * @irq: irq line
28 * @regs: memory mapped I/O space
29 * @clk: hclk clock
30 * @dw: struct dw_dma that is filed by dw_dma_probe()
Andy Shevchenko3a14c662016-04-27 14:15:40 +030031 * @pdata: pointer to platform data
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +030032 */
33struct dw_dma_chip {
34 struct device *dev;
Andy Shevchenko08d62f52017-01-17 13:57:26 +020035 int id;
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +030036 int irq;
37 void __iomem *regs;
38 struct clk *clk;
39 struct dw_dma *dw;
Andy Shevchenko3a14c662016-04-27 14:15:40 +030040
41 const struct dw_dma_platform_data *pdata;
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +030042};
43
44/* Export to the platform drivers */
Andy Shevchenko19d82912016-08-17 19:20:23 +030045#if IS_ENABLED(CONFIG_DW_DMAC_CORE)
Andy Shevchenko3a14c662016-04-27 14:15:40 +030046int dw_dma_probe(struct dw_dma_chip *chip);
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +030047int dw_dma_remove(struct dw_dma_chip *chip);
Andy Shevchenko19d82912016-08-17 19:20:23 +030048#else
49static inline int dw_dma_probe(struct dw_dma_chip *chip) { return -ENODEV; }
50static inline int dw_dma_remove(struct dw_dma_chip *chip) { return 0; }
51#endif /* CONFIG_DW_DMAC_CORE */
Andy Shevchenko2a52f6e2014-09-23 17:18:15 +030052
Andy Shevchenko3d588f82014-09-23 17:18:11 +030053#endif /* _DMA_DW_H */