X-Git-Url: https://repo.jachan.dev/J-u-boot.git/blobdiff_plain/ecc198c9b9522aa766235b7780f8ef7e01d0d0e2..14f73ca679f6fdb44cff0b7304d419db41a0ab69:/lib_ppc/board.c diff --git a/lib_ppc/board.c b/lib_ppc/board.c index 07197450666..5e6e1e6a31b 100644 --- a/lib_ppc/board.c +++ b/lib_ppc/board.c @@ -38,6 +38,9 @@ #if defined(CONFIG_CMD_IDE) #include #endif +#if defined(CONFIG_CMD_SATA) +#include +#endif #if defined(CONFIG_CMD_SCSI) #include #endif @@ -87,6 +90,9 @@ void doc_init (void); defined(CONFIG_SOFT_I2C) #include #endif +#if defined(CONFIG_HARD_SPI) +#include +#endif #if defined(CONFIG_CMD_NAND) void nand_init (void); #endif @@ -247,6 +253,16 @@ static int init_func_i2c (void) } #endif +#if defined(CONFIG_HARD_SPI) +static int init_func_spi (void) +{ + puts ("SPI: "); + spi_init (); + puts ("ready\n"); + return (0); +} +#endif + /***********************************************************************/ #if defined(CONFIG_WATCHDOG) @@ -329,6 +345,9 @@ init_fnc_t *init_sequence[] = { #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) init_func_i2c, #endif +#if defined(CONFIG_HARD_SPI) + init_func_spi, +#endif #if defined(CONFIG_DTT) /* Digital Thermometers and Thermostats */ dtt_init, #endif @@ -345,6 +364,20 @@ init_fnc_t *init_sequence[] = { NULL, /* Terminate this list */ }; +#ifndef CONFIG_MAX_MEM_MAPPED +#define CONFIG_MAX_MEM_MAPPED (256 << 20) +#endif +ulong get_effective_memsize(void) +{ +#ifndef CONFIG_VERY_BIG_RAM + return gd->ram_size; +#else + /* limit stack to what we can reasonable map */ + return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ? + CONFIG_MAX_MEM_MAPPED : gd->ram_size); +#endif +} + /************************************************************************ * * This is the first part of the initialization sequence that is @@ -395,6 +428,7 @@ void board_init_f (ulong bootflag) * relocate the code and continue running from DRAM. * * Reserve memory at end of RAM for (top down in that order): + * - area that won't get touched by U-Boot and Linux (optional) * - kernel log buffer * - protected RAM * - LCD framebuffer @@ -403,19 +437,38 @@ void board_init_f (ulong bootflag) */ len = (ulong)&_end - CFG_MONITOR_BASE; + /* + * Subtract specified amount of memory to hide so that it won't + * get "touched" at all by U-Boot. By fixing up gd->ram_size + * the Linux kernel should now get passed the now "corrected" + * memory size and won't touch it either. This should work + * for arch/ppc and arch/powerpc. Only Linux board ports in + * arch/powerpc with bootwrapper support, that recalculate the + * memory size from the SDRAM controller setup will have to + * get fixed. + */ + gd->ram_size -= CFG_MEM_TOP_HIDE; + +#ifndef CONFIG_MAX_MEM_MAPPED +#define CONFIG_MAX_MEM_MAPPED (256 << 20) +#endif + #ifndef CONFIG_VERY_BIG_RAM - addr = CFG_SDRAM_BASE + gd->ram_size; + addr = CFG_SDRAM_BASE + get_effective_memsize(); #else /* only allow stack below 256M */ addr = CFG_SDRAM_BASE + - (gd->ram_size > 256 << 20) ? 256 << 20 : gd->ram_size; + (gd->ram_size > CONFIG_MAX_MEM_MAPPED) ? + CONFIG_MAX_MEM_MAPPED : get_effective_memsize(); #endif #ifdef CONFIG_LOGBUFFER +#ifndef CONFIG_ALT_LB_ADDR /* reserve kernel log buffer */ addr -= (LOGBUFF_RESERVE); debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr); #endif +#endif #ifdef CONFIG_PRAM /* @@ -555,6 +608,9 @@ void board_init_f (ulong bootflag) bd->bi_sccfreq = gd->scc_clk; bd->bi_vco = gd->vco_out; #endif /* CONFIG_CPM2 */ +#if defined(CONFIG_MPC512X) + bd->bi_ipsfreq = gd->ips_clk; +#endif /* CONFIG_MPC512X */ #if defined(CONFIG_MPC5xxx) bd->bi_ipbfreq = gd->ipb_clk; bd->bi_pcifreq = gd->pci_clk; @@ -832,6 +888,11 @@ void board_init_r (gd_t *id, ulong dest_addr) #if defined(CONFIG_SC3) sc3_read_eeprom(); #endif + +#ifdef CFG_ID_EEPROM + mac_read_from_eeprom(); +#endif + s = getenv ("ethaddr"); #if defined (CONFIG_MBX) || \ defined (CONFIG_RPXCLASSIC) || \ @@ -899,10 +960,6 @@ void board_init_r (gd_t *id, ulong dest_addr) } #endif -#ifdef CFG_ID_EEPROM - mac_read_from_eeprom(); -#endif - #if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \ defined(CONFIG_TQM8272) || \ defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || \ @@ -1063,6 +1120,11 @@ void board_init_r (gd_t *id, ulong dest_addr) #endif #endif +#if defined(CONFIG_CMD_SATA) + puts ("SATA: "); + sata_initialize (); +#endif + #ifdef CONFIG_LAST_STAGE_INIT WATCHDOG_RESET (); /* @@ -1098,8 +1160,10 @@ void board_init_r (gd_t *id, ulong dest_addr) pram=0; #endif #ifdef CONFIG_LOGBUFFER +#ifndef CONFIG_ALT_LB_ADDR /* Also take the logbuffer into account (pram is in kB) */ pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024; +#endif #endif sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram); setenv ("mem", (char *)memsz);