]> git.sur5r.net Git - u-boot/blobdiff - lib_avr32/board.c
i386: Fix race condition when using SC520 timers
[u-boot] / lib_avr32 / board.c
index 959375a48f173354c641cb6be89eec78793acfbf..917ed6ce75ef8f7eccd29605dfece339778a1c36 100644 (file)
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
 #include <timestamp.h>
 #include <version.h>
 #include <net.h>
 
+#ifdef CONFIG_BITBANGMII
+#include <miiphy.h>
+#endif
+
 #include <asm/initcalls.h>
 #include <asm/sections.h>
 
@@ -41,13 +45,6 @@ const char version_string[] =
 
 unsigned long monitor_flash_len;
 
-/*
- * Begin and end of memory area for malloc(), and current "brk"
- */
-static unsigned long mem_malloc_start = 0;
-static unsigned long mem_malloc_end = 0;
-static unsigned long mem_malloc_brk = 0;
-
 /* Weak aliases for optional board functions */
 static int __do_nothing(void)
 {
@@ -56,37 +53,8 @@ static int __do_nothing(void)
 int board_postclk_init(void) __attribute__((weak, alias("__do_nothing")));
 int board_early_init_r(void) __attribute__((weak, alias("__do_nothing")));
 
-/* The malloc area is right below the monitor image in RAM */
-static void mem_malloc_init(void)
-{
-       unsigned long monitor_addr;
-
-       monitor_addr = CONFIG_SYS_MONITOR_BASE + gd->reloc_off;
-       mem_malloc_end = monitor_addr;
-       mem_malloc_start = mem_malloc_end - CONFIG_SYS_MALLOC_LEN;
-       mem_malloc_brk = mem_malloc_start;
-
-       printf("malloc: Using memory from 0x%08lx to 0x%08lx\n",
-              mem_malloc_start, mem_malloc_end);
-
-       memset ((void *)mem_malloc_start, 0,
-               mem_malloc_end - mem_malloc_start);
-}
-
-void *sbrk(ptrdiff_t increment)
-{
-       unsigned long old = mem_malloc_brk;
-       unsigned long new = old + increment;
-
-       if ((new < mem_malloc_start) || (new > mem_malloc_end))
-               return NULL;
-
-       mem_malloc_brk = new;
-       return ((void *)old);
-}
-
 #ifdef CONFIG_SYS_DMA_ALLOC_LEN
-#include <asm/cacheflush.h>
+#include <asm/arch/cacheflush.h>
 #include <asm/io.h>
 
 static unsigned long dma_alloc_start;
@@ -239,6 +207,18 @@ void board_init_f(ulong board_type)
        addr -= CONFIG_SYS_DMA_ALLOC_LEN;
 #endif
 
+#ifdef CONFIG_LCD
+#ifdef CONFIG_FB_ADDR
+       printf("LCD: Frame buffer allocated at preset 0x%08x\n",
+              CONFIG_FB_ADDR);
+       gd->fb_base = (void *)CONFIG_FB_ADDR;
+#else
+       addr = lcd_setmem(addr);
+       printf("LCD: Frame buffer allocated at 0x%08lx\n", addr);
+       gd->fb_base = (void *)addr;
+#endif /* CONFIG_FB_ADDR */
+#endif /* CONFIG_LCD */
+
        /* Allocate a Board Info struct on a word boundary */
        addr -= sizeof(bd_t);
        addr &= ~3UL;
@@ -319,7 +299,10 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 #endif
 
        timer_init();
-       mem_malloc_init();
+
+       /* The malloc area is right below the monitor image in RAM */
+       mem_malloc_init(CONFIG_SYS_MONITOR_BASE + gd->reloc_off -
+                       CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN);
        malloc_bin_reloc();
        dma_alloc_init();
 
@@ -350,7 +333,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 
        bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
 
-       devices_init();
+       stdio_init();
        jumptable_init();
        console_init_r();
 
@@ -358,6 +341,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        if (s)
                load_addr = simple_strtoul(s, NULL, 16);
 
+#ifdef CONFIG_BITBANGMII
+       bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
        s = getenv("bootfile");
        if (s)