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