Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 0681195 | 2014-02-26 15:59:22 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2013 Google, Inc |
| 4 | * |
| 5 | * (C) Copyright 2012 |
| 6 | * Marek Vasut <marex@denx.de> |
Simon Glass | 0681195 | 2014-02-26 15:59:22 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <common.h> |
Tom Rini | cbb2df2 | 2015-12-07 08:23:29 -0500 | [diff] [blame] | 10 | #include <command.h> |
Simon Glass | 304fbef | 2015-06-23 15:38:35 -0600 | [diff] [blame] | 11 | #include <dm/util.h> |
Simon Glass | 0681195 | 2014-02-26 15:59:22 -0700 | [diff] [blame] | 12 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 13 | static int do_dm_dump_all(struct cmd_tbl *cmdtp, int flag, int argc, |
| 14 | char *const argv[]) |
Simon Glass | 0681195 | 2014-02-26 15:59:22 -0700 | [diff] [blame] | 15 | { |
Simon Glass | 304fbef | 2015-06-23 15:38:35 -0600 | [diff] [blame] | 16 | dm_dump_all(); |
Masahiro Yamada | a56642c | 2014-11-29 17:01:56 +0900 | [diff] [blame] | 17 | |
| 18 | return 0; |
| 19 | } |
| 20 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 21 | static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc, |
| 22 | char *const argv[]) |
Simon Glass | 0681195 | 2014-02-26 15:59:22 -0700 | [diff] [blame] | 23 | { |
Simon Glass | 304fbef | 2015-06-23 15:38:35 -0600 | [diff] [blame] | 24 | dm_dump_uclass(); |
Simon Glass | 0681195 | 2014-02-26 15:59:22 -0700 | [diff] [blame] | 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 29 | static int do_dm_dump_devres(struct cmd_tbl *cmdtp, int flag, int argc, |
| 30 | char *const argv[]) |
Masahiro Yamada | 40b6f2d | 2015-07-25 21:52:38 +0900 | [diff] [blame] | 31 | { |
| 32 | dm_dump_devres(); |
| 33 | |
| 34 | return 0; |
| 35 | } |
| 36 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 37 | static int do_dm_dump_drivers(struct cmd_tbl *cmdtp, int flag, int argc, |
| 38 | char *const argv[]) |
Sean Anderson | 7b9d60f | 2020-01-17 14:48:09 -0500 | [diff] [blame] | 39 | { |
| 40 | dm_dump_drivers(); |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |
Niel Fourie | 2e48836 | 2020-03-24 16:17:05 +0100 | [diff] [blame] | 45 | static 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 | |
| 53 | static 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 Panait | 7f0836a | 2022-05-08 13:01:42 +0300 | [diff] [blame] | 61 | #if CONFIG_IS_ENABLED(SYS_LONGHELP) |
| 62 | static char dm_help_text[] = |
Masahiro Yamada | 138c8a7 | 2018-09-07 20:31:21 +0900 | [diff] [blame] | 63 | "tree Dump driver model tree ('*' = activated)\n" |
Masahiro Yamada | 40b6f2d | 2015-07-25 21:52:38 +0900 | [diff] [blame] | 64 | "dm uclass Dump list of instances for each uclass\n" |
Sean Anderson | 7b9d60f | 2020-01-17 14:48:09 -0500 | [diff] [blame] | 65 | "dm devres Dump list of device resources for each device\n" |
Niel Fourie | 2e48836 | 2020-03-24 16:17:05 +0100 | [diff] [blame] | 66 | "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 Panait | 7f0836a | 2022-05-08 13:01:42 +0300 | [diff] [blame] | 69 | ; |
| 70 | #endif |
| 71 | |
| 72 | U_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)); |