Blame view
common/cmd_mfsl.c
6.66 KB
100ea07e3 common: fsl: Fix ... |
1 2 3 4 |
/* * (C) Copyright 2007 Michal Simek * * Michal SIMEK <monstr@monstr.eu> |
f7e2e0eb0 new: FSL and MSR ... |
5 |
* |
1a4596601 Add GPL-2.0+ SPDX... |
6 |
* SPDX-License-Identifier: GPL-2.0+ |
f7e2e0eb0 new: FSL and MSR ... |
7 8 9 10 11 12 13 14 15 |
*/ /* * Microblaze FSL support */ #include <common.h> #include <config.h> #include <command.h> |
70124c260 Fix compile probl... |
16 |
#include <asm/asm.h> |
f7e2e0eb0 new: FSL and MSR ... |
17 |
|
54841ab50 Make sure that ar... |
18 |
int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
f7e2e0eb0 new: FSL and MSR ... |
19 20 21 22 |
{ unsigned int fslnum; unsigned int num; unsigned int blocking; |
47e26b1bf cmd_usage(): simp... |
23 |
if (argc < 2) |
4c12eeb8b Convert cmd_usage... |
24 |
return CMD_RET_USAGE; |
f7e2e0eb0 new: FSL and MSR ... |
25 26 27 28 29 30 |
fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16); blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16); if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) { puts ("Bad number of FSL "); |
4c12eeb8b Convert cmd_usage... |
31 |
return CMD_RET_USAGE; |
f7e2e0eb0 new: FSL and MSR ... |
32 33 34 35 36 |
} switch (fslnum) { #if (XILINX_FSL_NUMBER > 0) case 0: |
ab874d504 add: FSL control ... |
37 38 39 40 41 42 43 44 45 46 47 |
switch (blocking) { case 0: NGET (num, 0); break; case 1: NCGET (num, 0); break; case 2: GET (num, 0); break; case 3: CGET (num, 0); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
48 49 50 51 52 |
} break; #endif #if (XILINX_FSL_NUMBER > 1) case 1: |
ab874d504 add: FSL control ... |
53 54 55 56 57 58 59 60 61 62 63 |
switch (blocking) { case 0: NGET (num, 1); break; case 1: NCGET (num, 1); break; case 2: GET (num, 1); break; case 3: CGET (num, 1); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
64 65 66 67 68 |
} break; #endif #if (XILINX_FSL_NUMBER > 2) case 2: |
ab874d504 add: FSL control ... |
69 70 71 72 73 74 75 76 77 78 79 |
switch (blocking) { case 0: NGET (num, 2); break; case 1: NCGET (num, 2); break; case 2: GET (num, 2); break; case 3: CGET (num, 2); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
80 81 82 83 84 |
} break; #endif #if (XILINX_FSL_NUMBER > 3) case 3: |
ab874d504 add: FSL control ... |
85 86 87 88 89 90 91 92 93 94 95 |
switch (blocking) { case 0: NGET (num, 3); break; case 1: NCGET (num, 3); break; case 2: GET (num, 3); break; case 3: CGET (num, 3); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
96 97 98 99 100 |
} break; #endif #if (XILINX_FSL_NUMBER > 4) case 4: |
ab874d504 add: FSL control ... |
101 102 103 104 105 106 107 108 109 110 111 |
switch (blocking) { case 0: NGET (num, 4); break; case 1: NCGET (num, 4); break; case 2: GET (num, 4); break; case 3: CGET (num, 4); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
112 113 114 115 116 |
} break; #endif #if (XILINX_FSL_NUMBER > 5) case 5: |
ab874d504 add: FSL control ... |
117 118 119 120 121 122 123 124 125 126 127 |
switch (blocking) { case 0: NGET (num, 5); break; case 1: NCGET (num, 5); break; case 2: GET (num, 5); break; case 3: CGET (num, 5); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
128 129 130 131 132 |
} break; #endif #if (XILINX_FSL_NUMBER > 6) case 6: |
ab874d504 add: FSL control ... |
133 134 135 136 137 138 139 140 141 142 143 |
switch (blocking) { case 0: NGET (num, 6); break; case 1: NCGET (num, 6); break; case 2: GET (num, 6); break; case 3: CGET (num, 6); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
144 145 146 147 148 |
} break; #endif #if (XILINX_FSL_NUMBER > 7) case 7: |
ab874d504 add: FSL control ... |
149 150 151 152 153 154 155 156 157 158 159 |
switch (blocking) { case 0: NGET (num, 7); break; case 1: NCGET (num, 7); break; case 2: GET (num, 7); break; case 3: CGET (num, 7); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
160 161 162 163 164 165 |
} break; #endif default: return 1; } |
f2302d443 Fix merge problems |
166 167 |
printf ("%01x: 0x%08x - %s %s read ", fslnum, num, |
ab874d504 add: FSL control ... |
168 169 |
blocking < 2 ? "non blocking" : "blocking", ((blocking == 1) || (blocking == 3)) ? "control" : "data" ); |
f7e2e0eb0 new: FSL and MSR ... |
170 171 |
return 0; } |
54841ab50 Make sure that ar... |
172 |
int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
f7e2e0eb0 new: FSL and MSR ... |
173 174 175 176 |
{ unsigned int fslnum; unsigned int num; unsigned int blocking; |
47e26b1bf cmd_usage(): simp... |
177 |
if (argc < 3) |
4c12eeb8b Convert cmd_usage... |
178 |
return CMD_RET_USAGE; |
f7e2e0eb0 new: FSL and MSR ... |
179 180 181 182 |
fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16); num = (unsigned int)simple_strtoul (argv[2], NULL, 16); blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16); |
47e26b1bf cmd_usage(): simp... |
183 |
if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) |
4c12eeb8b Convert cmd_usage... |
184 |
return CMD_RET_USAGE; |
f7e2e0eb0 new: FSL and MSR ... |
185 186 187 188 |
switch (fslnum) { #if (XILINX_FSL_NUMBER > 0) case 0: |
ab874d504 add: FSL control ... |
189 190 191 192 193 194 195 196 197 198 199 |
switch (blocking) { case 0: NPUT (num, 0); break; case 1: NCPUT (num, 0); break; case 2: PUT (num, 0); break; case 3: CPUT (num, 0); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
200 201 202 203 204 |
} break; #endif #if (XILINX_FSL_NUMBER > 1) case 1: |
ab874d504 add: FSL control ... |
205 206 207 208 209 210 211 212 213 214 215 |
switch (blocking) { case 0: NPUT (num, 1); break; case 1: NCPUT (num, 1); break; case 2: PUT (num, 1); break; case 3: CPUT (num, 1); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
216 217 218 219 220 |
} break; #endif #if (XILINX_FSL_NUMBER > 2) case 2: |
ab874d504 add: FSL control ... |
221 222 223 224 225 226 227 228 229 230 231 |
switch (blocking) { case 0: NPUT (num, 2); break; case 1: NCPUT (num, 2); break; case 2: PUT (num, 2); break; case 3: CPUT (num, 2); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
232 233 234 235 236 |
} break; #endif #if (XILINX_FSL_NUMBER > 3) case 3: |
ab874d504 add: FSL control ... |
237 238 239 240 241 242 243 244 245 246 247 |
switch (blocking) { case 0: NPUT (num, 3); break; case 1: NCPUT (num, 3); break; case 2: PUT (num, 3); break; case 3: CPUT (num, 3); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
248 249 250 251 252 |
} break; #endif #if (XILINX_FSL_NUMBER > 4) case 4: |
ab874d504 add: FSL control ... |
253 254 255 256 257 258 259 260 261 262 263 |
switch (blocking) { case 0: NPUT (num, 4); break; case 1: NCPUT (num, 4); break; case 2: PUT (num, 4); break; case 3: CPUT (num, 4); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
264 265 266 267 268 |
} break; #endif #if (XILINX_FSL_NUMBER > 5) case 5: |
ab874d504 add: FSL control ... |
269 270 271 272 273 274 275 276 277 278 279 |
switch (blocking) { case 0: NPUT (num, 5); break; case 1: NCPUT (num, 5); break; case 2: PUT (num, 5); break; case 3: CPUT (num, 5); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
280 281 282 283 284 |
} break; #endif #if (XILINX_FSL_NUMBER > 6) case 6: |
ab874d504 add: FSL control ... |
285 286 287 288 289 290 291 292 293 294 295 |
switch (blocking) { case 0: NPUT (num, 6); break; case 1: NCPUT (num, 6); break; case 2: PUT (num, 6); break; case 3: CPUT (num, 6); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
296 297 298 299 300 |
} break; #endif #if (XILINX_FSL_NUMBER > 7) case 7: |
ab874d504 add: FSL control ... |
301 302 303 304 305 306 307 308 309 310 311 |
switch (blocking) { case 0: NPUT (num, 7); break; case 1: NCPUT (num, 7); break; case 2: PUT (num, 7); break; case 3: CPUT (num, 7); break; default: return 2; |
f7e2e0eb0 new: FSL and MSR ... |
312 313 314 315 316 317 |
} break; #endif default: return 1; } |
f2302d443 Fix merge problems |
318 319 |
printf ("%01x: 0x%08x - %s %s write ", fslnum, num, |
ab874d504 add: FSL control ... |
320 321 |
blocking < 2 ? "non blocking" : "blocking", ((blocking == 1) || (blocking == 3)) ? "control" : "data" ); |
f7e2e0eb0 new: FSL and MSR ... |
322 323 324 |
return 0; } |
54841ab50 Make sure that ar... |
325 |
int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
f7e2e0eb0 new: FSL and MSR ... |
326 |
{ |
e69f66c6e add: reading spec... |
327 |
unsigned int reg = 0; |
48fbd3a4c new: add writing ... |
328 |
unsigned int val = 0; |
f7e2e0eb0 new: FSL and MSR ... |
329 |
|
47e26b1bf cmd_usage(): simp... |
330 |
if (argc < 2) |
4c12eeb8b Convert cmd_usage... |
331 |
return CMD_RET_USAGE; |
47e26b1bf cmd_usage(): simp... |
332 |
|
481d43286 [FIX] repair MFSL... |
333 334 |
reg = (unsigned int)simple_strtoul (argv[1], NULL, 16); val = (unsigned int)simple_strtoul (argv[2], NULL, 16); |
e69f66c6e add: reading spec... |
335 336 337 338 339 340 |
switch (reg) { case 0x1: if (argc > 2) { MTS (val, rmsr); NOP; MFS (val, rmsr); |
e69f66c6e add: reading spec... |
341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
} else { MFS (val, rmsr); } puts ("MSR"); break; case 0x3: MFS (val, rear); puts ("EAR"); break; case 0x5: MFS (val, resr); puts ("ESR"); break; default: |
481d43286 [FIX] repair MFSL... |
355 356 |
puts ("Unsupported register "); |
e69f66c6e add: reading spec... |
357 |
return 1; |
48fbd3a4c new: add writing ... |
358 |
} |
f2302d443 Fix merge problems |
359 360 |
printf (": 0x%08x ", val); |
f7e2e0eb0 new: FSL and MSR ... |
361 362 363 364 365 366 |
return 0; } /***************************************************/ U_BOOT_CMD (frd, 3, 1, do_frd, |
2fb2604d5 Command usage cle... |
367 |
"read data from FSL", |
ab874d504 add: FSL control ... |
368 369 370 371 372 373 374 375 |
"- [fslnum [0|1|2|3]] " " 0 - non blocking data read " " 1 - non blocking control read " " 2 - blocking data read " |
a89c33db9 General help mess... |
376 |
" 3 - blocking control read"); |
f7e2e0eb0 new: FSL and MSR ... |
377 378 |
U_BOOT_CMD (fwr, 4, 1, do_fwr, |
2fb2604d5 Command usage cle... |
379 |
"write data to FSL", |
ab874d504 add: FSL control ... |
380 381 382 383 384 385 386 387 |
"- [fslnum [0|1|2|3]] " " 0 - non blocking data write " " 1 - non blocking control write " " 2 - blocking data write " |
a89c33db9 General help mess... |
388 |
" 3 - blocking control write"); |
f7e2e0eb0 new: FSL and MSR ... |
389 |
|
e69f66c6e add: reading spec... |
390 |
U_BOOT_CMD (rspr, 3, 1, do_rspr, |
2fb2604d5 Command usage cle... |
391 |
"read/write special purpose register", |
e69f66c6e add: reading spec... |
392 393 |
"- reg_num [write value] read/write special purpose register " |
481d43286 [FIX] repair MFSL... |
394 395 396 397 |
" 1 - MSR - Machine status register " " 3 - EAR - Exception address register " |
a89c33db9 General help mess... |
398 |
" 5 - ESR - Exception status register"); |