[PATCH 06/10] ixp4xx: add generic board lowlevel_init

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Mon Apr 23 03:02:15 EDT 2012


Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 arch/arm/mach-ixp4xx/Kconfig               |    3 +
 arch/arm/mach-ixp4xx/Makefile              |    2 +
 arch/arm/mach-ixp4xx/board_lowlevel_init.c |   56 ++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-ixp4xx/board_lowlevel_init.c

diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index d92832c..f9388bf 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -1,5 +1,8 @@
 if ARCH_IXP4XX
 
+config IXP4XX_GENERIC_LOWLEVEL_INIT
+	bool
+
 choice
 	prompt "IXP4xx Board Type"
 
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
index 9bb2e99..958de5e 100644
--- a/arch/arm/mach-ixp4xx/Makefile
+++ b/arch/arm/mach-ixp4xx/Makefile
@@ -4,3 +4,5 @@ obj-y += timer.o
 obj-y += reset.o
 obj-$(CONFIG_IXP4XX_QMGR) += qmgr.o
 obj-$(CONFIG_IXP4XX_NPE) += npe.o
+arch_board_lowlevel_init-$(CONFIG_IXP4XX_GENERIC_LOWLEVEL_INIT) = board_lowlevel_init.o
+obj-$(CONFIG_MACH_HAS_LOWLEVEL_INIT) += $(arch_board_lowlevel_init-y)
diff --git a/arch/arm/mach-ixp4xx/board_lowlevel_init.c b/arch/arm/mach-ixp4xx/board_lowlevel_init.c
new file mode 100644
index 0000000..061246d
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/board_lowlevel_init.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
+ *
+ * Under GPLv2
+ */
+
+#include <common.h>
+#include <init.h>
+#include <asm/barebox-arm.h>
+#include <asm/io.h>
+#include <asm/system.h>
+#include <mach/ixp4xx-regs.h>
+
+static void inline delay(int x)
+{
+	while (x-- > 0)
+		barrier();
+}
+
+void __naked __bare_init board_init_lowlevel(void)
+{
+	int i;
+
+	IXP4XX_SDRAM_CONFIG = CONFIG_SDRAM_CONFIG;
+
+	/* disable refresh cycles */
+	IXP4XX_SDRAM_REFRESH = 0x0;
+
+	/* send NOP command */
+	IXP4XX_SDRAM_IR = 0x3;
+	delay(0x4000);
+
+	/* set SDRAM internal refresh */
+	IXP4XX_SDRAM_REFRESH = CONFIG_SDRAM_REFRESH;
+	delay(0x4000);
+
+	/* send precharge-all command to close all open banks */
+	IXP4XX_SDRAM_IR = 0x2;
+	delay(0x4000);
+
+	/* provide 8 auto-refresh cycles */
+	for (i = 0; i < 8; i++) {
+		IXP4XX_SDRAM_IR = 0x4;
+		delay(0x100);
+	}
+
+	/* set mode register in SDRAM */
+	IXP4XX_SDRAM_IR = CONFIG_SDRAM_MODE;
+	delay(0x4000);
+
+	/* send normal operation command */
+	IXP4XX_SDRAM_IR = 0x6;
+	delay(0x4000);
+
+	board_init_lowlevel_return();
+}
-- 
1.7.9.1




More information about the barebox mailing list