{
unsigned int addr;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (!strncmp(argv[1], "init", 4)) {
#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
/* -------------------------------------------------- */
if (argc < 2)
- {
- cmd_usage(cmdtp);
- return;
- }
+ return cmd_usage(cmdtp);
/* Turn off a breakpoint */
if(!(( isdigit( argv[ 1 ][ 0 ] )) ||
(( argv[ 1 ][ 0 ] >= 'a' ) && ( argv[ 1 ][ 0 ] <= 'f' )) ||
(( argv[ 1 ][ 0 ] >= 'A' ) && ( argv[ 1 ][ 0 ] <= 'F' ))))
- {
- cmd_usage(cmdtp);
- return;
- }
+ return cmd_usage(cmdtp);
addr = simple_strtoul( argv[ 1 ], NULL, 16 );
writeback[0] = 0x01234567UL;
writeback[1] = 0x89abcdefUL;
- if (argc > 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc > 4)
+ return cmd_usage(cmdtp);
if (argc == 2) {
if (strcmp(argv[1], "status") == 0) {
return 0;
}
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(ecc, 4, 0, do_ecc,
/* -------------------------------------------------- */
if (argc < 2)
- {
- cmd_usage(cmdtp);
- return;
- }
+ return cmd_usage(cmdtp);
/* Turn off a breakpoint */
/* Set a breakpoint at the address */
if( !isdigit( argv[ 1 ][ 0 ]))
- {
- cmd_usage(cmdtp);
- return;
- }
+ return cmd_usage(cmdtp);
addr = simple_strtoul( argv[ 1 ], NULL, 16 ) & 0xfffffffc;
u8 *buf;
int cpu_freq;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
cpu_freq = simple_strtol(argv[1], NULL, 10);
if (cpu_freq != 267) {
l2cache_status() ? "ON" : "OFF");
return 0;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
{
char c = '\0';
pll_freq_t pll_freq;
- if (argc < 2) {
- cmd_usage(cmdtp);
- goto ret;
- }
- for (pll_freq = PLL_ebc20; pll_freq < PLL_TOTAL; pll_freq++)
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
+ for (pll_freq = PLL_ebc20; pll_freq < PLL_TOTAL; pll_freq++) {
if (!strcmp(pll_name[pll_freq], argv[1]))
break;
+ }
switch (pll_freq) {
case PLL_ebc20:
default:
printf("Invalid options\n\n");
- cmd_usage(cmdtp);
- goto ret;
+ return cmd_usage(cmdtp);
}
printf("PLL set to %s, "
static int do_lcd_puts (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);
+
lcd_puts(argv[1]);
return 0;
static int do_lcd_putc (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);
+
lcd_putc((char)argv[1][0]);
return 0;
ulong dir;
char cur_addr;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
count = simple_strtoul(argv[1], NULL, 16);
if (count > 31) {
{
int led_no;
- if (argc != 3) {
- cmd_usage(cmd_tp);
- return -1;
- }
+ if (argc != 3)
+ return cmd_usage(cmd_tp);
led_no = simple_strtoul(argv[1], NULL, 16);
- if (led_no != 1 && led_no != 2) {
- cmd_usage(cmd_tp);
- return -1;
- }
+ if (led_no != 1 && led_no != 2)
+ return cmd_usage(cmd_tp);
if (strcmp(argv[2],"off") == 0x0) {
if (led_no == 1)
else
gpio_write_bit(31, 0);
} else {
- cmd_usage(cmd_tp);
- return -1;
+ return cmd_usage(cmd_tp);
}
return 0;
}
static int do_lcd_puts(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);
+
lcd_puts(argv[1]);
return 0;
}
static int do_lcd_putc(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);
+
lcd_putc((char)argv[1][0]);
return 0;
}
ulong dir;
char cur_addr;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
count = simple_strtoul(argv[1], NULL, 16);
if (count > 31) {
char plbClock[4];
char pcixClock[4];
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
if (strcmp(argv[2], "prom0") == 0)
chip = IIC0_BOOTPROM_ADDR;
int barcobcd_boot_image (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
-#if 0
- if (argc > 1) {
- cmd_usage(cmdtp);
- return 1;
- }
-#endif
barcobcd_boot ();
return 0;
int err;
int i;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
memset(&pcmd, 0, sizeof(pcmd));
memset(&prx, 0, sizeof(prx));
int err;
uchar channel_mask = 0;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
if (strncmp(argv[1], "on", 2) == 0)
channel_mask |= 1;
int err;
uchar channel_num = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
channel_num = simple_strtol(argv[1], NULL, 10);
if ((channel_num != 1) && (channel_num != 2)) {
return c->cmd(c, flag, argc, argv);
} else {
/* Unrecognized command */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return err;
#ifdef CONFIG_VIDEO_SM501
char *str;
#endif
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);
return 0;
}
- cmd_usage(cmdtp);
- return 1;
-
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
prog_eeprom();
break;
default:
- cmd_usage(cmdtp);
- break;
+ return cmd_usage(cmdtp);
}
return 0;
break;
case 'h': /* help */
default:
- cmd_usage(cmdtp);
- break;
+ return cmd_usage(cmdtp);
}
return 0;
{
unsigned int addr;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (!strncmp(argv[1],"init",4)) {
#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
break;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
fpga, 6, 1, do_fpga,
/* fall through ... */
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
memset (data, 0, HYMOD_EEPROM_SIZE);
printf("exit code: 0x%X\n", val);
return 0;
default:
- cmd_usage(cmdtp);
- break;
+ return cmd_usage(cmdtp);
}
return -1;
int combrd, baudrate, i, j, len;
int address;
- if (argc < 5) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 5)
+ return cmd_usage(cmdtp);
argc--;
argv++;
unsigned int period, freq;
int prev, i;
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 3)
+ return cmd_usage(cmdtp);
argc--;
argv++;
return c->cmd(c, flag, argc, argv);
} else {
/* Unrecognized command */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
}
int do_spi_toggle(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
u32 tmp;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if ((strcmp(argv[1], "off") == 0)) {
printf("SPI FLASH disabled, NAND enabled\n");
tmp = readl(KW_GPIO0_BASE);
writel(tmp & (~FLASH_GPIO_PIN) , KW_GPIO0_BASE);
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
default:
break;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
pic, 4, 1, do_pic,
default:
break;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
int do_eeprom_wp(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);
- if ((strcmp(argv[1], "on") == 0)) {
+ if ((strcmp(argv[1], "on") == 0))
gpio_write_bit(CONFIG_SYS_GPIO_EEPROM_EXT_WP, 1);
- } else if ((strcmp(argv[1], "off") == 0)) {
+ else if ((strcmp(argv[1], "off") == 0))
gpio_write_bit(CONFIG_SYS_GPIO_EEPROM_EXT_WP, 0);
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
-
+ else
+ return cmd_usage(cmdtp);
return 0;
}
return 0;
}
#endif
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
default:
break;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
int rcode = -1;
if (argc < 2) {
- usage:
- cmd_usage(cmdtp);
- return 1;
+usage:
+ return cmd_usage(cmdtp);
}
if (argc >= 3) {
static int cmd_lcd_brightness(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);
return set_lcd_brightness(argv[1]);
}
/*
* Command led: controls the various LEDs 0..11 on the PN62 card.
*/
-int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_led(cmd_tbl_t * cmdtp, int flag, int argc, char *const argv[])
{
- unsigned int number, function;
+ unsigned int number, function;
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
- number = simple_strtoul(argv[1], NULL, 10);
- if (number > PN62_LED_MAX)
- return 1;
- function = simple_strtoul(argv[2], NULL, 16);
- set_led (number, function);
- return 0;
+ if (argc != 3)
+ return cmd_usage(cmdtp);
+
+ number = simple_strtoul(argv[1], NULL, 10);
+ if (number > PN62_LED_MAX)
+ return 1;
+
+ function = simple_strtoul(argv[2], NULL, 16);
+ set_led(number, function);
+ return 0;
}
U_BOOT_CMD(
led , 3, 1, do_led,
addr = simple_strtoul(argv[1], NULL, 16);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
printf ("## Ready for image download ...\n");
{
ulong addr;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);
unsigned char mac[6];
char *s, *e;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
s = argv[1];
int do_print_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc != 1) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 1)
+ return cmd_usage(cmdtp);
mac_read();
{
char *cmd;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
cmd = argv[1];
switch (cmd[0]) {
test_net();
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
return 0;
failure:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
default:
break;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD (puma, 4, 1, do_puma,
char *s, *e;
char i2c_mac[20];
- if ((argc > 3) || (argc < 2)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc > 3) || (argc < 2))
+ return cmd_usage(cmdtp);
if ((!strcmp(argv[1], "cpufreq")) || (!strcmp(argv[1], "ddrfreq"))) {
return 0;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(chip_config, 3, 1, do_chip_config,
switch (argc) {
case 0:
case 1:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 2:
if (strncmp(argv[1],"saw",3) == 0) {
printf ("Play sawtooth\n");
return rcode;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 3:
if (strncmp(argv[1],"saw",3) == 0) {
duration = simple_strtoul(argv[2], NULL, 10);
LEFT_RIGHT);
return rcode;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 4:
if (strncmp(argv[1],"saw",3) == 0) {
duration = simple_strtoul(argv[2], NULL, 10);
pcm1772_write_reg((uchar)reg, (uchar)val);
return 0;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 5:
if (strncmp(argv[1],"saw",3) == 0) {
duration = simple_strtoul(argv[2], NULL, 10);
channel);
return rcode;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
printf ("Usage:\nsound cmd [arg1] [arg2] ...\n");
return 1;
channel = LEFT_RIGHT;
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if ((tmp = getenv ("volume")) != NULL) {
int i;
int cycle_status;
- if (argc > 1) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc > 1)
+ return cmd_usage(cmdtp);
led_init ();
global_vars_init ();
{
int i, dip;
- if (argc > 1) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc > 1)
+ return cmd_usage(cmdtp);
- if ((dip = read_dip ()) == -1) {
+ if ((dip = read_dip ()) == -1)
return 1;
- }
for (i = 0; i < 4; i++) {
if ((dip & (1 << i)) == 0)
{
int vcc5v;
- if (argc > 1) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc > 1)
+ return cmd_usage(cmdtp);
- if ((vcc5v = read_vcc5v ()) == -1) {
+ if ((vcc5v = read_vcc5v ()) == -1)
return (1);
- }
printf ("%d", (vcc5v / 1000));
printf (".%d", (vcc5v % 1000) / 100);
{
int contact_temp;
- if (argc > 1) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc > 1)
+ return cmd_usage(cmdtp);
tsc2000_spi_init ();
int do_burn_in_status (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc > 1) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc > 1)
+ return cmd_usage(cmdtp);
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_STATUS, 1,
- (unsigned char*) &status, 1)) {
+ (unsigned char*) &status, 1))
return (1);
- }
+
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_PASS_CYCLES, 1,
- (unsigned char*) &pass_cycles, 2)) {
+ (unsigned char*) &pass_cycles, 2))
return (1);
- }
+
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_CYCLE,
- 1, (unsigned char*) &first_error_cycle, 2)) {
+ 1, (unsigned char*) &first_error_cycle, 2))
return (1);
- }
+
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NUM,
- 1, (unsigned char*) &first_error_num, 1)) {
+ 1, (unsigned char*) &first_error_num, 1))
return (1);
- }
+
if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME,
1, (unsigned char*)first_error_name,
- sizeof (first_error_name))) {
+ sizeof (first_error_name)))
return (1);
- }
- if (read_max_cycles () != 0) {
+ if (read_max_cycles () != 0)
return (1);
- }
printf ("max_cycles = %d\n", max_cycles);
printf ("status = %d\n", status);
struct rtc_time tm;
#endif
- if (argc > 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc > 2)
+ return cmd_usage(cmdtp);
- if (argc > 1) {
+ if (argc > 1)
delay = simple_strtoul(argv[1], NULL, 10);
- }
tsc2000_spi_init ();
while (1) {
static int do_write_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
int offset,value;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
offset=simple_strtoul(argv[2],NULL,16);
value=simple_strtoul(argv[3],NULL,16);
if (offset > 0x40) {
printf("Wrong offset : 0x%x\n",offset);
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
dm9000_write_srom_word(offset, value);
return (0);
}
int do_dm9000_eeprom ( 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);
- if (strcmp (argv[1],"read") == 0) {
+ if (strcmp (argv[1],"read") == 0)
return (do_read_dm9000_eeprom(cmdtp,flag,argc,argv));
- } else if (strcmp (argv[1],"write") == 0) {
+ else if (strcmp (argv[1],"write") == 0)
return (do_write_dm9000_eeprom(cmdtp,flag,argc,argv));
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
uchar dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
/* Validate usage */
- if (argc > 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc > 2)
+ return cmd_usage(cmdtp);
/* Passed in EEPROM address */
if (argc == 2)
addr = dis_last_addr;
len = dis_last_len;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command */
/* -------------------------------------------------- */
int rcode = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
printf ("\nEnter '.' when done\n");
mem_addr = simple_strtoul (argv[1], NULL, 16);
addr = simple_strtoul(argv[1], NULL, 16);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return (bmp_info(addr));
y = simple_strtoul(argv[3], NULL, 10);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return (bmp_display(addr, x, y));
c = find_cmd_tbl(argv[0], &cmd_bmp_sub[0], ARRAY_SIZE(cmd_bmp_sub));
- if (c) {
+ if (c)
return c->cmd(cmdtp, flag, argc, argv);
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
ulong addr, rc;
int rcode = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);
argv++;
return bootm_start(cmdtp, flag, argc, argv);
}
- }
- /* Unrecognized command */
- else {
- cmd_usage(cmdtp);
- return 1;
+ } else {
+ /* Unrecognized command */
+ return cmd_usage(cmdtp);
}
if (images.state >= state) {
printf ("Trying to execute a command out of order\n");
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
images.state |= state;
switch (argc) {
case 2: /* on / off */
switch (on_off(argv[1])) {
-#if 0 /* prevented by varargs handling; FALLTROUGH is harmless, too */
- default: cmd_usage(cmdtp);
- return;
-#endif
case 0: icache_disable();
break;
case 1: icache_enable ();
icache_status() ? "ON" : "OFF");
return 0;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
}
switch (argc) {
case 2: /* on / off */
switch (on_off(argv[1])) {
-#if 0 /* prevented by varargs handling; FALLTROUGH is harmless, too */
- default: cmd_usage(cmdtp);
- return;
-#endif
case 0: dcache_disable();
break;
case 1: dcache_enable ();
dcache_status() ? "ON" : "OFF");
return 0;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
unsigned long get_dcr (unsigned short);
/* Validate arguments */
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
/* Get a DCR */
dcrn = (unsigned short) simple_strtoul (argv[1], NULL, 16);
extern char console_buffer[];
/* Validate arguments */
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
/* Set a DCR */
dcrn = (unsigned short) simple_strtoul (argv[1], NULL, 16);
char buf[80];
/* Validate arguments */
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
/* Find out whether ther is '.' (dot) symbol in the first parameter. */
strncpy (buf, argv[1], sizeof(buf)-1);
char buf[80];
/* Validate arguments */
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
/* Find out whether ther is '.' (dot) symbol in the first parameter. */
strncpy (buf, argv[1], sizeof(buf)-1);
}
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
}
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
#endif
block_dev_desc_t *dev_desc=NULL;
int part_length;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
+
dev = (int)simple_strtoul (argv[2], &ep, 16);
dev_desc = get_dev(argv[1],dev);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (!filename) {
boot_drive=simple_strtoul(argv[2], NULL, 10);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/* setup FDC and scan for drives */
if(fdc_setup(boot_drive,pCMD,pFG)==FALSE) {
name = argv [2];
break;
default:
- cmd_usage(cmdtp);
- break;
+ return cmd_usage(cmdtp);
}
/* Init physical layer */
*/
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;
/*
}
}
- /********************************************************************
+ /*
* 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.
}
working_fdt = newaddr;
- /********************************************************************
+ /*
* Make a new node
- ********************************************************************/
+ */
} else if (strncmp(argv[1], "mk", 2) == 0) {
char *pathp; /* path */
char *nodep; /* new node to add */
/*
* 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];
return 1;
}
- /********************************************************************
+ /*
* Set the value of a property in the working_fdt.
- ********************************************************************/
+ */
} else if (argv[1][0] == 's') {
char *pathp; /* path */
char *prop; /* property */
/*
* 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];
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 */
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;
}
}
- /********************************************************************
+ /*
* 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));
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;
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;
}
} else {
/* Unrecognized command */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
}
#ifdef CONFIG_OF_BOARD_SETUP
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);
}
else {
/* Unrecognized command */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
#endif
int rcode = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "all") == 0) {
for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
}
#endif
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 3)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "bank") == 0) {
bank = simple_strtoul(argv[2], NULL, 16);
return 1;
}
- if (addr_first >= addr_last) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (addr_first >= addr_last)
+ return cmd_usage(cmdtp);
rcode = flash_sect_erase(addr_first, addr_last);
return rcode;
int p;
int rcode = 0;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
- if (strcmp(argv[1], "off") == 0) {
+ if (strcmp(argv[1], "off") == 0)
p = 0;
- } else if (strcmp(argv[1], "on") == 0) {
+ else if (strcmp(argv[1], "on") == 0)
p = 1;
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
#ifdef CONFIG_HAS_DATAFLASH
if ((strcmp(argv[2], "all") != 0) && (strcmp(argv[2], "bank") != 0)) {
}
#endif
- if (argc != 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 4)
+ return cmd_usage(cmdtp);
if (strcmp(argv[2], "bank") == 0) {
bank = simple_strtoul(argv[3], NULL, 16);
return 1;
}
- if (addr_first >= addr_last) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (addr_first >= addr_last)
+ return cmd_usage(cmdtp);
+
rcode = flash_sect_protect (p, addr_first, addr_last);
#endif /* CONFIG_SYS_NO_FLASH */
return rcode;
#endif
/* Local functions */
-static void fpga_usage (cmd_tbl_t * cmdtp);
static int fpga_get_op (char *opstr);
/* Local defines */
switch (op) {
case FPGA_NONE:
- fpga_usage (cmdtp);
- break;
+ return cmd_usage(cmdtp);
case FPGA_INFO:
rc = fpga_info (dev);
default:
printf ("Unknown operation\n");
- fpga_usage (cmdtp);
- break;
+ return cmd_usage(cmdtp);
}
return (rc);
}
-static void fpga_usage (cmd_tbl_t * cmdtp)
-{
- cmd_usage(cmdtp);
-}
-
/*
* Map op to supported operations. We don't use a table since we
* would just have to relocate it from flash anyway.
uint devaddr, alen, length;
u_char *memaddr;
- if (argc != 5) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 5)
+ return cmd_usage(cmdtp);
/*
* I2C chip address
*/
devaddr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* Length is the number of objects, not number of bytes.
alen = i2c_dp_last_alen;
length = i2c_dp_last_length;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
/*
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* If another parameter, it is the length to display.
uchar byte;
int count;
- if ((argc < 4) || (argc > 5)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc < 4) || (argc > 5))
+ return cmd_usage(cmdtp);
/*
* Chip is always specified.
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* Value to write is always specified.
ulong crc;
ulong err;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
/*
* Chip is always specified.
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* Count is always specified
int nbytes;
extern char console_buffer[];
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 3)
+ return cmd_usage(cmdtp);
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* got a good command to get here */
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
}
/*
u_char bytes[16];
int delay;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
/*
* Chip is always specified.
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (alen == 0)
+ return cmd_usage(cmdtp);
/*
* Length is the number of objects, not number of bytes.
"32 MiB", "16 MiB", "8 MiB", "4 MiB"
};
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
/*
* Chip is always specified.
*/
c = find_cmd_tbl(argv[0], &cmd_i2c_sub[0], ARRAY_SIZE(cmd_i2c_sub));
- if (c) {
+ if (c)
return c->cmd(cmdtp, flag, argc, argv);
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
}
/***************************************************/
switch (argc) {
case 0:
case 1:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 2:
if (strncmp(argv[1],"res",3) == 0) {
puts ("\nReset IDE"
}
return rcode;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 3:
if (strncmp(argv[1],"dev",3) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
#endif
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
default:
/* at least 4 args */
printf ("%ld blocks written: %s\n",
n, (n==cnt) ? "OK" : "ERROR");
- if (n==cnt) {
+ if (n==cnt)
return 0;
- } else {
+ else
return 1;
- }
} else {
- cmd_usage(cmdtp);
- rcode = 1;
+ return cmd_usage(cmdtp);
}
return rcode;
boot_device = argv[2];
break;
default:
- cmd_usage(cmdtp);
show_boot_progress (-42);
- return 1;
+ return cmd_usage(cmdtp);
}
show_boot_progress (42);
int do_interrupts(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);
/* on */
- if (strncmp(argv[1], "on", 2) == 0) {
+ if (strncmp(argv[1], "on", 2) == 0)
enable_interrupts();
- } else {
+ else
disable_interrupts();
- }
return 0;
}
int value, w;
/* Validate arguments */
- if ((argc != 4)){
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc != 4))
+ return cmd_usage(cmdtp);
/* Check for a data width specification.
* Defaults to long (4) if no specification.
if (strcmp(argv[1], "on") == 0)
hwflow_onoff(1);
else
- cmd_usage(cmdtp);
+ return cmd_usage(cmdtp);
}
printf("RTS/CTS hardware flow control: %s\n", hwflow_onoff(0) ? "on" : "off");
return 0;
}
return 0;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
}
size = dp_last_size;
length = dp_last_length;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command specified. Check for a size specification.
ulong addr, writeval, count;
int size;
- if ((argc < 3) || (argc > 4)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc < 3) || (argc > 4))
+ return cmd_usage(cmdtp);
/* Check for size specification.
*/
int i;
ulong count;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
count = simple_strtoul(argv[3], NULL, 10);
int i;
ulong count;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
count = simple_strtoul(argv[3], NULL, 10);
int size;
int rcode = 0;
- if (argc != 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 4)
+ return cmd_usage(cmdtp);
/* Check for size specification.
*/
ulong addr, dest, count;
int size;
- if (argc != 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 4)
+ return cmd_usage(cmdtp);
/* Check for size specification.
*/
volatile ushort *shortp;
volatile u_char *cp;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
/* Check for a size spefication.
* Defaults to long if no or incorrect specification.
volatile ushort *shortp;
volatile u_char *cp;
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
/* Check for a size spefication.
* Defaults to long if no or incorrect specification.
int nbytes, size;
extern char console_buffer[];
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout(); /* got a good command to get here */
ulong crc;
ulong *ptr;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
addr = simple_strtoul (argv[1], NULL, 16);
addr += base_address;
char * const *av;
if (argc < 3) {
- usage:
- cmd_usage(cmdtp);
- return 1;
+usage:
+ return cmd_usage(cmdtp);
}
av = argv + 1;
unsigned int i;
u8 output[16];
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);
len = simple_strtoul(argv[2], NULL, 16);
unsigned int i;
u8 output[20];
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], NULL, 16);
len = simple_strtoul(argv[2], NULL, 16);
dst = simple_strtoul(argv[2], NULL, 16);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
unsigned int num;
unsigned int blocking;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16);
if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
puts ("Bad number of FSL\n");
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
switch (fslnum) {
unsigned int num;
unsigned int blocking;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
num = (unsigned int)simple_strtoul (argv[2], NULL, 16);
blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16);
- if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER)
+ return cmd_usage(cmdtp);
switch (fslnum) {
#if (XILINX_FSL_NUMBER > 0)
unsigned int reg = 0;
unsigned int val = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
reg = (unsigned int)simple_strtoul (argv[1], NULL, 16);
val = (unsigned int)simple_strtoul (argv[2], NULL, 16);
switch (reg) {
int rcode = 0;
char *devname;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
#if defined(CONFIG_MII_INIT)
mii_init ();
else
miiphy_set_current_dev (argv[2]);
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/*
ulong start = get_timer(0);
ulong delay;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ;
while (get_timer(start) < delay) {
- if (ctrlc ()) {
+ if (ctrlc ())
return (-1);
- }
+
udelay (100);
}
{
int dev;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "init") == 0) {
if (argc == 2) {
} else if (argc == 3) {
dev = (int)simple_strtoul(argv[2], NULL, 10);
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (mmc_legacy_init(dev) != 0) {
#endif
curr_device = dev;
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
printf("mmc%d is current device\n", curr_device);
} else {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
{
unsigned long cpuid;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
cpuid = simple_strtoul(argv[1], NULL, 10);
if (cpuid >= cpu_numcores()) {
if (argc == 3) {
- if (strncmp(argv[2], "reset", 5) == 0) {
+ if (strncmp(argv[2], "reset", 5) == 0)
cpu_reset(cpuid);
- } else if (strncmp(argv[2], "status", 6) == 0) {
+ else if (strncmp(argv[2], "status", 6) == 0)
cpu_status(cpuid);
- } else if (strncmp(argv[2], "disable", 7) == 0) {
+ else if (strncmp(argv[2], "disable", 7) == 0)
return cpu_disable(cpuid);
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
+
return 0;
}
/* 4 or greater, make sure its release */
- if (strncmp(argv[2], "release", 7) != 0) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (strncmp(argv[2], "release", 7) != 0)
+ return cmd_usage(cmdtp);
- if (cpu_release(cpuid, argc - 3, argv + 3)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (cpu_release(cpuid, argc - 3, argv + 3))
+ return cmd_usage(cmdtp);
return 0;
}
return delete_partition(argv[2]);
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/***************************************************/
return ret;
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
#endif
#endif
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(nand, CONFIG_SYS_MAXARGS, 1, do_nand,
#if defined(CONFIG_CMD_MTDPARTS)
usage:
#endif
- cmd_usage(cmdtp);
show_boot_progress(-53);
- return 1;
+ return cmd_usage(cmdtp);
}
show_boot_progress(53);
break;
- default: cmd_usage(cmdtp);
+ default:
show_boot_progress (-80);
- return 1;
+ return cmd_usage(cmdtp);
}
show_boot_progress (80);
return -1;
NetPingIP = string_to_ip(argv[1]);
- if (NetPingIP == 0) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (NetPingIP == 0)
+ return cmd_usage(cmdtp);
if (NetLoop(PING) < 0) {
printf("ping failed; host %s is not alive\n", argv[1]);
#if defined(CONFIG_CMD_DNS)
int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc == 1) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (argc == 1)
+ return cmd_usage(cmdtp);
/*
* We should check for a valid hostname:
int do_setenv (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);
return _do_setenv (flag, argc, argv);
}
local_args[2] = NULL;
local_args[3] = NULL;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
/* Check the syntax */
switch (argc) {
case 1:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 2: /* askenv envname */
sprintf (message, "Please enter '%s':", argv[1]);
char *init_val;
int len;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
/* Set read buffer to initial value or empty sting */
init_val = getenv(argv[1]);
size_t retlen = 0;
if (argc < 3)
- {
- cmd_usage(cmdtp);
- return 1;
- }
+ return cmd_usage(cmdtp);
s = strchr(argv[0], '.');
if ((s != NULL) && (!strcmp(s, ".oob")))
size_t retlen = 0;
if (argc < 3)
- {
- cmd_usage(cmdtp);
- return 1;
- }
+ return cmd_usage(cmdtp);
addr = (ulong)simple_strtoul(argv[1], NULL, 16);
char *s;
if (argc < 2)
- {
- cmd_usage(cmdtp);
- return 1;
- }
+ return cmd_usage(cmdtp);
s = strchr(argv[0], '.');
ofs = (int)simple_strtoul(argv[1], NULL, 16);
argv += 2;
if (argc <= 0)
- {
- cmd_usage(cmdtp);
- return 1;
- }
+ return cmd_usage(cmdtp);
while (argc > 0) {
addr = simple_strtoul(*argv, NULL, 16);
c = find_cmd_tbl(argv[0], &cmd_onenand_sub[0], ARRAY_SIZE(cmd_onenand_sub));
- if (c) {
- return c->cmd(cmdtp, flag, argc, argv);
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (c)
+ return c->cmd(cmdtp, flag, argc, argv);
+ else
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
if (argc < 4) {
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
prompt_user = false;
return 1;
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/***************************************************/
uint size = out_last_size;
uint value = out_last_value;
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 3)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
- /* New command specified. Check for a size specification.
+ /*
+ * New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
size = cmd_get_data_size (argv[0], 1);
uint addr = in_last_addr;
uint size = in_last_size;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
- /* New command specified. Check for a size specification.
+ /*
+ * New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
size = cmd_get_data_size (argv[0], 1);
block_dev_desc_t *dev_desc=NULL;
int part_length;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
+
dev = (int)simple_strtoul (argv[2], &ep, 16);
dev_desc = get_dev(argv[1],dev);
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (!filename) {
switch (argc) {
case 0:
case 1:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 2:
if (strncmp(argv[1],"inf", 3) == 0) {
int i;
}
return rc;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 3:
if (strncmp(argv[1], "dev", 3) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
}
return rc;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
default: /* at least 4 args */
if (strcmp(argv[1], "read") == 0) {
n, (n == cnt) ? "OK" : "ERROR");
return (n == cnt) ? 0 : 1;
} else {
- cmd_usage(cmdtp);
- rc = 1;
+ return cmd_usage(cmdtp);
}
return rc;
boot_device = argv[2];
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (!boot_device) {
{
switch (argc) {
case 0:
- case 1: cmd_usage(cmdtp); return 1;
+ case 1: return cmd_usage(cmdtp);
+
case 2:
if (strncmp(argv[1],"res",3) == 0) {
printf("\nReset SCSI\n");
printf("\nno SCSI devices available\n");
return 1;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
case 3:
if (strncmp(argv[1],"dev",3) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
}
return 1;
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
default:
/* at least 4 args */
if (strcmp(argv[1],"read") == 0) {
return 0;
}
} /* switch */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/****************************************************************************************
int w;
/* Validate arguments */
- if ((argc != 5) || (strlen(argv[3]) != 1)) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if ((argc != 5) || (strlen(argv[3]) != 1))
+ return cmd_usage(cmdtp);
w = cmd_get_data_size(argv[0], 4);
return do_spi_flash_erase(argc - 1, argv + 1);
usage:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc == 1) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc == 1)
+ return cmd_usage(cmdtp);
if ((flag & CMD_FLAG_REPEAT) == 0) {
start_addr = (char *)simple_strtoul(argv[1], NULL, 16);
ulong addr = 0;
int err = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (mtdparts_init() != 0) {
printf("Error initializing mtdparts!\n");
return 0;
}
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
/* todo: get dev number for NAND... */
ubi_dev.nr = 0;
char *vol_name;
int ret;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
+
vol_name = argv[1];
debug("Using volume %s\n", vol_name);
return -1;
}
- if (argc < 3) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[1], &endp, 16);
- if (endp == argv[1]) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (endp == argv[1])
+ return cmd_usage(cmdtp);
filename = argv[2];
if (argc == 4) {
size = simple_strtoul(argv[3], &endp, 16);
- if (endp == argv[3]) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (endp == argv[3])
+ return cmd_usage(cmdtp);
}
debug("Loading file '%s' to address 0x%08x (size %d)\n", filename, addr, size);
boot_device = argv[2];
break;
default:
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
if (!boot_device) {
block_dev_desc_t *stor_dev;
#endif
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if ((strncmp(argv[1], "reset", 5) == 0) ||
(strncmp(argv[1], "start", 5) == 0)) {
return 0;
}
#endif /* CONFIG_USB_STORAGE */
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
#ifdef CONFIG_USB_STORAGE
{
ulong bitmap;
- if (argc != 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 2)
+ return cmd_usage(cmdtp);
if (argv[1][0] == '/') { /* select bitmap by number */
bitmap = simple_strtoul(argv[1]+1, NULL, 10);
puts (cmdtp->help);
putc ('\n');
#endif /* CONFIG_SYS_LONGHELP */
- return 0;
+ return 1;
}
#ifdef CONFIG_AUTO_COMPLETE
}
#endif
/* found - check max args */
- if ((child->argc - i) > cmdtp->maxargs) {
- cmd_usage(cmdtp);
- return -1;
- }
+ if ((child->argc - i) > cmdtp->maxargs)
+ return cmd_usage(cmdtp);
#endif
child->argv+=i; /* XXX horrible hack */
#ifndef __U_BOOT__
{
int i;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
for (i=1; i<argc; ++i) {
char *arg;
if (!c || !((argc == (c->maxargs)) ||
(((int)c->cmd == PCA953X_CMD_DEVICE) &&
(argc == (c->maxargs - 1))))) {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/* arg2 used as chip number or pin number */
if (!c || !((argc == (c->maxargs)) ||
(((int)c->cmd == DS4510_CMD_DEVICE) &&
(argc == (c->maxargs - 1))))) {
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
/* arg2 used as chip addr and pin number */
#ifdef CONFIG_CMD_DS4510_MEM
/* Only eeprom, seeprom, and sram commands should make it here */
- if (strcmp(argv[2], "read") == 0) {
+ if (strcmp(argv[2], "read") == 0)
rw_func = ds4510_mem_read;
- } else if (strcmp(argv[2], "write") == 0) {
+ else if (strcmp(argv[2], "write") == 0)
rw_func = ds4510_mem_write;
- } else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
addr = simple_strtoul(argv[3], NULL, 16);
off += simple_strtoul(argv[4], NULL, 16);
u32 val;
/* at least two arguments please */
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
cmd = argv[1];
if (strcmp(cmd, "dump") == 0) {
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
+
nregs = simple_strtoul(argv[2], NULL, 16);
pmic_dump(nregs);
return 0;
}
if (strcmp(cmd, "write") == 0) {
- if (argc < 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 4)
+ return cmd_usage(cmdtp);
+
nregs = simple_strtoul(argv[2], NULL, 16);
val = simple_strtoul(argv[3], NULL, 16);
pmic_reg_write(nregs, val);
{
ulong addr;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "fw") == 0) {
addr = simple_strtoul(argv[2], NULL, 16);
return qe_upload_firmware((const struct qe_firmware *) addr);
}
- cmd_usage(cmdtp);
- return 1;
+ return cmd_usage(cmdtp);
}
U_BOOT_CMD(
int n, sect_first, sect_last;
int rcode = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "all") == 0) {
for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
return rcode;
}
- if (argc != 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 3)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "bank") == 0) {
bank = simple_strtoul(argv[2], NULL, 16);
addr_first = simple_strtoul(argv[1], NULL, 16);
addr_last = simple_strtoul(argv[2], NULL, 16);
- if (addr_first >= addr_last) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (addr_first >= addr_last)
+ return cmd_usage(cmdtp);
printf ("Erase Flash from 0x%08lx to 0x%08lx ", addr_first, addr_last);
rcode = flash_sect_erase(addr_first, addr_last);
int i, p, n, sect_first, sect_last;
int rcode = 0;
- if (argc < 3) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 3)
+ return cmd_usage(cmdtp);
if (strcmp(argv[1], "off") == 0)
p = 0;
else if (strcmp(argv[1], "on") == 0)
p = 1;
- else {
- cmd_usage(cmdtp);
- return 1;
- }
+ else
+ return cmd_usage(cmdtp);
if (strcmp(argv[2], "all") == 0) {
for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
return rcode;
}
- if (argc != 4) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc != 4)
+ return cmd_usage(cmdtp);
if (strcmp(argv[2], "bank") == 0) {
bank = simple_strtoul(argv[3], NULL, 16);
}
#if defined(CONFIG_SYS_FLASH_PROTECTION)
- if (!rcode) puts (" done\n");
+ if (!rcode)
+ puts(" done\n");
#endif /* CONFIG_SYS_FLASH_PROTECTION */
return rcode;
addr_first = simple_strtoul(argv[2], NULL, 16);
addr_last = simple_strtoul(argv[3], NULL, 16);
- if (addr_first >= addr_last) {
- cmd_usage(cmdtp);
- return 1;
- }
- rcode = flash_sect_protect (p, addr_first, addr_last);
- return rcode;
+ if (addr_first >= addr_last)
+ return cmd_usage(cmdtp);
+
+ return flash_sect_protect (p, addr_first, addr_last);
}
int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
{