1
2
3
4
5
6 #ifndef __ALTERA_SGDMAHW_H__
7 #define __ALTERA_SGDMAHW_H__
8
9
10 struct sgdma_descrip {
11 u32 raddr;
12 u32 pad1;
13 u32 waddr;
14 u32 pad2;
15 u32 next;
16 u32 pad3;
17 u16 bytes;
18 u8 rburst;
19 u8 wburst;
20 u16 bytes_xferred;
21
22
23
24
25
26
27
28
29
30
31 u8 status;
32
33
34
35
36
37
38
39 u8 control;
40 } __packed;
41
42 #define SGDMA_DESC_LEN sizeof(struct sgdma_descrip)
43
44 #define SGDMA_STATUS_ERR BIT(0)
45 #define SGDMA_STATUS_LENGTH_ERR BIT(1)
46 #define SGDMA_STATUS_CRC_ERR BIT(2)
47 #define SGDMA_STATUS_TRUNC_ERR BIT(3)
48 #define SGDMA_STATUS_PHY_ERR BIT(4)
49 #define SGDMA_STATUS_COLL_ERR BIT(5)
50 #define SGDMA_STATUS_EOP BIT(7)
51
52 #define SGDMA_CONTROL_EOP BIT(0)
53 #define SGDMA_CONTROL_RD_FIXED BIT(1)
54 #define SGDMA_CONTROL_WR_FIXED BIT(2)
55
56
57
58 #define SGDMA_CONTROL_HW_OWNED BIT(7)
59
60
61 struct sgdma_csr {
62
63
64
65
66
67
68
69 u32 status;
70 u32 pad1[3];
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 u32 control;
89 u32 pad2[3];
90 u32 next_descrip;
91 u32 pad3[3];
92 };
93
94 #define sgdma_csroffs(a) (offsetof(struct sgdma_csr, a))
95 #define sgdma_descroffs(a) (offsetof(struct sgdma_descrip, a))
96
97 #define SGDMA_STSREG_ERR BIT(0)
98 #define SGDMA_STSREG_EOP BIT(1)
99 #define SGDMA_STSREG_DESCRIP BIT(2)
100 #define SGDMA_STSREG_CHAIN BIT(3)
101 #define SGDMA_STSREG_BUSY BIT(4)
102
103 #define SGDMA_CTRLREG_IOE BIT(0)
104 #define SGDMA_CTRLREG_IOEOP BIT(1)
105 #define SGDMA_CTRLREG_IDESCRIP BIT(2)
106 #define SGDMA_CTRLREG_ILASTD BIT(3)
107 #define SGDMA_CTRLREG_INTEN BIT(4)
108 #define SGDMA_CTRLREG_START BIT(5)
109 #define SGDMA_CTRLREG_STOPERR BIT(6)
110 #define SGDMA_CTRLREG_INTMAX BIT(7)
111 #define SGDMA_CTRLREG_RESET BIT(16)
112 #define SGDMA_CTRLREG_COBHW BIT(17)
113 #define SGDMA_CTRLREG_POLL BIT(18)
114 #define SGDMA_CTRLREG_CLRINT BIT(31)
115
116 #endif