1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef _SPRD_DMA_H_
4 #define _SPRD_DMA_H_
5 
6 #define SPRD_DMA_REQ_SHIFT 16
7 #define SPRD_DMA_FLAGS(req_mode, int_type) \
8 	((req_mode) << SPRD_DMA_REQ_SHIFT | (int_type))
9 
10 /*
11  * enum sprd_dma_req_mode: define the DMA request mode
12  * @SPRD_DMA_FRAG_REQ: fragment request mode
13  * @SPRD_DMA_BLK_REQ: block request mode
14  * @SPRD_DMA_TRANS_REQ: transaction request mode
15  * @SPRD_DMA_LIST_REQ: link-list request mode
16  *
17  * We have 4 types request mode: fragment mode, block mode, transaction mode
18  * and linklist mode. One transaction can contain several blocks, one block can
19  * contain several fragments. Link-list mode means we can save several DMA
20  * configuration into one reserved memory, then DMA can fetch each DMA
21  * configuration automatically to start transfer.
22  */
23 enum sprd_dma_req_mode {
24 	SPRD_DMA_FRAG_REQ,
25 	SPRD_DMA_BLK_REQ,
26 	SPRD_DMA_TRANS_REQ,
27 	SPRD_DMA_LIST_REQ,
28 };
29 
30 /*
31  * enum sprd_dma_int_type: define the DMA interrupt type
32  * @SPRD_DMA_NO_INT: do not need generate DMA interrupts.
33  * @SPRD_DMA_FRAG_INT: fragment done interrupt when one fragment request
34  * is done.
35  * @SPRD_DMA_BLK_INT: block done interrupt when one block request is done.
36  * @SPRD_DMA_BLK_FRAG_INT: block and fragment interrupt when one fragment
37  * or one block request is done.
38  * @SPRD_DMA_TRANS_INT: tansaction done interrupt when one transaction
39  * request is done.
40  * @SPRD_DMA_TRANS_FRAG_INT: transaction and fragment interrupt when one
41  * transaction request or fragment request is done.
42  * @SPRD_DMA_TRANS_BLK_INT: transaction and block interrupt when one
43  * transaction request or block request is done.
44  * @SPRD_DMA_LIST_INT: link-list done interrupt when one link-list request
45  * is done.
46  * @SPRD_DMA_CFGERR_INT: configure error interrupt when configuration is
47  * incorrect.
48  */
49 enum sprd_dma_int_type {
50 	SPRD_DMA_NO_INT,
51 	SPRD_DMA_FRAG_INT,
52 	SPRD_DMA_BLK_INT,
53 	SPRD_DMA_BLK_FRAG_INT,
54 	SPRD_DMA_TRANS_INT,
55 	SPRD_DMA_TRANS_FRAG_INT,
56 	SPRD_DMA_TRANS_BLK_INT,
57 	SPRD_DMA_LIST_INT,
58 	SPRD_DMA_CFGERR_INT,
59 };
60 
61 #endif
62