summaryrefslogtreecommitdiff
path: root/common/cmd_fdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/cmd_fdt.c')
-rw-r--r--common/cmd_fdt.c76
1 files changed, 32 insertions, 44 deletions
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index cd4c6de..3d0c2b7 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -65,14 +65,12 @@ void set_working_fdt_addr(void *addr)
*/
int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
- /********************************************************************
+ /*
* Set the address of the fdt
- ********************************************************************/
+ */
if (argv[1][0] == 'a') {
unsigned long addr;
/*
@@ -116,18 +114,16 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
}
- /********************************************************************
+ /*
* Move the working_fdt
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "mo", 2) == 0) {
struct fdt_header *newaddr;
int len;
int err;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
/*
* Set the address and length of the fdt.
@@ -166,9 +162,9 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
working_fdt = newaddr;
- /********************************************************************
+ /*
* Make a new node
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "mk", 2) == 0) {
char *pathp; /* path */
char *nodep; /* new node to add */
@@ -178,10 +174,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
/*
* Parameters: Node path, new node to be appended to the path.
*/
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
pathp = argv[2];
nodep = argv[3];
@@ -202,9 +196,9 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return 1;
}
- /********************************************************************
+ /*
* Set the value of a property in the working_fdt.
- ********************************************************************/
+ */
} else if (argv[1][0] == 's') {
char *pathp; /* path */
char *prop; /* property */
@@ -216,10 +210,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
/*
* Parameters: Node path, property, optional value.
*/
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
pathp = argv[2];
prop = argv[3];
@@ -247,9 +239,9 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return 1;
}
- /********************************************************************
+ /*
* Print (recursive) / List (single level)
- ********************************************************************/
+ */
} else if ((argv[1][0] == 'p') || (argv[1][0] == 'l')) {
int depth = MAX_LEVEL; /* how deep to print */
char *pathp; /* path */
@@ -281,9 +273,9 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
if (ret != 0)
return ret;
- /********************************************************************
+ /*
* Remove a property/node
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "rm", 2) == 0) {
int nodeoffset; /* node offset from libfdt */
int err;
@@ -321,9 +313,9 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
}
- /********************************************************************
+ /*
* Display header info
- ********************************************************************/
+ */
} else if (argv[1][0] == 'h') {
u32 version = fdt_version(working_fdt);
printf("magic:\t\t\t0x%x\n", fdt_magic(working_fdt));
@@ -351,16 +343,16 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
fdt_num_mem_rsv(working_fdt));
printf("\n");
- /********************************************************************
+ /*
* Set boot cpu id
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "boo", 3) == 0) {
unsigned long tmp = simple_strtoul(argv[2], NULL, 16);
fdt_set_boot_cpuid_phys(working_fdt, tmp);
- /********************************************************************
+ /*
* memory command
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "me", 2) == 0) {
uint64_t addr, size;
int err;
@@ -370,9 +362,9 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
if (err < 0)
return err;
- /********************************************************************
+ /*
* mem reserve commands
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "rs", 2) == 0) {
if (argv[2][0] == 'p') {
uint64_t addr, size;
@@ -417,8 +409,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
} else {
/* Unrecognized command */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
}
#ifdef CONFIG_OF_BOARD_SETUP
@@ -430,10 +421,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
else if (argv[1][0] == 'c') {
unsigned long initrd_start = 0, initrd_end = 0;
- if ((argc != 2) && (argc != 4)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc != 2) && (argc != 4))
+ return cmd_usage(cmdtp);
if (argc == 4) {
initrd_start = simple_strtoul(argv[2], NULL, 16);
@@ -449,8 +438,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
}
else {
/* Unrecognized command */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;