blob: 658756d9842dcca1cbc64ae694efe258ceaf936e [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Dirk Eibachf74a0272014-11-13 19:21:18 +01002/*
3 * (C) Copyright 2014
4 * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
Dirk Eibachf74a0272014-11-13 19:21:18 +01005 */
6
7#include <common.h>
8#include <command.h>
Simon Glassa73bda42015-11-08 23:47:45 -07009#include <console.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -060010#include <linux/bitops.h>
Simon Glassdbd79542020-05-10 11:40:11 -060011#include <linux/delay.h>
Dirk Eibachf74a0272014-11-13 19:21:18 +010012
13#include <gdsys_fpga.h>
14
Mario Sixdab9eaa2019-03-29 10:18:14 +010015#ifndef CONFIG_GDSYS_LEGACY_DRIVERS
16#include <dm.h>
17#include <misc.h>
18#include <regmap.h>
Simon Glass458b66a2020-11-05 06:32:05 -070019#include <sysinfo.h>
Mario Sixdab9eaa2019-03-29 10:18:14 +010020
21#include "../../../drivers/misc/gdsys_soc.h"
22#include "../../../drivers/misc/gdsys_ioep.h"
23#include "../../../drivers/misc/ihs_fpga.h"
24
25const int HEADER_WORDS = sizeof(struct io_generic_packet) / 2;
26#endif /* !CONFIG_GDSYS_LEGACY_DRIVERS */
27
Mario Sixa5d76b22019-03-29 10:18:13 +010028enum status_print_type {
29 STATUS_LOUD = 0,
30 STATUS_SILENT = 1,
31};
32
Mario Sixdab9eaa2019-03-29 10:18:14 +010033#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
Dirk Eibachf74a0272014-11-13 19:21:18 +010034enum {
Mario Sixc5d78522019-03-29 10:18:12 +010035 STATE_TX_PACKET_BUILDING = BIT(0),
36 STATE_TX_TRANSMITTING = BIT(1),
37 STATE_TX_BUFFER_FULL = BIT(2),
38 STATE_TX_ERR = BIT(3),
39 STATE_RECEIVE_TIMEOUT = BIT(4),
40 STATE_PROC_RX_STORE_TIMEOUT = BIT(5),
41 STATE_PROC_RX_RECEIVE_TIMEOUT = BIT(6),
42 STATE_RX_DIST_ERR = BIT(7),
43 STATE_RX_LENGTH_ERR = BIT(8),
44 STATE_RX_FRAME_CTR_ERR = BIT(9),
45 STATE_RX_FCS_ERR = BIT(10),
46 STATE_RX_PACKET_DROPPED = BIT(11),
47 STATE_RX_DATA_LAST = BIT(12),
48 STATE_RX_DATA_FIRST = BIT(13),
49 STATE_RX_DATA_AVAILABLE = BIT(15),
Dirk Eibachf74a0272014-11-13 19:21:18 +010050};
51
52enum {
Mario Sixc5d78522019-03-29 10:18:12 +010053 IRQ_CPU_TRANSMITBUFFER_FREE_STATUS = BIT(5),
54 IRQ_CPU_PACKET_TRANSMITTED_EVENT = BIT(6),
55 IRQ_NEW_CPU_PACKET_RECEIVED_EVENT = BIT(7),
56 IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS = BIT(8),
Dirk Eibachf74a0272014-11-13 19:21:18 +010057};
58
Mario Sixdab9eaa2019-03-29 10:18:14 +010059enum {
60 CTRL_PROC_RECEIVE_ENABLE = BIT(12),
61 CTRL_FLUSH_TRANSMIT_BUFFER = BIT(15),
62};
63
Dirk Eibachf74a0272014-11-13 19:21:18 +010064struct io_generic_packet {
65 u16 target_address;
66 u16 source_address;
67 u8 packet_type;
68 u8 bc;
69 u16 packet_length;
70} __attribute__((__packed__));
Mario Sixdab9eaa2019-03-29 10:18:14 +010071#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
Dirk Eibachf74a0272014-11-13 19:21:18 +010072
73unsigned long long rx_ctr;
74unsigned long long tx_ctr;
75unsigned long long err_ctr;
Mario Sixdab9eaa2019-03-29 10:18:14 +010076#ifndef CONFIG_GDSYS_LEGACY_DRIVERS
77struct udevice *dev;
78#endif /* !CONFIG_GDSYS_LEGACY_DRIVERS */
Dirk Eibachf74a0272014-11-13 19:21:18 +010079
Mario Sixdab9eaa2019-03-29 10:18:14 +010080#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
Mario Sixa5d76b22019-03-29 10:18:13 +010081static void io_check_status(uint fpga, u16 status, enum status_print_type type)
Dirk Eibachf74a0272014-11-13 19:21:18 +010082{
83 u16 mask = STATE_RX_DIST_ERR | STATE_RX_LENGTH_ERR |
84 STATE_RX_FRAME_CTR_ERR | STATE_RX_FCS_ERR |
85 STATE_RX_PACKET_DROPPED | STATE_TX_ERR;
86
87 if (!(status & mask)) {
88 FPGA_SET_REG(fpga, ep.rx_tx_status, status);
89 return;
90 }
91
92 err_ctr++;
93 FPGA_SET_REG(fpga, ep.rx_tx_status, status);
94
Mario Sixa5d76b22019-03-29 10:18:13 +010095 if (type == STATUS_SILENT)
Dirk Eibachf74a0272014-11-13 19:21:18 +010096 return;
97
98 if (status & STATE_RX_PACKET_DROPPED)
99 printf("RX_PACKET_DROPPED, status %04x\n", status);
100
101 if (status & STATE_RX_DIST_ERR)
102 printf("RX_DIST_ERR\n");
103 if (status & STATE_RX_LENGTH_ERR)
104 printf("RX_LENGTH_ERR\n");
105 if (status & STATE_RX_FRAME_CTR_ERR)
106 printf("RX_FRAME_CTR_ERR\n");
107 if (status & STATE_RX_FCS_ERR)
108 printf("RX_FCS_ERR\n");
109
110 if (status & STATE_TX_ERR)
111 printf("TX_ERR\n");
112}
Mario Sixdab9eaa2019-03-29 10:18:14 +0100113#else
114static void io_check_status(struct udevice *dev, enum status_print_type type)
115{
116 u16 status = 0;
117 int ret;
Dirk Eibachf74a0272014-11-13 19:21:18 +0100118
Mario Sixdab9eaa2019-03-29 10:18:14 +0100119 ret = misc_call(dev, 0, NULL, 0, &status, 0);
120 if (!ret)
121 return;
122
123 err_ctr++;
124
125 if (type != STATUS_LOUD)
126 return;
127
128 if (status & STATE_RX_PACKET_DROPPED)
129 printf("RX_PACKET_DROPPED, status %04x\n", status);
130
131 if (status & STATE_RX_DIST_ERR)
132 printf("RX_DIST_ERR\n");
133 if (status & STATE_RX_LENGTH_ERR)
134 printf("RX_LENGTH_ERR\n");
135 if (status & STATE_RX_FRAME_CTR_ERR)
136 printf("RX_FRAME_CTR_ERR\n");
137 if (status & STATE_RX_FCS_ERR)
138 printf("RX_FCS_ERR\n");
139
140 if (status & STATE_TX_ERR)
141 printf("TX_ERR\n");
142}
143#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
144
145#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
Mario Sixc5d78522019-03-29 10:18:12 +0100146static void io_send(uint fpga, uint size)
Dirk Eibachf74a0272014-11-13 19:21:18 +0100147{
Mario Sixc5d78522019-03-29 10:18:12 +0100148 uint k;
Dirk Eibachf74a0272014-11-13 19:21:18 +0100149 struct io_generic_packet packet = {
150 .source_address = 1,
151 .packet_type = 1,
152 .packet_length = size,
153 };
154 u16 *p = (u16 *)&packet;
155
156 for (k = 0; k < sizeof(packet) / 2; ++k)
157 FPGA_SET_REG(fpga, ep.transmit_data, *p++);
158
159 for (k = 0; k < (size + 1) / 2; ++k)
160 FPGA_SET_REG(fpga, ep.transmit_data, k);
161
162 FPGA_SET_REG(fpga, ep.rx_tx_control,
163 CTRL_PROC_RECEIVE_ENABLE | CTRL_FLUSH_TRANSMIT_BUFFER);
164
165 tx_ctr++;
166}
Mario Sixdab9eaa2019-03-29 10:18:14 +0100167#else
168static void io_send(struct udevice *dev, uint size)
169{
170 uint k;
171 u16 buffer[HEADER_WORDS + 128];
172 struct io_generic_packet header = {
173 .source_address = 1,
174 .packet_type = 1,
175 .packet_length = size,
176 };
177 const uint words = (size + 1) / 2;
178
179 memcpy(buffer, &header, 2 * HEADER_WORDS);
180 for (k = 0; k < words; ++k)
181 buffer[k + HEADER_WORDS] = (2 * k + 1) + ((2 * k) << 8);
Dirk Eibachf74a0272014-11-13 19:21:18 +0100182
Mario Sixdab9eaa2019-03-29 10:18:14 +0100183 misc_write(dev, 0, buffer, HEADER_WORDS + words);
184
185 tx_ctr++;
186}
187#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
188
189#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
Mario Sixc5d78522019-03-29 10:18:12 +0100190static void io_receive(uint fpga)
Dirk Eibachf74a0272014-11-13 19:21:18 +0100191{
Dirk Eibachf74a0272014-11-13 19:21:18 +0100192 u16 rx_tx_status;
193
194 FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
195
196 while (rx_tx_status & STATE_RX_DATA_AVAILABLE) {
197 u16 rx;
198
199 if (rx_tx_status & STATE_RX_DATA_LAST)
200 rx_ctr++;
201
202 FPGA_GET_REG(fpga, ep.receive_data, &rx);
203
204 FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
Dirk Eibachf74a0272014-11-13 19:21:18 +0100205 }
206}
Mario Sixdab9eaa2019-03-29 10:18:14 +0100207#else
208static void io_receive(struct udevice *dev)
209{
210 u16 buffer[HEADER_WORDS + 128];
Dirk Eibachf74a0272014-11-13 19:21:18 +0100211
Mario Sixdab9eaa2019-03-29 10:18:14 +0100212 if (!misc_read(dev, 0, buffer, 0))
213 rx_ctr++;
214}
215#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
216
217#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
Mario Sixc5d78522019-03-29 10:18:12 +0100218static void io_reflect(uint fpga)
Dirk Eibachf74a0272014-11-13 19:21:18 +0100219{
220 u16 buffer[128];
221
Mario Sixc5d78522019-03-29 10:18:12 +0100222 uint k = 0;
223 uint n;
Dirk Eibachf74a0272014-11-13 19:21:18 +0100224 u16 rx_tx_status;
225
226 FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
227
228 while (rx_tx_status & STATE_RX_DATA_AVAILABLE) {
229 FPGA_GET_REG(fpga, ep.receive_data, &buffer[k++]);
230 if (rx_tx_status & STATE_RX_DATA_LAST)
231 break;
232
233 FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
234 }
235
236 if (!k)
237 return;
238
239 for (n = 0; n < k; ++n)
240 FPGA_SET_REG(fpga, ep.transmit_data, buffer[n]);
241
242 FPGA_SET_REG(fpga, ep.rx_tx_control,
243 CTRL_PROC_RECEIVE_ENABLE | CTRL_FLUSH_TRANSMIT_BUFFER);
244
245 tx_ctr++;
246}
Mario Sixdab9eaa2019-03-29 10:18:14 +0100247#else
248static void io_reflect(struct udevice *dev)
249{
250 u16 buffer[HEADER_WORDS + 128];
251 struct io_generic_packet *header;
252
253 if (misc_read(dev, 0, buffer, 0))
254 return;
255
256 header = (struct io_generic_packet *)&buffer;
Dirk Eibachf74a0272014-11-13 19:21:18 +0100257
Mario Sixdab9eaa2019-03-29 10:18:14 +0100258 misc_write(dev, 0, buffer, HEADER_WORDS + header->packet_length);
259}
260#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
261
262#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
Dirk Eibachf74a0272014-11-13 19:21:18 +0100263/*
264 * FPGA io-endpoint reflector
265 *
266 * Syntax:
267 * ioreflect {fpga} {reportrate}
268 */
Simon Glassed38aef2020-05-10 11:40:03 -0600269int do_ioreflect(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Dirk Eibachf74a0272014-11-13 19:21:18 +0100270{
Mario Sixc5d78522019-03-29 10:18:12 +0100271 uint fpga;
272 uint rate = 0;
Dirk Eibachf74a0272014-11-13 19:21:18 +0100273 unsigned long long last_seen = 0;
274
275 if (argc < 2)
276 return CMD_RET_USAGE;
277
278 fpga = simple_strtoul(argv[1], NULL, 10);
279
280 /*
281 * If another parameter, it is the report rate in packets.
282 */
283 if (argc > 2)
284 rate = simple_strtoul(argv[2], NULL, 10);
285
Mario Sixc5d78522019-03-29 10:18:12 +0100286 /* Enable receive path */
Dirk Eibachf74a0272014-11-13 19:21:18 +0100287 FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
288
Mario Sixc5d78522019-03-29 10:18:12 +0100289 /* Set device address to dummy 1*/
Dirk Eibachf74a0272014-11-13 19:21:18 +0100290 FPGA_SET_REG(fpga, ep.device_address, 1);
291
292 rx_ctr = 0; tx_ctr = 0; err_ctr = 0;
293
294 while (1) {
295 u16 top_int;
296 u16 rx_tx_status;
297
298 FPGA_GET_REG(fpga, top_interrupt, &top_int);
299 FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
300
Mario Sixa5d76b22019-03-29 10:18:13 +0100301 io_check_status(fpga, rx_tx_status, STATUS_SILENT);
Dirk Eibachf74a0272014-11-13 19:21:18 +0100302 if ((top_int & IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS) &&
303 (top_int & IRQ_CPU_TRANSMITBUFFER_FREE_STATUS))
304 io_reflect(fpga);
305
306 if (rate) {
307 if (!(tx_ctr % rate) && (tx_ctr != last_seen))
308 printf("refl %llu, err %llu\n", tx_ctr,
309 err_ctr);
310 last_seen = tx_ctr;
311 }
312
313 if (ctrlc())
314 break;
315 }
316
317 return 0;
318}
Mario Sixdab9eaa2019-03-29 10:18:14 +0100319#else
320/*
321 * FPGA io-endpoint reflector
322 *
323 * Syntax:
324 * ioreflect {reportrate}
325 */
Simon Glassed38aef2020-05-10 11:40:03 -0600326int do_ioreflect(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Mario Sixdab9eaa2019-03-29 10:18:14 +0100327{
328 struct udevice *fpga;
329 struct regmap *map;
330 uint rate = 0;
331 unsigned long long last_seen = 0;
332
333 if (!dev) {
334 printf("No device selected\n");
335 return 1;
336 }
337
338 gdsys_soc_get_fpga(dev, &fpga);
339 regmap_init_mem(dev_ofnode(dev), &map);
340
341 /* Enable receive path */
342 misc_set_enabled(dev, true);
343
344 rx_ctr = 0; tx_ctr = 0; err_ctr = 0;
345
346 while (1) {
347 uint top_int;
348
349 ihs_fpga_get(map, top_interrupt, &top_int);
350 io_check_status(dev, STATUS_SILENT);
351 if ((top_int & IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS) &&
352 (top_int & IRQ_CPU_TRANSMITBUFFER_FREE_STATUS))
353 io_reflect(dev);
354
355 if (rate) {
356 if (!(tx_ctr % rate) && (tx_ctr != last_seen))
357 printf("refl %llu, err %llu\n", tx_ctr,
358 err_ctr);
359 last_seen = tx_ctr;
360 }
361
362 if (ctrlc())
363 break;
364 }
365
366 return 0;
367}
368#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
Dirk Eibachf74a0272014-11-13 19:21:18 +0100369
Mario Sixc5d78522019-03-29 10:18:12 +0100370#define DISP_LINE_LEN 16
371
Mario Sixdab9eaa2019-03-29 10:18:14 +0100372#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
Dirk Eibachf74a0272014-11-13 19:21:18 +0100373/*
374 * FPGA io-endpoint looptest
375 *
376 * Syntax:
377 * ioloop {fpga} {size} {rate}
378 */
Simon Glassed38aef2020-05-10 11:40:03 -0600379int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Dirk Eibachf74a0272014-11-13 19:21:18 +0100380{
Mario Sixc5d78522019-03-29 10:18:12 +0100381 uint fpga;
382 uint size;
383 uint rate = 0;
Dirk Eibachf74a0272014-11-13 19:21:18 +0100384
385 if (argc < 3)
386 return CMD_RET_USAGE;
387
388 /*
389 * FPGA is specified since argc > 2
390 */
391 fpga = simple_strtoul(argv[1], NULL, 10);
392
393 /*
394 * packet size is specified since argc > 2
395 */
396 size = simple_strtoul(argv[2], NULL, 10);
397
398 /*
399 * If another parameter, it is the test rate in packets per second.
400 */
401 if (argc > 3)
402 rate = simple_strtoul(argv[3], NULL, 10);
403
404 /* enable receive path */
405 FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
406
407 /* set device address to dummy 1*/
408 FPGA_SET_REG(fpga, ep.device_address, 1);
409
410 rx_ctr = 0; tx_ctr = 0; err_ctr = 0;
411
412 while (1) {
413 u16 top_int;
414 u16 rx_tx_status;
415
416 FPGA_GET_REG(fpga, top_interrupt, &top_int);
417 FPGA_GET_REG(fpga, ep.rx_tx_status, &rx_tx_status);
418
Mario Sixa5d76b22019-03-29 10:18:13 +0100419 io_check_status(fpga, rx_tx_status, STATUS_LOUD);
Dirk Eibachf74a0272014-11-13 19:21:18 +0100420 if (top_int & IRQ_CPU_TRANSMITBUFFER_FREE_STATUS)
421 io_send(fpga, size);
422 if (top_int & IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS)
423 io_receive(fpga);
424
425 if (rate) {
426 if (ctrlc())
427 break;
428 udelay(1000000 / rate);
429 if (!(tx_ctr % rate))
Mario Sixc5d78522019-03-29 10:18:12 +0100430 printf("d %llu, tx %llu, rx %llu, err %llu\n",
Dirk Eibachf74a0272014-11-13 19:21:18 +0100431 tx_ctr - rx_ctr, tx_ctr, rx_ctr,
432 err_ctr);
433 }
434 }
435
436 return 0;
437}
Mario Sixdab9eaa2019-03-29 10:18:14 +0100438#else
439/*
440 * FPGA io-endpoint looptest
441 *
442 * Syntax:
443 * ioloop {size} {rate}
444 */
Simon Glassed38aef2020-05-10 11:40:03 -0600445int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Mario Sixdab9eaa2019-03-29 10:18:14 +0100446{
447 uint size;
448 uint rate = 0;
449 struct udevice *fpga;
450 struct regmap *map;
451
452 if (!dev) {
453 printf("No device selected\n");
454 return 1;
455 }
Dirk Eibachf74a0272014-11-13 19:21:18 +0100456
Mario Sixdab9eaa2019-03-29 10:18:14 +0100457 gdsys_soc_get_fpga(dev, &fpga);
458 regmap_init_mem(dev_ofnode(dev), &map);
459
460 if (argc < 2)
461 return CMD_RET_USAGE;
462
463 /*
464 * packet size is specified since argc > 1
465 */
466 size = simple_strtoul(argv[2], NULL, 10);
467
468 /*
469 * If another parameter, it is the test rate in packets per second.
470 */
471 if (argc > 2)
472 rate = simple_strtoul(argv[3], NULL, 10);
473
474 /* Enable receive path */
475 misc_set_enabled(dev, true);
476
477 rx_ctr = 0; tx_ctr = 0; err_ctr = 0;
478
479 while (1) {
480 uint top_int;
481
482 if (ctrlc())
483 break;
484
485 ihs_fpga_get(map, top_interrupt, &top_int);
486
487 io_check_status(dev, STATUS_LOUD);
488 if (top_int & IRQ_CPU_TRANSMITBUFFER_FREE_STATUS)
489 io_send(dev, size);
490 if (top_int & IRQ_CPU_RECEIVE_DATA_AVAILABLE_STATUS)
491 io_receive(dev);
492
493 if (rate) {
494 udelay(1000000 / rate);
495 if (!(tx_ctr % rate))
496 printf("d %llu, tx %llu, rx %llu, err %llu\n",
497 tx_ctr - rx_ctr, tx_ctr, rx_ctr,
498 err_ctr);
499 }
500 }
501 return 0;
502}
503#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
504
505#ifndef CONFIG_GDSYS_LEGACY_DRIVERS
Simon Glassed38aef2020-05-10 11:40:03 -0600506int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Mario Sixdab9eaa2019-03-29 10:18:14 +0100507{
508 struct udevice *ioep = NULL;
Simon Glass458b66a2020-11-05 06:32:05 -0700509 struct udevice *sysinfo;
Mario Sixdab9eaa2019-03-29 10:18:14 +0100510 char name[8];
511 int ret;
512
Simon Glass458b66a2020-11-05 06:32:05 -0700513 if (sysinfo_get(&sysinfo))
Mario Sixdab9eaa2019-03-29 10:18:14 +0100514 return CMD_RET_FAILURE;
515
516 if (argc > 1) {
517 int i = simple_strtoul(argv[1], NULL, 10);
518
519 snprintf(name, sizeof(name), "ioep%d", i);
520
Simon Glass458b66a2020-11-05 06:32:05 -0700521 ret = uclass_get_device_by_phandle(UCLASS_MISC, sysinfo, name,
522 &ioep);
Mario Sixdab9eaa2019-03-29 10:18:14 +0100523
524 if (ret || !ioep) {
525 printf("Invalid IOEP %d\n", i);
526 return CMD_RET_FAILURE;
527 }
528
529 dev = ioep;
530 } else {
531 int i = 0;
532
533 while (1) {
534 snprintf(name, sizeof(name), "ioep%d", i);
535
Simon Glass458b66a2020-11-05 06:32:05 -0700536 ret = uclass_get_device_by_phandle(UCLASS_MISC, sysinfo,
537 name, &ioep);
Mario Sixdab9eaa2019-03-29 10:18:14 +0100538
539 if (ret || !ioep)
540 break;
541
542 printf("IOEP %d:\t%s\n", i++, ioep->name);
543 }
544
545 if (dev)
546 printf("\nSelected IOEP: %s\n", dev->name);
547 else
548 puts("\nNo IOEP selected.\n");
549 }
550
551 return 0;
552}
553#endif /* !CONFIG_GDSYS_LEGACY_DRIVERS */
554
555#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
Dirk Eibachf74a0272014-11-13 19:21:18 +0100556U_BOOT_CMD(
557 ioloop, 4, 0, do_ioloop,
558 "fpga io-endpoint looptest",
559 "fpga packetsize [packets/sec]"
560);
561
562U_BOOT_CMD(
563 ioreflect, 3, 0, do_ioreflect,
564 "fpga io-endpoint reflector",
565 "fpga reportrate"
566);
Mario Sixdab9eaa2019-03-29 10:18:14 +0100567#else
568U_BOOT_CMD(
569 ioloop, 3, 0, do_ioloop,
570 "fpga io-endpoint looptest",
571 "packetsize [packets/sec]"
572);
573
574U_BOOT_CMD(
575 ioreflect, 2, 0, do_ioreflect,
576 "fpga io-endpoint reflector",
577 "reportrate"
578);
579
580U_BOOT_CMD(
581 iodev, 2, 0, do_iodev,
582 "fpga io-endpoint listing/selection",
583 "[ioep device to select]"
584);
585#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */