mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: franck.jullien@gmail.com
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] Add a generic board
Date: Tue, 20 Dec 2011 23:11:37 +0100	[thread overview]
Message-ID: <1324419097-2786-2-git-send-email-franck.jullien@gmail.com> (raw)
In-Reply-To: <1324419097-2786-1-git-send-email-franck.jullien@gmail.com>

From: Franck Jullien <franck.jullien@gmail.com>

In this generic configuration, the board can be run in the
or1ksim simulator with the linux configuration file using
the UART to print the console.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 arch/openrisc/boards/generic/Makefile   |    1 +
 arch/openrisc/boards/generic/config.h   |   28 ++++++++++++++++++++++++++++
 arch/openrisc/boards/generic/env/config |   20 ++++++++++++++++++++
 arch/openrisc/boards/generic/generic.c  |   19 +++++++++++++++++++
 4 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/boards/generic/Makefile
 create mode 100644 arch/openrisc/boards/generic/config.h
 create mode 100644 arch/openrisc/boards/generic/env/config
 create mode 100644 arch/openrisc/boards/generic/generic.c

diff --git a/arch/openrisc/boards/generic/Makefile b/arch/openrisc/boards/generic/Makefile
new file mode 100644
index 0000000..d8a3d7f
--- /dev/null
+++ b/arch/openrisc/boards/generic/Makefile
@@ -0,0 +1 @@
+obj-y += generic.o
diff --git a/arch/openrisc/boards/generic/config.h b/arch/openrisc/boards/generic/config.h
new file mode 100644
index 0000000..88d2929
--- /dev/null
+++ b/arch/openrisc/boards/generic/config.h
@@ -0,0 +1,28 @@
+#ifndef _GENERIC_NAMES_H_
+#define _GENERIC_NAMES_H_
+
+#define CONFIG_SYS_CLK_FREQ		20000000
+
+#define OPENRISC_TIMER_FREQ		20000000
+
+#define OPENRISC_SOPC_MEMORY_BASE	0x00000000
+#define OPENRISC_SOPC_MEMORY_SIZE	0x02000000
+
+#define OPENRISC_SOPC_UART_BASE		0x90000000
+#define CONFIG_SYS_UART_FREQ		CONFIG_SYS_CLK_FREQ
+#define CONFIG_SYS_UART_BAUD		115200
+
+/* We reserve 256K for barebox */
+#define BAREBOX_RESERVED_SIZE		0x40000
+
+/* Barebox will be at top of main memory */
+#define OPENRISC_SOPC_TEXT_BASE		(OPENRISC_SOPC_MEMORY_BASE + OPENRISC_SOPC_MEMORY_SIZE - BAREBOX_RESERVED_SIZE)
+
+/*
+* TEXT_BASE is defined here because STACK_BASE definition
+*  in include/asm-generic/memory_layout.h uses this name
+*/
+
+#define TEXT_BASE                       OPENRISC_SOPC_TEXT_BASE
+
+#endif
diff --git a/arch/openrisc/boards/generic/env/config b/arch/openrisc/boards/generic/env/config
new file mode 100644
index 0000000..9dee8d9
--- /dev/null
+++ b/arch/openrisc/boards/generic/env/config
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# can be either 'net' or 'flash'
+kernel=flash
+root=flash
+
+kernel_loc=nor
+kernelimage_type=uimage
+
+# use 'dhcp' todo dhcp in barebox and in kernel
+ip=none
+
+autoboot_timeout=3
+
+nor_parts="256k(barebox),128k(env),4M(kernel),-(rootfs)"
+
+bootargs="console=ttyS0,9600"
+
+# set a fancy prompt (if support is compiled in)
+PS1="\e[1;33mbarebox@\e[1;32mor32:\w\e[0m "
diff --git a/arch/openrisc/boards/generic/generic.c b/arch/openrisc/boards/generic/generic.c
new file mode 100644
index 0000000..6a9ce5b
--- /dev/null
+++ b/arch/openrisc/boards/generic/generic.c
@@ -0,0 +1,19 @@
+#include <common.h>
+#include <init.h>
+#include <driver.h>
+#include <partition.h>
+#include <ns16550.h>
+
+static struct NS16550_plat serial_plat = {
+	.clock = 50000000,      /* 48MHz (APLL96/2) */
+	.shift = 0,
+};
+
+static int openrisc_console_init(void)
+{
+	/* Register the serial port */
+	add_ns16550_device(-1, OPENRISC_SOPC_UART_BASE, 1024, IORESOURCE_MEM_8BIT, &serial_plat);
+	return 0;
+}
+
+console_initcall(openrisc_console_init);
-- 
1.7.7


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

  reply	other threads:[~2011-12-20 22:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20 22:11 [PATCH 1/2] Add OpenRISC arch franck.jullien
2011-12-20 22:11 ` franck.jullien [this message]
2012-01-02 12:31 ` Franck JULLIEN

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=1324419097-2786-2-git-send-email-franck.jullien@gmail.com \
    --to=franck.jullien@gmail.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