u-boot-2016/board/qca/arm/common/env.c
Gokul Sriram Palanisamy 0dedd94f33 ARM: qca: Added support for flashless boot
U-boot uses APPSBLENV partition on flash to save environment variables.
During flashless boot, there cannot be any dependency over a flash partition.
This patch revokes the support for this flash partition for flashless boot.

Change-Id: Id387ec3af52c597f3fd408e022446c9b600ecf1d
Signed-off-by: Gopinath Sekar <gsekar@codeaurora.org>
Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
2017-04-24 14:08:40 +05:30

73 lines
1.7 KiB
C

/*
* Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <common.h>
#include <asm/arch-qca-common/smem.h>
#include <environment.h>
extern void nand_env_relocate_spec(void);
extern int nand_env_init(void);
#ifdef CONFIG_QCA_MMC
extern int mmc_env_init(void);
extern void mmc_env_relocate_spec(void);
#endif
/*
* Function description: Board specific initialization.
* I/P : None
* O/P : integer, 0 - no error.
*/
int env_init(void)
{
int ret = 0;
qca_smem_flash_info_t sfi;
smem_get_boot_flash(&sfi.flash_type,
&sfi.flash_index,
&sfi.flash_chip_select,
&sfi.flash_block_size,
&sfi.flash_density);
if (sfi.flash_type != SMEM_BOOT_MMC_FLASH) {
ret = nand_env_init();
#ifdef CONFIG_QCA_MMC
} else {
ret = mmc_env_init();
#endif
}
return ret;
}
void env_relocate_spec(void)
{
qca_smem_flash_info_t sfi;
smem_get_boot_flash(&sfi.flash_type,
&sfi.flash_index,
&sfi.flash_chip_select,
&sfi.flash_block_size,
&sfi.flash_density);
if (sfi.flash_type == SMEM_BOOT_NO_FLASH) {
set_default_env("!flashless boot");
} else if (sfi.flash_type != SMEM_BOOT_MMC_FLASH) {
nand_env_relocate_spec();
#ifdef CONFIG_QCA_MMC
} else {
mmc_env_relocate_spec();
#endif
}
};