1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
4 */
5
6 #include <common.h>
7
8 /* Functions for initializing variable tables of different types of tasks. */
9
10 /*
11 * Do not edit!
12 */
13
14 #include <MCD_dma.h>
15
16 extern dmaRegs *MCD_dmaBar;
17
18 /* Task 0 */
19
MCD_startDmaChainNoEu(int * currBD,short srcIncr,short destIncr,int xferSize,short xferSizeIncr,int * cSave,volatile TaskTableEntry * taskTable,int channel)20 void MCD_startDmaChainNoEu(int *currBD, short srcIncr, short destIncr,
21 int xferSize, short xferSizeIncr, int *cSave,
22 volatile TaskTableEntry * taskTable, int channel)
23 {
24 volatile TaskTableEntry *taskChan = taskTable + channel;
25
26 MCD_SET_VAR(taskChan, 2, (u32) currBD); /* var[2] */
27 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr)); /* inc[1] */
28 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr)); /* inc[0] */
29 MCD_SET_VAR(taskChan, 11, (u32) xferSize); /* var[11] */
30 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr)); /* inc[2] */
31 MCD_SET_VAR(taskChan, 0, (u32) cSave); /* var[0] */
32 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */
33 MCD_SET_VAR(taskChan, 3, (u32) 0x00000000); /* var[3] */
34 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */
35 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */
36 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000); /* var[6] */
37 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */
38 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */
39 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000); /* var[9] */
40 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000); /* var[10] */
41 MCD_SET_VAR(taskChan, 12, (u32) 0x00000000); /* var[12] */
42 MCD_SET_VAR(taskChan, 13, (u32) 0x80000000); /* var[13] */
43 MCD_SET_VAR(taskChan, 14, (u32) 0x00000010); /* var[14] */
44 MCD_SET_VAR(taskChan, 15, (u32) 0x00000004); /* var[15] */
45 MCD_SET_VAR(taskChan, 16, (u32) 0x08000000); /* var[16] */
46 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000); /* inc[3] */
47 MCD_SET_VAR(taskChan, 28, (u32) 0x80000000); /* inc[4] */
48 MCD_SET_VAR(taskChan, 29, (u32) 0x80000001); /* inc[5] */
49 MCD_SET_VAR(taskChan, 30, (u32) 0x40000000); /* inc[6] */
50
51 /* Set the task's Enable bit in its Task Control Register */
52 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
53 }
54
55 /* Task 1 */
56
MCD_startDmaSingleNoEu(char * srcAddr,short srcIncr,char * destAddr,short destIncr,int dmaSize,short xferSizeIncr,int flags,int * currBD,int * cSave,volatile TaskTableEntry * taskTable,int channel)57 void MCD_startDmaSingleNoEu(char *srcAddr, short srcIncr, char *destAddr,
58 short destIncr, int dmaSize, short xferSizeIncr,
59 int flags, int *currBD, int *cSave,
60 volatile TaskTableEntry * taskTable, int channel)
61 {
62 volatile TaskTableEntry *taskChan = taskTable + channel;
63
64 MCD_SET_VAR(taskChan, 7, (u32) srcAddr); /* var[7] */
65 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr)); /* inc[1] */
66 MCD_SET_VAR(taskChan, 2, (u32) destAddr); /* var[2] */
67 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr)); /* inc[0] */
68 MCD_SET_VAR(taskChan, 3, (u32) dmaSize); /* var[3] */
69 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr)); /* inc[2] */
70 MCD_SET_VAR(taskChan, 5, (u32) flags); /* var[5] */
71 MCD_SET_VAR(taskChan, 1, (u32) currBD); /* var[1] */
72 MCD_SET_VAR(taskChan, 0, (u32) cSave); /* var[0] */
73 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */
74 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000); /* var[6] */
75 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */
76 MCD_SET_VAR(taskChan, 9, (u32) 0x00000004); /* var[9] */
77 MCD_SET_VAR(taskChan, 10, (u32) 0x08000000); /* var[10] */
78 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000); /* inc[3] */
79 MCD_SET_VAR(taskChan, 28, (u32) 0x80000001); /* inc[4] */
80 MCD_SET_VAR(taskChan, 29, (u32) 0x40000000); /* inc[5] */
81
82 /* Set the task's Enable bit in its Task Control Register */
83 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
84 }
85
86 /* Task 2 */
87
MCD_startDmaChainEu(int * currBD,short srcIncr,short destIncr,int xferSize,short xferSizeIncr,int * cSave,volatile TaskTableEntry * taskTable,int channel)88 void MCD_startDmaChainEu(int *currBD, short srcIncr, short destIncr,
89 int xferSize, short xferSizeIncr, int *cSave,
90 volatile TaskTableEntry * taskTable, int channel)
91 {
92 volatile TaskTableEntry *taskChan = taskTable + channel;
93
94 MCD_SET_VAR(taskChan, 3, (u32) currBD); /* var[3] */
95 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr)); /* inc[1] */
96 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr)); /* inc[0] */
97 MCD_SET_VAR(taskChan, 12, (u32) xferSize); /* var[12] */
98 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr)); /* inc[2] */
99 MCD_SET_VAR(taskChan, 0, (u32) cSave); /* var[0] */
100 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */
101 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000); /* var[2] */
102 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */
103 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */
104 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000); /* var[6] */
105 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */
106 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */
107 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000); /* var[9] */
108 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000); /* var[10] */
109 MCD_SET_VAR(taskChan, 11, (u32) 0x00000000); /* var[11] */
110 MCD_SET_VAR(taskChan, 13, (u32) 0x00000000); /* var[13] */
111 MCD_SET_VAR(taskChan, 14, (u32) 0x80000000); /* var[14] */
112 MCD_SET_VAR(taskChan, 15, (u32) 0x00000010); /* var[15] */
113 MCD_SET_VAR(taskChan, 16, (u32) 0x00000001); /* var[16] */
114 MCD_SET_VAR(taskChan, 17, (u32) 0x00000004); /* var[17] */
115 MCD_SET_VAR(taskChan, 18, (u32) 0x08000000); /* var[18] */
116 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000); /* inc[3] */
117 MCD_SET_VAR(taskChan, 28, (u32) 0x80000000); /* inc[4] */
118 MCD_SET_VAR(taskChan, 29, (u32) 0xc0000000); /* inc[5] */
119 MCD_SET_VAR(taskChan, 30, (u32) 0x80000001); /* inc[6] */
120 MCD_SET_VAR(taskChan, 31, (u32) 0x40000000); /* inc[7] */
121
122 /* Set the task's Enable bit in its Task Control Register */
123 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
124 }
125
126 /* Task 3 */
127
MCD_startDmaSingleEu(char * srcAddr,short srcIncr,char * destAddr,short destIncr,int dmaSize,short xferSizeIncr,int flags,int * currBD,int * cSave,volatile TaskTableEntry * taskTable,int channel)128 void MCD_startDmaSingleEu(char *srcAddr, short srcIncr, char *destAddr,
129 short destIncr, int dmaSize, short xferSizeIncr,
130 int flags, int *currBD, int *cSave,
131 volatile TaskTableEntry * taskTable, int channel)
132 {
133 volatile TaskTableEntry *taskChan = taskTable + channel;
134
135 MCD_SET_VAR(taskChan, 8, (u32) srcAddr); /* var[8] */
136 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr)); /* inc[1] */
137 MCD_SET_VAR(taskChan, 3, (u32) destAddr); /* var[3] */
138 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr)); /* inc[0] */
139 MCD_SET_VAR(taskChan, 4, (u32) dmaSize); /* var[4] */
140 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr)); /* inc[2] */
141 MCD_SET_VAR(taskChan, 6, (u32) flags); /* var[6] */
142 MCD_SET_VAR(taskChan, 2, (u32) currBD); /* var[2] */
143 MCD_SET_VAR(taskChan, 0, (u32) cSave); /* var[0] */
144 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */
145 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */
146 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */
147 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000); /* var[9] */
148 MCD_SET_VAR(taskChan, 10, (u32) 0x00000001); /* var[10] */
149 MCD_SET_VAR(taskChan, 11, (u32) 0x00000004); /* var[11] */
150 MCD_SET_VAR(taskChan, 12, (u32) 0x08000000); /* var[12] */
151 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000); /* inc[3] */
152 MCD_SET_VAR(taskChan, 28, (u32) 0xc0000000); /* inc[4] */
153 MCD_SET_VAR(taskChan, 29, (u32) 0x80000000); /* inc[5] */
154 MCD_SET_VAR(taskChan, 30, (u32) 0x80000001); /* inc[6] */
155 MCD_SET_VAR(taskChan, 31, (u32) 0x40000000); /* inc[7] */
156
157 /* Set the task's Enable bit in its Task Control Register */
158 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
159 }
160
161 /* Task 4 */
162
MCD_startDmaENetRcv(char * bDBase,char * currBD,char * rcvFifoPtr,volatile TaskTableEntry * taskTable,int channel)163 void MCD_startDmaENetRcv(char *bDBase, char *currBD, char *rcvFifoPtr,
164 volatile TaskTableEntry * taskTable, int channel)
165 {
166 volatile TaskTableEntry *taskChan = taskTable + channel;
167
168 MCD_SET_VAR(taskChan, 0, (u32) bDBase); /* var[0] */
169 MCD_SET_VAR(taskChan, 3, (u32) currBD); /* var[3] */
170 MCD_SET_VAR(taskChan, 6, (u32) rcvFifoPtr); /* var[6] */
171 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */
172 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000); /* var[2] */
173 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */
174 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */
175 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */
176 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */
177 MCD_SET_VAR(taskChan, 9, (u32) 0x0000ffff); /* var[9] */
178 MCD_SET_VAR(taskChan, 10, (u32) 0x30000000); /* var[10] */
179 MCD_SET_VAR(taskChan, 11, (u32) 0x0fffffff); /* var[11] */
180 MCD_SET_VAR(taskChan, 12, (u32) 0x00000008); /* var[12] */
181 MCD_SET_VAR(taskChan, 24, (u32) 0x00000000); /* inc[0] */
182 MCD_SET_VAR(taskChan, 25, (u32) 0x60000000); /* inc[1] */
183 MCD_SET_VAR(taskChan, 26, (u32) 0x20000004); /* inc[2] */
184 MCD_SET_VAR(taskChan, 27, (u32) 0x40000000); /* inc[3] */
185
186 /* Set the task's Enable bit in its Task Control Register */
187 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
188 }
189
190 /* Task 5 */
191
MCD_startDmaENetXmit(char * bDBase,char * currBD,char * xmitFifoPtr,volatile TaskTableEntry * taskTable,int channel)192 void MCD_startDmaENetXmit(char *bDBase, char *currBD, char *xmitFifoPtr,
193 volatile TaskTableEntry * taskTable, int channel)
194 {
195 volatile TaskTableEntry *taskChan = taskTable + channel;
196
197 MCD_SET_VAR(taskChan, 0, (u32) bDBase); /* var[0] */
198 MCD_SET_VAR(taskChan, 3, (u32) currBD); /* var[3] */
199 MCD_SET_VAR(taskChan, 11, (u32) xmitFifoPtr); /* var[11] */
200 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */
201 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000); /* var[2] */
202 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */
203 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */
204 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000); /* var[6] */
205 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */
206 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */
207 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000); /* var[9] */
208 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000); /* var[10] */
209 MCD_SET_VAR(taskChan, 12, (u32) 0x00000000); /* var[12] */
210 MCD_SET_VAR(taskChan, 13, (u32) 0x0000ffff); /* var[13] */
211 MCD_SET_VAR(taskChan, 14, (u32) 0xffffffff); /* var[14] */
212 MCD_SET_VAR(taskChan, 15, (u32) 0x00000004); /* var[15] */
213 MCD_SET_VAR(taskChan, 16, (u32) 0x00000008); /* var[16] */
214 MCD_SET_VAR(taskChan, 24, (u32) 0x00000000); /* inc[0] */
215 MCD_SET_VAR(taskChan, 25, (u32) 0x60000000); /* inc[1] */
216 MCD_SET_VAR(taskChan, 26, (u32) 0x40000000); /* inc[2] */
217 MCD_SET_VAR(taskChan, 27, (u32) 0xc000fffc); /* inc[3] */
218 MCD_SET_VAR(taskChan, 28, (u32) 0xe0000004); /* inc[4] */
219 MCD_SET_VAR(taskChan, 29, (u32) 0x80000000); /* inc[5] */
220 MCD_SET_VAR(taskChan, 30, (u32) 0x4000ffff); /* inc[6] */
221 MCD_SET_VAR(taskChan, 31, (u32) 0xe0000001); /* inc[7] */
222
223 /* Set the task's Enable bit in its Task Control Register */
224 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000;
225 }
226