mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 06/10] ixp4xx: add generic board lowlevel_init
Date: Mon, 23 Apr 2012 09:02:15 +0200	[thread overview]
Message-ID: <1335164539-2188-6-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20120423065650.GM20601@game.jcrosoft.org>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-04-23  7:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23  6:56 [PATCH 00/10] IXP4xx rebase WIP Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` [PATCH 01/10] ARM: add support of in_be16/32 and out_be16/32 Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` [PATCH 02/10] ARM: Add support for IXP4xx CPU Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` [PATCH 03/10] ARM: Add support for IXP4xx Network Process Engine and queue Manager support Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` [PATCH 04/10] net: Add support for IXP4xx ethernet support Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` [PATCH 05/10] ixp4xx: add gpio support Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-04-23  7:02 ` [PATCH 07/10] ARM: Add support for Linksys NSLU2 support Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` [PATCH 08/10] ARM: Add support for Goramo Multilink router platform Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` [PATCH 09/10] nslu2: NPE-B firmware + boot script Jean-Christophe PLAGNIOL-VILLARD
2012-04-23  7:02 ` [PATCH 10/10] multilink: " Jean-Christophe PLAGNIOL-VILLARD
2012-04-24  8:08 ` [PATCH 00/10] IXP4xx rebase WIP Sascha Hauer
2012-04-28  8:32   ` Krzysztof Halasa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1335164539-2188-6-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox