public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] SPL: Add spl_early_board_init() generic function
@ 2017-01-15 22:46 Lukasz Majewski
  2017-01-15 23:03 ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2017-01-15 22:46 UTC (permalink / raw)
  To: u-boot

Some boards do require early adjustments (due to e.g. HW fix) in SPL code.
In this particular case such operations must be performed just before ANY
external IC is accessed (good example here is the I2C early bus access).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 common/spl/Kconfig | 8 ++++++++
 common/spl/spl.c   | 6 ++++++
 include/spl.h      | 4 ++++
 3 files changed, 18 insertions(+)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index bb99f1f..7e6f9c4 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -185,6 +185,14 @@ config SPL_SAVEENV
 	  "reboot_image" and act accordingly and change the reboot_image
 	  to default mode using setenv and save the environemnt.
 
+config SPL_EARLY_BOARD_INIT
+	bool "Support early board init code"
+	depends on SPL
+	help
+	  Enable support for very early SPL board code adjustments.
+	  Some boards require having adjustements done before any
+	  peripherals being operational (e.g. I2C, SPI, UART).
+
 config SPL_ETH_SUPPORT
 	bool "Support Ethernet"
 	depends on SPL_ENV_SUPPORT
diff --git a/common/spl/spl.c b/common/spl/spl.c
index bdb165a..a15647b 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -393,6 +393,12 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	struct spl_image_info spl_image;
 	int i;
 
+#ifdef CONFIG_SPL_EARLY_BOARD_INIT
+	debug(">>spl:early_board_init()\n");
+
+	spl_early_board_init();
+#endif
+
 	debug(">>spl:board_init_r()\n");
 
 #if defined(CONFIG_SYS_SPL_MALLOC_START)
diff --git a/include/spl.h b/include/spl.h
index e080a82..00a2058 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -215,6 +215,10 @@ int spl_init(void);
 void spl_board_init(void);
 #endif
 
+#ifdef CONFIG_SPL_EARLY_BOARD_INIT
+void spl_early_board_init(void);
+#endif
+
 /**
  * spl_was_boot_source() - check if U-Boot booted from SPL
  *
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-16  1:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-15 22:46 [U-Boot] [PATCH] SPL: Add spl_early_board_init() generic function Lukasz Majewski
2017-01-15 23:03 ` Marek Vasut
2017-01-16  1:19   ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox