[U-Boot] [PATCHv2 11/20] arm: socfpga: spl: Add s_init

dinguyen at opensource.altera.com dinguyen at opensource.altera.com
Mon Mar 2 17:27:59 CET 2015


From: Dinh Nguyen <dinguyen at opensource.altera.com>

Clear OCRAM's ECC.

Signed-off-by: Dinh Nguyen <dinguyen at opensource.altera.com>
---
v2: remove redundant code that is already in arch_early_init_r
---
 arch/arm/cpu/armv7/socfpga/Makefile |  4 ++--
 arch/arm/cpu/armv7/socfpga/s_init.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/socfpga/s_init.c

diff --git a/arch/arm/cpu/armv7/socfpga/Makefile b/arch/arm/cpu/armv7/socfpga/Makefile
index 8b6e108..ee0af9b 100644
--- a/arch/arm/cpu/armv7/socfpga/Makefile
+++ b/arch/arm/cpu/armv7/socfpga/Makefile
@@ -8,6 +8,6 @@
 #
 
 obj-y	:= lowlevel_init.o
-obj-y	+= misc.o timer.o reset_manager.o system_manager.o clock_manager.o \
-	   fpga_manager.o
+obj-y	+= s_init.o misc.o timer.o reset_manager.o system_manager.o \
+	   clock_manager.o fpga_manager.o
 obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o scan_manager.o
diff --git a/arch/arm/cpu/armv7/socfpga/s_init.c b/arch/arm/cpu/armv7/socfpga/s_init.c
new file mode 100644
index 0000000..bb159c6
--- /dev/null
+++ b/arch/arm/cpu/armv7/socfpga/s_init.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Altera Corporation <www.altera.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <watchdog.h>
+#include <asm/io.h>
+#include <asm/spl.h>
+#include <asm/arch/system_manager.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * First C function to initialize the critical hardware early
+ */
+void s_init(void)
+{
+#ifdef CONFIG_SPL_BUILD
+	struct socfpga_system_manager *sysmgr_regs =
+		(struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
+	unsigned long reg;
+	/*
+	 * First C code to run. Clear fake OCRAM ECC first as SBE
+	 * and DBE might triggered during power on
+	 */
+	reg = readl(&sysmgr_regs->eccgrp_ocram);
+	if (reg & SYSMGR_ECC_OCRAM_SERR)
+		writel(SYSMGR_ECC_OCRAM_SERR | SYSMGR_ECC_OCRAM_EN,
+			&sysmgr_regs->eccgrp_ocram);
+	if (reg & SYSMGR_ECC_OCRAM_DERR)
+		writel(SYSMGR_ECC_OCRAM_DERR  | SYSMGR_ECC_OCRAM_EN,
+			&sysmgr_regs->eccgrp_ocram);
+#endif	/* CONFIG_SPL_BUILD */
+}
-- 
2.2.1



More information about the U-Boot mailing list