In case of DT boot, don't read default speed and mode for SPI from
CONFIG_*, instead read from DT node.

Signed-off-by: Patrick Delaunay <patrick.delau...@st.com>
---

 env/Kconfig | 4 ++--
 env/sf.c    | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/env/Kconfig b/env/Kconfig
index 9011109..0f760ce 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -329,11 +329,11 @@ config ENV_IS_IN_SPI_FLASH
 
          Define the SPI bus and chip select. If not defined they will be 0.
 
-         - CONFIG_ENV_SPI_MAX_HZ (optional):
+         - CONFIG_ENV_SPI_MAX_HZ (optional if !DM_SPI_FLASH):
 
          Define the SPI max work clock. If not defined then use 1MHz.
 
-         - CONFIG_ENV_SPI_MODE (optional):
+         - CONFIG_ENV_SPI_MODE (optional if !DM_SPI_FLASH):
 
          Define the SPI work mode. If not defined then use SPI_MODE_3.
 
diff --git a/env/sf.c b/env/sf.c
index 2e3c600..edd36f1 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -24,12 +24,15 @@
 #ifndef CONFIG_ENV_SPI_CS
 # define CONFIG_ENV_SPI_CS     CONFIG_SF_DEFAULT_CS
 #endif
+
+#ifndef CONFIG_DM_SPI_FLASH
 #ifndef CONFIG_ENV_SPI_MAX_HZ
 # define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
 #endif
 #ifndef CONFIG_ENV_SPI_MODE
 # define CONFIG_ENV_SPI_MODE   CONFIG_SF_DEFAULT_MODE
 #endif
+#endif
 
 #ifndef CONFIG_SPL_BUILD
 #define CMD_SAVEENV
@@ -58,7 +61,7 @@ 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,
-                                    CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE,
+                                    0, 0,
                                     &new);
        if (ret) {
                set_default_env("spi_flash_probe_bus_cs() failed", 0);
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to