From: wdenk Date: Tue, 28 May 2002 22:57:05 +0000 (+0000) Subject: * Add new RAM configurations to LWMON board X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=47c310bfc99ef5bcac336551f2c6ceb320a1b02e;p=users%2Frw%2Fppcboot.git * Add new RAM configurations to LWMON board * Fix "loadaddr" setting in TFTP code (initialize from environment var if available). * Patch by Marius Gröger, 28 May 2002 (and Andrew May, 2 Apr 2002): Add CONFIG_EXTRA_ENV_SETTINGS configuration option --- diff --git a/CHANGELOG b/CHANGELOG index 54aaaa6..9ba61e0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,18 @@ Modifications for 1.1.6: ====================================================================== +* Add new RAM configurations to LWMON board + +* Fix "loadaddr" setting in TFTP code (initialize from environment + var if available). + +* Patch by Marius Gröger, 28 May 2002 + (and Andrew May, 2 Apr 2002): + Add CONFIG_EXTRA_ENV_SETTINGS configuration option + +* Patch by Stefan Roese, 16 May 2002: + Fix I2C initialization + * Patch by Wolfgang Grandegger, 15 May 2002: Add "filesize" support for "loadb" and "loads" commands diff --git a/README b/README index da65145..bdb8a43 100644 --- a/README +++ b/README @@ -317,7 +317,7 @@ The following options need to be configured: Only needed when CONFIG_BOOTDELAY is enabled; define a command string that is automatically executed when no character is read on the console interface - withing "Boot Delay" after reset. + within "Boot Delay" after reset. CONFIG_BOOTARGS This can be used to pass arguments to the bootm command. @@ -804,6 +804,31 @@ The following options need to be configured: of the backslashes before semicolons and special symbols. +- Default Environment + CONFIG_EXTRA_ENV_SETTINGS + + Define this to contain any number of null terminated + strings (variable = value pairs) that will be part of + the default enviroment compiled into the boot image. + For example, place something like this in your + board's config file: + + #define CONFIG_EXTRA_ENV_SETTINGS \ + "myvar1=value1\0" \ + "myvar2=value2\0" + + Warning: This method is based on knowledge about the + internal format how the environment is stored by the + PPCBoot code. This is NOT an official, expoerted + interface! Although it is unlikely that this format + will change soon, there is no guarantee either. + You better know what you are doing here. + + Note: overly (ab)use of the default environment is + discouraged. Make sure to check other ways to preset + the environment like the autoscript function or the + boot command first. + Configuration Settings: ----------------------- diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c index b7e184b..5348983 100644 --- a/board/lwmon/lwmon.c +++ b/board/lwmon/lwmon.c @@ -45,6 +45,7 @@ static long int dram_size (long int, long int *, long int); */ const uint sdram_table[] = { +#if defined(CFG_MEMORY_75) || defined(CFG_MEMORY_8E) /* * Single Read. (Offset 0 in UPM RAM) */ @@ -91,6 +92,57 @@ const uint sdram_table[] = */ 0x7FFFFC07, /* last */ 0xFFFFFCFF, 0xFFFFFCFF, 0xFFFFFCFF, +#endif +#ifdef CFG_MEMORY_7E + /* + * Single Read. (Offset 0 in UPM RAM) + */ + 0x0E2DBC04, 0x11AF7C04, 0xEFBAFC00, 0x1FF5FC47, /* last */ + _NOT_USED_, + /* + * SDRAM Initialization (offset 5 in UPM RAM) + * + * This is no UPM entry point. The following definition uses + * the remaining space to establish an initialization + * sequence, which is executed by a RUN command. + * + */ + 0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */ + /* + * Burst Read. (Offset 8 in UPM RAM) + */ + 0x0E2DBC04, 0x10AF7C04, 0xF0AFFC00, 0xF0AFFC00, + 0xF1AFFC00, 0xEFBAFC00, 0x1FF5FC47, /* last */ + _NOT_USED_, + _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, + _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, + /* + * Single Write. (Offset 18 in UPM RAM) + */ + 0x0E29BC04, 0x01B27C04, 0x1FF5FC47, /* last */ + _NOT_USED_, + _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, + /* + * Burst Write. (Offset 20 in UPM RAM) + */ + 0x0E29BC04, 0x10A77C00, 0xF0AFFC00, 0xF0AFFC00, + 0xE1BAFC04, 0x1FF5FC47, /* last */ + _NOT_USED_, _NOT_USED_, + _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, + _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, + /* + * Refresh (Offset 30 in UPM RAM) + */ + 0x1FFD7C84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04, + 0xFFFFFC84, 0xFFFFFC07, /* last */ + _NOT_USED_, _NOT_USED_, + _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_, + /* + * Exception. (Offset 3c in UPM RAM) + */ + 0x7FFFFC07, /* last */ + 0xFFFFFCFF, 0xFFFFFCFF, 0xFFFFFCFF, +#endif }; /* ------------------------------------------------------------------------- */ @@ -115,6 +167,7 @@ initdram (int board_type) volatile immap_t *immr = (immap_t *)CFG_IMMR; volatile memctl8xx_t *memctl = &immr->im_memctl; long int size_b0; + long int size8, size9; int i; /* @@ -125,7 +178,7 @@ initdram (int board_type) memctl->memc_mptpr = CFG_MPTPR; /* burst length=4, burst type=sequential, CAS latency=2 */ - memctl->memc_mar = 0x00000088; + memctl->memc_mar = CFG_MAR; /* * Map controller bank 3 to the SDRAM bank at preliminary address. @@ -134,7 +187,7 @@ initdram (int board_type) memctl->memc_br3 = CFG_BR3_PRELIM; /* initialize memory address register */ - memctl->memc_mamr = CFG_MAMR; /* refresh not enabled yet */ + memctl->memc_mamr = CFG_MAMR_8COL; /* refresh not enabled yet */ /* mode initialization (offset 5) */ udelay(200); /* 0x80006105 */ @@ -164,10 +217,27 @@ initdram (int board_type) /* * Check Bank 0 Memory Size for re-configuration + * + * try 8 column mode */ - size_b0 = dram_size (CFG_MAMR, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE); + size8 = dram_size (CFG_MAMR_8COL, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE); + + udelay (1000); - memctl->memc_mamr = CFG_MAMR | MAMR_PTBE; + /* + * try 9 column mode + */ + size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE); + + if (size8 < size9) { /* leave configuration at 9 columns */ + size_b0 = size9; + memctl->memc_mamr = CFG_MAMR_9COL | MAMR_PTBE; + udelay(500); + } else { /* back to 8 columns */ + size_b0 = size8; + memctl->memc_mamr = CFG_MAMR_8COL | MAMR_PTBE; + udelay(500); + } /* * Final mapping: diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 546804a..36565ce 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -86,6 +86,7 @@ int do_bootelf( cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[] ); image_header_t header; ulong load_addr = CFG_LOAD_ADDR; /* Default Load Address */ + int do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) { ulong iflag; diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index 11a868d..fc73c83 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -342,12 +342,11 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn void eeprom_init (void) { -#if defined(CONFIG_8xx) || defined(CONFIG_8260) -# if defined(CONFIG_SPI) +#if defined(CONFIG_SPI) spi_init_f (); -# else +#endif +#if defined(CONFIG_HARD_I2C) i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE); -# endif #endif } /*----------------------------------------------------------------------- diff --git a/common/cmd_net.c b/common/cmd_net.c index ac5ed27..c92a0eb 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -103,6 +103,11 @@ netboot_common (int proto, cmd_tbl_t *cmdtp, bd_t *bd, int argc, char *argv[]) int rcode = 0; int size; + /* pre-set load_addr */ + if ((s = getenv("loadaddr")) != NULL) { + load_addr = simple_strtoul(s, NULL, 16); + } + switch (argc) { case 1: break; diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index d7a58db..29dde3a 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -228,6 +228,9 @@ static uchar default_environment[] = { #ifdef CONFIG_CLOCKS_IN_MHZ "clocks_in_mhz=1\0" #endif +#ifdef CONFIG_EXTRA_ENV_SETTINGS + CONFIG_EXTRA_ENV_SETTINGS +#endif "\0" }; diff --git a/common/environment.c b/common/environment.c index 638c334..e652eac 100644 --- a/common/environment.c +++ b/common/environment.c @@ -186,6 +186,9 @@ env_t environment __PPCENV__ = { #ifdef CONFIG_CLOCKS_IN_MHZ "clocks_in_mhz=" "1" "\0" #endif +#ifdef CONFIG_EXTRA_ENV_SETTINGS + CONFIG_EXTRA_ENV_SETTINGS +#endif "\0" /* Term. env_t.data with 2 NULLs */ } }; diff --git a/include/config_lwmon.h b/include/config_lwmon.h index d9899f3..9dc6a71 100644 --- a/include/config_lwmon.h +++ b/include/config_lwmon.h @@ -130,6 +130,7 @@ #define CONFIG_COMMANDS ( (CONFIG_CMD_DFL & ~CFG_CMD_NET) | \ CFG_CMD_DATE | \ CFG_CMD_I2C | \ + CFG_CMD_EEPROM | \ CFG_CMD_IDE | \ CFG_CMD_BSP ) #else @@ -137,6 +138,7 @@ CFG_CMD_DHCP | \ CFG_CMD_DATE | \ CFG_CMD_I2C | \ + CFG_CMD_EEPROM | \ CFG_CMD_IDE | \ CFG_CMD_BSP ) #endif @@ -468,6 +470,10 @@ TOUCHPNL_TIMING ) #define CFG_BR5_PRELIM ((TOUCHPNL_BASE & BR_BA_MSK) | BR_PS_32 | BR_V ) +#define CFG_MEMORY_75 1 +#undef CFG_MEMORY_7E +#undef CFG_MEMORY_8E + /* * Memory Periodic Timer Prescaler */ @@ -479,7 +485,13 @@ * MAMR settings for SDRAM */ -#define CFG_MAMR 0x80802114 +#define CFG_MAMR_8COL 0x80802114 +#define CFG_MAMR_9COL 0x80902114 + +/* + * MAR setting for SDRAM + */ +#define CFG_MAR 0x00000088 /* * Internal Definitions