From 8e2326232d38f9792e54c0359ae28b9c17dbbb55 Mon Sep 17 00:00:00 2001 From: Gokul Sriram Palanisamy Date: Fri, 29 Dec 2017 16:30:47 +0530 Subject: [PATCH] Revert "ipq806x: use proper partition for env varibales in eMMC" This reverts commit 6345e2888c492ea706cc91b15ed6678f9c7b8897. --- board/qca/arm/common/env.c | 33 --------------------------------- board/qca/arm/ipq40xx/ipq40xx.c | 32 +++++++++++++++++++++++++++++++- board/qca/arm/ipq806x/ipq806x.c | 4 ---- board/qca/arm/ipq807x/ipq807x.c | 33 ++++++++++++++++++++++++++++++++- 4 files changed, 63 insertions(+), 39 deletions(-) diff --git a/board/qca/arm/common/env.c b/board/qca/arm/common/env.c index 2a907c2c86..f35122d33f 100644 --- a/board/qca/arm/common/env.c +++ b/board/qca/arm/common/env.c @@ -26,7 +26,6 @@ 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 /* @@ -85,35 +84,3 @@ 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 diff --git a/board/qca/arm/ipq40xx/ipq40xx.c b/board/qca/arm/ipq40xx/ipq40xx.c index 613bc51fe0..985038b66e 100644 --- a/board/qca/arm/ipq40xx/ipq40xx.c +++ b/board/qca/arm/ipq40xx/ipq40xx.c @@ -219,6 +219,36 @@ 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; @@ -248,7 +278,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(mmc_host); + ret = board_mmc_env_init(); } return ret; diff --git a/board/qca/arm/ipq806x/ipq806x.c b/board/qca/arm/ipq806x/ipq806x.c index d52ae2ccb8..49bab45a9e 100644 --- a/board/qca/arm/ipq806x/ipq806x.c +++ b/board/qca/arm/ipq806x/ipq806x.c @@ -174,7 +174,6 @@ 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"); @@ -200,9 +199,6 @@ 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; } diff --git a/board/qca/arm/ipq807x/ipq807x.c b/board/qca/arm/ipq807x/ipq807x.c index 5790928af4..83a0ab9efb 100644 --- a/board/qca/arm/ipq807x/ipq807x.c +++ b/board/qca/arm/ipq807x/ipq807x.c @@ -388,6 +388,37 @@ 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; @@ -419,7 +450,7 @@ int board_mmc_init(bd_t *bis) #endif if (!ret && sfi->flash_type == SMEM_BOOT_MMC_FLASH) { - ret = board_mmc_env_init(mmc_host); + ret = board_mmc_env_init(); } return ret;