diff options
author | Andreas Fenkart <afenkart@gmail.com> | 2017-04-08 09:59:32 (GMT) |
---|---|---|
committer | Jagan Teki <jagan@openedev.com> | 2017-05-03 05:47:54 (GMT) |
commit | 8fee8845e7543aec3edd64fcef2d6ff268d65a0d (patch) | |
tree | 1686752d42fabd8daf24b37caca58da2c75ff713 | |
parent | afa81a7750d63be9cb9eeb99a26c73bc93f4e1d9 (diff) | |
download | u-boot-8fee8845e7543aec3edd64fcef2d6ff268d65a0d.tar.xz |
enf_sf: reuse setup_flash_device instead of open coding it
setup_flash_device selects one of two code paths depending on the driver
model being used (=CONFIG_DM_SPI_FLASH). env_relocate_spec only used
the non driver-model code path. I'm unsure why, either none of the
platforms that need relocation use the driver model, or - worse - the
driver model is not yet usable when relocating.
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Tested-by: Jagan Teki <jagan@openedev.com>
-rw-r--r-- | common/env_sf.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/common/env_sf.c b/common/env_sf.c index 8af590a..a52fb73 100644 --- a/common/env_sf.c +++ b/common/env_sf.c @@ -176,12 +176,9 @@ void env_relocate_spec(void) goto out; } - env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); - if (!env_flash) { - set_default_env("!spi_flash_probe() failed"); + ret = setup_flash_device(); + if (ret) goto out; - } ret = spi_flash_read(env_flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, tmp_env1); @@ -316,10 +313,9 @@ void env_relocate_spec(void) char *buf = NULL; buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE); - env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); - if (!env_flash) { - set_default_env("!spi_flash_probe() failed"); + + ret = setup_flash_device(); + if (ret) { if (buf) free(buf); return; |