blob: ca609224f557f92155613eb273c433ac0c7c25de [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glass06811952014-02-26 15:59:22 -07002/*
3 * Copyright (c) 2013 Google, Inc
4 *
5 * (C) Copyright 2012
6 * Marek Vasut <marex@denx.de>
Simon Glass06811952014-02-26 15:59:22 -07007 */
8
9#include <common.h>
Tom Rinicbb2df22015-12-07 08:23:29 -050010#include <command.h>
Simon Glass304fbef2015-06-23 15:38:35 -060011#include <dm/util.h>
Simon Glass06811952014-02-26 15:59:22 -070012
Simon Glass09140112020-05-10 11:40:03 -060013static int do_dm_dump_all(struct cmd_tbl *cmdtp, int flag, int argc,
14 char *const argv[])
Simon Glass06811952014-02-26 15:59:22 -070015{
Simon Glass304fbef2015-06-23 15:38:35 -060016 dm_dump_all();
Masahiro Yamadaa56642c2014-11-29 17:01:56 +090017
18 return 0;
19}
20
Simon Glass09140112020-05-10 11:40:03 -060021static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc,
22 char *const argv[])
Simon Glass06811952014-02-26 15:59:22 -070023{
Simon Glass304fbef2015-06-23 15:38:35 -060024 dm_dump_uclass();
Simon Glass06811952014-02-26 15:59:22 -070025
26 return 0;
27}
28
Simon Glass09140112020-05-10 11:40:03 -060029static int do_dm_dump_devres(struct cmd_tbl *cmdtp, int flag, int argc,
30 char *const argv[])
Masahiro Yamada40b6f2d2015-07-25 21:52:38 +090031{
32 dm_dump_devres();
33
34 return 0;
35}
36
Simon Glass09140112020-05-10 11:40:03 -060037static int do_dm_dump_drivers(struct cmd_tbl *cmdtp, int flag, int argc,
38 char *const argv[])
Sean Anderson7b9d60f2020-01-17 14:48:09 -050039{
40 dm_dump_drivers();
41
42 return 0;
43}
44
Niel Fourie2e488362020-03-24 16:17:05 +010045static int do_dm_dump_driver_compat(struct cmd_tbl *cmdtp, int flag, int argc,
46 char * const argv[])
47{
48 dm_dump_driver_compat();
49
50 return 0;
51}
52
53static int do_dm_dump_static_driver_info(struct cmd_tbl *cmdtp, int flag, int argc,
54 char * const argv[])
55{
56 dm_dump_static_driver_info();
57
58 return 0;
59}
60
Ovidiu Panait7f0836a2022-05-08 13:01:42 +030061#if CONFIG_IS_ENABLED(SYS_LONGHELP)
62static char dm_help_text[] =
Masahiro Yamada138c8a72018-09-07 20:31:21 +090063 "tree Dump driver model tree ('*' = activated)\n"
Masahiro Yamada40b6f2d2015-07-25 21:52:38 +090064 "dm uclass Dump list of instances for each uclass\n"
Sean Anderson7b9d60f2020-01-17 14:48:09 -050065 "dm devres Dump list of device resources for each device\n"
Niel Fourie2e488362020-03-24 16:17:05 +010066 "dm drivers Dump list of drivers with uclass and instances\n"
67 "dm compat Dump list of drivers with compatibility strings\n"
68 "dm static Dump list of drivers with static platform data"
Ovidiu Panait7f0836a2022-05-08 13:01:42 +030069 ;
70#endif
71
72U_BOOT_CMD_WITH_SUBCMDS(dm, "Driver model low level access", dm_help_text,
73 U_BOOT_SUBCMD_MKENT(tree, 1, 1, do_dm_dump_all),
74 U_BOOT_SUBCMD_MKENT(uclass, 1, 1, do_dm_dump_uclass),
75 U_BOOT_SUBCMD_MKENT(devres, 1, 1, do_dm_dump_devres),
76 U_BOOT_SUBCMD_MKENT(drivers, 1, 1, do_dm_dump_drivers),
77 U_BOOT_SUBCMD_MKENT(compat, 1, 1, do_dm_dump_driver_compat),
78 U_BOOT_SUBCMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info));