]> git.sur5r.net Git - u-boot/commitdiff
AVR32: Initialize bi_flash* in board_init_r
authorHaavard Skinnemoen <hskinnemoen@atmel.com>
Sat, 6 Oct 2007 16:55:35 +0000 (18:55 +0200)
committerHaavard Skinnemoen <hskinnemoen@atmel.com>
Sat, 6 Oct 2007 18:17:37 +0000 (20:17 +0200)
The ATSTK1000-specific flash driver intializes bi_flashstart,
bi_flashsize and bi_flashoffset, but other flash drivers, like the CFI
driver, don't.

Initialize these in board_init_r instead so that things will still be
set up correctly when we switch to the CFI driver.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
board/atmel/atstk1000/flash.c
lib_avr32/board.c

index 958f4dc330c82fb0c245c3fafcf2deae7306632e..93d790f1731c67f4b9b65eeb59dd8266b8c1fcb0 100644 (file)
@@ -55,10 +55,6 @@ unsigned long flash_init(void)
        unsigned long addr;
        unsigned int i;
 
-       gd->bd->bi_flashstart = CFG_FLASH_BASE;
-       gd->bd->bi_flashsize = CFG_FLASH_SIZE;
-       gd->bd->bi_flashoffset = _edata - _text;
-
        flash_info[0].size = CFG_FLASH_SIZE;
        flash_info[0].sector_count = 135;
 
index 8b9ca38f50cf2bf16b11ccbe8df752c52da747e5..11d864feacabb66b783916b3a6cd0ddca41c314b 100644 (file)
@@ -310,10 +310,20 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        malloc_bin_reloc();
        dma_alloc_init();
        board_init_info();
-       flash_init();
+
+       bd->bi_flashstart = 0;
+       bd->bi_flashsize = 0;
+       bd->bi_flashoffset = 0;
+
+#ifndef CFG_NO_FLASH
+       bd->bi_flashstart = CFG_FLASH_BASE;
+       bd->bi_flashsize = flash_init();
+       bd->bi_flashoffset = (unsigned long)_edata - (unsigned long)_text;
 
        if (bd->bi_flashsize)
                display_flash_config();
+#endif
+
        if (bd->bi_dram[0].size)
                display_dram_config();