blob: a8133ee3fa3ed46cfb421db2eef3d284616ee958 [file] [log] [blame]
Tom Rini10e47792018-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 */
wdenk38635852002-08-27 05:55:31 +000010#include <command.h>
Heinrich Schuchardt67edf462023-04-01 12:20:34 +020011#include <iomux.h>
Jean-Christophe PLAGNIOL-VILLARD2a7a0312009-05-16 12:14:54 +020012#include <stdio_dev.h>
wdenk38635852002-08-27 05:55:31 +000013
wdenk38635852002-08-27 05:55:31 +000014extern void _do_coninfo (void);
Simon Glassed38aef2020-05-10 11:40:03 -060015static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc,
16 char *const argv[])
wdenk38635852002-08-27 05:55:31 +000017{
Jean-Christophe PLAGNIOL-VILLARD8a4a7842008-08-31 04:24:55 +020018 int l;
Jean-Christophe PLAGNIOL-VILLARD2a7a0312009-05-16 12:14:54 +020019 struct list_head *list = stdio_get_list();
Jean-Christophe PLAGNIOL-VILLARD8a4a7842008-08-31 04:24:55 +020020 struct list_head *pos;
Jean-Christophe PLAGNIOL-VILLARD2a7a0312009-05-16 12:14:54 +020021 struct stdio_dev *dev;
wdenk38635852002-08-27 05:55:31 +000022
23 /* Scan for valid output and input devices */
24
Heinrich Schuchardt855d4ad2023-01-28 01:11:56 +010025 puts("List of available devices\n");
wdenk38635852002-08-27 05:55:31 +000026
Jean-Christophe PLAGNIOL-VILLARD8a4a7842008-08-31 04:24:55 +020027 list_for_each(pos, list) {
Jean-Christophe PLAGNIOL-VILLARD2a7a0312009-05-16 12:14:54 +020028 dev = list_entry(pos, struct stdio_dev, list);
wdenk38635852002-08-27 05:55:31 +000029
Heinrich Schuchardt855d4ad2023-01-28 01:11:56 +010030 printf("|-- %s (%s%s)\n",
31 dev->name,
32 (dev->flags & DEV_FLAGS_INPUT) ? "I" : "",
33 (dev->flags & DEV_FLAGS_OUTPUT) ? "O" : "");
wdenk38635852002-08-27 05:55:31 +000034
35 for (l = 0; l < MAX_FILES; l++) {
Heinrich Schuchardt67edf462023-04-01 12:20:34 +020036 if (CONFIG_IS_ENABLED(CONSOLE_MUX)) {
37 if (iomux_match_device(console_devices[l],
38 cd_count[l], dev) >= 0)
39 printf("| |-- %s\n", stdio_names[l]);
40 } else {
41 if (stdio_devices[l] == dev)
42 printf("| |-- %s\n", stdio_names[l]);
wdenk38635852002-08-27 05:55:31 +000043 }
Heinrich Schuchardt67edf462023-04-01 12:20:34 +020044
wdenk38635852002-08-27 05:55:31 +000045 }
wdenk38635852002-08-27 05:55:31 +000046 }
47 return 0;
48}
wdenk57b2d802003-06-27 21:31:46 +000049
wdenk57b2d802003-06-27 21:31:46 +000050/***************************************************/
51
wdenkf287a242003-07-01 21:06:45 +000052U_BOOT_CMD(
53 coninfo, 3, 1, do_coninfo,
Peter Tyserdfb72b82009-01-27 18:03:12 -060054 "print console devices and information",
wdenk57b2d802003-06-27 21:31:46 +000055 ""
56);