X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=lib_arm%2Fboard.c;h=ada8cc887900ea566d2a29d7699ed2512dc603d6;hb=07a2505f67e091ff70506ae6a5022b416211df44;hp=54f554b6d4dc567bad9035cee06d2ea19ea77747;hpb=45219c46605f9b933ab454738ee4ce543d5b70d6;p=oweals%2Fu-boot.git diff --git a/lib_arm/board.c b/lib_arm/board.c index 54f554b6d4..ada8cc8879 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -27,24 +27,44 @@ #include #include +#include #include #include #include +#ifdef CONFIG_DRIVER_SMC91111 +#include "../drivers/smc91111.h" +#endif +#ifdef CONFIG_DRIVER_LAN91C96 +#include "../drivers/lan91c96.h" +#endif + #if (CONFIG_COMMANDS & CFG_CMD_NAND) void nand_init (void); #endif +ulong monitor_flash_len; + +#ifdef CONFIG_HAS_DATAFLASH +extern int AT91F_DataflashInit(void); +extern void dataflash_print_info(void); +#endif + +#ifndef CONFIG_IDENT_STRING +#define CONFIG_IDENT_STRING "" +#endif + const char version_string[] = - U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")"; + U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")"CONFIG_IDENT_STRING; #ifdef CONFIG_DRIVER_CS8900 extern void cs8900_get_enetaddr (uchar * addr); #endif -#ifdef CONFIG_DRIVER_LAN91C96 -#include "../drivers/lan91c96.h" +#ifdef CONFIG_DRIVER_RTL8019 +extern void rtl8019_get_enetaddr (uchar * addr); #endif + /* * Begin and End of memory area for malloc(), and current "brk" */ @@ -90,8 +110,7 @@ static int init_baudrate (void) uchar tmp[64]; /* long enough for environment variables */ int i = getenv_r ("baudrate", tmp, sizeof (tmp)); - - gd->baudrate = (i > 0) + gd->bd->bi_baudrate = gd->baudrate = (i > 0) ? (int) simple_strtoul (tmp, NULL, 10) : CONFIG_BAUDRATE; @@ -100,10 +119,9 @@ static int init_baudrate (void) static int display_banner (void) { - printf ("\n\n%s\n\n", version_string); printf ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n", - _armboot_start, _armboot_end_data, _armboot_end); + _armboot_start, _bss_start, _bss_end); #ifdef CONFIG_MODEM_SUPPORT puts ("Modem Support enabled\n"); #endif @@ -111,6 +129,7 @@ static int display_banner (void) printf ("IRQ Stack: %08lx\n", IRQ_STACK_START); printf ("FIQ Stack: %08lx\n", FIQ_STACK_START); #endif + return (0); } @@ -126,7 +145,7 @@ static int display_dram_config (void) DECLARE_GLOBAL_DATA_PTR; int i; - puts ("DRAM Configuration:\n"); + puts ("RAM Configuration:\n"); for(i=0; ibd->bi_dram[i].start); @@ -143,11 +162,10 @@ static void display_flash_config (ulong size) } - /* - * Breath some life into the board... + * Breathe some life into the board... * - * Initialize an SMC for serial comms, and carry out some hardware + * Initialize a serial port as console, and carry out some hardware * tests. * * The first part of initialization is running from Flash memory; @@ -159,7 +177,7 @@ static void display_flash_config (ulong size) * All attempts to come up with a "common" initialization sequence * that works for all boards and architectures failed: some of the * requirements are just _too_ different. To get rid of the resulting - * mess of board dependend #ifdef'ed code we now make the whole + * mess of board dependent #ifdef'ed code we now make the whole * initialization sequence configurable to the user. * * The requirements for any new initalization function is simple: it @@ -176,10 +194,11 @@ init_fnc_t *init_sequence[] = { env_init, /* initialize environment */ init_baudrate, /* initialze baudrate settings */ serial_init, /* serial communications setup */ + console_init_f, /* stage 1 init of console */ display_banner, /* say that we are here */ dram_init, /* configure available RAM banks */ display_dram_config, -#if defined(CONFIG_VCMA9) +#if defined(CONFIG_VCMA9) || defined (CONFIG_CMC_PU2) checkboard, #endif NULL, @@ -190,20 +209,23 @@ void start_armboot (void) DECLARE_GLOBAL_DATA_PTR; ulong size; - gd_t gd_data; - bd_t bd_data; init_fnc_t **init_fnc_ptr; char *s; -#if defined(CONFIG_VFD) +#if defined(CONFIG_VFD) || defined(CONFIG_LCD) unsigned long addr; #endif /* Pointer is writable since we allocated a register for it */ - gd = &gd_data; - memset (gd, 0, sizeof (gd_t)); - gd->bd = &bd_data; + gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t)); + /* compiler optimization barrier needed for GCC >= 3.4 */ + __asm__ __volatile__("": : :"memory"); + + memset ((void*)gd, 0, sizeof (gd_t)); + gd->bd = (bd_t*)((char*)gd - sizeof(bd_t)); memset (gd->bd, 0, sizeof (bd_t)); + monitor_flash_len = _bss_start - _armboot_start; + for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { if ((*init_fnc_ptr)() != 0) { hang (); @@ -215,39 +237,54 @@ void start_armboot (void) display_flash_config (size); #ifdef CONFIG_VFD -# ifndef PAGE_SIZE -# define PAGE_SIZE 4096 -# endif +# ifndef PAGE_SIZE +# define PAGE_SIZE 4096 +# endif /* * reserve memory for VFD display (always full pages) */ - /* armboot_real_end is defined in the board-specific linker script */ - addr = (_armboot_real_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); + /* bss_end is defined in the board-specific linker script */ + addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); size = vfd_setmem (addr); gd->fb_base = addr; - /* round to the next page boundary */ - addr += size; - addr = (addr + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); - mem_malloc_init (addr); -#else - /* armboot_real_end is defined in the board-specific linker script */ - mem_malloc_init (_armboot_real_end); #endif /* CONFIG_VFD */ +#ifdef CONFIG_LCD +# ifndef PAGE_SIZE +# define PAGE_SIZE 4096 +# endif + /* + * reserve memory for LCD display (always full pages) + */ + /* bss_end is defined in the board-specific linker script */ + addr = (_bss_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); + size = lcd_setmem (addr); + gd->fb_base = addr; +#endif /* CONFIG_LCD */ + + /* 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:"); nand_init(); /* go init the NAND */ #endif +#ifdef CONFIG_HAS_DATAFLASH + AT91F_DataflashInit(); + dataflash_print_info(); +#endif + /* initialize environment */ env_relocate (); #ifdef CONFIG_VFD /* must do this after the framebuffer is allocated */ drv_vfd_init(); -#endif +#endif /* CONFIG_VFD */ /* IP Address */ - bd_data.bi_ip_addr = getenv_IPaddr ("ipaddr"); + gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr"); /* MAC Address */ { @@ -260,12 +297,18 @@ void start_armboot (void) s = (i > 0) ? tmp : NULL; for (reg = 0; reg < 6; ++reg) { - bd_data.bi_enetaddr[reg] = s ? simple_strtoul (s, &e, 16) : 0; + gd->bd->bi_enetaddr[reg] = s ? simple_strtoul (s, &e, 16) : 0; if (s) s = (*e) ? e + 1 : e; } } + devices_init (); /* get the devices list going. */ + + jumptable_init (); + + console_init_r (); /* fully init console as a device */ + #if defined(CONFIG_MISC_INIT_R) /* miscellaneous platform dependent initialisations */ misc_init_r (); @@ -274,16 +317,16 @@ void start_armboot (void) /* enable exceptions */ enable_interrupts (); + /* Perform network card initialisation if necessary */ #ifdef CONFIG_DRIVER_CS8900 cs8900_get_enetaddr (gd->bd->bi_enetaddr); #endif -#ifdef CONFIG_DRIVER_LAN91C96 +#if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96) if (getenv ("ethaddr")) { smc_set_mac_addr(gd->bd->bi_enetaddr); } - /* eth_hw_init(); */ -#endif /* CONFIG_DRIVER_LAN91C96 */ +#endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */ /* Initialize from environment */ if ((s = getenv ("loadaddr")) != NULL) { @@ -295,10 +338,13 @@ void start_armboot (void) } #endif /* CFG_CMD_NET */ -#ifdef BOARD_POST_INIT - board_post_init (); +#ifdef BOARD_LATE_INIT + board_late_init (); +#endif +#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) + puts ("Net: "); + eth_initialize(gd->bd); #endif - /* main_loop() can return to retry autoboot, if so just run it again. */ for (;;) { main_loop ();