1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2013 Google, Inc
6 * Marek Vasut <marex@denx.de>
19 static int do_dm_dump_all(struct cmd_tbl *cmdtp, int flag, int argc,
27 static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc,
35 static int do_dm_dump_devres(struct cmd_tbl *cmdtp, int flag, int argc,
43 static int do_dm_dump_drivers(struct cmd_tbl *cmdtp, int flag, int argc,
51 static int do_dm_dump_driver_compat(struct cmd_tbl *cmdtp, int flag, int argc,
54 dm_dump_driver_compat();
59 static int do_dm_dump_static_driver_info(struct cmd_tbl *cmdtp, int flag, int argc,
62 dm_dump_static_driver_info();
67 static struct cmd_tbl test_commands[] = {
68 U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""),
69 U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""),
70 U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
71 U_BOOT_CMD_MKENT(drivers, 1, 1, do_dm_dump_drivers, "", ""),
72 U_BOOT_CMD_MKENT(compat, 1, 1, do_dm_dump_driver_compat, "", ""),
73 U_BOOT_CMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info, "", ""),
76 static __maybe_unused void dm_reloc(void)
81 fixup_cmdtable(test_commands, ARRAY_SIZE(test_commands));
86 static int do_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
88 struct cmd_tbl *test_cmd;
91 #ifdef CONFIG_NEEDS_MANUAL_RELOC
97 test_cmd = find_cmd_tbl(argv[1], test_commands,
98 ARRAY_SIZE(test_commands));
101 if (!test_cmd || argc > test_cmd->maxargs)
102 return CMD_RET_USAGE;
104 ret = test_cmd->cmd(test_cmd, flag, argc, argv);
106 return cmd_process_error(test_cmd, ret);
111 "Driver model low level access",
112 "tree Dump driver model tree ('*' = activated)\n"
113 "dm uclass Dump list of instances for each uclass\n"
114 "dm devres Dump list of device resources for each device\n"
115 "dm drivers Dump list of drivers with uclass and instances\n"
116 "dm compat Dump list of drivers with compatibility strings\n"
117 "dm static Dump list of drivers with static platform data"