1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2007 Michal Simek
5 * Michal SIMEK <monstr@monstr.eu>
9 * Microblaze FSL support
17 int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
21 unsigned int blocking;
26 fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
27 blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16);
28 if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
29 puts ("Bad number of FSL\n");
34 #if (XILINX_FSL_NUMBER > 0)
37 case 0: NGET (num, 0);
39 case 1: NCGET (num, 0);
43 case 3: CGET (num, 0);
50 #if (XILINX_FSL_NUMBER > 1)
53 case 0: NGET (num, 1);
55 case 1: NCGET (num, 1);
59 case 3: CGET (num, 1);
66 #if (XILINX_FSL_NUMBER > 2)
69 case 0: NGET (num, 2);
71 case 1: NCGET (num, 2);
75 case 3: CGET (num, 2);
82 #if (XILINX_FSL_NUMBER > 3)
85 case 0: NGET (num, 3);
87 case 1: NCGET (num, 3);
91 case 3: CGET (num, 3);
98 #if (XILINX_FSL_NUMBER > 4)
101 case 0: NGET (num, 4);
103 case 1: NCGET (num, 4);
105 case 2: GET (num, 4);
107 case 3: CGET (num, 4);
114 #if (XILINX_FSL_NUMBER > 5)
117 case 0: NGET (num, 5);
119 case 1: NCGET (num, 5);
121 case 2: GET (num, 5);
123 case 3: CGET (num, 5);
130 #if (XILINX_FSL_NUMBER > 6)
133 case 0: NGET (num, 6);
135 case 1: NCGET (num, 6);
137 case 2: GET (num, 6);
139 case 3: CGET (num, 6);
146 #if (XILINX_FSL_NUMBER > 7)
149 case 0: NGET (num, 7);
151 case 1: NCGET (num, 7);
153 case 2: GET (num, 7);
155 case 3: CGET (num, 7);
166 printf ("%01x: 0x%08x - %s %s read\n", fslnum, num,
167 blocking < 2 ? "non blocking" : "blocking",
168 ((blocking == 1) || (blocking == 3)) ? "control" : "data" );
172 int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
176 unsigned int blocking;
179 return CMD_RET_USAGE;
181 fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
182 num = (unsigned int)simple_strtoul (argv[2], NULL, 16);
183 blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16);
184 if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER)
185 return CMD_RET_USAGE;
188 #if (XILINX_FSL_NUMBER > 0)
191 case 0: NPUT (num, 0);
193 case 1: NCPUT (num, 0);
195 case 2: PUT (num, 0);
197 case 3: CPUT (num, 0);
204 #if (XILINX_FSL_NUMBER > 1)
207 case 0: NPUT (num, 1);
209 case 1: NCPUT (num, 1);
211 case 2: PUT (num, 1);
213 case 3: CPUT (num, 1);
220 #if (XILINX_FSL_NUMBER > 2)
223 case 0: NPUT (num, 2);
225 case 1: NCPUT (num, 2);
227 case 2: PUT (num, 2);
229 case 3: CPUT (num, 2);
236 #if (XILINX_FSL_NUMBER > 3)
239 case 0: NPUT (num, 3);
241 case 1: NCPUT (num, 3);
243 case 2: PUT (num, 3);
245 case 3: CPUT (num, 3);
252 #if (XILINX_FSL_NUMBER > 4)
255 case 0: NPUT (num, 4);
257 case 1: NCPUT (num, 4);
259 case 2: PUT (num, 4);
261 case 3: CPUT (num, 4);
268 #if (XILINX_FSL_NUMBER > 5)
271 case 0: NPUT (num, 5);
273 case 1: NCPUT (num, 5);
275 case 2: PUT (num, 5);
277 case 3: CPUT (num, 5);
284 #if (XILINX_FSL_NUMBER > 6)
287 case 0: NPUT (num, 6);
289 case 1: NCPUT (num, 6);
291 case 2: PUT (num, 6);
293 case 3: CPUT (num, 6);
300 #if (XILINX_FSL_NUMBER > 7)
303 case 0: NPUT (num, 7);
305 case 1: NCPUT (num, 7);
307 case 2: PUT (num, 7);
309 case 3: CPUT (num, 7);
320 printf ("%01x: 0x%08x - %s %s write\n", fslnum, num,
321 blocking < 2 ? "non blocking" : "blocking",
322 ((blocking == 1) || (blocking == 3)) ? "control" : "data" );
327 int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
329 unsigned int reg = 0;
330 unsigned int val = 0;
333 return CMD_RET_USAGE;
335 reg = (unsigned int)simple_strtoul (argv[1], NULL, 16);
336 val = (unsigned int)simple_strtoul (argv[2], NULL, 16);
357 puts ("Unsupported register\n");
360 printf (": 0x%08x\n", val);
364 /***************************************************/
366 U_BOOT_CMD (frd, 3, 1, do_frd,
367 "read data from FSL",
368 "- [fslnum [0|1|2|3]]\n"
369 " 0 - non blocking data read\n"
370 " 1 - non blocking control read\n"
371 " 2 - blocking data read\n"
372 " 3 - blocking control read");
374 U_BOOT_CMD (fwr, 4, 1, do_fwr,
376 "- [fslnum [0|1|2|3]]\n"
377 " 0 - non blocking data write\n"
378 " 1 - non blocking control write\n"
379 " 2 - blocking data write\n"
380 " 3 - blocking control write");
382 U_BOOT_CMD (rspr, 3, 1, do_rspr,
383 "read/write special purpose register",
384 "- reg_num [write value] read/write special purpose register\n"
385 " 1 - MSR - Machine status register\n"
386 " 3 - EAR - Exception address register\n"
387 " 5 - ESR - Exception status register");