Merge "ipq806x: use proper partition for env varibales in eMMC"

This commit is contained in:
Linux Build Service Account 2017-12-27 07:53:53 -08:00 committed by Gerrit - the friendly Code Review server
commit b2d362e64d
4 changed files with 39 additions and 63 deletions

View file

@ -26,6 +26,7 @@ extern int sf_env_init(void);
#ifdef CONFIG_QCA_MMC
extern int mmc_env_init(void);
extern void mmc_env_relocate_spec(void);
extern int mmc_init(struct mmc *mmc);
#endif
/*
@ -84,3 +85,35 @@ void env_relocate_spec(void)
}
};
#ifdef CONFIG_QCA_MMC
int board_mmc_env_init(qca_mmc mmc_host)
{
block_dev_desc_t *blk_dev;
disk_partition_t disk_info;
int ret;
if (mmc_init(mmc_host.mmc)) {
/* The HS mode command(cmd6) is getting timed out. So mmc card is
* not getting initialized properly. Since the env partition is not
* visible, the env default values are writing into the default
* partition (start of the mmc device). So do a reset again.
*/
if (mmc_init(mmc_host.mmc)) {
printf("MMC init failed \n");
return -1;
}
}
blk_dev = mmc_get_dev(mmc_host.dev_num);
ret = get_partition_info_efi_by_name(blk_dev,
"0:APPSBLENV", &disk_info);
if (ret == 0) {
board_env_offset = disk_info.start * disk_info.blksz;
board_env_size = disk_info.size * disk_info.blksz;
board_env_range = board_env_size;
BUG_ON(board_env_size > CONFIG_ENV_SIZE_MAX);
}
return ret;
}
#endif

View file

@ -219,36 +219,6 @@ int board_eth_init(bd_t *bis)
}
#ifdef CONFIG_QCA_MMC
int board_mmc_env_init(void)
{
block_dev_desc_t *blk_dev;
disk_partition_t disk_info;
int ret;
if (mmc_init(mmc_host.mmc)) {
/* The HS mode command(cmd6) is getting timed out. So mmc card is
* not getting initialized properly. Since the env partition is not
* visible, the env default values are writing into the default
* partition (start of the mmc device). So do a reset again.
*/
if (mmc_init(mmc_host.mmc)) {
printf("MMC init failed \n");
return -1;
}
}
blk_dev = mmc_get_dev(mmc_host.dev_num);
ret = get_partition_info_efi_by_name(blk_dev,
"0:APPSBLENV", &disk_info);
if (ret == 0) {
board_env_offset = disk_info.start * disk_info.blksz;
board_env_size = disk_info.size * disk_info.blksz;
board_env_range = board_env_size;
BUG_ON(board_env_size > CONFIG_ENV_SIZE_MAX);
}
return ret;
}
int board_mmc_init(bd_t *bis)
{
int ret;
@ -278,7 +248,7 @@ int board_mmc_init(bd_t *bis)
ret = qca_mmc_init(bis, &mmc_host);
if (!ret && sfi->flash_type == SMEM_BOOT_MMC_FLASH) {
ret = board_mmc_env_init();
ret = board_mmc_env_init(mmc_host);
}
return ret;

View file

@ -172,6 +172,7 @@ int board_mmc_init(bd_t *bis)
int ret = -ENODEV;
u32 *emmc_base;
int len;
qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
node = fdt_path_offset(gd->fdt_blob, "sdcc");
@ -197,6 +198,9 @@ int board_mmc_init(bd_t *bis)
ret = qca_mmc_init(bis, &mmc_host);
}
if (!ret && sfi->flash_type == SMEM_BOOT_MMC_FLASH) {
ret = board_mmc_env_init(mmc_host);
}
out:
return ret;
}

View file

@ -388,37 +388,6 @@ int board_eth_init(bd_t *bis)
return ret;
}
int board_mmc_env_init(void)
{
block_dev_desc_t *blk_dev;
disk_partition_t disk_info;
int ret;
if (mmc_init(mmc_host.mmc)) {
/* The HS mode command(cmd6) is getting timed out. So mmc card
* is not getting initialized properly. Since the env partition
* is not visible, the env default values are writing into the
* default partition (start of the mmc device).
* So do a reset again.
*/
if (mmc_init(mmc_host.mmc)) {
printf("MMC init failed \n");
return -1;
}
}
blk_dev = mmc_get_dev(mmc_host.dev_num);
ret = get_partition_info_efi_by_name(blk_dev,
"0:APPSBLENV", &disk_info);
if (ret == 0) {
board_env_offset = disk_info.start * disk_info.blksz;
board_env_size = disk_info.size * disk_info.blksz;
board_env_range = board_env_size;
BUG_ON(board_env_size > CONFIG_ENV_SIZE_MAX);
}
return ret;
}
int board_mmc_init(bd_t *bis)
{
int ret;
@ -450,7 +419,7 @@ int board_mmc_init(bd_t *bis)
#endif
if (!ret && sfi->flash_type == SMEM_BOOT_MMC_FLASH) {
ret = board_mmc_env_init();
ret = board_mmc_env_init(mmc_host);
}
return ret;