diff mbox series

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

Message ID 1542648790-21362-3-git-send-email-patrick.delaunay@st.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series Read default speed and mode values from DT | expand

Commit Message

Patrick DELAUNAY Nov. 19, 2018, 5:33 p.m. UTC
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@st.com>
---

Changes in v2:
- use variables to avoid duplicated code

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

Patch

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;
 	}