1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * linux/arch/unicore32/include/mach/dma.h
4 *
5 * Code specific to PKUnity SoC and UniCore ISA
6 *
7 * Copyright (C) 2001-2010 GUAN Xue-tao
8 */
9 #ifndef __MACH_PUV3_DMA_H__
10 #define __MACH_PUV3_DMA_H__
11
12 /*
13 * The PKUnity has six internal DMA channels.
14 */
15 #define MAX_DMA_CHANNELS 6
16
17 typedef enum {
18 DMA_PRIO_HIGH = 0,
19 DMA_PRIO_MEDIUM = 1,
20 DMA_PRIO_LOW = 2
21 } puv3_dma_prio;
22
23 /*
24 * DMA registration
25 */
26
27 extern int puv3_request_dma(char *name,
28 puv3_dma_prio prio,
29 void (*irq_handler)(int, void *),
30 void (*err_handler)(int, void *),
31 void *data);
32
33 extern void puv3_free_dma(int dma_ch);
34
puv3_stop_dma(int ch)35 static inline void puv3_stop_dma(int ch)
36 {
37 writel(readl(DMAC_CONFIG(ch)) & ~DMAC_CONFIG_EN, DMAC_CONFIG(ch));
38 }
39
puv3_resume_dma(int ch)40 static inline void puv3_resume_dma(int ch)
41 {
42 writel(readl(DMAC_CONFIG(ch)) | DMAC_CONFIG_EN, DMAC_CONFIG(ch));
43 }
44
45 #endif /* __MACH_PUV3_DMA_H__ */
46