X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=lib_arm%2Fboard.c;h=1028b046d8463842549711bac0ba782b97af3473;hb=d2ed2f661b6f74b68105d27a399801bdef287ef5;hp=314126af5edcb0a16f8b9128af3e75afadef43f4;hpb=f6e20fc6ca5a45316f94743d8b60dce4d9766bc8;p=oweals%2Fu-boot.git diff --git a/lib_arm/board.c b/lib_arm/board.c index 314126af5e..1028b046d8 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2002 + * (C) Copyright 2002-2006 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * (C) Copyright 2002 @@ -25,6 +25,19 @@ * MA 02111-1307 USA */ +/* + * To match the U-Boot user interface on ARM platforms to the U-Boot + * standard (as on PPC platforms), some messages with debug character + * are removed from the default U-Boot build. + * + * Define DEBUG here if you want additional info as shown below + * printed upon startup: + * + * U-Boot code: 00F00000 -> 00F3C774 BSS: -> 00FC3274 + * IRQ Stack: 00ebff7c + * FIQ Stack: 00ebef7c + */ + #include #include #include @@ -32,6 +45,15 @@ #include #include +#ifdef CONFIG_DRIVER_SMC91111 +#include "../drivers/smc91111.h" +#endif +#ifdef CONFIG_DRIVER_LAN91C96 +#include "../drivers/lan91c96.h" +#endif + +DECLARE_GLOBAL_DATA_PTR; + #if (CONFIG_COMMANDS & CFG_CMD_NAND) void nand_init (void); #endif @@ -54,13 +76,10 @@ const char version_string[] = extern void cs8900_get_enetaddr (uchar * addr); #endif -#ifdef CONFIG_DRIVER_CS8900 +#ifdef CONFIG_DRIVER_RTL8019 extern void rtl8019_get_enetaddr (uchar * addr); #endif -#ifdef CONFIG_DRIVER_LAN91C96 -#include "../drivers/lan91c96.h" -#endif /* * Begin and End of memory area for malloc(), and current "brk" */ @@ -102,9 +121,7 @@ void *sbrk (ptrdiff_t increment) static int init_baudrate (void) { - DECLARE_GLOBAL_DATA_PTR; - - uchar tmp[64]; /* long enough for environment variables */ + char tmp[64]; /* long enough for environment variables */ int i = getenv_r ("baudrate", tmp, sizeof (tmp)); gd->bd->bi_baudrate = gd->baudrate = (i > 0) ? (int) simple_strtoul (tmp, NULL, 10) @@ -116,14 +133,14 @@ 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, _bss_start, _bss_end); + debug ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n", + _armboot_start, _bss_start, _bss_end); #ifdef CONFIG_MODEM_SUPPORT - puts ("Modem Support enabled\n"); + debug ("Modem Support enabled\n"); #endif #ifdef CONFIG_USE_IRQ - printf ("IRQ Stack: %08lx\n", IRQ_STACK_START); - printf ("FIQ Stack: %08lx\n", FIQ_STACK_START); + debug ("IRQ Stack: %08lx\n", IRQ_STACK_START); + debug ("FIQ Stack: %08lx\n", FIQ_STACK_START); #endif return (0); @@ -138,24 +155,35 @@ static int display_banner (void) */ static int display_dram_config (void) { - DECLARE_GLOBAL_DATA_PTR; int i; +#ifdef DEBUG puts ("RAM Configuration:\n"); for(i=0; ibd->bi_dram[i].start); print_size (gd->bd->bi_dram[i].size, "\n"); } +#else + ulong size = 0; + + for (i=0; ibd->bi_dram[i].size; + } + puts("DRAM: "); + print_size(size, "\n"); +#endif return (0); } +#ifndef CFG_NO_FLASH static void display_flash_config (ulong size) { puts ("Flash: "); print_size (size, "\n"); } +#endif /* CFG_NO_FLASH */ /* @@ -183,6 +211,8 @@ static void display_flash_config (ulong size) */ typedef int (init_fnc_t) (void); +int print_cpuinfo (void); /* test-only */ + init_fnc_t *init_sequence[] = { cpu_init, /* basic cpu dependent setup */ board_init, /* basic board dependent setup */ @@ -192,27 +222,33 @@ init_fnc_t *init_sequence[] = { serial_init, /* serial communications setup */ console_init_f, /* stage 1 init of console */ display_banner, /* say that we are here */ +#if defined(CONFIG_DISPLAY_CPUINFO) + print_cpuinfo, /* display cpu info (and speed) */ +#endif +#if defined(CONFIG_DISPLAY_BOARDINFO) + checkboard, /* display board info */ +#endif dram_init, /* configure available RAM banks */ display_dram_config, -#if defined(CONFIG_VCMA9) - checkboard, -#endif NULL, }; void start_armboot (void) { - DECLARE_GLOBAL_DATA_PTR; - - ulong size; init_fnc_t **init_fnc_ptr; char *s; -#if defined(CONFIG_VFD) +#ifndef CFG_NO_FLASH + ulong size; +#endif +#if defined(CONFIG_VFD) || defined(CONFIG_LCD) unsigned long addr; #endif /* Pointer is writable since we allocated a register for it */ 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)); @@ -225,9 +261,11 @@ void start_armboot (void) } } +#ifndef CFG_NO_FLASH /* configure available FLASH banks */ size = flash_init (); display_flash_config (size); +#endif /* CFG_NO_FLASH */ #ifdef CONFIG_VFD # ifndef PAGE_SIZE @@ -236,12 +274,25 @@ void start_armboot (void) /* * reserve memory for VFD display (always full pages) */ - /* armboot_end is defined in the board-specific linker script */ - addr = (_bss_start + (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; #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); @@ -271,7 +322,7 @@ void start_armboot (void) int i; ulong reg; char *s, *e; - uchar tmp[64]; + char tmp[64]; i = getenv_r ("ethaddr", tmp, sizeof (tmp)); s = (i > 0) ? tmp : NULL; @@ -281,10 +332,25 @@ void start_armboot (void) if (s) s = (*e) ? e + 1 : e; } + +#ifdef CONFIG_HAS_ETH1 + i = getenv_r ("eth1addr", tmp, sizeof (tmp)); + s = (i > 0) ? tmp : NULL; + + for (reg = 0; reg < 6; ++reg) { + gd->bd->bi_enet1addr[reg] = s ? simple_strtoul (s, &e, 16) : 0; + if (s) + s = (*e) ? e + 1 : e; + } +#endif } devices_init (); /* get the devices list going. */ +#ifdef CONFIG_CMC_PU2 + load_sernum_ethaddr (); +#endif /* CONFIG_CMC_PU2 */ + jumptable_init (); console_init_r (); /* fully init console as a device */ @@ -302,12 +368,11 @@ void start_armboot (void) 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) { @@ -322,7 +387,12 @@ void start_armboot (void) #ifdef BOARD_LATE_INIT board_late_init (); #endif - +#if (CONFIG_COMMANDS & CFG_CMD_NET) +#if defined(CONFIG_NET_MULTI) + puts ("Net: "); +#endif + eth_initialize(gd->bd); +#endif /* main_loop() can return to retry autoboot, if so just run it again. */ for (;;) { main_loop (); @@ -338,6 +408,8 @@ void hang (void) } #ifdef CONFIG_MODEM_SUPPORT +static inline void mdm_readline(char *buf, int bufsiz); + /* called from main loop (common/main.c) */ extern void dbg(const char *fmt, ...); int mdm_init (void) @@ -346,7 +418,6 @@ int mdm_init (void) char *init_str; int i; extern char console_buffer[]; - static inline void mdm_readline(char *buf, int bufsiz); extern void enable_putc(void); extern int hwflow_onoff(int);