[U-Boot] [PATCH v2 2/2] splash: sf: Read default speed and mode values from DT

Patrick Delaunay patrick.delaunay at st.com
Mon Nov 19 17:33:10 UTC 2018


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.delaunay at st.com>
---

Changes in v2:
- use variables to avoid duplicated code

 common/splash_source.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/common/splash_source.c b/common/splash_source.c
index 62763b9..427196c 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -24,11 +24,19 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct spi_flash *sf;
 static int splash_sf_read_raw(u32 bmp_load_addr, int offset, size_t read_size)
 {
+	unsigned int max_hz = CONFIG_SF_DEFAULT_SPEED;
+	unsigned int spi_mode = CONFIG_SF_DEFAULT_MODE;
+
+#ifdef CONFIG_DM_SPI_FLASH
+	/* In DM mode defaults will be taken from DT */
+	max_hz = 0, spi_mode = 0;
+#endif
+
 	if (!sf) {
 		sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
 				     CONFIG_SF_DEFAULT_CS,
-				     CONFIG_SF_DEFAULT_SPEED,
-				     CONFIG_SF_DEFAULT_MODE);
+				     max_hz,
+				     spi_mode);
 		if (!sf)
 			return -ENODEV;
 	}
-- 
2.7.4



More information about the U-Boot mailing list