]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - test/dm/cmd_dm.c
dm: test: replace dm_scan_dt() by of dm_extended_scan_fdt() in dm_do_test
[people/ms/u-boot.git] / test / dm / cmd_dm.c
index 5c501ec2541b85756b59f8038dd0f89c5c2add0c..a3c5971a8b1466ce773fe634f2076f79c65bd0cf 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -32,16 +33,39 @@ static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int argc,
        return 0;
 }
 
+static int do_dm_dump_devres(cmd_tbl_t *cmdtp, int flag, int argc,
+                            char * const argv[])
+{
+       dm_dump_devres();
+
+       return 0;
+}
+
 static cmd_tbl_t test_commands[] = {
        U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""),
        U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""),
+       U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
 };
 
+static __maybe_unused void dm_reloc(void)
+{
+       static int relocated;
+
+       if (!relocated) {
+               fixup_cmdtable(test_commands, ARRAY_SIZE(test_commands));
+               relocated = 1;
+       }
+}
+
 static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        cmd_tbl_t *test_cmd;
        int ret;
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+       dm_reloc();
+#endif
+
        if (argc < 2)
                return CMD_RET_USAGE;
        test_cmd = find_cmd_tbl(argv[1], test_commands,
@@ -60,5 +84,6 @@ U_BOOT_CMD(
        dm,     3,      1,      do_dm,
        "Driver model low level access",
        "tree         Dump driver model tree ('*' = activated)\n"
-       "dm uclass        Dump list of instances for each uclass"
+       "dm uclass        Dump list of instances for each uclass\n"
+       "dm devres        Dump list of device resources for each device"
 );