1 // SPDX-License-Identifier: GPL-2.0+
4 * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com
5 * Based on code written by:
6 * Pantelis Antoniou <pantelis.antoniou@gmail.com> and
7 * Matthew McClintock <msm@freescale.com>
14 #include <linux/ctype.h>
15 #include <linux/types.h>
16 #include <asm/global_data.h>
17 #include <linux/libfdt.h>
18 #include <fdt_support.h>
22 #define MAX_LEVEL 32 /* how deeply nested we will go */
23 #define SCRATCHPAD 1024 /* bytes of scratchpad memory */
26 * Global data (for the gd->bd)
28 DECLARE_GLOBAL_DATA_PTR;
30 static int fdt_parse_prop(char *const*newval, int count, char *data, int *len);
31 static int fdt_print(const char *pathp, char *prop, int depth);
32 static int is_printable_string(const void *data, int len);
35 * The working_fdt points to our working flattened device tree.
37 struct fdt_header *working_fdt;
39 void set_working_fdt_addr(ulong addr)
43 printf("Working FDT set to %lx\n", addr);
44 buf = map_sysmem(addr, 0);
46 env_set_hex("fdtaddr", addr);
50 * Get a value from the fdt and format it to be set in the environment
52 static int fdt_value_env_set(const void *nodep, int len,
53 const char *var, int index)
55 if (is_printable_string(nodep, len)) {
56 const char *nodec = (const char *)nodep;
60 * Iterate over all members in stringlist and find the one at
61 * offset $index. If no such index exists, indicate failure.
63 for (i = 0; i < len; ) {
65 i += strlen(nodec) + 1;
66 nodec += strlen(nodec) + 1;
75 } else if (len == 4) {
78 sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep));
80 } else if (len % 4 == 0 && index >= 0) {
81 /* Needed to print integer arrays. */
82 const unsigned int *nodec = (const unsigned int *)nodep;
88 sprintf(buf, "0x%08X", fdt32_to_cpu(*(nodec + index)));
90 } else if (len % 4 == 0 && len <= 20) {
91 /* Needed to print things like sha1 hashes. */
95 for (i = 0; i < len; i += sizeof(unsigned int))
96 sprintf(buf + (i * 2), "%08x",
97 *(unsigned int *)(nodep + i));
100 printf("error: unprintable value\n");
106 static const char * const fdt_member_table[] = {
119 static int fdt_get_header_value(int argc, char *const argv[])
121 fdt32_t *fdtp = (fdt32_t *)working_fdt;
125 if (argv[2][0] != 'g')
126 return CMD_RET_FAILURE;
128 for (i = 0; i < ARRAY_SIZE(fdt_member_table); i++) {
129 if (strcmp(fdt_member_table[i], argv[4]))
132 val = fdt32_to_cpu(fdtp[i]);
133 env_set_hex(argv[3], val);
134 return CMD_RET_SUCCESS;
137 return CMD_RET_FAILURE;
141 * Flattened Device Tree command, see the help for parameter definitions.
143 static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
146 return CMD_RET_USAGE;
148 /* fdt addr: Set the address of the fdt */
149 if (strncmp(argv[1], "ad", 2) == 0) {
153 struct fdt_header *blob;
155 /* Set the address [and length] of the fdt */
158 while (argc > 0 && **argv == '-') {
170 return CMD_RET_USAGE;
178 blob = (struct fdt_header *)gd->fdt_blob;
181 if (!blob || !fdt_valid(&blob))
183 printf("%s fdt: %08lx\n",
184 control ? "Control" : "Working",
185 control ? (ulong)map_to_sysmem(blob) :
186 env_get_hex("fdtaddr", 0));
190 addr = hextoul(argv[0], NULL);
191 blob = map_sysmem(addr, 0);
192 if ((quiet && fdt_check_header(blob)) ||
193 (!quiet && !fdt_valid(&blob)))
198 set_working_fdt_addr(addr);
204 /* Optional new length */
205 len = hextoul(argv[1], NULL);
206 if (len < fdt_totalsize(blob)) {
208 printf("New length %d < existing length %d, ignoring\n",
209 len, fdt_totalsize(blob));
211 /* Open in place with a new length */
212 err = fdt_open_into(blob, blob, len);
213 if (!quiet && err != 0) {
214 printf("libfdt fdt_open_into(): %s\n",
220 return CMD_RET_SUCCESS;
223 * Move the working_fdt
225 } else if (strncmp(argv[1], "mo", 2) == 0) {
226 struct fdt_header *newaddr;
231 return CMD_RET_USAGE;
234 * Set the address and length of the fdt.
236 working_fdt = map_sysmem(hextoul(argv[2], NULL), 0);
237 if (!fdt_valid(&working_fdt))
240 newaddr = map_sysmem(hextoul(argv[3], NULL), 0);
243 * If the user specifies a length, use that. Otherwise use the
247 len = fdt_totalsize(working_fdt);
249 len = hextoul(argv[4], NULL);
250 if (len < fdt_totalsize(working_fdt)) {
251 printf ("New length 0x%X < existing length "
253 len, fdt_totalsize(working_fdt));
259 * Copy to the new location.
261 err = fdt_open_into(working_fdt, newaddr, len);
263 printf ("libfdt fdt_open_into(): %s\n",
267 set_working_fdt_addr(map_to_sysmem(newaddr));
269 return CMD_RET_SUCCESS;
273 puts("No FDT memory address configured. Please configure\n"
274 "the FDT address via \"fdt addr <address>\" command.\n"
276 return CMD_RET_FAILURE;
279 #ifdef CONFIG_OF_SYSTEM_SETUP
280 /* Call the board-specific fixup routine */
281 if (strncmp(argv[1], "sys", 3) == 0) {
282 int err = ft_system_setup(working_fdt, gd->bd);
285 printf("Failed to add system information to FDT: %s\n",
287 return CMD_RET_FAILURE;
290 return CMD_RET_SUCCESS;
296 if (strncmp(argv[1], "mk", 2) == 0) {
297 char *pathp; /* path */
298 char *nodep; /* new node to add */
299 int nodeoffset; /* node offset from libfdt */
303 * Parameters: Node path, new node to be appended to the path.
306 return CMD_RET_USAGE;
311 nodeoffset = fdt_path_offset (working_fdt, pathp);
312 if (nodeoffset < 0) {
314 * Not found or something else bad happened.
316 printf ("libfdt fdt_path_offset() returned %s\n",
317 fdt_strerror(nodeoffset));
320 err = fdt_add_subnode(working_fdt, nodeoffset, nodep);
322 printf ("libfdt fdt_add_subnode(): %s\n",
328 * Set the value of a property in the working_fdt.
330 } else if (strncmp(argv[1], "se", 2) == 0) {
331 char *pathp; /* path */
332 char *prop; /* property */
333 int nodeoffset; /* node offset from libfdt */
334 static char data[SCRATCHPAD] __aligned(4);/* property storage */
336 int len; /* new length of the property */
337 int ret; /* return value */
340 * Parameters: Node path, property, optional value.
343 return CMD_RET_USAGE;
348 nodeoffset = fdt_path_offset (working_fdt, pathp);
349 if (nodeoffset < 0) {
351 * Not found or something else bad happened.
353 printf ("libfdt fdt_path_offset() returned %s\n",
354 fdt_strerror(nodeoffset));
361 ptmp = fdt_getprop(working_fdt, nodeoffset, prop, &len);
362 if (len > SCRATCHPAD) {
363 printf("prop (%d) doesn't fit in scratchpad!\n",
368 memcpy(data, ptmp, len);
370 ret = fdt_parse_prop(&argv[4], argc - 4, data, &len);
375 ret = fdt_setprop(working_fdt, nodeoffset, prop, data, len);
377 printf ("libfdt fdt_setprop(): %s\n", fdt_strerror(ret));
381 /********************************************************************
382 * Get the value of a property in the working_fdt.
383 ********************************************************************/
384 } else if (argv[1][0] == 'g') {
385 char *subcmd; /* sub-command */
386 char *pathp; /* path */
387 char *prop; /* property */
388 char *var; /* variable to store result */
389 int nodeoffset; /* node offset from libfdt */
390 const void *nodep; /* property node pointer */
391 int len = 0; /* new length of the property */
394 * Parameters: Node path, property, optional value.
397 return CMD_RET_USAGE;
401 if (argc < 6 && subcmd[0] != 's')
402 return CMD_RET_USAGE;
408 nodeoffset = fdt_path_offset(working_fdt, pathp);
409 if (nodeoffset < 0) {
411 * Not found or something else bad happened.
413 printf("libfdt fdt_path_offset() returned %s\n",
414 fdt_strerror(nodeoffset));
418 if (subcmd[0] == 'n' || (subcmd[0] == 's' && argc == 5)) {
420 int startDepth = fdt_node_depth(
421 working_fdt, nodeoffset);
422 int curDepth = startDepth;
424 int nextNodeOffset = fdt_next_node(
425 working_fdt, nodeoffset, &curDepth);
427 if (subcmd[0] == 'n')
428 req_index = hextoul(argv[5], NULL);
430 while (curDepth > startDepth) {
431 if (curDepth == startDepth + 1)
433 if (subcmd[0] == 'n' &&
434 cur_index == req_index) {
435 const char *node_name;
437 node_name = fdt_get_name(working_fdt,
440 env_set(var, node_name);
443 nextNodeOffset = fdt_next_node(
444 working_fdt, nextNodeOffset, &curDepth);
445 if (nextNodeOffset < 0)
448 if (subcmd[0] == 's') {
449 /* get the num nodes at this level */
450 env_set_ulong(var, cur_index + 1);
452 /* node index not found */
453 printf("libfdt node not found\n");
458 working_fdt, nodeoffset, prop, &len);
459 if (nodep && len >= 0) {
460 if (subcmd[0] == 'v') {
465 /* no property value */
471 index = simple_strtoul(argv[6], NULL, 10);
473 ret = fdt_value_env_set(nodep, len,
477 } else if (subcmd[0] == 'a') {
478 env_set_hex(var, (ulong)map_to_sysmem(nodep));
479 } else if (subcmd[0] == 's') {
480 env_set_hex(var, len);
482 return CMD_RET_USAGE;
485 printf("libfdt fdt_getprop(): %s\n",
492 * Print (recursive) / List (single level)
494 } else if ((argv[1][0] == 'p') || (argv[1][0] == 'l')) {
495 int depth = MAX_LEVEL; /* how deep to print */
496 char *pathp; /* path */
497 char *prop; /* property */
498 int ret; /* return value */
499 static char root[2] = "/";
502 * list is an alias for print, but limited to 1 level
504 if (argv[1][0] == 'l') {
509 * Get the starting path. The root node is an oddball,
510 * the offset is zero and has no name.
521 ret = fdt_print(pathp, prop, depth);
526 * Remove a property/node
528 } else if (strncmp(argv[1], "rm", 2) == 0) {
529 int nodeoffset; /* node offset from libfdt */
533 * Get the path. The root node is an oddball, the offset
534 * is zero and has no name.
536 nodeoffset = fdt_path_offset (working_fdt, argv[2]);
537 if (nodeoffset < 0) {
539 * Not found or something else bad happened.
541 printf ("libfdt fdt_path_offset() returned %s\n",
542 fdt_strerror(nodeoffset));
546 * Do the delete. A fourth parameter means delete a property,
547 * otherwise delete the node.
550 err = fdt_delprop(working_fdt, nodeoffset, argv[3]);
552 printf("libfdt fdt_delprop(): %s\n",
554 return CMD_RET_FAILURE;
557 err = fdt_del_node(working_fdt, nodeoffset);
559 printf("libfdt fdt_del_node(): %s\n",
561 return CMD_RET_FAILURE;
566 * Display header info
568 } else if (argv[1][0] == 'h') {
570 return fdt_get_header_value(argc, argv);
572 u32 version = fdt_version(working_fdt);
573 printf("magic:\t\t\t0x%x\n", fdt_magic(working_fdt));
574 printf("totalsize:\t\t0x%x (%d)\n", fdt_totalsize(working_fdt),
575 fdt_totalsize(working_fdt));
576 printf("off_dt_struct:\t\t0x%x\n",
577 fdt_off_dt_struct(working_fdt));
578 printf("off_dt_strings:\t\t0x%x\n",
579 fdt_off_dt_strings(working_fdt));
580 printf("off_mem_rsvmap:\t\t0x%x\n",
581 fdt_off_mem_rsvmap(working_fdt));
582 printf("version:\t\t%d\n", version);
583 printf("last_comp_version:\t%d\n",
584 fdt_last_comp_version(working_fdt));
586 printf("boot_cpuid_phys:\t0x%x\n",
587 fdt_boot_cpuid_phys(working_fdt));
589 printf("size_dt_strings:\t0x%x\n",
590 fdt_size_dt_strings(working_fdt));
592 printf("size_dt_struct:\t\t0x%x\n",
593 fdt_size_dt_struct(working_fdt));
594 printf("number mem_rsv:\t\t0x%x\n",
595 fdt_num_mem_rsv(working_fdt));
601 } else if (strncmp(argv[1], "boo", 3) == 0) {
605 return CMD_RET_USAGE;
607 tmp = hextoul(argv[2], NULL);
608 fdt_set_boot_cpuid_phys(working_fdt, tmp);
613 } else if (strncmp(argv[1], "me", 2) == 0) {
618 return CMD_RET_USAGE;
620 addr = simple_strtoull(argv[2], NULL, 16);
621 size = simple_strtoull(argv[3], NULL, 16);
622 err = fdt_fixup_memory(working_fdt, addr, size);
627 * mem reserve commands
629 } else if (strncmp(argv[1], "rs", 2) == 0) {
630 if (argv[2][0] == 'p') {
632 int total = fdt_num_mem_rsv(working_fdt);
634 printf("index\t\t start\t\t size\n");
635 printf("-------------------------------"
636 "-----------------\n");
637 for (j = 0; j < total; j++) {
638 err = fdt_get_mem_rsv(working_fdt, j, &addr, &size);
640 printf("libfdt fdt_get_mem_rsv(): %s\n",
644 printf(" %x\t%08x%08x\t%08x%08x\n", j,
646 (u32)(addr & 0xffffffff),
648 (u32)(size & 0xffffffff));
650 } else if (argv[2][0] == 'a') {
653 addr = simple_strtoull(argv[3], NULL, 16);
654 size = simple_strtoull(argv[4], NULL, 16);
655 err = fdt_add_mem_rsv(working_fdt, addr, size);
658 printf("libfdt fdt_add_mem_rsv(): %s\n",
660 return CMD_RET_FAILURE;
662 } else if (argv[2][0] == 'd') {
663 unsigned long idx = hextoul(argv[3], NULL);
664 int err = fdt_del_mem_rsv(working_fdt, idx);
667 printf("libfdt fdt_del_mem_rsv(): %s\n",
669 return CMD_RET_FAILURE;
672 /* Unrecognized command */
673 return CMD_RET_USAGE;
676 #ifdef CONFIG_OF_BOARD_SETUP
677 /* Call the board-specific fixup routine */
678 else if (strncmp(argv[1], "boa", 3) == 0) {
679 int err = ft_board_setup(working_fdt, gd->bd);
682 printf("Failed to update board information in FDT: %s\n",
684 return CMD_RET_FAILURE;
686 #ifdef CONFIG_ARCH_KEYSTONE
687 ft_board_setup_ex(working_fdt, gd->bd);
691 /* Create a chosen node */
692 else if (strncmp(argv[1], "cho", 3) == 0) {
693 unsigned long initrd_start = 0, initrd_end = 0;
695 if ((argc != 2) && (argc != 4))
696 return CMD_RET_USAGE;
699 initrd_start = hextoul(argv[2], NULL);
700 initrd_end = initrd_start + hextoul(argv[3], NULL) - 1;
703 fdt_chosen(working_fdt);
704 fdt_initrd(working_fdt, initrd_start, initrd_end);
706 #if defined(CONFIG_FIT_SIGNATURE)
707 } else if (strncmp(argv[1], "che", 3) == 0) {
711 struct fdt_header *blob;
714 return CMD_RET_FAILURE;
717 addr = hextoul(argv[2], NULL);
718 blob = map_sysmem(addr, 0);
720 blob = (struct fdt_header *)gd->fdt_blob;
722 if (!fdt_valid(&blob))
726 cfg_noffset = fit_conf_get_node(working_fdt, NULL);
728 printf("Could not find configuration node: %s\n",
729 fdt_strerror(cfg_noffset));
730 return CMD_RET_FAILURE;
733 ret = fit_config_verify(working_fdt, cfg_noffset);
735 return CMD_RET_SUCCESS;
737 return CMD_RET_FAILURE;
741 #ifdef CONFIG_OF_LIBFDT_OVERLAY
742 /* apply an overlay */
743 else if (strncmp(argv[1], "ap", 2) == 0) {
745 struct fdt_header *blob;
749 return CMD_RET_USAGE;
752 return CMD_RET_FAILURE;
754 addr = hextoul(argv[2], NULL);
755 blob = map_sysmem(addr, 0);
756 if (!fdt_valid(&blob))
757 return CMD_RET_FAILURE;
759 /* apply method prints messages on error */
760 ret = fdt_overlay_apply_verbose(working_fdt, blob);
762 return CMD_RET_FAILURE;
766 else if (strncmp(argv[1], "re", 2) == 0) {
769 extrasize = hextoul(argv[2], NULL);
772 fdt_shrink_to_minimum(working_fdt, extrasize);
775 /* Unrecognized command */
776 return CMD_RET_USAGE;
782 /****************************************************************************/
785 * Parse the user's input, partially heuristic. Valid formats:
786 * <0x00112233 4 05> - an array of cells. Numbers follow standard
788 * [00 11 22 .. nn] - byte stream
789 * "string" - If the the value doesn't start with "<" or "[", it is
790 * treated as a string. Note that the quotes are
791 * stripped by the parser before we get the string.
792 * newval: An array of strings containing the new property as specified
793 * on the command line
794 * count: The number of strings in the array
795 * data: A bytestream to be placed in the property
796 * len: The length of the resulting bytestream
798 static int fdt_parse_prop(char * const *newval, int count, char *data, int *len)
800 char *cp; /* temporary char pointer */
801 char *newp; /* temporary newval char pointer */
802 unsigned long tmp; /* holds converted values */
808 /* An array of cells */
811 while ((*newp != '>') && (stridx < count)) {
813 * Keep searching until we find that last ">"
814 * That way users don't have to escape the spaces
817 newp = newval[++stridx];
822 tmp = simple_strtoul(cp, &newp, 0);
824 *(fdt32_t *)data = cpu_to_fdt32(tmp);
831 /* If the ptr didn't advance, something went wrong */
832 if ((newp - cp) <= 0) {
833 printf("Sorry, I could not convert \"%s\"\n",
843 printf("Unexpected character '%c'\n", *newp);
846 } else if (*newp == '[') {
848 * Byte stream. Convert the values.
851 while ((stridx < count) && (*newp != ']')) {
855 newp = newval[++stridx];
858 if (!isxdigit(*newp))
860 tmp = hextoul(newp, &newp);
861 *data++ = tmp & 0xFF;
865 printf("Unexpected character '%c'\n", *newp);
870 * Assume it is one or more strings. Copy it into our
871 * data area for convenience (including the
872 * terminating '\0's).
874 while (stridx < count) {
875 size_t length = strlen(newp) + 1;
879 newp = newval[++stridx];
885 /****************************************************************************/
888 * Heuristic to guess if this is a string or concatenated strings.
891 static int is_printable_string(const void *data, int len)
893 const char *s = data;
896 /* zero length is not */
900 /* must terminate with zero */
901 if (s[len - 1] != '\0')
908 while (s < se && *s && isprint((unsigned char)*s))
911 /* not zero, or not done yet */
912 if (*s != '\0' || s == ss)
922 * Print the property in the best format, a heuristic guess. Print as
923 * a string, concatenated strings, a byte, word, double word, or (if all
924 * else fails) it is printed as a stream of bytes.
926 static void print_data(const void *data, int len)
929 const char *env_max_dump;
930 ulong max_dump = ULONG_MAX;
932 /* no data, don't print */
936 env_max_dump = env_get("fdt_max_dump");
938 max_dump = hextoul(env_max_dump, NULL);
941 * It is a string, but it may have multiple strings (embedded '\0's).
943 if (is_printable_string(data, len)) {
950 j += strlen(data) + 1;
951 data += strlen(data) + 1;
959 printf("* 0x%p [0x%08x]", data, len);
964 for (j = 0, p = data; j < len/4; j++)
965 printf("0x%08x%s", fdt32_to_cpu(p[j]),
966 j < (len/4 - 1) ? " " : "");
969 } else { /* anything else... hexdump */
971 printf("* 0x%p [0x%08x]", data, len);
976 for (j = 0, s = data; j < len; j++)
977 printf("%02x%s", s[j], j < len - 1 ? " " : "");
983 /****************************************************************************/
986 * Recursively print (a portion of) the working_fdt. The depth parameter
987 * determines how deeply nested the fdt is printed.
989 static int fdt_print(const char *pathp, char *prop, int depth)
991 static char tabs[MAX_LEVEL+1] =
992 "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
993 "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
994 const void *nodep; /* property node pointer */
995 int nodeoffset; /* node offset from libfdt */
996 int nextoffset; /* next node offset from libfdt */
997 uint32_t tag; /* tag */
998 int len; /* length of the property */
999 int level = 0; /* keep track of nesting level */
1000 const struct fdt_property *fdt_prop;
1002 nodeoffset = fdt_path_offset (working_fdt, pathp);
1003 if (nodeoffset < 0) {
1005 * Not found or something else bad happened.
1007 printf ("libfdt fdt_path_offset() returned %s\n",
1008 fdt_strerror(nodeoffset));
1012 * The user passed in a property as well as node path.
1013 * Print only the given property and then return.
1016 nodep = fdt_getprop (working_fdt, nodeoffset, prop, &len);
1018 /* no property value */
1019 printf("%s %s\n", pathp, prop);
1021 } else if (nodep && len > 0) {
1022 printf("%s = ", prop);
1023 print_data (nodep, len);
1027 printf ("libfdt fdt_getprop(): %s\n",
1034 * The user passed in a node path and no property,
1035 * print the node and all subnodes.
1038 tag = fdt_next_tag(working_fdt, nodeoffset, &nextoffset);
1040 case FDT_BEGIN_NODE:
1041 pathp = fdt_get_name(working_fdt, nodeoffset, NULL);
1042 if (level <= depth) {
1044 pathp = "/* NULL pointer error */";
1046 pathp = "/"; /* root is nameless */
1048 &tabs[MAX_LEVEL - level], pathp);
1051 if (level >= MAX_LEVEL) {
1052 printf("Nested too deep, aborting.\n");
1059 printf("%s};\n", &tabs[MAX_LEVEL - level]);
1061 level = -1; /* exit the loop */
1065 fdt_prop = fdt_offset_ptr(working_fdt, nodeoffset,
1067 pathp = fdt_string(working_fdt,
1068 fdt32_to_cpu(fdt_prop->nameoff));
1069 len = fdt32_to_cpu(fdt_prop->len);
1070 nodep = fdt_prop->data;
1072 printf ("libfdt fdt_getprop(): %s\n",
1075 } else if (len == 0) {
1076 /* the property has no value */
1079 &tabs[MAX_LEVEL - level],
1082 if (level <= depth) {
1084 &tabs[MAX_LEVEL - level],
1086 print_data (nodep, len);
1092 printf("%s/* NOP */\n", &tabs[MAX_LEVEL - level]);
1098 printf("Unknown tag 0x%08X\n", tag);
1101 nodeoffset = nextoffset;
1106 /********************************************************************/
1107 #ifdef CONFIG_SYS_LONGHELP
1108 static char fdt_help_text[] =
1109 "addr [-c] [-q] <addr> [<size>] - Set the [control] fdt location to <addr>\n"
1110 #ifdef CONFIG_OF_LIBFDT_OVERLAY
1111 "fdt apply <addr> - Apply overlay to the DT\n"
1113 #ifdef CONFIG_OF_BOARD_SETUP
1114 "fdt boardsetup - Do board-specific set up\n"
1116 #ifdef CONFIG_OF_SYSTEM_SETUP
1117 "fdt systemsetup - Do system-specific set up\n"
1119 "fdt move <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active\n"
1120 "fdt resize [<extrasize>] - Resize fdt to size + padding to 4k addr + some optional <extrasize> if needed\n"
1121 "fdt print <path> [<prop>] - Recursive print starting at <path>\n"
1122 "fdt list <path> [<prop>] - Print one level starting at <path>\n"
1123 "fdt get value <var> <path> <prop> [<index>] - Get <property> and store in <var>\n"
1124 " In case of stringlist property, use optional <index>\n"
1125 " to select string within the stringlist. Default is 0.\n"
1126 "fdt get name <var> <path> <index> - Get name of node <index> and store in <var>\n"
1127 "fdt get addr <var> <path> <prop> - Get start address of <property> and store in <var>\n"
1128 "fdt get size <var> <path> [<prop>] - Get size of [<property>] or num nodes and store in <var>\n"
1129 "fdt set <path> <prop> [<val>] - Set <property> [to <val>]\n"
1130 "fdt mknode <path> <node> - Create a new node after <path>\n"
1131 "fdt rm <path> [<prop>] - Delete the node or <property>\n"
1132 "fdt header [get <var> <member>] - Display header info\n"
1133 " get - get header member <member> and store it in <var>\n"
1134 "fdt bootcpu <id> - Set boot cpuid\n"
1135 "fdt memory <addr> <size> - Add/Update memory node\n"
1136 "fdt rsvmem print - Show current mem reserves\n"
1137 "fdt rsvmem add <addr> <size> - Add a mem reserve\n"
1138 "fdt rsvmem delete <index> - Delete a mem reserves\n"
1139 "fdt chosen [<start> <size>] - Add/update the /chosen branch in the tree\n"
1140 " <start>/<size> - initrd start addr/size\n"
1141 #if defined(CONFIG_FIT_SIGNATURE)
1142 "fdt checksign [<addr>] - check FIT signature\n"
1143 " <addr> - address of key blob\n"
1144 " default gd->fdt_blob\n"
1146 "NOTE: Dereference aliases by omitting the leading '/', "
1147 "e.g. fdt print ethernet0.";
1151 fdt, 255, 0, do_fdt,
1152 "flattened device tree utility commands", fdt_help_text