1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-26 10:46:16 +02:00

Add the code needed to launch memtest.

This commit is contained in:
Peter Zotov 2010-12-04 07:23:33 +03:00
parent 8c36acee57
commit ba795ac17d
2 changed files with 43 additions and 1 deletions

View File

@ -207,6 +207,10 @@ int ingenic_rebuild(void *hndl) {
* (handle->cfg.bank_num + 1) * 2 * (handle->cfg.bank_num + 1) * 2
* (2 - handle->cfg.bus_width); * (2 - handle->cfg.bus_width);
char tmp[20];
snprintf(tmp, 20, "%d", handle->total_sdram_size);
cfg_setenv("SDRAM_SIZE", tmp);
debug(LEVEL_DEBUG, "Firmware configuration dump:\n"); debug(LEVEL_DEBUG, "Firmware configuration dump:\n");
hexdump(&handle->cfg, sizeof(firmware_config_t)); hexdump(&handle->cfg, sizeof(firmware_config_t));

View File

@ -49,9 +49,47 @@ static int spl_load_stage1() {
static int spl_memtest(int argc, char *argv[]) { static int spl_memtest(int argc, char *argv[]) {
if(argc != 1 && argc != 3) { if(argc != 1 && argc != 3) {
printf("Usage: %s [BASE <SIZE>]\n", argv[0]); printf("Usage: %s [BASE <SIZE>]\n", argv[0]);
return -1;
} }
return spl_load_stage1(); // TODO char *old_debugops = strdup(cfg_getenv("DEBUGOPS")),
*old_start = strdup(cfg_getenv("PINNUM")),
*old_size = strdup(cfg_getenv("SIZE"));
cfg_setenv("DEBUGOPS", SPL_DEBUG_MEMTEST);
if(argc == 3) {
cfg_setenv("START", argv[1]);
cfg_setenv("SIZE", argv[2]);
} else {
char tmp[20];
snprintf(tmp, 20, "%d", SDRAM_BASE);
cfg_setenv("START", tmp);
cfg_setenv("SIZE", cfg_getenv("SDRAM_SIZE"));
}
int ret = 0;
ret = shell_execute("rebuildcfg");
if(ret == -1)
goto finally;
ret = spl_load_stage1();
finally:
cfg_setenv("DEBUGOPS", old_debugops);
cfg_setenv("START", old_start);
cfg_setenv("SIZE", old_size);
free(old_debugops);
free(old_start);
free(old_size);
return ret;
} }
static int spl_gpio(int argc, char *argv[]) { static int spl_gpio(int argc, char *argv[]) {