blob: 58c2cf1c8943e177bc47201c39073b03d17b00d9 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenk38635852002-08-27 05:55:31 +00002/*
3 * (C) Copyright 2000
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenk38635852002-08-27 05:55:31 +00005 */
6
7/*
8 * Boot support
9 */
Tom Rinid678a592024-05-18 20:20:43 -060010#include <common.h>
wdenk38635852002-08-27 05:55:31 +000011#include <command.h>
Heinrich Schuchardtd9d07d72023-04-01 12:20:34 +020012#include <iomux.h>
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020013#include <stdio_dev.h>
wdenk38635852002-08-27 05:55:31 +000014
wdenk38635852002-08-27 05:55:31 +000015extern void _do_coninfo (void);
Simon Glass09140112020-05-10 11:40:03 -060016static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc,
17 char *const argv[])
wdenk38635852002-08-27 05:55:31 +000018{
Jean-Christophe PLAGNIOL-VILLARDc1de7a62008-08-31 04:24:55 +020019 int l;
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020020 struct list_head *list = stdio_get_list();
Jean-Christophe PLAGNIOL-VILLARDc1de7a62008-08-31 04:24:55 +020021 struct list_head *pos;
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020022 struct stdio_dev *dev;
wdenk38635852002-08-27 05:55:31 +000023
24 /* Scan for valid output and input devices */
25
Heinrich Schuchardtfe34e162023-01-28 01:11:56 +010026 puts("List of available devices\n");
wdenk38635852002-08-27 05:55:31 +000027
Jean-Christophe PLAGNIOL-VILLARDc1de7a62008-08-31 04:24:55 +020028 list_for_each(pos, list) {
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020029 dev = list_entry(pos, struct stdio_dev, list);
wdenk38635852002-08-27 05:55:31 +000030
Heinrich Schuchardtfe34e162023-01-28 01:11:56 +010031 printf("|-- %s (%s%s)\n",
32 dev->name,
33 (dev->flags & DEV_FLAGS_INPUT) ? "I" : "",
34 (dev->flags & DEV_FLAGS_OUTPUT) ? "O" : "");
wdenk38635852002-08-27 05:55:31 +000035
36 for (l = 0; l < MAX_FILES; l++) {
Heinrich Schuchardtd9d07d72023-04-01 12:20:34 +020037 if (CONFIG_IS_ENABLED(CONSOLE_MUX)) {
38 if (iomux_match_device(console_devices[l],
39 cd_count[l], dev) >= 0)
40 printf("| |-- %s\n", stdio_names[l]);
41 } else {
42 if (stdio_devices[l] == dev)
43 printf("| |-- %s\n", stdio_names[l]);
wdenk38635852002-08-27 05:55:31 +000044 }
Heinrich Schuchardtd9d07d72023-04-01 12:20:34 +020045
wdenk38635852002-08-27 05:55:31 +000046 }
wdenk38635852002-08-27 05:55:31 +000047 }
48 return 0;
49}
wdenk8bde7f72003-06-27 21:31:46 +000050
51
52/***************************************************/
53
wdenk0d498392003-07-01 21:06:45 +000054U_BOOT_CMD(
55 coninfo, 3, 1, do_coninfo,
Peter Tyser2fb26042009-01-27 18:03:12 -060056 "print console devices and information",
wdenk8bde7f72003-06-27 21:31:46 +000057 ""
58);