blob: ca609224f557f92155613eb273c433ac0c7c25de [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glassc267cf72014-02-26 15:59:22 -07002/*
3 * Copyright (c) 2013 Google, Inc
4 *
5 * (C) Copyright 2012
6 * Marek Vasut <marex@denx.de>
Simon Glassc267cf72014-02-26 15:59:22 -07007 */
8
9#include <common.h>
Tom Rini23415e52015-12-07 08:23:29 -050010#include <command.h>
Simon Glassd9f9a892015-06-23 15:38:35 -060011#include <dm/util.h>
Simon Glassc267cf72014-02-26 15:59:22 -070012
Simon Glassed38aef2020-05-10 11:40:03 -060013static int do_dm_dump_all(struct cmd_tbl *cmdtp, int flag, int argc,
14 char *const argv[])
Simon Glassc267cf72014-02-26 15:59:22 -070015{
Simon Glassd9f9a892015-06-23 15:38:35 -060016 dm_dump_all();
Masahiro Yamadaee7637b2014-11-29 17:01:56 +090017
18 return 0;
19}
20
Simon Glassed38aef2020-05-10 11:40:03 -060021static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc,
22 char *const argv[])
Simon Glassc267cf72014-02-26 15:59:22 -070023{
Simon Glassd9f9a892015-06-23 15:38:35 -060024 dm_dump_uclass();
Simon Glassc267cf72014-02-26 15:59:22 -070025
26 return 0;
27}
28
Simon Glassed38aef2020-05-10 11:40:03 -060029static int do_dm_dump_devres(struct cmd_tbl *cmdtp, int flag, int argc,
30 char *const argv[])
Masahiro Yamadaf929c0b2015-07-25 21:52:38 +090031{
32 dm_dump_devres();
33
34 return 0;
35}
36
Simon Glassed38aef2020-05-10 11:40:03 -060037static int do_dm_dump_drivers(struct cmd_tbl *cmdtp, int flag, int argc,
38 char *const argv[])
Sean Anderson02827572020-01-17 14:48:09 -050039{
40 dm_dump_drivers();
41
42 return 0;
43}
44
Niel Fourie39832fb2020-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 Panaite4c5b792022-05-08 13:01:42 +030061#if CONFIG_IS_ENABLED(SYS_LONGHELP)
62static char dm_help_text[] =
Masahiro Yamada8a5c8a92018-09-07 20:31:21 +090063 "tree Dump driver model tree ('*' = activated)\n"
Masahiro Yamadaf929c0b2015-07-25 21:52:38 +090064 "dm uclass Dump list of instances for each uclass\n"
Sean Anderson02827572020-01-17 14:48:09 -050065 "dm devres Dump list of device resources for each device\n"
Niel Fourie39832fb2020-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 Panaite4c5b792022-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));