]> git.sur5r.net Git - u-boot/blobdiff - common/main.c
sdhci: Add sdhci support for spear devices
[u-boot] / common / main.c
index b145f8556586c27c4e150396d1bd5ddbc19f60e0..953ef296b197fd7dcb8dbd692f8d437b63b7df7b 100644 (file)
 #include <fdtdec.h>
 #endif
 
-#ifdef CONFIG_OF_LIBFDT
-#include <fdt_support.h>
-#endif /* CONFIG_OF_LIBFDT */
-
 #include <post.h>
 #include <linux/ctype.h>
 #include <menu.h>
@@ -95,7 +91,7 @@ extern void mdm_init(void); /* defined in board.c */
  * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
  * returns: 0 -  no key string, allow autoboot 1 - got key string, abort
  */
-#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
+#if defined(CONFIG_BOOTDELAY)
 # if defined(CONFIG_AUTOBOOT_KEYED)
 #ifndef CONFIG_MENU
 static inline
@@ -225,6 +221,7 @@ static inline
 int abortboot(int bootdelay)
 {
        int abort = 0;
+       unsigned long ts;
 
 #ifdef CONFIG_MENUPROMPT
        printf(CONFIG_MENUPROMPT);
@@ -248,11 +245,10 @@ int abortboot(int bootdelay)
 #endif
 
        while ((bootdelay > 0) && (!abort)) {
-               int i;
-
                --bootdelay;
-               /* delay 100 * 10ms */
-               for (i=0; !abort && i<100; ++i) {
+               /* delay 1000 ms */
+               ts = get_timer(0);
+               do {
                        if (tstc()) {   /* we got a key press   */
                                abort  = 1;     /* don't auto boot      */
                                bootdelay = 0;  /* no more delay        */
@@ -264,7 +260,7 @@ int abortboot(int bootdelay)
                                break;
                        }
                        udelay(10000);
-               }
+               } while (!abort && get_timer(ts) < 1000);
 
                printf("\b\b\b%2d ", bootdelay);
        }
@@ -279,7 +275,7 @@ int abortboot(int bootdelay)
        return abort;
 }
 # endif        /* CONFIG_AUTOBOOT_KEYED */
-#endif /* CONFIG_BOOTDELAY >= 0  */
+#endif /* CONFIG_BOOTDELAY */
 
 /*
  * Runs the given boot command securely.  Specifically:
@@ -295,8 +291,7 @@ int abortboot(int bootdelay)
  * printing the error message to console.
  */
 
-#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) && \
-       defined(CONFIG_OF_CONTROL)
+#if defined(CONFIG_BOOTDELAY) && defined(CONFIG_OF_CONTROL)
 static void secure_boot_cmd(char *cmd)
 {
        cmd_tbl_t *cmdtp;
@@ -358,11 +353,10 @@ void main_loop (void)
        int rc = 1;
        int flag;
 #endif
-#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) && \
-               defined(CONFIG_OF_CONTROL)
+#if defined(CONFIG_BOOTDELAY) && defined(CONFIG_OF_CONTROL)
        char *env;
 #endif
-#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
+#if defined(CONFIG_BOOTDELAY)
        char *s;
        int bootdelay;
 #endif
@@ -431,7 +425,7 @@ void main_loop (void)
        update_tftp (0UL);
 #endif /* CONFIG_UPDATE_TFTP */
 
-#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
+#if defined(CONFIG_BOOTDELAY)
        s = getenv ("bootdelay");
        bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
 
@@ -500,10 +494,6 @@ void main_loop (void)
 #endif /* CONFIG_MENUKEY */
 #endif /* CONFIG_BOOTDELAY */
 
-#if defined CONFIG_OF_CONTROL
-       set_working_fdt_addr((void *)gd->fdt_blob);
-#endif /* CONFIG_OF_CONTROL */
-
        /*
         * Main Loop for Monitor Command Processing
         */
@@ -1141,8 +1131,16 @@ int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
                                        puts (tab_seq+(col&07));
                                        col += 8 - (col&07);
                                } else {
-                                       ++col;          /* echo input           */
-                                       putc (c);
+                                       char buf[2];
+
+                                       /*
+                                        * Echo input using puts() to force am
+                                        * LCD flush if we are using an LCD
+                                        */
+                                       ++col;
+                                       buf[0] = c;
+                                       buf[1] = '\0';
+                                       puts(buf);
                                }
                                *p++ = c;
                                ++n;
@@ -1444,7 +1442,7 @@ static int builtin_run_command(const char *cmd, int flag)
                        continue;
                }
 
-               if (cmd_process(flag, argc, argv, &repeatable))
+               if (cmd_process(flag, argc, argv, &repeatable, NULL))
                        rc = -1;
 
                /* Did the user stop this? */