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; i += strlen(nodec) + 1) {
67 env_set(var, nodec + i);
72 } else if (len == 4) {
75 sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep));
77 } else if (len%4 == 0 && len <= 20) {
78 /* Needed to print things like sha1 hashes. */
82 for (i = 0; i < len; i += sizeof(unsigned int))
83 sprintf(buf + (i * 2), "%08x",
84 *(unsigned int *)(nodep + i));
87 printf("error: unprintable value\n");
93 static const char * const fdt_member_table[] = {
106 static int fdt_get_header_value(int argc, char *const argv[])
108 fdt32_t *fdtp = (fdt32_t *)working_fdt;
112 if (argv[2][0] != 'g')
113 return CMD_RET_FAILURE;
115 for (i = 0; i < ARRAY_SIZE(fdt_member_table); i++) {
116 if (strcmp(fdt_member_table[i], argv[4]))
119 val = fdt32_to_cpu(fdtp[i]);
120 env_set_hex(argv[3], val);
121 return CMD_RET_SUCCESS;
124 return CMD_RET_FAILURE;
128 * Flattened Device Tree command, see the help for parameter definitions.
130 static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
133 return CMD_RET_USAGE;
135 /* fdt addr: Set the address of the fdt */
136 if (strncmp(argv[1], "ad", 2) == 0) {
140 struct fdt_header *blob;
142 /* Set the address [and length] of the fdt */
145 while (argc > 0 && **argv == '-') {
157 return CMD_RET_USAGE;
165 blob = (struct fdt_header *)gd->fdt_blob;
168 if (!blob || !fdt_valid(&blob))
170 printf("%s fdt: %08lx\n",
171 control ? "Control" : "Working",
172 control ? (ulong)map_to_sysmem(blob) :
173 env_get_hex("fdtaddr", 0));
177 addr = hextoul(argv[0], NULL);
178 blob = map_sysmem(addr, 0);
179 if ((quiet && fdt_check_header(blob)) ||
180 (!quiet && !fdt_valid(&blob)))
185 set_working_fdt_addr(addr);
191 /* Optional new length */
192 len = hextoul(argv[1], NULL);
193 if (len < fdt_totalsize(blob)) {
195 printf("New length %d < existing length %d, ignoring\n",
196 len, fdt_totalsize(blob));
198 /* Open in place with a new length */
199 err = fdt_open_into(blob, blob, len);
200 if (!quiet && err != 0) {
201 printf("libfdt fdt_open_into(): %s\n",
207 return CMD_RET_SUCCESS;
211 puts("No FDT memory address configured. Please configure\n"
212 "the FDT address via \"fdt addr <address>\" command.\n"
214 return CMD_RET_FAILURE;
218 * Move the working_fdt
220 if (strncmp(argv[1], "mo", 2) == 0) {
221 struct fdt_header *newaddr;
226 return CMD_RET_USAGE;
229 * Set the address and length of the fdt.
231 working_fdt = (struct fdt_header *)hextoul(argv[2], NULL);
232 if (!fdt_valid(&working_fdt))
235 newaddr = (struct fdt_header *)hextoul(argv[3], NULL);
238 * If the user specifies a length, use that. Otherwise use the
242 len = fdt_totalsize(working_fdt);
244 len = hextoul(argv[4], NULL);
245 if (len < fdt_totalsize(working_fdt)) {
246 printf ("New length 0x%X < existing length "
248 len, fdt_totalsize(working_fdt));
254 * Copy to the new location.
256 err = fdt_open_into(working_fdt, newaddr, len);
258 printf ("libfdt fdt_open_into(): %s\n",
262 set_working_fdt_addr((ulong)newaddr);
263 #ifdef CONFIG_OF_SYSTEM_SETUP
264 /* Call the board-specific fixup routine */
265 } else if (strncmp(argv[1], "sys", 3) == 0) {
266 int err = ft_system_setup(working_fdt, gd->bd);
269 printf("Failed to add system information to FDT: %s\n",
271 return CMD_RET_FAILURE;
277 } else if (strncmp(argv[1], "mk", 2) == 0) {
278 char *pathp; /* path */
279 char *nodep; /* new node to add */
280 int nodeoffset; /* node offset from libfdt */
284 * Parameters: Node path, new node to be appended to the path.
287 return CMD_RET_USAGE;
292 nodeoffset = fdt_path_offset (working_fdt, pathp);
293 if (nodeoffset < 0) {
295 * Not found or something else bad happened.
297 printf ("libfdt fdt_path_offset() returned %s\n",
298 fdt_strerror(nodeoffset));
301 err = fdt_add_subnode(working_fdt, nodeoffset, nodep);
303 printf ("libfdt fdt_add_subnode(): %s\n",
309 * Set the value of a property in the working_fdt.
311 } else if (strncmp(argv[1], "se", 2) == 0) {
312 char *pathp; /* path */
313 char *prop; /* property */
314 int nodeoffset; /* node offset from libfdt */
315 static char data[SCRATCHPAD] __aligned(4);/* property storage */
317 int len; /* new length of the property */
318 int ret; /* return value */
321 * Parameters: Node path, property, optional value.
324 return CMD_RET_USAGE;
329 nodeoffset = fdt_path_offset (working_fdt, pathp);
330 if (nodeoffset < 0) {
332 * Not found or something else bad happened.
334 printf ("libfdt fdt_path_offset() returned %s\n",
335 fdt_strerror(nodeoffset));
342 ptmp = fdt_getprop(working_fdt, nodeoffset, prop, &len);
343 if (len > SCRATCHPAD) {
344 printf("prop (%d) doesn't fit in scratchpad!\n",
349 memcpy(data, ptmp, len);
351 ret = fdt_parse_prop(&argv[4], argc - 4, data, &len);
356 ret = fdt_setprop(working_fdt, nodeoffset, prop, data, len);
358 printf ("libfdt fdt_setprop(): %s\n", fdt_strerror(ret));
362 /********************************************************************
363 * Get the value of a property in the working_fdt.
364 ********************************************************************/
365 } else if (argv[1][0] == 'g') {
366 char *subcmd; /* sub-command */
367 char *pathp; /* path */
368 char *prop; /* property */
369 char *var; /* variable to store result */
370 int nodeoffset; /* node offset from libfdt */
371 const void *nodep; /* property node pointer */
372 int len = 0; /* new length of the property */
375 * Parameters: Node path, property, optional value.
378 return CMD_RET_USAGE;
382 if (argc < 6 && subcmd[0] != 's')
383 return CMD_RET_USAGE;
389 nodeoffset = fdt_path_offset(working_fdt, pathp);
390 if (nodeoffset < 0) {
392 * Not found or something else bad happened.
394 printf("libfdt fdt_path_offset() returned %s\n",
395 fdt_strerror(nodeoffset));
399 if (subcmd[0] == 'n' || (subcmd[0] == 's' && argc == 5)) {
401 int startDepth = fdt_node_depth(
402 working_fdt, nodeoffset);
403 int curDepth = startDepth;
405 int nextNodeOffset = fdt_next_node(
406 working_fdt, nodeoffset, &curDepth);
408 if (subcmd[0] == 'n')
409 req_index = hextoul(argv[5], NULL);
411 while (curDepth > startDepth) {
412 if (curDepth == startDepth + 1)
414 if (subcmd[0] == 'n' &&
415 cur_index == req_index) {
416 const char *node_name;
418 node_name = fdt_get_name(working_fdt,
421 env_set(var, node_name);
424 nextNodeOffset = fdt_next_node(
425 working_fdt, nextNodeOffset, &curDepth);
426 if (nextNodeOffset < 0)
429 if (subcmd[0] == 's') {
430 /* get the num nodes at this level */
431 env_set_ulong(var, cur_index + 1);
433 /* node index not found */
434 printf("libfdt node not found\n");
439 working_fdt, nodeoffset, prop, &len);
441 /* no property value */
444 } else if (nodep && len > 0) {
445 if (subcmd[0] == 'v') {
450 index = simple_strtoul(argv[6], NULL, 10);
452 ret = fdt_value_env_set(nodep, len,
456 } else if (subcmd[0] == 'a') {
460 sprintf(buf, "0x%p", nodep);
462 } else if (subcmd[0] == 's') {
466 sprintf(buf, "0x%08X", len);
469 return CMD_RET_USAGE;
472 printf("libfdt fdt_getprop(): %s\n",
479 * Print (recursive) / List (single level)
481 } else if ((argv[1][0] == 'p') || (argv[1][0] == 'l')) {
482 int depth = MAX_LEVEL; /* how deep to print */
483 char *pathp; /* path */
484 char *prop; /* property */
485 int ret; /* return value */
486 static char root[2] = "/";
489 * list is an alias for print, but limited to 1 level
491 if (argv[1][0] == 'l') {
496 * Get the starting path. The root node is an oddball,
497 * the offset is zero and has no name.
508 ret = fdt_print(pathp, prop, depth);
513 * Remove a property/node
515 } else if (strncmp(argv[1], "rm", 2) == 0) {
516 int nodeoffset; /* node offset from libfdt */
520 * Get the path. The root node is an oddball, the offset
521 * is zero and has no name.
523 nodeoffset = fdt_path_offset (working_fdt, argv[2]);
524 if (nodeoffset < 0) {
526 * Not found or something else bad happened.
528 printf ("libfdt fdt_path_offset() returned %s\n",
529 fdt_strerror(nodeoffset));
533 * Do the delete. A fourth parameter means delete a property,
534 * otherwise delete the node.
537 err = fdt_delprop(working_fdt, nodeoffset, argv[3]);
539 printf("libfdt fdt_delprop(): %s\n",
544 err = fdt_del_node(working_fdt, nodeoffset);
546 printf("libfdt fdt_del_node(): %s\n",
553 * Display header info
555 } else if (argv[1][0] == 'h') {
557 return fdt_get_header_value(argc, argv);
559 u32 version = fdt_version(working_fdt);
560 printf("magic:\t\t\t0x%x\n", fdt_magic(working_fdt));
561 printf("totalsize:\t\t0x%x (%d)\n", fdt_totalsize(working_fdt),
562 fdt_totalsize(working_fdt));
563 printf("off_dt_struct:\t\t0x%x\n",
564 fdt_off_dt_struct(working_fdt));
565 printf("off_dt_strings:\t\t0x%x\n",
566 fdt_off_dt_strings(working_fdt));
567 printf("off_mem_rsvmap:\t\t0x%x\n",
568 fdt_off_mem_rsvmap(working_fdt));
569 printf("version:\t\t%d\n", version);
570 printf("last_comp_version:\t%d\n",
571 fdt_last_comp_version(working_fdt));
573 printf("boot_cpuid_phys:\t0x%x\n",
574 fdt_boot_cpuid_phys(working_fdt));
576 printf("size_dt_strings:\t0x%x\n",
577 fdt_size_dt_strings(working_fdt));
579 printf("size_dt_struct:\t\t0x%x\n",
580 fdt_size_dt_struct(working_fdt));
581 printf("number mem_rsv:\t\t0x%x\n",
582 fdt_num_mem_rsv(working_fdt));
588 } else if (strncmp(argv[1], "boo", 3) == 0) {
589 unsigned long tmp = hextoul(argv[2], NULL);
590 fdt_set_boot_cpuid_phys(working_fdt, tmp);
595 } else if (strncmp(argv[1], "me", 2) == 0) {
598 addr = simple_strtoull(argv[2], NULL, 16);
599 size = simple_strtoull(argv[3], NULL, 16);
600 err = fdt_fixup_memory(working_fdt, addr, size);
605 * mem reserve commands
607 } else if (strncmp(argv[1], "rs", 2) == 0) {
608 if (argv[2][0] == 'p') {
610 int total = fdt_num_mem_rsv(working_fdt);
612 printf("index\t\t start\t\t size\n");
613 printf("-------------------------------"
614 "-----------------\n");
615 for (j = 0; j < total; j++) {
616 err = fdt_get_mem_rsv(working_fdt, j, &addr, &size);
618 printf("libfdt fdt_get_mem_rsv(): %s\n",
622 printf(" %x\t%08x%08x\t%08x%08x\n", j,
624 (u32)(addr & 0xffffffff),
626 (u32)(size & 0xffffffff));
628 } else if (argv[2][0] == 'a') {
631 addr = simple_strtoull(argv[3], NULL, 16);
632 size = simple_strtoull(argv[4], NULL, 16);
633 err = fdt_add_mem_rsv(working_fdt, addr, size);
636 printf("libfdt fdt_add_mem_rsv(): %s\n",
640 } else if (argv[2][0] == 'd') {
641 unsigned long idx = hextoul(argv[3], NULL);
642 int err = fdt_del_mem_rsv(working_fdt, idx);
645 printf("libfdt fdt_del_mem_rsv(): %s\n",
650 /* Unrecognized command */
651 return CMD_RET_USAGE;
654 #ifdef CONFIG_OF_BOARD_SETUP
655 /* Call the board-specific fixup routine */
656 else if (strncmp(argv[1], "boa", 3) == 0) {
657 int err = ft_board_setup(working_fdt, gd->bd);
660 printf("Failed to update board information in FDT: %s\n",
662 return CMD_RET_FAILURE;
664 #ifdef CONFIG_ARCH_KEYSTONE
665 ft_board_setup_ex(working_fdt, gd->bd);
669 /* Create a chosen node */
670 else if (strncmp(argv[1], "cho", 3) == 0) {
671 unsigned long initrd_start = 0, initrd_end = 0;
673 if ((argc != 2) && (argc != 4))
674 return CMD_RET_USAGE;
677 initrd_start = hextoul(argv[2], NULL);
678 initrd_end = initrd_start + hextoul(argv[3], NULL) - 1;
681 fdt_chosen(working_fdt);
682 fdt_initrd(working_fdt, initrd_start, initrd_end);
684 #if defined(CONFIG_FIT_SIGNATURE)
685 } else if (strncmp(argv[1], "che", 3) == 0) {
689 struct fdt_header *blob;
692 return CMD_RET_FAILURE;
695 addr = hextoul(argv[2], NULL);
696 blob = map_sysmem(addr, 0);
698 blob = (struct fdt_header *)gd->fdt_blob;
700 if (!fdt_valid(&blob))
704 cfg_noffset = fit_conf_get_node(working_fdt, NULL);
706 printf("Could not find configuration node: %s\n",
707 fdt_strerror(cfg_noffset));
708 return CMD_RET_FAILURE;
711 ret = fit_config_verify(working_fdt, cfg_noffset);
713 return CMD_RET_SUCCESS;
715 return CMD_RET_FAILURE;
719 #ifdef CONFIG_OF_LIBFDT_OVERLAY
720 /* apply an overlay */
721 else if (strncmp(argv[1], "ap", 2) == 0) {
723 struct fdt_header *blob;
727 return CMD_RET_USAGE;
730 return CMD_RET_FAILURE;
732 addr = hextoul(argv[2], NULL);
733 blob = map_sysmem(addr, 0);
734 if (!fdt_valid(&blob))
735 return CMD_RET_FAILURE;
737 /* apply method prints messages on error */
738 ret = fdt_overlay_apply_verbose(working_fdt, blob);
740 return CMD_RET_FAILURE;
744 else if (strncmp(argv[1], "re", 2) == 0) {
747 extrasize = hextoul(argv[2], NULL);
750 fdt_shrink_to_minimum(working_fdt, extrasize);
753 /* Unrecognized command */
754 return CMD_RET_USAGE;
760 /****************************************************************************/
763 * Parse the user's input, partially heuristic. Valid formats:
764 * <0x00112233 4 05> - an array of cells. Numbers follow standard
766 * [00 11 22 .. nn] - byte stream
767 * "string" - If the the value doesn't start with "<" or "[", it is
768 * treated as a string. Note that the quotes are
769 * stripped by the parser before we get the string.
770 * newval: An array of strings containing the new property as specified
771 * on the command line
772 * count: The number of strings in the array
773 * data: A bytestream to be placed in the property
774 * len: The length of the resulting bytestream
776 static int fdt_parse_prop(char * const *newval, int count, char *data, int *len)
778 char *cp; /* temporary char pointer */
779 char *newp; /* temporary newval char pointer */
780 unsigned long tmp; /* holds converted values */
786 /* An array of cells */
789 while ((*newp != '>') && (stridx < count)) {
791 * Keep searching until we find that last ">"
792 * That way users don't have to escape the spaces
795 newp = newval[++stridx];
800 tmp = simple_strtoul(cp, &newp, 0);
802 *(fdt32_t *)data = cpu_to_fdt32(tmp);
809 /* If the ptr didn't advance, something went wrong */
810 if ((newp - cp) <= 0) {
811 printf("Sorry, I could not convert \"%s\"\n",
821 printf("Unexpected character '%c'\n", *newp);
824 } else if (*newp == '[') {
826 * Byte stream. Convert the values.
829 while ((stridx < count) && (*newp != ']')) {
833 newp = newval[++stridx];
836 if (!isxdigit(*newp))
838 tmp = hextoul(newp, &newp);
839 *data++ = tmp & 0xFF;
843 printf("Unexpected character '%c'\n", *newp);
848 * Assume it is one or more strings. Copy it into our
849 * data area for convenience (including the
850 * terminating '\0's).
852 while (stridx < count) {
853 size_t length = strlen(newp) + 1;
857 newp = newval[++stridx];
863 /****************************************************************************/
866 * Heuristic to guess if this is a string or concatenated strings.
869 static int is_printable_string(const void *data, int len)
871 const char *s = data;
873 /* zero length is not */
877 /* must terminate with zero or '\n' */
878 if (s[len - 1] != '\0' && s[len - 1] != '\n')
881 /* printable or a null byte (concatenated strings) */
882 while (((*s == '\0') || isprint(*s) || isspace(*s)) && (len > 0)) {
884 * If we see a null, there are three possibilities:
885 * 1) If len == 1, it is the end of the string, printable
886 * 2) Next character also a null, not printable.
887 * 3) Next character not a null, continue to check.
899 /* Not the null termination, or not done yet: not printable */
900 if (*s != '\0' || (len != 0))
908 * Print the property in the best format, a heuristic guess. Print as
909 * a string, concatenated strings, a byte, word, double word, or (if all
910 * else fails) it is printed as a stream of bytes.
912 static void print_data(const void *data, int len)
915 const char *env_max_dump;
916 ulong max_dump = ULONG_MAX;
918 /* no data, don't print */
922 env_max_dump = env_get("fdt_max_dump");
924 max_dump = hextoul(env_max_dump, NULL);
927 * It is a string, but it may have multiple strings (embedded '\0's).
929 if (is_printable_string(data, len)) {
936 j += strlen(data) + 1;
937 data += strlen(data) + 1;
945 printf("* 0x%p [0x%08x]", data, len);
950 for (j = 0, p = data; j < len/4; j++)
951 printf("0x%08x%s", fdt32_to_cpu(p[j]),
952 j < (len/4 - 1) ? " " : "");
955 } else { /* anything else... hexdump */
957 printf("* 0x%p [0x%08x]", data, len);
962 for (j = 0, s = data; j < len; j++)
963 printf("%02x%s", s[j], j < len - 1 ? " " : "");
969 /****************************************************************************/
972 * Recursively print (a portion of) the working_fdt. The depth parameter
973 * determines how deeply nested the fdt is printed.
975 static int fdt_print(const char *pathp, char *prop, int depth)
977 static char tabs[MAX_LEVEL+1] =
978 "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
979 "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
980 const void *nodep; /* property node pointer */
981 int nodeoffset; /* node offset from libfdt */
982 int nextoffset; /* next node offset from libfdt */
983 uint32_t tag; /* tag */
984 int len; /* length of the property */
985 int level = 0; /* keep track of nesting level */
986 const struct fdt_property *fdt_prop;
988 nodeoffset = fdt_path_offset (working_fdt, pathp);
989 if (nodeoffset < 0) {
991 * Not found or something else bad happened.
993 printf ("libfdt fdt_path_offset() returned %s\n",
994 fdt_strerror(nodeoffset));
998 * The user passed in a property as well as node path.
999 * Print only the given property and then return.
1002 nodep = fdt_getprop (working_fdt, nodeoffset, prop, &len);
1004 /* no property value */
1005 printf("%s %s\n", pathp, prop);
1007 } else if (nodep && len > 0) {
1008 printf("%s = ", prop);
1009 print_data (nodep, len);
1013 printf ("libfdt fdt_getprop(): %s\n",
1020 * The user passed in a node path and no property,
1021 * print the node and all subnodes.
1024 tag = fdt_next_tag(working_fdt, nodeoffset, &nextoffset);
1026 case FDT_BEGIN_NODE:
1027 pathp = fdt_get_name(working_fdt, nodeoffset, NULL);
1028 if (level <= depth) {
1030 pathp = "/* NULL pointer error */";
1032 pathp = "/"; /* root is nameless */
1034 &tabs[MAX_LEVEL - level], pathp);
1037 if (level >= MAX_LEVEL) {
1038 printf("Nested too deep, aborting.\n");
1045 printf("%s};\n", &tabs[MAX_LEVEL - level]);
1047 level = -1; /* exit the loop */
1051 fdt_prop = fdt_offset_ptr(working_fdt, nodeoffset,
1053 pathp = fdt_string(working_fdt,
1054 fdt32_to_cpu(fdt_prop->nameoff));
1055 len = fdt32_to_cpu(fdt_prop->len);
1056 nodep = fdt_prop->data;
1058 printf ("libfdt fdt_getprop(): %s\n",
1061 } else if (len == 0) {
1062 /* the property has no value */
1065 &tabs[MAX_LEVEL - level],
1068 if (level <= depth) {
1070 &tabs[MAX_LEVEL - level],
1072 print_data (nodep, len);
1078 printf("%s/* NOP */\n", &tabs[MAX_LEVEL - level]);
1084 printf("Unknown tag 0x%08X\n", tag);
1087 nodeoffset = nextoffset;
1092 /********************************************************************/
1093 #ifdef CONFIG_SYS_LONGHELP
1094 static char fdt_help_text[] =
1095 "addr [-c] [-q] <addr> [<size>] - Set the [control] fdt location to <addr>\n"
1096 #ifdef CONFIG_OF_LIBFDT_OVERLAY
1097 "fdt apply <addr> - Apply overlay to the DT\n"
1099 #ifdef CONFIG_OF_BOARD_SETUP
1100 "fdt boardsetup - Do board-specific set up\n"
1102 #ifdef CONFIG_OF_SYSTEM_SETUP
1103 "fdt systemsetup - Do system-specific set up\n"
1105 "fdt move <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active\n"
1106 "fdt resize [<extrasize>] - Resize fdt to size + padding to 4k addr + some optional <extrasize> if needed\n"
1107 "fdt print <path> [<prop>] - Recursive print starting at <path>\n"
1108 "fdt list <path> [<prop>] - Print one level starting at <path>\n"
1109 "fdt get value <var> <path> <prop> [<index>] - Get <property> and store in <var>\n"
1110 " In case of stringlist property, use optional <index>\n"
1111 " to select string within the stringlist. Default is 0.\n"
1112 "fdt get name <var> <path> <index> - Get name of node <index> and store in <var>\n"
1113 "fdt get addr <var> <path> <prop> - Get start address of <property> and store in <var>\n"
1114 "fdt get size <var> <path> [<prop>] - Get size of [<property>] or num nodes and store in <var>\n"
1115 "fdt set <path> <prop> [<val>] - Set <property> [to <val>]\n"
1116 "fdt mknode <path> <node> - Create a new node after <path>\n"
1117 "fdt rm <path> [<prop>] - Delete the node or <property>\n"
1118 "fdt header [get <var> <member>] - Display header info\n"
1119 " get - get header member <member> and store it in <var>\n"
1120 "fdt bootcpu <id> - Set boot cpuid\n"
1121 "fdt memory <addr> <size> - Add/Update memory node\n"
1122 "fdt rsvmem print - Show current mem reserves\n"
1123 "fdt rsvmem add <addr> <size> - Add a mem reserve\n"
1124 "fdt rsvmem delete <index> - Delete a mem reserves\n"
1125 "fdt chosen [<start> <size>] - Add/update the /chosen branch in the tree\n"
1126 " <start>/<size> - initrd start addr/size\n"
1127 #if defined(CONFIG_FIT_SIGNATURE)
1128 "fdt checksign [<addr>] - check FIT signature\n"
1129 " <start> - addr of key blob\n"
1130 " default gd->fdt_blob\n"
1132 "NOTE: Dereference aliases by omitting the leading '/', "
1133 "e.g. fdt print ethernet0.";
1137 fdt, 255, 0, do_fdt,
1138 "flattened device tree utility commands", fdt_help_text