X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib_mips%2Fboard.c;h=f62a46a1726f27c6d6c9e6ca4a9014dd749e62ad;hb=d4e8ada0f6d51e0e3b80790fb9375ac8910f5352;hp=8c1af769c82fddcbbeeda32e6ad2eb544fab457a;hpb=508eb85db7065e34948c189c83f7e348c1cfd61e;p=platform%2Fkernel%2Fu-boot.git diff --git a/lib_mips/board.c b/lib_mips/board.c index 8c1af76..f62a46a 100644 --- a/lib_mips/board.c +++ b/lib_mips/board.c @@ -24,21 +24,23 @@ #include #include #include -#include +#include +#include #include #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; -#if ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CFG_MONITOR_BASE) || \ - (CONFIG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \ +#if ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \ + (CONFIG_ENV_ADDR >= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)) ) || \ defined(CONFIG_ENV_IS_IN_NVRAM) -#define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CONFIG_ENV_SIZE) +#define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE) #else -#define TOTAL_MALLOC_LEN CFG_MALLOC_LEN +#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN #endif #undef DEBUG @@ -53,50 +55,24 @@ extern ulong uboot_end; ulong monitor_flash_len; const char version_string[] = - U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")"; + U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"; static char *failed = "*** failed ***\n"; /* - * Begin and End of memory area for malloc(), and current "brk" - */ -static ulong mem_malloc_start; -static ulong mem_malloc_end; -static ulong mem_malloc_brk; - -/* * mips_io_port_base is the begin of the address space to which x86 style * I/O ports are mapped. */ unsigned long mips_io_port_base = -1; -/* - * The Malloc area is immediately below the monitor copy in DRAM - */ -static void mem_malloc_init (void) +int __board_early_init_f(void) { - ulong dest_addr = CFG_MONITOR_BASE + gd->reloc_off; - - mem_malloc_end = dest_addr; - mem_malloc_start = dest_addr - TOTAL_MALLOC_LEN; - mem_malloc_brk = mem_malloc_start; - - memset ((void *) mem_malloc_start, - 0, - mem_malloc_end - mem_malloc_start); -} - -void *sbrk (ptrdiff_t increment) -{ - ulong old = mem_malloc_brk; - ulong new = old + increment; - - if ((new < mem_malloc_start) || (new > mem_malloc_end)) { - return (NULL); - } - mem_malloc_brk = new; - return ((void *) old); + /* + * Nothing to do in this dummy implementation + */ + return 0; } +int board_early_init_f(void) __attribute__((weak, alias("__board_early_init_f"))); static int init_func_ram (void) @@ -123,7 +99,7 @@ static int display_banner(void) return (0); } -#ifndef CFG_NO_FLASH +#ifndef CONFIG_SYS_NO_FLASH static void display_flash_config(ulong size) { puts ("Flash: "); @@ -167,6 +143,7 @@ static int init_baudrate (void) typedef int (init_fnc_t) (void); init_fnc_t *init_sequence[] = { + board_early_init_f, timer_init, env_init, /* initialize environment */ #ifdef CONFIG_INCA_IP @@ -187,7 +164,7 @@ void board_init_f(ulong bootflag) gd_t gd_data, *id; bd_t *bd; init_fnc_t **init_fnc_ptr; - ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE; + ulong addr, addr_sp, len = (ulong)&uboot_end - CONFIG_SYS_MONITOR_BASE; ulong *s; #ifdef CONFIG_PURPLE void copy_code (ulong); @@ -211,7 +188,7 @@ void board_init_f(ulong bootflag) * Now that we have DRAM mapped and working, we can * relocate the code and continue running from DRAM. */ - addr = CFG_SDRAM_BASE + gd->ram_size; + addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size; /* We can reserve some RAM "on top" here. */ @@ -252,10 +229,10 @@ void board_init_f(ulong bootflag) /* Reserve memory for boot params. */ - addr_sp -= CFG_BOOTPARAMS_LEN; + addr_sp -= CONFIG_SYS_BOOTPARAMS_LEN; bd->bi_boot_params = addr_sp; debug ("Reserving %dk for boot params() at: %08lx\n", - CFG_BOOTPARAMS_LEN >> 10, addr_sp); + CONFIG_SYS_BOOTPARAMS_LEN >> 10, addr_sp); /* * Finally, we set up a new (bigger) stack. @@ -274,7 +251,7 @@ void board_init_f(ulong bootflag) /* * Save local variables to board info struct */ - bd->bi_memstart = CFG_SDRAM_BASE; /* start of DRAM memory */ + bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of DRAM memory */ bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */ bd->bi_baudrate = gd->baudrate; /* Console Baudrate */ @@ -304,23 +281,22 @@ void board_init_f(ulong bootflag) void board_init_r (gd_t *id, ulong dest_addr) { cmd_tbl_t *cmdtp; -#ifndef CFG_NO_FLASH +#ifndef CONFIG_SYS_NO_FLASH ulong size; #endif extern void malloc_bin_reloc (void); #ifndef CONFIG_ENV_IS_NOWHERE extern char * env_name_spec; #endif - char *s, *e; + char *s; bd_t *bd; - int i; gd = id; gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */ debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr); - gd->reloc_off = dest_addr - CFG_MONITOR_BASE; + gd->reloc_off = dest_addr - CONFIG_SYS_MONITOR_BASE; monitor_flash_len = (ulong)&uboot_end_data - dest_addr; @@ -345,7 +321,7 @@ void board_init_r (gd_t *id, ulong dest_addr) addr = (ulong)(cmdtp->usage) + gd->reloc_off; cmdtp->usage = (char *)addr; } -#ifdef CFG_LONGHELP +#ifdef CONFIG_SYS_LONGHELP if (cmdtp->help) { addr = (ulong)(cmdtp->help) + gd->reloc_off; cmdtp->help = (char *)addr; @@ -359,35 +335,37 @@ void board_init_r (gd_t *id, ulong dest_addr) bd = gd->bd; -#ifndef CFG_NO_FLASH + /* The Malloc area is immediately below the monitor copy in DRAM */ + mem_malloc_init(CONFIG_SYS_MONITOR_BASE + gd->reloc_off - + TOTAL_MALLOC_LEN, TOTAL_MALLOC_LEN); + malloc_bin_reloc(); + +#ifndef CONFIG_SYS_NO_FLASH /* configure available FLASH banks */ size = flash_init(); display_flash_config (size); bd->bi_flashsize = size; #endif - bd->bi_flashstart = CFG_FLASH_BASE; -#if CFG_MONITOR_BASE == CFG_FLASH_BASE + bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; +#if CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE bd->bi_flashoffset = monitor_flash_len; /* reserved area for U-Boot */ #else bd->bi_flashoffset = 0; #endif - /* initialize malloc() area */ - mem_malloc_init(); - malloc_bin_reloc(); +#ifdef CONFIG_CMD_NAND + puts ("NAND: "); + nand_init (); /* go init the NAND */ +#endif + +#if defined(CONFIG_CMD_ONENAND) + onenand_init(); +#endif /* relocate environment function pointers etc. */ env_relocate(); - /* board MAC address */ - s = getenv ("ethaddr"); - for (i = 0; i < 6; ++i) { - bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0; - if (s) - s = (*e) ? e + 1 : e; - } - /* IP Address */ bd->bi_ip_addr = getenv_IPaddr("ipaddr"); @@ -399,8 +377,8 @@ void board_init_r (gd_t *id, ulong dest_addr) #endif /** leave this here (after malloc(), environment and PCI are working) **/ - /* Initialize devices */ - devices_init (); + /* Initialize stdio devices */ + stdio_init (); jumptable_init (); @@ -418,11 +396,6 @@ void board_init_r (gd_t *id, ulong dest_addr) } #endif -#ifdef CONFIG_CMD_NAND - puts ("NAND: "); - nand_init (); /* go init the NAND */ -#endif - #ifdef CONFIG_CMD_SPI puts ("SPI: "); spi_init (); /* go init the SPI */