mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-13 00:17:23 +00:00
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>
This commit is contained in:
parent
afa81a7750
commit
8fee8845e7
1 changed files with 5 additions and 9 deletions
|
@ -176,12 +176,9 @@ void env_relocate_spec(void)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
|
ret = setup_flash_device();
|
||||||
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
|
if (ret)
|
||||||
if (!env_flash) {
|
|
||||||
set_default_env("!spi_flash_probe() failed");
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
ret = spi_flash_read(env_flash, CONFIG_ENV_OFFSET,
|
ret = spi_flash_read(env_flash, CONFIG_ENV_OFFSET,
|
||||||
CONFIG_ENV_SIZE, tmp_env1);
|
CONFIG_ENV_SIZE, tmp_env1);
|
||||||
|
@ -316,10 +313,9 @@ void env_relocate_spec(void)
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
|
|
||||||
buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
|
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);
|
ret = setup_flash_device();
|
||||||
if (!env_flash) {
|
if (ret) {
|
||||||
set_default_env("!spi_flash_probe() failed");
|
|
||||||
if (buf)
|
if (buf)
|
||||||
free(buf);
|
free(buf);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue