Merge with git://www.denx.de/git/u-boot.git
[platform/kernel/u-boot.git] / lib_arm / board.c
index f7ee9ee..87848d9 100644 (file)
@@ -52,7 +52,9 @@
 #include "../drivers/lan91c96.h"
 #endif
 
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+DECLARE_GLOBAL_DATA_PTR;
+
+#if defined(CONFIG_CMD_NAND)
 void nand_init (void);
 #endif
 
@@ -110,6 +112,30 @@ void *sbrk (ptrdiff_t increment)
 }
 
 /************************************************************************
+ * Coloured LED functionality
+ ************************************************************************
+ * May be supplied by boards if desired
+ */
+void inline __coloured_LED_init (void) {}
+void inline coloured_LED_init (void) __attribute__((weak, alias("__coloured_LED_init"))); 
+void inline __red_LED_on (void) {}
+void inline red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
+void inline __red_LED_off(void) {}
+void inline red_LED_off(void)       __attribute__((weak, alias("__red_LED_off"))); 
+void inline __green_LED_on(void) {}
+void inline green_LED_on(void) __attribute__((weak, alias("__green_LED_on"))); 
+void inline __green_LED_off(void) {}
+void inline green_LED_off(void)__attribute__((weak, alias("__green_LED_off"))); 
+void inline __yellow_LED_on(void) {}
+void inline yellow_LED_on(void)__attribute__((weak, alias("__yellow_LED_on"))); 
+void inline __yellow_LED_off(void) {}
+void inline yellow_LED_off(void)__attribute__((weak, alias("__yellow_LED_off"))); 
+
+
+
+
+
+/************************************************************************
  * Init Utilities                                                      *
  ************************************************************************
  * Some of this code should be moved into the core functions,
@@ -119,9 +145,7 @@ void *sbrk (ptrdiff_t increment)
 
 static int init_baudrate (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
-       uchar tmp[64];  /* long enough for environment variables */
+       char tmp[64];   /* long enough for environment variables */
        int i = getenv_r ("baudrate", tmp, sizeof (tmp));
        gd->bd->bi_baudrate = gd->baudrate = (i > 0)
                        ? (int) simple_strtoul (tmp, NULL, 10)
@@ -155,7 +179,6 @@ static int display_banner (void)
  */
 static int display_dram_config (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        int i;
 
 #ifdef DEBUG
@@ -236,11 +259,11 @@ init_fnc_t *init_sequence[] = {
 
 void start_armboot (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
-       ulong size;
        init_fnc_t **init_fnc_ptr;
        char *s;
+#ifndef CFG_NO_FLASH
+       ulong size;
+#endif
 #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
        unsigned long addr;
 #endif
@@ -297,8 +320,8 @@ void start_armboot (void)
        /* armboot_start is defined in the board-specific linker script */
        mem_malloc_init (_armboot_start - CFG_MALLOC_LEN);
 
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
-       puts ("NAND:");
+#if defined(CONFIG_CMD_NAND)
+       puts ("NAND:  ");
        nand_init();            /* go init the NAND */
 #endif
 
@@ -315,6 +338,10 @@ void start_armboot (void)
        drv_vfd_init();
 #endif /* CONFIG_VFD */
 
+#ifdef CONFIG_SERIAL_MULTI
+       serial_initialize();
+#endif
+
        /* IP Address */
        gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
 
@@ -323,7 +350,7 @@ void start_armboot (void)
                int i;
                ulong reg;
                char *s, *e;
-               uchar tmp[64];
+               char tmp[64];
 
                i = getenv_r ("ethaddr", tmp, sizeof (tmp));
                s = (i > 0) ? tmp : NULL;
@@ -365,6 +392,13 @@ void start_armboot (void)
        enable_interrupts ();
 
        /* Perform network card initialisation if necessary */
+#ifdef CONFIG_DRIVER_TI_EMAC
+extern void dm644x_eth_set_mac_addr (const u_int8_t *addr);
+       if (getenv ("ethaddr")) {
+               dm644x_eth_set_mac_addr(gd->bd->bi_enetaddr);
+       }
+#endif
+
 #ifdef CONFIG_DRIVER_CS8900
        cs8900_get_enetaddr (gd->bd->bi_enetaddr);
 #endif
@@ -379,16 +413,16 @@ void start_armboot (void)
        if ((s = getenv ("loadaddr")) != NULL) {
                load_addr = simple_strtoul (s, NULL, 16);
        }
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
        if ((s = getenv ("bootfile")) != NULL) {
                copy_filename (BootFile, s, sizeof (BootFile));
        }
-#endif /* CFG_CMD_NET */
+#endif
 
 #ifdef BOARD_LATE_INIT
        board_late_init ();
 #endif
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
        puts ("Net:   ");
 #endif
@@ -409,6 +443,8 @@ void hang (void)
 }
 
 #ifdef CONFIG_MODEM_SUPPORT
+static inline void mdm_readline(char *buf, int bufsiz);
+
 /* called from main loop (common/main.c) */
 extern void  dbg(const char *fmt, ...);
 int mdm_init (void)
@@ -417,7 +453,6 @@ int mdm_init (void)
        char *init_str;
        int i;
        extern char console_buffer[];
-       static inline void mdm_readline(char *buf, int bufsiz);
        extern void enable_putc(void);
        extern int hwflow_onoff(int);