mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-03-11 19:48:59 +01:00
ARM: env: qca: Update parameters for mmc env patition
This change adds mmc init code to update mmc env parameters such as env offset and size in case of env is in mmc. Change-Id: I27b5a68b47cab8090ad1a56d452b3211d92d1e21 Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
This commit is contained in:
parent
c61f26e363
commit
e697c8f7e2
1 changed files with 41 additions and 0 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include <asm/arch-qca-common/qpic_nand.h>
|
||||
#include <asm/arch-qca-common/gpio.h>
|
||||
#include <asm/arch-qca-common/uart.h>
|
||||
#include <asm/arch-qca-common/smem.h>
|
||||
#include <fdtdec.h>
|
||||
|
||||
|
||||
|
|
@ -26,6 +27,10 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
|
||||
qca_mmc mmc_host;
|
||||
|
||||
extern loff_t board_env_offset;
|
||||
extern loff_t board_env_range;
|
||||
extern loff_t board_env_size;
|
||||
|
||||
extern int ipq_spi_init(u16);
|
||||
extern int ipq807x_edma_init(void *cfg);
|
||||
|
||||
|
|
@ -118,9 +123,41 @@ 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;
|
||||
qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
|
||||
|
||||
mmc_host.base = MSM_SDC1_BASE;
|
||||
mmc_host.clk_mode = MMC_IDENTIFY_MODE;
|
||||
|
|
@ -128,6 +165,10 @@ 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();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue