fix: env: Fix the SPI flash device setup for DM mode
authorKonstantin Porotchkin <kostap@marvell.com>
Wed, 29 Aug 2018 13:34:52 +0000 (16:34 +0300)
committerStefan Roese <sr@denx.de>
Wed, 19 Sep 2018 07:02:34 +0000 (09:02 +0200)
For some reason the spi_flash_probe_bus_cs() is called
inside the setup_flash_device() with zero values in place
of configurated SPI flash mode and maximum flash speed.
This code causes HALT error during startup environment
relocation on some platforms - namely Armada-38x-GP board.
Fix the function call by replacing zeros with the appropriate
values - CONFIG_ENV_SPI_MAX_HZ and CONFIG_ENV_SPI_MODE.

Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
Cc: Igal Liberman <igall@marvell.com>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
env/sf.c

index 494510533a72e9de0fb3eb16d4a6329efcc8e7a8..2e3c60048392da5dc04789399185fec8e8a5266b 100644 (file)
--- a/env/sf.c
+++ b/env/sf.c
@@ -58,7 +58,8 @@ static int setup_flash_device(void)
 
        /* speed and mode will be read from DT */
        ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
-                                    0, 0, &new);
+                                    CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE,
+                                    &new);
        if (ret) {
                set_default_env("spi_flash_probe_bus_cs() failed", 0);
                return ret;