]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_fdos.c
nand: remove CONFIG_SYS_NAND_PAGE_SIZE
[karo-tx-uboot.git] / common / cmd_fdos.c
index f9da98ddcc7e9491345435aedfa752fad4d861a6..69303255ff0e72ba4d6fac2d05eb1e2f7a4851db 100644 (file)
@@ -1,25 +1,9 @@
 /*
  * (C) Copyright 2002
- * Stäubli Faverges - <www.staubli.com>
+ * Stäubli Faverges - <www.staubli.com>
  * Pierre AUBERT  p.aubert@staubli.com
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
 #include <command.h>
 #include <fdc.h>
 
-#if defined(CONFIG_CMD_FDOS)
-
 /*-----------------------------------------------------------------------------
  * do_fdosboot --
  *-----------------------------------------------------------------------------
  */
-int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
     char *name;
     char *ep;
     int size;
-    int rcode = 0;
-    char buf [12];
-    int drive = CFG_FDC_DRIVE_NUMBER;
+    int drive = CONFIG_SYS_FDC_DRIVE_NUMBER;
 
     /* pre-set load_addr */
     if ((ep = getenv("loadaddr")) != NULL) {
@@ -75,8 +55,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        name = argv [2];
        break;
     default:
-       printf ("Usage:\n%s\n", cmdtp->usage);
-       break;
+       return CMD_RET_USAGE;
     }
 
     /* Init physical layer                                                   */
@@ -95,32 +74,22 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
     }
     flush_cache (load_addr, size);
 
-    sprintf(buf, "%x", size);
-    setenv("filesize", buf);
+    setenv_hex("filesize", size);
 
     printf("Floppy DOS load complete: %d bytes loaded to 0x%lx\n",
           size, load_addr);
 
-    /* Check if we should attempt an auto-start */
-    if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) {
-       char *local_args[2];
-       extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
-       local_args[0] = argv[0];
-       local_args[1] = NULL;
-       printf ("Automatic boot of image at addr 0x%08lX ...\n", load_addr);
-       rcode = do_bootm (cmdtp, 0, 1, local_args);
-    }
-    return rcode;
+    return bootm_maybe_autostart(cmdtp, argv[0]);
 }
 
 /*-----------------------------------------------------------------------------
  * do_fdosls --
  *-----------------------------------------------------------------------------
  */
-int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
     char *path = "";
-    int drive = CFG_FDC_DRIVE_NUMBER;
+    int drive = CONFIG_SYS_FDC_DRIVE_NUMBER;
 
     switch (argc) {
     case 1:
@@ -144,14 +113,12 @@ int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 U_BOOT_CMD(
        fdosboot,       3,      0,      do_fdosboot,
-       "fdosboot- boot from a dos floppy file\n",
-       "[loadAddr] [filename]\n"
+       "boot from a dos floppy file",
+       "[loadAddr] [filename]"
 );
 
 U_BOOT_CMD(
        fdosls, 2,      0,      do_fdosls,
-       "fdosls  - list files in a directory\n",
-       "[directory]\n"
+       "list files in a directory",
+       "[directory]"
 );
-
-#endif