1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _ASM_CRIS_SVINTO_H
3 #define _ASM_CRIS_SVINTO_H
5 #include <arch/sv_addr_ag.h>
7 extern unsigned int genconfig_shadow; /* defined and set in head.S */
11 enum { /* Available in: */
12 d_eol = (1 << 0), /* flags */
13 d_eop = (1 << 1), /* flags & status */
14 d_wait = (1 << 2), /* flags */
15 d_int = (1 << 3), /* flags */
16 d_txerr = (1 << 4), /* flags */
17 d_stop = (1 << 4), /* status */
18 d_ecp = (1 << 4), /* flags & status */
19 d_pri = (1 << 5), /* flags & status */
20 d_alignerr = (1 << 6), /* status */
21 d_crcerr = (1 << 7) /* status */
24 /* Do remember that DMA does not go through the MMU and needs
25 * a real physical address, not an address virtually mapped or
26 * paged. Therefore the buf/next ptrs below are unsigned long instead
27 * of void * to give a warning if you try to put a pointer directly
28 * to them instead of going through virt_to_phys/phys_to_virt.
31 typedef struct etrax_dma_descr {
32 unsigned short sw_len; /* 0-1 */
33 unsigned short ctrl; /* 2-3 */
34 unsigned long next; /* 4-7 */
35 unsigned long buf; /* 8-11 */
36 unsigned short hw_len; /* 12-13 */
37 unsigned char status; /* 14 */
38 unsigned char fifo_len; /* 15 */
42 /* Use this for constant numbers only */
43 #define RESET_DMA_NUM( n ) \
44 *R_DMA_CH##n##_CMD = IO_STATE( R_DMA_CH0_CMD, cmd, reset )
46 /* Use this for constant numbers or symbols,
47 * having two macros makes it possible to use constant expressions.
49 #define RESET_DMA( n ) RESET_DMA_NUM( n )
52 /* Use this for constant numbers only */
53 #define WAIT_DMA_NUM( n ) \
54 while( (*R_DMA_CH##n##_CMD & IO_MASK( R_DMA_CH0_CMD, cmd )) != \
55 IO_STATE( R_DMA_CH0_CMD, cmd, hold ) )
57 /* Use this for constant numbers or symbols
58 * having two macros makes it possible to use constant expressions.
60 #define WAIT_DMA( n ) WAIT_DMA_NUM( n )
62 extern void prepare_rx_descriptor(struct etrax_dma_descr *desc);
63 extern void flush_etrax_cache(void);