1 /* 2 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. 3 * 4 * See file CREDITS for list of people who contributed to this 5 * project. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation; either version 2 of 10 * the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20 * MA 02111-1307 USA 21 */ 22 23 #include <common.h> 24 25 /* Functions for initializing variable tables of different types of tasks. */ 26 27 /* 28 * Do not edit! 29 */ 30 31 #ifdef CONFIG_FSLDMAFEC 32 33 #include <MCD_dma.h> 34 35 extern dmaRegs *MCD_dmaBar; 36 37 /* Task 0 */ 38 39 void MCD_startDmaChainNoEu(int *currBD, short srcIncr, short destIncr, 40 int xferSize, short xferSizeIncr, int *cSave, 41 volatile TaskTableEntry * taskTable, int channel) 42 { 43 volatile TaskTableEntry *taskChan = taskTable + channel; 44 45 MCD_SET_VAR(taskChan, 2, (u32) currBD); /* var[2] */ 46 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr)); /* inc[1] */ 47 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr)); /* inc[0] */ 48 MCD_SET_VAR(taskChan, 11, (u32) xferSize); /* var[11] */ 49 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr)); /* inc[2] */ 50 MCD_SET_VAR(taskChan, 0, (u32) cSave); /* var[0] */ 51 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */ 52 MCD_SET_VAR(taskChan, 3, (u32) 0x00000000); /* var[3] */ 53 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */ 54 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */ 55 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000); /* var[6] */ 56 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */ 57 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */ 58 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000); /* var[9] */ 59 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000); /* var[10] */ 60 MCD_SET_VAR(taskChan, 12, (u32) 0x00000000); /* var[12] */ 61 MCD_SET_VAR(taskChan, 13, (u32) 0x80000000); /* var[13] */ 62 MCD_SET_VAR(taskChan, 14, (u32) 0x00000010); /* var[14] */ 63 MCD_SET_VAR(taskChan, 15, (u32) 0x00000004); /* var[15] */ 64 MCD_SET_VAR(taskChan, 16, (u32) 0x08000000); /* var[16] */ 65 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000); /* inc[3] */ 66 MCD_SET_VAR(taskChan, 28, (u32) 0x80000000); /* inc[4] */ 67 MCD_SET_VAR(taskChan, 29, (u32) 0x80000001); /* inc[5] */ 68 MCD_SET_VAR(taskChan, 30, (u32) 0x40000000); /* inc[6] */ 69 70 /* Set the task's Enable bit in its Task Control Register */ 71 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000; 72 } 73 74 /* Task 1 */ 75 76 void MCD_startDmaSingleNoEu(char *srcAddr, short srcIncr, char *destAddr, 77 short destIncr, int dmaSize, short xferSizeIncr, 78 int flags, int *currBD, int *cSave, 79 volatile TaskTableEntry * taskTable, int channel) 80 { 81 volatile TaskTableEntry *taskChan = taskTable + channel; 82 83 MCD_SET_VAR(taskChan, 7, (u32) srcAddr); /* var[7] */ 84 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr)); /* inc[1] */ 85 MCD_SET_VAR(taskChan, 2, (u32) destAddr); /* var[2] */ 86 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr)); /* inc[0] */ 87 MCD_SET_VAR(taskChan, 3, (u32) dmaSize); /* var[3] */ 88 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr)); /* inc[2] */ 89 MCD_SET_VAR(taskChan, 5, (u32) flags); /* var[5] */ 90 MCD_SET_VAR(taskChan, 1, (u32) currBD); /* var[1] */ 91 MCD_SET_VAR(taskChan, 0, (u32) cSave); /* var[0] */ 92 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */ 93 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000); /* var[6] */ 94 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */ 95 MCD_SET_VAR(taskChan, 9, (u32) 0x00000004); /* var[9] */ 96 MCD_SET_VAR(taskChan, 10, (u32) 0x08000000); /* var[10] */ 97 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000); /* inc[3] */ 98 MCD_SET_VAR(taskChan, 28, (u32) 0x80000001); /* inc[4] */ 99 MCD_SET_VAR(taskChan, 29, (u32) 0x40000000); /* inc[5] */ 100 101 /* Set the task's Enable bit in its Task Control Register */ 102 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000; 103 } 104 105 /* Task 2 */ 106 107 void MCD_startDmaChainEu(int *currBD, short srcIncr, short destIncr, 108 int xferSize, short xferSizeIncr, int *cSave, 109 volatile TaskTableEntry * taskTable, int channel) 110 { 111 volatile TaskTableEntry *taskChan = taskTable + channel; 112 113 MCD_SET_VAR(taskChan, 3, (u32) currBD); /* var[3] */ 114 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr)); /* inc[1] */ 115 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr)); /* inc[0] */ 116 MCD_SET_VAR(taskChan, 12, (u32) xferSize); /* var[12] */ 117 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr)); /* inc[2] */ 118 MCD_SET_VAR(taskChan, 0, (u32) cSave); /* var[0] */ 119 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */ 120 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000); /* var[2] */ 121 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */ 122 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */ 123 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000); /* var[6] */ 124 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */ 125 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */ 126 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000); /* var[9] */ 127 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000); /* var[10] */ 128 MCD_SET_VAR(taskChan, 11, (u32) 0x00000000); /* var[11] */ 129 MCD_SET_VAR(taskChan, 13, (u32) 0x00000000); /* var[13] */ 130 MCD_SET_VAR(taskChan, 14, (u32) 0x80000000); /* var[14] */ 131 MCD_SET_VAR(taskChan, 15, (u32) 0x00000010); /* var[15] */ 132 MCD_SET_VAR(taskChan, 16, (u32) 0x00000001); /* var[16] */ 133 MCD_SET_VAR(taskChan, 17, (u32) 0x00000004); /* var[17] */ 134 MCD_SET_VAR(taskChan, 18, (u32) 0x08000000); /* var[18] */ 135 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000); /* inc[3] */ 136 MCD_SET_VAR(taskChan, 28, (u32) 0x80000000); /* inc[4] */ 137 MCD_SET_VAR(taskChan, 29, (u32) 0xc0000000); /* inc[5] */ 138 MCD_SET_VAR(taskChan, 30, (u32) 0x80000001); /* inc[6] */ 139 MCD_SET_VAR(taskChan, 31, (u32) 0x40000000); /* inc[7] */ 140 141 /* Set the task's Enable bit in its Task Control Register */ 142 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000; 143 } 144 145 /* Task 3 */ 146 147 void MCD_startDmaSingleEu(char *srcAddr, short srcIncr, char *destAddr, 148 short destIncr, int dmaSize, short xferSizeIncr, 149 int flags, int *currBD, int *cSave, 150 volatile TaskTableEntry * taskTable, int channel) 151 { 152 volatile TaskTableEntry *taskChan = taskTable + channel; 153 154 MCD_SET_VAR(taskChan, 8, (u32) srcAddr); /* var[8] */ 155 MCD_SET_VAR(taskChan, 25, (u32) (0xe000 << 16) | (0xffff & srcIncr)); /* inc[1] */ 156 MCD_SET_VAR(taskChan, 3, (u32) destAddr); /* var[3] */ 157 MCD_SET_VAR(taskChan, 24, (u32) (0xe000 << 16) | (0xffff & destIncr)); /* inc[0] */ 158 MCD_SET_VAR(taskChan, 4, (u32) dmaSize); /* var[4] */ 159 MCD_SET_VAR(taskChan, 26, (u32) (0x2000 << 16) | (0xffff & xferSizeIncr)); /* inc[2] */ 160 MCD_SET_VAR(taskChan, 6, (u32) flags); /* var[6] */ 161 MCD_SET_VAR(taskChan, 2, (u32) currBD); /* var[2] */ 162 MCD_SET_VAR(taskChan, 0, (u32) cSave); /* var[0] */ 163 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */ 164 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */ 165 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */ 166 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000); /* var[9] */ 167 MCD_SET_VAR(taskChan, 10, (u32) 0x00000001); /* var[10] */ 168 MCD_SET_VAR(taskChan, 11, (u32) 0x00000004); /* var[11] */ 169 MCD_SET_VAR(taskChan, 12, (u32) 0x08000000); /* var[12] */ 170 MCD_SET_VAR(taskChan, 27, (u32) 0x00000000); /* inc[3] */ 171 MCD_SET_VAR(taskChan, 28, (u32) 0xc0000000); /* inc[4] */ 172 MCD_SET_VAR(taskChan, 29, (u32) 0x80000000); /* inc[5] */ 173 MCD_SET_VAR(taskChan, 30, (u32) 0x80000001); /* inc[6] */ 174 MCD_SET_VAR(taskChan, 31, (u32) 0x40000000); /* inc[7] */ 175 176 /* Set the task's Enable bit in its Task Control Register */ 177 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000; 178 } 179 180 /* Task 4 */ 181 182 void MCD_startDmaENetRcv(char *bDBase, char *currBD, char *rcvFifoPtr, 183 volatile TaskTableEntry * taskTable, int channel) 184 { 185 volatile TaskTableEntry *taskChan = taskTable + channel; 186 187 MCD_SET_VAR(taskChan, 0, (u32) bDBase); /* var[0] */ 188 MCD_SET_VAR(taskChan, 3, (u32) currBD); /* var[3] */ 189 MCD_SET_VAR(taskChan, 6, (u32) rcvFifoPtr); /* var[6] */ 190 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */ 191 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000); /* var[2] */ 192 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */ 193 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */ 194 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */ 195 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */ 196 MCD_SET_VAR(taskChan, 9, (u32) 0x0000ffff); /* var[9] */ 197 MCD_SET_VAR(taskChan, 10, (u32) 0x30000000); /* var[10] */ 198 MCD_SET_VAR(taskChan, 11, (u32) 0x0fffffff); /* var[11] */ 199 MCD_SET_VAR(taskChan, 12, (u32) 0x00000008); /* var[12] */ 200 MCD_SET_VAR(taskChan, 24, (u32) 0x00000000); /* inc[0] */ 201 MCD_SET_VAR(taskChan, 25, (u32) 0x60000000); /* inc[1] */ 202 MCD_SET_VAR(taskChan, 26, (u32) 0x20000004); /* inc[2] */ 203 MCD_SET_VAR(taskChan, 27, (u32) 0x40000000); /* inc[3] */ 204 205 /* Set the task's Enable bit in its Task Control Register */ 206 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000; 207 } 208 209 /* Task 5 */ 210 211 void MCD_startDmaENetXmit(char *bDBase, char *currBD, char *xmitFifoPtr, 212 volatile TaskTableEntry * taskTable, int channel) 213 { 214 volatile TaskTableEntry *taskChan = taskTable + channel; 215 216 MCD_SET_VAR(taskChan, 0, (u32) bDBase); /* var[0] */ 217 MCD_SET_VAR(taskChan, 3, (u32) currBD); /* var[3] */ 218 MCD_SET_VAR(taskChan, 11, (u32) xmitFifoPtr); /* var[11] */ 219 MCD_SET_VAR(taskChan, 1, (u32) 0x00000000); /* var[1] */ 220 MCD_SET_VAR(taskChan, 2, (u32) 0x00000000); /* var[2] */ 221 MCD_SET_VAR(taskChan, 4, (u32) 0x00000000); /* var[4] */ 222 MCD_SET_VAR(taskChan, 5, (u32) 0x00000000); /* var[5] */ 223 MCD_SET_VAR(taskChan, 6, (u32) 0x00000000); /* var[6] */ 224 MCD_SET_VAR(taskChan, 7, (u32) 0x00000000); /* var[7] */ 225 MCD_SET_VAR(taskChan, 8, (u32) 0x00000000); /* var[8] */ 226 MCD_SET_VAR(taskChan, 9, (u32) 0x00000000); /* var[9] */ 227 MCD_SET_VAR(taskChan, 10, (u32) 0x00000000); /* var[10] */ 228 MCD_SET_VAR(taskChan, 12, (u32) 0x00000000); /* var[12] */ 229 MCD_SET_VAR(taskChan, 13, (u32) 0x0000ffff); /* var[13] */ 230 MCD_SET_VAR(taskChan, 14, (u32) 0xffffffff); /* var[14] */ 231 MCD_SET_VAR(taskChan, 15, (u32) 0x00000004); /* var[15] */ 232 MCD_SET_VAR(taskChan, 16, (u32) 0x00000008); /* var[16] */ 233 MCD_SET_VAR(taskChan, 24, (u32) 0x00000000); /* inc[0] */ 234 MCD_SET_VAR(taskChan, 25, (u32) 0x60000000); /* inc[1] */ 235 MCD_SET_VAR(taskChan, 26, (u32) 0x40000000); /* inc[2] */ 236 MCD_SET_VAR(taskChan, 27, (u32) 0xc000fffc); /* inc[3] */ 237 MCD_SET_VAR(taskChan, 28, (u32) 0xe0000004); /* inc[4] */ 238 MCD_SET_VAR(taskChan, 29, (u32) 0x80000000); /* inc[5] */ 239 MCD_SET_VAR(taskChan, 30, (u32) 0x4000ffff); /* inc[6] */ 240 MCD_SET_VAR(taskChan, 31, (u32) 0xe0000001); /* inc[7] */ 241 242 /* Set the task's Enable bit in its Task Control Register */ 243 MCD_dmaBar->taskControl[channel] |= (u16) 0x8000; 244 } 245 246 #endif /* CONFIG_FSLDMAFEC */ 247