Restore go command for all supported devices
authorPiotr Dymacz <pepe2k@gmail.com>
Mon, 13 Jan 2014 23:43:15 +0000 (00:43 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Mon, 13 Jan 2014 23:43:15 +0000 (00:43 +0100)
u-boot/common/cmd_boot.c

index ff1e64ab5e4a71ed14c6e9f8c1833f3ad498bad7..e2937e1c5a0fc6474f56826eebaa9aa09427c54c 100755 (executable)
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
+int do_go(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
+       ulong addr, rc;
+       int rcode = 0;
+
+       if(argc < 2){
+#ifdef CFG_LONGHELP
+               if(cmdtp->help != NULL){
+                       printf("Usage:\n%s %s\n", cmdtp->name, cmdtp->help);
+               } else {
+                       printf("Usage:\n%s %s\n", cmdtp->name, cmdtp->usage);
+               }
+#else
+               printf("Usage:\n%s %s\n", cmdtp->name, cmdtp->usage);
+#endif
+               return(1);
+       }
+
+       addr = simple_strtoul(argv[1], NULL, 16);
+
+       printf("## Starting application at 0x%08lX...\n", addr);
+
+       /*
+        * Pass address parameter as argv[0] (aka command name),
+        * and all remaining args
+        */
+       rc = ((ulong (*)(int, char *[]))addr)(--argc, &argv[1]);
+
+       if(rc != 0){
+               rcode = 1;
+       }
+
+       printf("## Application terminated, rc = 0x%lX\n", rc);
+
+       return(rcode);
+}
+
+U_BOOT_CMD(go, CFG_MAXARGS, 1, do_go, "start application at address 'addr'\n",
+               "addr [arg ...]\n"
+               "\t- start application at address 'addr'\n"
+               "\t  passing 'arg' as arguments\n");
+
 extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
-U_BOOT_CMD(reset, 1, 0,        do_reset, "perform RESET of the CPU\n", NULL);
+U_BOOT_CMD(reset, 1, 0, do_reset, "perform RESET of the CPU\n", NULL);