diff mbox series

[v2,1/2] spl: Introduce SoC specific init function

Message ID 20240327104638.2432672-2-lukas.funke-oss@weidmueller.com
State Superseded
Delegated to: Michal Simek
Headers show
Series Introduce spl_soc_init() for SoC specific initialization | expand

Commit Message

Lukas Funke March 27, 2024, 10:46 a.m. UTC
From: Lukas Funke <lukas.funke@weidmueller.com>

Some architectures use spl_board_init() in their SoC specific
implementation. Board developers should be able to add board specific
implementation via spl_board_init(). Hence, introduce a spl_soc_init()
method which is called right before spl_board_init() for SoC
specific implementation.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
---

(no changes since v1)

 common/spl/Kconfig | 7 +++++++
 common/spl/spl.c   | 3 +++
 include/spl.h      | 8 ++++++++
 3 files changed, 18 insertions(+)

Comments

Devarsh Thakkar March 27, 2024, 11:21 a.m. UTC | #1
On 27/03/24 16:16, lukas.funke-oss@weidmueller.com wrote:
> From: Lukas Funke <lukas.funke@weidmueller.com>
> 
> Some architectures use spl_board_init() in their SoC specific
> implementation. Board developers should be able to add board specific
> implementation via spl_board_init(). Hence, introduce a spl_soc_init()
> method which is called right before spl_board_init() for SoC
> specific implementation.
> 
> Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
> ---
> 
> (no changes since v1)
> 
>  common/spl/Kconfig | 7 +++++++
>  common/spl/spl.c   | 3 +++
>  include/spl.h      | 8 ++++++++
>  3 files changed, 18 insertions(+)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 6405374bcc..9b5cc8daa7 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -272,6 +272,13 @@ config SPL_TEXT_BASE
>  	help
>  	  The address in memory that SPL will be running from.
>  
> +config SPL_SOC_INIT
> +	bool "Call arch-specific initialization in SPL"

Call SoC specific intialization in SPL

With above change,
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>

Regards
Devarsh
> +	help
> +	  If this option is enabled, U-Boot will call the function
> +	  spl_soc_init() from board_init_r(). This function should be
> +	  provided by the architecture.
> +
>  config SPL_BOARD_INIT
>  	bool "Call board-specific initialization in SPL"
>  	help
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index b65c439e7a..9b83c85df5 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -711,6 +711,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  		}
>  	}
>  
> +	if (CONFIG_IS_ENABLED(SOC_INIT))
> +		spl_soc_init();
> +
>  	if (CONFIG_IS_ENABLED(BOARD_INIT))
>  		spl_board_init();
>  
> diff --git a/include/spl.h b/include/spl.h
> index 043875f10f..5dfdf778d2 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -816,6 +816,14 @@ int spl_early_init(void);
>   */
>  int spl_init(void);
>  
> +/*
> + * spl_soc_init() - Do architecture-specific init in SPL
> + *
> + * If SPL_SOC_INIT is enabled, this is called from board_init_r() before
> + * jumping to the next phase.
> + */
> +void spl_soc_init(void);
> +
>  /*
>   * spl_board_init() - Do board-specific init in SPL
>   *
diff mbox series

Patch

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 6405374bcc..9b5cc8daa7 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -272,6 +272,13 @@  config SPL_TEXT_BASE
 	help
 	  The address in memory that SPL will be running from.
 
+config SPL_SOC_INIT
+	bool "Call arch-specific initialization in SPL"
+	help
+	  If this option is enabled, U-Boot will call the function
+	  spl_soc_init() from board_init_r(). This function should be
+	  provided by the architecture.
+
 config SPL_BOARD_INIT
 	bool "Call board-specific initialization in SPL"
 	help
diff --git a/common/spl/spl.c b/common/spl/spl.c
index b65c439e7a..9b83c85df5 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -711,6 +711,9 @@  void board_init_r(gd_t *dummy1, ulong dummy2)
 		}
 	}
 
+	if (CONFIG_IS_ENABLED(SOC_INIT))
+		spl_soc_init();
+
 	if (CONFIG_IS_ENABLED(BOARD_INIT))
 		spl_board_init();
 
diff --git a/include/spl.h b/include/spl.h
index 043875f10f..5dfdf778d2 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -816,6 +816,14 @@  int spl_early_init(void);
  */
 int spl_init(void);
 
+/*
+ * spl_soc_init() - Do architecture-specific init in SPL
+ *
+ * If SPL_SOC_INIT is enabled, this is called from board_init_r() before
+ * jumping to the next phase.
+ */
+void spl_soc_init(void);
+
 /*
  * spl_board_init() - Do board-specific init in SPL
  *