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>
9 #ifndef _DW_EDMA_CORE_H
10 #define _DW_EDMA_CORE_H
12 #include <linux/msi.h>
13 #include <linux/dma/edma.h>
15 #include "../virt-dma.h"
29 enum dw_edma_request
{
44 struct dw_edma_burst
{
45 struct list_head list
;
51 struct dw_edma_region
{
57 struct dw_edma_chunk
{
58 struct list_head list
;
59 struct dw_edma_chan
*chan
;
60 struct dw_edma_burst
*burst
;
65 struct dw_edma_region ll_region
; /* Linked list */
69 struct virt_dma_desc vd
;
70 struct dw_edma_chan
*chan
;
71 struct dw_edma_chunk
*chunk
;
80 struct virt_dma_chan vc
;
81 struct dw_edma_chip
*chip
;
92 enum dw_edma_request request
;
93 enum dw_edma_status status
;
96 struct dma_slave_config config
;
106 struct dw_edma_core_ops
{
107 int (*irq_vector
)(struct device
*dev
, unsigned int nr
);
113 struct dma_device wr_edma
;
116 struct dma_device rd_edma
;
119 struct dw_edma_region rg_region
; /* Registers */
120 struct dw_edma_region ll_region
; /* Linked list */
121 struct dw_edma_region dt_region
; /* Data */
123 struct dw_edma_irq
*irq
;
127 enum dw_edma_mode mode
;
129 struct dw_edma_chan
*chan
;
130 const struct dw_edma_core_ops
*ops
;
132 raw_spinlock_t lock
; /* Only for legacy */
136 struct scatterlist
*sgl
;
140 struct dw_edma_cyclic
{
146 struct dw_edma_transfer
{
147 struct dma_chan
*dchan
;
149 struct dw_edma_sg sg
;
150 struct dw_edma_cyclic cyclic
;
152 enum dma_transfer_direction direction
;
158 struct dw_edma_chan
*vc2dw_edma_chan(struct virt_dma_chan
*vc
)
160 return container_of(vc
, struct dw_edma_chan
, vc
);
164 struct dw_edma_chan
*dchan2dw_edma_chan(struct dma_chan
*dchan
)
166 return vc2dw_edma_chan(to_virt_chan(dchan
));
169 #endif /* _DW_EDMA_CORE_H */