]> git.sur5r.net Git - u-boot/blobdiff - lib_blackfin/board.c
Add support for KARO TX25 board
[u-boot] / lib_blackfin / board.c
index 49465d2a058a706c543b8f7d989c8a2724e9c143..6cade7d1102e2d968ab3148732ee33f5ea934e6f 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <common.h>
 #include <command.h>
-#include <devices.h>
+#include <stdio_dev.h>
 #include <environment.h>
 #include <malloc.h>
 #include <net.h>
 #include <nand.h>      /* cannot even include nand.h if it isnt configured */
 #endif
 
+#ifdef CONFIG_BITBANGMII
+#include <miiphy.h>
+#endif
+
 #if defined(CONFIG_POST)
 #include <post.h>
 int post_flag;
@@ -44,29 +48,6 @@ static inline void serial_early_puts(const char *s)
 #endif
 }
 
-static void *mem_malloc_start, *mem_malloc_end, *mem_malloc_brk;
-
-static void mem_malloc_init(void)
-{
-       mem_malloc_start = (void *)CONFIG_SYS_MALLOC_BASE;
-       mem_malloc_end = (void *)(CONFIG_SYS_MALLOC_BASE + CONFIG_SYS_MALLOC_LEN);
-       mem_malloc_brk = mem_malloc_start;
-       memset(mem_malloc_start, 0, mem_malloc_end - mem_malloc_start);
-}
-
-void *sbrk(ptrdiff_t increment)
-{
-       void *old = mem_malloc_brk;
-       void *new = old + increment;
-
-       if (new < mem_malloc_start || new > mem_malloc_end)
-               return NULL;
-
-       mem_malloc_brk = new;
-
-       return old;
-}
-
 static int display_banner(void)
 {
        printf("\n\n%s\n\n", version_string);
@@ -93,25 +74,25 @@ static void display_global_data(void)
 #ifdef CONFIG_DEBUG_EARLY_SERIAL
        bd_t *bd;
        bd = gd->bd;
-       printf(" gd: %x\n", gd);
-       printf(" |-flags: %x\n", gd->flags);
-       printf(" |-board_type: %x\n", gd->board_type);
-       printf(" |-baudrate: %i\n", gd->baudrate);
-       printf(" |-have_console: %x\n", gd->have_console);
-       printf(" |-ram_size: %x\n", gd->ram_size);
-       printf(" |-reloc_off: %x\n", gd->reloc_off);
-       printf(" |-env_addr: %x\n", gd->env_addr);
-       printf(" |-env_valid: %x\n", gd->env_valid);
-       printf(" |-jt(%x): %x\n", gd->jt, *(gd->jt));
-       printf(" \\-bd: %x\n", gd->bd);
+       printf(" gd: %p\n", gd);
+       printf(" |-flags: %lx\n", gd->flags);
+       printf(" |-board_type: %lx\n", gd->board_type);
+       printf(" |-baudrate: %lu\n", gd->baudrate);
+       printf(" |-have_console: %lx\n", gd->have_console);
+       printf(" |-ram_size: %lx\n", gd->ram_size);
+       printf(" |-reloc_off: %lx\n", gd->reloc_off);
+       printf(" |-env_addr: %lx\n", gd->env_addr);
+       printf(" |-env_valid: %lx\n", gd->env_valid);
+       printf(" |-jt(%p): %p\n", gd->jt, *(gd->jt));
+       printf(" \\-bd: %p\n", gd->bd);
        printf("   |-bi_baudrate: %x\n", bd->bi_baudrate);
-       printf("   |-bi_ip_addr: %x\n", bd->bi_ip_addr);
-       printf("   |-bi_boot_params: %x\n", bd->bi_boot_params);
-       printf("   |-bi_memstart: %x\n", bd->bi_memstart);
-       printf("   |-bi_memsize: %x\n", bd->bi_memsize);
-       printf("   |-bi_flashstart: %x\n", bd->bi_flashstart);
-       printf("   |-bi_flashsize: %x\n", bd->bi_flashsize);
-       printf("   \\-bi_flashoffset: %x\n", bd->bi_flashoffset);
+       printf("   |-bi_ip_addr: %lx\n", bd->bi_ip_addr);
+       printf("   |-bi_boot_params: %lx\n", bd->bi_boot_params);
+       printf("   |-bi_memstart: %lx\n", bd->bi_memstart);
+       printf("   |-bi_memsize: %lx\n", bd->bi_memsize);
+       printf("   |-bi_flashstart: %lx\n", bd->bi_flashstart);
+       printf("   |-bi_flashsize: %lx\n", bd->bi_flashsize);
+       printf("   \\-bi_flashoffset: %lx\n", bd->bi_flashoffset);
 #endif
 }
 
@@ -293,8 +274,10 @@ void board_init_f(ulong bootflag)
 
 static void board_net_init_r(bd_t *bd)
 {
+#ifdef CONFIG_BITBANGMII
+       bb_miiphy_init();
+#endif
 #ifdef CONFIG_CMD_NET
-       uchar enetaddr[6];
        char *s;
 
        if ((s = getenv("bootfile")) != NULL)
@@ -304,15 +287,11 @@ static void board_net_init_r(bd_t *bd)
 
        printf("Net:   ");
        eth_initialize(gd->bd);
-
-       eth_getenv_enetaddr("ethaddr", enetaddr);
-       printf("MAC:   %pM\n", enetaddr);
 #endif
 }
 
 void board_init_r(gd_t * id, ulong dest_addr)
 {
-       extern void malloc_bin_reloc(void);
        char *s;
        bd_t *bd;
        gd = id;
@@ -324,6 +303,9 @@ void board_init_r(gd_t * id, ulong dest_addr)
        post_reloc();
 #endif
 
+       /* initialize malloc() area */
+       mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
+
 #if    !defined(CONFIG_SYS_NO_FLASH)
        /* Initialize the flash and protect u-boot by default */
        extern flash_info_t flash_info[];
@@ -341,9 +323,6 @@ void board_init_r(gd_t * id, ulong dest_addr)
        bd->bi_flashsize = 0;
        bd->bi_flashoffset = 0;
 #endif
-       /* initialize malloc() area */
-       mem_malloc_init();
-       malloc_bin_reloc();
 
 #ifdef CONFIG_CMD_NAND
        puts("NAND:  ");
@@ -353,8 +332,8 @@ void board_init_r(gd_t * id, ulong dest_addr)
        /* relocate environment function pointers etc. */
        env_relocate();
 
-       /* Initialize devices */
-       devices_init();
+       /* Initialize stdio devices */
+       stdio_init();
        jumptable_init();
 
        /* Initialize the console (after the relocation and devices init) */
@@ -383,6 +362,12 @@ void board_init_r(gd_t * id, ulong dest_addr)
                post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
+       if (bfin_os_log_check()) {
+               puts("\nLog buffer from operating system:\n");
+               bfin_os_log_dump();
+               puts("\n");
+       }
+
        /* main_loop() can return to retry autoboot, if so just run it again. */
        for (;;)
                main_loop();