aboutsummaryrefslogtreecommitdiff
path: root/cmd/fdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/fdt.c')
-rw-r--r--cmd/fdt.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 8e51a43..1972490 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -208,19 +208,11 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
return CMD_RET_SUCCESS;
- }
-
- if (!working_fdt) {
- puts("No FDT memory address configured. Please configure\n"
- "the FDT address via \"fdt addr <address>\" command.\n"
- "Aborting!\n");
- return CMD_RET_FAILURE;
- }
/*
* Move the working_fdt
*/
- if (strncmp(argv[1], "mo", 2) == 0) {
+ } else if (strncmp(argv[1], "mo", 2) == 0) {
struct fdt_header *newaddr;
int len;
int err;
@@ -231,11 +223,11 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* Set the address and length of the fdt.
*/
- working_fdt = (struct fdt_header *)hextoul(argv[2], NULL);
+ working_fdt = map_sysmem(hextoul(argv[2], NULL), 0);
if (!fdt_valid(&working_fdt))
return 1;
- newaddr = (struct fdt_header *)hextoul(argv[3], NULL);
+ newaddr = map_sysmem(hextoul(argv[3], NULL), 0);
/*
* If the user specifies a length, use that. Otherwise use the
@@ -262,10 +254,21 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
fdt_strerror(err));
return 1;
}
- set_working_fdt_addr((ulong)newaddr);
+ set_working_fdt_addr(map_to_sysmem(newaddr));
+
+ return CMD_RET_SUCCESS;
+ }
+
+ if (!working_fdt) {
+ puts("No FDT memory address configured. Please configure\n"
+ "the FDT address via \"fdt addr <address>\" command.\n"
+ "Aborting!\n");
+ return CMD_RET_FAILURE;
+ }
+
#ifdef CONFIG_OF_SYSTEM_SETUP
/* Call the board-specific fixup routine */
- } else if (strncmp(argv[1], "sys", 3) == 0) {
+ if (strncmp(argv[1], "sys", 3) == 0) {
int err = ft_system_setup(working_fdt, gd->bd);
if (err) {
@@ -273,11 +276,14 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
fdt_strerror(err));
return CMD_RET_FAILURE;
}
+
+ return CMD_RET_SUCCESS;
+ }
#endif
/*
* Make a new node
*/
- } else if (strncmp(argv[1], "mk", 2) == 0) {
+ if (strncmp(argv[1], "mk", 2) == 0) {
char *pathp; /* path */
char *nodep; /* new node to add */
int nodeoffset; /* node offset from libfdt */