[PATCH 1/5] arm: socfpga: agilex5: separate EL3 init function

Michael Tretter <[email protected]>
Newsgroups org.infradead.lists.barebox
Message-ID <20260604-socfpga-axe5-sdram-init-v1-1-274f6361ce98@pengutronix.de>
Extract the EL3 initialization from the entry function as cleanup and to
be able to adjust the el3_init code more easily.

Signed-off-by: Michael Tretter <[email protected]>
---
 arch/arm/mach-socfpga/atf.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-socfpga/atf.c b/arch/arm/mach-socfpga/atf.c
index e1f0a3558b04..1fd11c426bc2 100644
--- a/arch/arm/mach-socfpga/atf.c
+++ b/arch/arm/mach-socfpga/atf.c
@@ -61,27 +61,32 @@ static void __noreturn agilex5_load_and_start_image_via_tfa(void)
 	__builtin_unreachable();
 }
 
+static void agilex5_el3_init(void)
+{
+	agilex5_initialize_security_policies();
+	pr_debug("Security policies initialized\n");
+
+	/*
+	 * need to set the bank select enable before the
+	 * agilex5_ddr_init_full() otherwise the serial doesn't show
+	 * anything.
+	 */
+	if (!IS_ENABLED(CONFIG_DEBUG_LL))
+		writel(LCR_BKSE, SOCFPGA_UART0_ADDRESS + LCR);
+	agilex5_ddr_init_full();
+
+	socfpga_agilex5_qspi_init();
+
+	agilex5_load_and_start_image_via_tfa();
+}
+
 void __noreturn agilex5_barebox_entry(void *fdt)
 {
 	phys_addr_t membase;
 	phys_size_t memsize;
 
 	if (current_el() == 3) {
-		agilex5_initialize_security_policies();
-		pr_debug("Security policies initialized\n");
-
-		/*
-		 * need to set the bank select enable before the
-		 * agilex5_ddr_init_full() otherwise the serial doesn't show
-		 * anything.
-		 */
-		if (!IS_ENABLED(CONFIG_DEBUG_LL))
-			writel(LCR_BKSE, SOCFPGA_UART0_ADDRESS + LCR);
-		agilex5_ddr_init_full();
-
-		socfpga_agilex5_qspi_init();
-
-		agilex5_load_and_start_image_via_tfa();
+		agilex5_el3_init();
 		__builtin_unreachable();
 	}
 

-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.