diff options
-rw-r--r-- | board/keymile/common/common.c | 36 | ||||
-rw-r--r-- | board/keymile/common/common.h | 1 | ||||
-rw-r--r-- | board/keymile/km83xx/km83xx.c | 6 | ||||
-rw-r--r-- | board/keymile/km_arm/km_arm.c | 6 | ||||
-rw-r--r-- | board/keymile/mgcoge/mgcoge.c | 1 | ||||
-rw-r--r-- | include/configs/keymile-common.h | 3 | ||||
-rw-r--r-- | include/configs/km_arm.h | 7 | ||||
-rw-r--r-- | include/configs/mgcoge.h | 2 |
8 files changed, 60 insertions, 2 deletions
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 8392a6413e..4883fe588b 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -42,6 +42,7 @@ static void i2c_write_start_seq(void); static int i2c_make_abort(void); +DECLARE_GLOBAL_DATA_PTR; int ivm_calc_crc(unsigned char *buf, int len) { @@ -73,6 +74,41 @@ int ivm_calc_crc(unsigned char *buf, int len) return crc; } +/* + * Set Keymile specific environment variables + * Currently only some memory layout variables are calculated here + * ... ------------------------------------------------ + * ... |@rootfsaddr |@pnvramaddr |@varaddr |@reserved |@END_OF_RAM + * ... |<------------------- pram ------------------->| + * ... ------------------------------------------------ + * @END_OF_RAM: denotes the RAM size + * @pnvramaddr: Startadress of pseudo non volatile RAM in hex + * @pram : preserved ram size in k + * @varaddr : startadress for /var mounted into RAM + */ +int set_km_env(void) +{ + uchar buf[32]; + unsigned int pnvramaddr; + unsigned int pram; + unsigned int varaddr; + + pnvramaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM + - CONFIG_KM_PNVRAM; + sprintf((char *)buf, "0x%x", pnvramaddr); + setenv("pnvramaddr", (char *)buf); + + pram = (CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM + CONFIG_KM_PNVRAM) / + 0x400; + sprintf((char *)buf, "0x%x", pram); + setenv("pram", (char *)buf); + + varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM; + sprintf((char *)buf, "0x%x", varaddr); + setenv("varaddr", (char *)buf); + return 0; +} + static int ivm_set_value(char *name, char *value) { char tempbuf[256]; diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h index e32de8d9fa..099de98c6d 100644 --- a/board/keymile/common/common.h +++ b/board/keymile/common/common.h @@ -50,6 +50,7 @@ int ivm_read_eeprom(void); int keymile_hdlc_enet_initialize(bd_t *bis); #endif +int set_km_env(void); int fdt_set_node_and_value(void *blob, char *nodename, char *regname, diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index f9186e813b..17560c8dba 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -190,6 +190,12 @@ int misc_init_r(void) return 0; } +int last_stage_init(void) +{ + set_km_env(); + return 0; +} + int fixed_sdram(void) { immap_t *im = (immap_t *)CONFIG_SYS_IMMR; diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index cb999b23fa..c772ee2a55 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -212,6 +212,12 @@ int board_init(void) return 0; } +int last_stage_init(void) +{ + set_km_env(); + return 0; +} + #if defined(CONFIG_CMD_SF) int do_spi_toggle(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c index 7f487f109e..7b346849ba 100644 --- a/board/keymile/mgcoge/mgcoge.c +++ b/board/keymile/mgcoge/mgcoge.c @@ -310,6 +310,7 @@ int last_stage_init(void) puts("DIP: Enabled\n"); setenv("actual_bank", "0"); } + set_km_env(); return 0; } diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index 77e20909ce..da5a4475b0 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -26,6 +26,9 @@ /* Do boardspecific init for all boards */ #define CONFIG_BOARD_EARLY_INIT_R +#define CONFIG_LAST_STAGE_INIT + +#define CONFIG_BOOTCOUNT_LIMIT /* * By default kwbimage.cfg from board specific folder is used diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h index 8cb0fe834d..9c8d0e7af7 100644 --- a/include/configs/km_arm.h +++ b/include/configs/km_arm.h @@ -254,4 +254,11 @@ int get_scl (void); #define CONFIG_SYS_INIT_SP_ADDR 0xC8012000 /* Do early setups now in board_init_f() */ #define CONFIG_BOARD_EARLY_INIT_F + +/* + * resereved pram area at the end of memroy [hex] + * 8Mbytes for switch + 4Kbytes for bootcount + */ +#define CONFIG_KM_RESERVED_PRAM 0x801000 + #endif /* _CONFIG_KM_ARM_H */ diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h index a0d1765adf..dcde76c86f 100644 --- a/include/configs/mgcoge.h +++ b/include/configs/mgcoge.h @@ -61,8 +61,6 @@ /* include further common stuff for all keymile 82xx boards */ #include "km82xx-common.h" -/* enable last_stage_init */ -#define CONFIG_LAST_STAGE_INIT 1 /* bfticu address */ #define CONFIG_SYS_BFTICU_BASE 0x40000000 |