mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-03-08 02:07:55 +01:00
Merge "ipq806x: use proper partition for env varibales in eMMC"
This commit is contained in:
commit
ce3c581f24
4 changed files with 47 additions and 63 deletions
|
|
@ -15,6 +15,10 @@
|
|||
#include <asm/arch-qca-common/smem.h>
|
||||
#include <environment.h>
|
||||
|
||||
#ifdef CONFIG_SDHCI_SUPPORT
|
||||
#include <sdhci.h>
|
||||
#endif
|
||||
|
||||
extern void nand_env_relocate_spec(void);
|
||||
extern int nand_env_init(void);
|
||||
|
||||
|
|
@ -26,6 +30,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 +89,39 @@ void env_relocate_spec(void)
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
#ifdef CONFIG_QCA_MMC
|
||||
#ifdef CONFIG_SDHCI_SUPPORT
|
||||
int board_mmc_env_init(struct sdhci_host mmc_host)
|
||||
#else
|
||||
int board_mmc_env_init(qca_mmc mmc_host)
|
||||
#endif
|
||||
{
|
||||
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
|
||||
|
|
|
|||
|
|
@ -227,36 +227,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;
|
||||
|
|
@ -286,7 +256,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;
|
||||
|
|
|
|||
|
|
@ -185,6 +185,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");
|
||||
|
||||
|
|
@ -210,6 +211,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -413,37 +413,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;
|
||||
|
|
@ -475,7 +444,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue