AVR32: Split start_u_boot into board_init_f and board_init_r
authorHaavard Skinnemoen <hskinnemoen@atmel.com>
Sat, 18 Nov 2006 16:15:30 +0000 (17:15 +0100)
committerHaavard Skinnemoen <hskinnemoen@atmel.com>
Sat, 14 Apr 2007 13:20:20 +0000 (15:20 +0200)
Split the avr32 initialization code into a function to run before
relocation, board_init_f and a function to run after relocation,
board_init_r. For now, board_init_f simply calls board_init_r
at the end.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
cpu/at32ap/start.S
lib_avr32/board.c

index 79ee33b1fac0d028eabd118ad831d4cbbacd9e7d..4ae0b5480efceb5d6bf6fb9cd1689251dc08b3e6 100644 (file)
@@ -95,7 +95,7 @@ _start:
        /* Initialize the GOT pointer */
        lddpc   r6, got_init
 3:     rsub    r6, pc
-       ld.w    pc, r6[start_u_boot@got]
+       ld.w    pc, r6[board_init_f@got]
 
        .align  2
        .type   sp_init,@object
index 02c106b80ede83c7a64b31a095bbe63ec49289f9..c531eef713b464c5d0bd6fcfc0cbec7a4d12ecf9 100644 (file)
@@ -122,7 +122,7 @@ static void display_flash_config (void)
        printf("at address 0x%08lx\n", gd->bd->bi_flashstart);
 }
 
-void start_u_boot (void)
+void board_init_f(ulong unused)
 {
        gd_t gd_data;
 
@@ -130,8 +130,6 @@ void start_u_boot (void)
        memset(&gd_data, 0, sizeof(gd_data));
        gd = &gd_data;
 
-       monitor_flash_len = _edata - _text;
-
        /* Perform initialization sequence */
        cpu_init();
        timer_init();
@@ -140,10 +138,18 @@ void start_u_boot (void)
        serial_init();
        console_init_f();
        display_banner();
-
        board_init_memories();
-       mem_malloc_init();
 
+       board_init_r(gd, CFG_MONITOR_BASE);
+}
+
+void board_init_r(gd_t *new_gd, ulong dest_addr)
+{
+       gd = new_gd;
+
+       monitor_flash_len = _edata - _text;
+
+       mem_malloc_init();
        gd->bd = malloc(sizeof(bd_t));
        memset(gd->bd, 0, sizeof(bd_t));
        gd->bd->bi_baudrate = gd->baudrate;