2 * (C) Copyright 2007 Michal Simek
4 * Michal SIMEK <monstr@monstr.eu>
6 * SPDX-License-Identifier: GPL-2.0+
10 * Microblaze FSL support
18 int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
22 unsigned int blocking;
27 fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
28 blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16);
29 if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
30 puts ("Bad number of FSL\n");
35 #if (XILINX_FSL_NUMBER > 0)
38 case 0: NGET (num, 0);
40 case 1: NCGET (num, 0);
44 case 3: CGET (num, 0);
51 #if (XILINX_FSL_NUMBER > 1)
54 case 0: NGET (num, 1);
56 case 1: NCGET (num, 1);
60 case 3: CGET (num, 1);
67 #if (XILINX_FSL_NUMBER > 2)
70 case 0: NGET (num, 2);
72 case 1: NCGET (num, 2);
76 case 3: CGET (num, 2);
83 #if (XILINX_FSL_NUMBER > 3)
86 case 0: NGET (num, 3);
88 case 1: NCGET (num, 3);
92 case 3: CGET (num, 3);
99 #if (XILINX_FSL_NUMBER > 4)
102 case 0: NGET (num, 4);
104 case 1: NCGET (num, 4);
106 case 2: GET (num, 4);
108 case 3: CGET (num, 4);
115 #if (XILINX_FSL_NUMBER > 5)
118 case 0: NGET (num, 5);
120 case 1: NCGET (num, 5);
122 case 2: GET (num, 5);
124 case 3: CGET (num, 5);
131 #if (XILINX_FSL_NUMBER > 6)
134 case 0: NGET (num, 6);
136 case 1: NCGET (num, 6);
138 case 2: GET (num, 6);
140 case 3: CGET (num, 6);
147 #if (XILINX_FSL_NUMBER > 7)
150 case 0: NGET (num, 7);
152 case 1: NCGET (num, 7);
154 case 2: GET (num, 7);
156 case 3: CGET (num, 7);
167 printf ("%01x: 0x%08x - %s %s read\n", fslnum, num,
168 blocking < 2 ? "non blocking" : "blocking",
169 ((blocking == 1) || (blocking == 3)) ? "control" : "data" );
173 int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
177 unsigned int blocking;
180 return CMD_RET_USAGE;
182 fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
183 num = (unsigned int)simple_strtoul (argv[2], NULL, 16);
184 blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16);
185 if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER)
186 return CMD_RET_USAGE;
189 #if (XILINX_FSL_NUMBER > 0)
192 case 0: NPUT (num, 0);
194 case 1: NCPUT (num, 0);
196 case 2: PUT (num, 0);
198 case 3: CPUT (num, 0);
205 #if (XILINX_FSL_NUMBER > 1)
208 case 0: NPUT (num, 1);
210 case 1: NCPUT (num, 1);
212 case 2: PUT (num, 1);
214 case 3: CPUT (num, 1);
221 #if (XILINX_FSL_NUMBER > 2)
224 case 0: NPUT (num, 2);
226 case 1: NCPUT (num, 2);
228 case 2: PUT (num, 2);
230 case 3: CPUT (num, 2);
237 #if (XILINX_FSL_NUMBER > 3)
240 case 0: NPUT (num, 3);
242 case 1: NCPUT (num, 3);
244 case 2: PUT (num, 3);
246 case 3: CPUT (num, 3);
253 #if (XILINX_FSL_NUMBER > 4)
256 case 0: NPUT (num, 4);
258 case 1: NCPUT (num, 4);
260 case 2: PUT (num, 4);
262 case 3: CPUT (num, 4);
269 #if (XILINX_FSL_NUMBER > 5)
272 case 0: NPUT (num, 5);
274 case 1: NCPUT (num, 5);
276 case 2: PUT (num, 5);
278 case 3: CPUT (num, 5);
285 #if (XILINX_FSL_NUMBER > 6)
288 case 0: NPUT (num, 6);
290 case 1: NCPUT (num, 6);
292 case 2: PUT (num, 6);
294 case 3: CPUT (num, 6);
301 #if (XILINX_FSL_NUMBER > 7)
304 case 0: NPUT (num, 7);
306 case 1: NCPUT (num, 7);
308 case 2: PUT (num, 7);
310 case 3: CPUT (num, 7);
321 printf ("%01x: 0x%08x - %s %s write\n", fslnum, num,
322 blocking < 2 ? "non blocking" : "blocking",
323 ((blocking == 1) || (blocking == 3)) ? "control" : "data" );
328 int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
330 unsigned int reg = 0;
331 unsigned int val = 0;
334 return CMD_RET_USAGE;
336 reg = (unsigned int)simple_strtoul (argv[1], NULL, 16);
337 val = (unsigned int)simple_strtoul (argv[2], NULL, 16);
358 puts ("Unsupported register\n");
361 printf (": 0x%08x\n", val);
365 /***************************************************/
367 U_BOOT_CMD (frd, 3, 1, do_frd,
368 "read data from FSL",
369 "- [fslnum [0|1|2|3]]\n"
370 " 0 - non blocking data read\n"
371 " 1 - non blocking control read\n"
372 " 2 - blocking data read\n"
373 " 3 - blocking control read");
375 U_BOOT_CMD (fwr, 4, 1, do_fwr,
377 "- [fslnum [0|1|2|3]]\n"
378 " 0 - non blocking data write\n"
379 " 1 - non blocking control write\n"
380 " 2 - blocking data write\n"
381 " 3 - blocking control write");
383 U_BOOT_CMD (rspr, 3, 1, do_rspr,
384 "read/write special purpose register",
385 "- reg_num [write value] read/write special purpose register\n"
386 " 1 - MSR - Machine status register\n"
387 " 3 - EAR - Exception address register\n"
388 " 5 - ESR - Exception status register");