ipq807x: uboot: spi : code clean up

This patch involves changes which makes
sure that spi related functionalities are
used only when the config corresponding
to it is defined.

This change will allow us to disable or
enable spi as per our need.

Change-Id: I6c3865a6028b9f2a50fe0bface35b1695b17b515
Signed-off-by: speriaka <speriaka@codeaurora.org>
This commit is contained in:
speriaka 2017-12-18 16:49:35 +05:30
parent 3527e1e29a
commit 77fef22256
2 changed files with 10 additions and 2 deletions

View file

@ -135,10 +135,11 @@ int board_init(void)
printf("BUG: unsupported flash type : %d\n", sfi->flash_type);
BUG();
}
if (sfi->flash_type == SMEM_BOOT_SPI_FLASH) {
#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
saveenv = sf_saveenv;
env_name_spec = sf_env_name_spec;
#endif
#ifdef CONFIG_QCA_MMC
} else if (sfi->flash_type == SMEM_BOOT_MMC_FLASH) {
saveenv = mmc_saveenv;

View file

@ -16,9 +16,12 @@
#include <environment.h>
extern void nand_env_relocate_spec(void);
extern void sf_env_relocate_spec(void);
extern int nand_env_init(void);
#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
extern void sf_env_relocate_spec(void);
extern int sf_env_init(void);
#endif
#ifdef CONFIG_QCA_MMC
extern int mmc_env_init(void);
@ -42,7 +45,9 @@ int env_init(void)
&sfi.flash_density);
if (sfi.flash_type == SMEM_BOOT_SPI_FLASH) {
#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
ret = sf_env_init();
#endif
#ifdef CONFIG_QCA_MMC
} else if (sfi.flash_type == SMEM_BOOT_MMC_FLASH) {
ret = mmc_env_init();
@ -66,8 +71,10 @@ void env_relocate_spec(void)
if (sfi.flash_type == SMEM_BOOT_NO_FLASH) {
set_default_env("!flashless boot");
#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
} else if (sfi.flash_type == SMEM_BOOT_SPI_FLASH) {
sf_env_relocate_spec();
#endif
#ifdef CONFIG_QCA_MMC
} else if (sfi.flash_type == SMEM_BOOT_MMC_FLASH) {
mmc_env_relocate_spec();