mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
Merge "IPQ5018: Redcued U-boot reserved memory to 2MB"
This commit is contained in:
commit
3f62b16b49
5 changed files with 75 additions and 15 deletions
|
|
@ -76,12 +76,18 @@ int saveenv(void)
|
|||
|
||||
void env_relocate_spec(void)
|
||||
{
|
||||
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
char *buf = NULL;
|
||||
block_dev_desc_t *dev_desc = NULL;
|
||||
disk_partition_t info;
|
||||
int dev, part;
|
||||
int err;
|
||||
|
||||
buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
|
||||
if (!buf) {
|
||||
printf("Error: Cannot allocate %d bytes\n", CONFIG_ENV_SIZE);
|
||||
goto err_env_relocate;
|
||||
}
|
||||
|
||||
part = get_device_and_partition(FAT_ENV_INTERFACE,
|
||||
FAT_ENV_DEVICE_AND_PART,
|
||||
&dev_desc, &info, 1);
|
||||
|
|
@ -103,8 +109,11 @@ void env_relocate_spec(void)
|
|||
}
|
||||
|
||||
env_import(buf, 1);
|
||||
free(buf);
|
||||
return;
|
||||
|
||||
err_env_relocate:
|
||||
set_default_env(NULL);
|
||||
if (buf)
|
||||
free(buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,15 +139,21 @@ static unsigned char env_flags;
|
|||
|
||||
int mmc_saveenv(void)
|
||||
{
|
||||
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
|
||||
struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
|
||||
u32 offset;
|
||||
int ret, copy = 0;
|
||||
const char *errmsg;
|
||||
|
||||
env_t *env_new = (env_t *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
|
||||
if (!env_new) {
|
||||
printf("Error: Cannot allocate %d bytes\n", CONFIG_ENV_SIZE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
errmsg = init_mmc_for_env(mmc);
|
||||
if (errmsg) {
|
||||
printf("%s\n", errmsg);
|
||||
free(env_new);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -184,6 +190,7 @@ int mmc_saveenv(void)
|
|||
|
||||
fini:
|
||||
fini_mmc_for_env(mmc);
|
||||
free(env_new);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_CMD_SAVEENV */
|
||||
|
|
@ -298,12 +305,17 @@ err:
|
|||
void mmc_env_relocate_spec(void)
|
||||
{
|
||||
#if !defined(ENV_IS_EMBEDDED)
|
||||
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
struct mmc *mmc;
|
||||
u32 offset;
|
||||
int ret;
|
||||
int dev = CONFIG_SYS_MMC_ENV_DEV;
|
||||
const char *errmsg;
|
||||
const char *errmsg = NULL;
|
||||
char *buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
|
||||
if (!buf) {
|
||||
printf("Error: Cannot allocate %d bytes\n", CONFIG_ENV_SIZE);
|
||||
ret = 1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPL_BUILD
|
||||
dev = 0;
|
||||
|
|
@ -336,6 +348,8 @@ fini:
|
|||
err:
|
||||
if (ret)
|
||||
set_default_env(errmsg);
|
||||
if (buf)
|
||||
free(buf);
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_ENV_OFFSET_REDUND */
|
||||
|
|
|
|||
|
|
@ -183,7 +183,6 @@ static unsigned char env_flags;
|
|||
int nand_saveenv(void)
|
||||
{
|
||||
int ret = 0;
|
||||
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
|
||||
int env_idx = 0;
|
||||
struct env_location location[] = {
|
||||
{
|
||||
|
|
@ -204,13 +203,22 @@ int nand_saveenv(void)
|
|||
#endif
|
||||
};
|
||||
|
||||
|
||||
if (CONFIG_ENV_RANGE > board_env_size)
|
||||
env_t *env_new = (env_t *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
|
||||
if (!env_new) {
|
||||
printf("Error: Cannot allocate %d bytes\n", CONFIG_ENV_SIZE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (CONFIG_ENV_RANGE > board_env_size) {
|
||||
free(env_new);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = env_export(env_new);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
free(env_new);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENV_OFFSET_REDUND
|
||||
env_new->flags = ++env_flags; /* increase the serial */
|
||||
|
|
@ -221,6 +229,7 @@ int nand_saveenv(void)
|
|||
if (!ret) {
|
||||
/* preset other copy for next write */
|
||||
gd->env_valid = gd->env_valid == 2 ? 1 : 2;
|
||||
free(env_new);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +239,7 @@ int nand_saveenv(void)
|
|||
printf("Warning: primary env write failed,"
|
||||
" redundancy is lost!\n");
|
||||
#endif
|
||||
|
||||
free(env_new);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CMD_SAVEENV */
|
||||
|
|
@ -385,7 +394,13 @@ void nand_env_relocate_spec(void)
|
|||
{
|
||||
#if !defined(ENV_IS_EMBEDDED)
|
||||
int ret;
|
||||
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
char *buf = NULL;
|
||||
buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
|
||||
if (!buf) {
|
||||
printf("Error: Cannot allocate %d bytes\n", CONFIG_ENV_SIZE);
|
||||
set_default_env(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ENV_OFFSET_OOB)
|
||||
ret = get_nand_env_oob(&nand_info[nand_env_device], &nand_env_oob_offset);
|
||||
|
|
@ -397,6 +412,7 @@ void nand_env_relocate_spec(void)
|
|||
printf("Found Environment offset in OOB..\n");
|
||||
} else {
|
||||
set_default_env("!no env offset in OOB");
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -404,10 +420,12 @@ void nand_env_relocate_spec(void)
|
|||
ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf);
|
||||
if (ret) {
|
||||
set_default_env("!readenv() failed");
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
env_import(buf, 1);
|
||||
free(buf);
|
||||
#endif /* ! ENV_IS_EMBEDDED */
|
||||
}
|
||||
#endif /* CONFIG_ENV_OFFSET_REDUND */
|
||||
|
|
|
|||
|
|
@ -81,14 +81,21 @@ int saveenv(void)
|
|||
#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
||||
int saveenv(void)
|
||||
{
|
||||
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
|
||||
int ret;
|
||||
env_t *env_new = (env_t *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE)
|
||||
if (!env_new) {
|
||||
printf("Error: Cannot allocate %d bytes\n", CONFIG_ENV_SIZE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = env_export(env_new);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
free(env_new);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
|
||||
free(env_new);
|
||||
printf("\n** Cannot find mtd partition \"%s\"\n",
|
||||
CONFIG_ENV_UBI_PART);
|
||||
return 1;
|
||||
|
|
@ -96,11 +103,13 @@ int saveenv(void)
|
|||
|
||||
if (ubi_volume_write(CONFIG_ENV_UBI_VOLUME, (void *)env_new,
|
||||
CONFIG_ENV_SIZE)) {
|
||||
free(env_new);
|
||||
printf("\n** Unable to write env to %s:%s **\n",
|
||||
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
|
||||
return 1;
|
||||
}
|
||||
|
||||
free(env_new);
|
||||
puts("done\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -172,12 +181,20 @@ void env_relocate_spec(void)
|
|||
#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
||||
void env_relocate_spec(void)
|
||||
{
|
||||
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
|
||||
char *buf = NULL;
|
||||
buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
|
||||
if (!buf) {
|
||||
printf("Error: Cannot allocate %d bytes\n");
|
||||
set_default_env(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
|
||||
printf("\n** Cannot find mtd partition \"%s\"\n",
|
||||
CONFIG_ENV_UBI_PART);
|
||||
set_default_env(NULL);
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -185,9 +202,11 @@ void env_relocate_spec(void)
|
|||
printf("\n** Unable to read env from %s:%s **\n",
|
||||
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
|
||||
set_default_env(NULL);
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
env_import(buf, 1);
|
||||
free(buf);
|
||||
}
|
||||
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
#define GPIO_IN_OUT_ADDR(x) (TLMM_BASE + 0x4 + (x)*0x1000)
|
||||
|
||||
#define CONFIG_SYS_SDRAM_BASE 0x40000000
|
||||
#define CONFIG_SYS_TEXT_BASE 0x4A900000
|
||||
#define CONFIG_SYS_TEXT_BASE 0x4A920000
|
||||
#define CONFIG_SYS_SDRAM_SIZE 0x10000000
|
||||
#define CONFIG_MAX_RAM_BANK_SIZE CONFIG_SYS_SDRAM_SIZE
|
||||
#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + (64 << 20))
|
||||
|
|
@ -134,7 +134,7 @@ extern loff_t board_env_size;
|
|||
#define CONFIG_ENV_OFFSET board_env_offset
|
||||
#define CONFIG_ENV_SIZE CONFIG_ENV_SIZE_MAX
|
||||
#define CONFIG_ENV_RANGE board_env_range
|
||||
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE_MAX + (1024 << 10))
|
||||
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE_MAX + (500 << 10))
|
||||
|
||||
/*
|
||||
* NAND Flash Configs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue