1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2018-2019 Synopsys, Inc. and/or its affiliates.
4 * Synopsys DesignWare eDMA core driver
6 * Author: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
12 #include <linux/device.h>
13 #include <linux/dmaengine.h>
15 #define EDMA_MAX_WR_CH 8
16 #define EDMA_MAX_RD_CH 8
20 struct dw_edma_region {
26 struct dw_edma_core_ops {
27 int (*irq_vector)(struct device *dev, unsigned int nr);
30 enum dw_edma_map_format {
31 EDMA_MF_EDMA_LEGACY = 0x0,
32 EDMA_MF_EDMA_UNROLL = 0x1,
33 EDMA_MF_HDMA_COMPAT = 0x5
37 * enum dw_edma_chip_flags - Flags specific to an eDMA chip
38 * @DW_EDMA_CHIP_LOCAL: eDMA is used locally by an endpoint
40 enum dw_edma_chip_flags {
41 DW_EDMA_CHIP_LOCAL = BIT(0),
45 * struct dw_edma_chip - representation of DesignWare eDMA controller hardware
46 * @dev: struct device of the eDMA controller
48 * @nr_irqs: total number of DMA IRQs
49 * @ops DMA channel to IRQ number mapping
50 * @flags dw_edma_chip_flags
51 * @reg_base DMA register base address
52 * @ll_wr_cnt DMA write link list count
53 * @ll_rd_cnt DMA read link list count
54 * @rg_region DMA register region
55 * @ll_region_wr DMA descriptor link list memory for write channel
56 * @ll_region_rd DMA descriptor link list memory for read channel
57 * @dt_region_wr DMA data memory for write channel
58 * @dt_region_rd DMA data memory for read channel
59 * @mf DMA register map format
60 * @dw: struct dw_edma that is filled by dw_edma_probe()
66 const struct dw_edma_core_ops *ops;
69 void __iomem *reg_base;
73 /* link list address */
74 struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH];
75 struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH];
78 struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH];
79 struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH];
81 enum dw_edma_map_format mf;
86 /* Export to the platform drivers */
87 #if IS_ENABLED(CONFIG_DW_EDMA)
88 int dw_edma_probe(struct dw_edma_chip *chip);
89 int dw_edma_remove(struct dw_edma_chip *chip);
91 static inline int dw_edma_probe(struct dw_edma_chip *chip)
96 static inline int dw_edma_remove(struct dw_edma_chip *chip)
100 #endif /* CONFIG_DW_EDMA */
102 #endif /* _DW_EDMA_H */