Skip to contentSkip to conversation

Add support for the OpenRISC architecture

PATCH Superseded Stefan Kristiansson 4 participants 25 messages Nov 27, 2011 – Jan 13, 2012

Subsystems (3)
lore
Share & tools
lore

Stefan Kristiansson

author maintainer
#0 lore raw

v2 cover Add support for the OpenRISC architecture

This patch series adds support for the OpenRISC 1000 architecture.

The OpenRISC architecture has been around for about a decade and has experienced a revival in the last couple of years from the efforts of a small, but dedicated community compound of both commercial and independent contributors.

Most of the development takes place on opencores.org/or1k and openrisc.net.

The patches included in this series are also available in the 'for-upstream' branch in the following git repository:

git://openrisc.net/stefan/u-boot

which is also browsable here:

http://git.openrisc.net/cgit.cgi/stefan/u-boot/?h=for-upstream

NOTE: The openrisc-generic board depends on this pending patch to build properly:
net/ethoc: use flush_dcache_range instead of flush_dcache
(http://patchwork.ozlabs.org/patch/123622/)

Stefan Kristiansson (9):
openrisc: Add architecture header files
openrisc: Add architecture image support
openrisc: Add cpu files
openrisc: Add library functions
openrisc: Add board info printout to cmd_bdinfo
openrisc: Add support for standalone programs
openrisc: Add openrisc-generic example board
openrisc: Add architecture to MAKEALL
openrisc: Add MAINTAINERS entry

 MAINTAINERS                                        |   11 +
 MAKEALL                                            |    5 +
 arch/openrisc/config.mk                            |   27 +
 arch/openrisc/cpu/Makefile                         |   47 +
 arch/openrisc/cpu/cache.c                          |  151 ++++
 arch/openrisc/cpu/cpu.c                            |  157 ++++
 arch/openrisc/cpu/exceptions.c                     |   85 ++
 arch/openrisc/cpu/interrupts.c                     |  121 +++
 arch/openrisc/cpu/start.S                          |  335 ++++++++
 arch/openrisc/include/asm/bitops.h                 |   28 +
 arch/openrisc/include/asm/bitops/ffs.h             |   26 +
 arch/openrisc/include/asm/bitops/fls.h             |   26 +
 arch/openrisc/include/asm/byteorder.h              |    1 +
 arch/openrisc/include/asm/cache.h                  |   35 +
 arch/openrisc/include/asm/config.h                 |   24 +
 arch/openrisc/include/asm/errno.h                  |    1 +
 arch/openrisc/include/asm/global_data.h            |   74 ++
 arch/openrisc/include/asm/gpio.h                   |   84 ++
 arch/openrisc/include/asm/io.h                     |  112 +++
 arch/openrisc/include/asm/openrisc_exc.h           |   41 +
 arch/openrisc/include/asm/posix_types.h            |   72 ++
 arch/openrisc/include/asm/processor.h              |    4 +
 arch/openrisc/include/asm/ptrace.h                 |  131 +++
 arch/openrisc/include/asm/spr-defs.h               |  567 +++++++++++++
 arch/openrisc/include/asm/string.h                 |    4 +
 arch/openrisc/include/asm/system.h                 |   39 +
 arch/openrisc/include/asm/types.h                  |   79 ++
 arch/openrisc/include/asm/u-boot.h                 |   48 ++
 arch/openrisc/include/asm/unaligned.h              |    1 +
 arch/openrisc/lib/Makefile                         |   47 +
 arch/openrisc/lib/board.c                          |  168 ++++
 arch/openrisc/lib/bootm.c                          |   84 ++
 arch/openrisc/lib/timer.c                          |  104 +++
 board/openrisc/openrisc-generic/Makefile           |   43 +
 board/openrisc/openrisc-generic/config.mk          |   24 +
 board/openrisc/openrisc-generic/openrisc-generic.c |   55 ++
 board/openrisc/openrisc-generic/or1ksim.cfg        |  882 ++++++++++++++++++++
 board/openrisc/openrisc-generic/u-boot.lds         |   75 ++
 boards.cfg                                         |    1 +
 common/cmd_bdinfo.c                                |   22 +
 common/image.c                                     |    1 +
 examples/standalone/stubs.c                        |   14 +
 include/configs/openrisc-generic.h                 |  158 ++++
 include/image.h                                    |    1 +
 44 files changed, 4015 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/config.mk
 create mode 100644 arch/openrisc/cpu/Makefile
 create mode 100644 arch/openrisc/cpu/cache.c
 create mode 100644 arch/openrisc/cpu/cpu.c
 create mode 100644 arch/openrisc/cpu/exceptions.c
 create mode 100644 arch/openrisc/cpu/interrupts.c
 create mode 100644 arch/openrisc/cpu/start.S
 create mode 100644 arch/openrisc/include/asm/bitops.h
 create mode 100644 arch/openrisc/include/asm/bitops/ffs.h
 create mode 100644 arch/openrisc/include/asm/bitops/fls.h
 create mode 100644 arch/openrisc/include/asm/byteorder.h
 create mode 100644 arch/openrisc/include/asm/cache.h
 create mode 100644 arch/openrisc/include/asm/config.h
 create mode 100644 arch/openrisc/include/asm/errno.h
 create mode 100644 arch/openrisc/include/asm/global_data.h
 create mode 100644 arch/openrisc/include/asm/gpio.h
 create mode 100644 arch/openrisc/include/asm/io.h
 create mode 100644 arch/openrisc/include/asm/openrisc_exc.h
 create mode 100644 arch/openrisc/include/asm/posix_types.h
 create mode 100644 arch/openrisc/include/asm/processor.h
 create mode 100644 arch/openrisc/include/asm/ptrace.h
 create mode 100644 arch/openrisc/include/asm/spr-defs.h
 create mode 100644 arch/openrisc/include/asm/string.h
 create mode 100644 arch/openrisc/include/asm/system.h
 create mode 100644 arch/openrisc/include/asm/types.h
 create mode 100644 arch/openrisc/include/asm/u-boot.h
 create mode 100644 arch/openrisc/include/asm/unaligned.h
 create mode 100644 arch/openrisc/lib/Makefile
 create mode 100644 arch/openrisc/lib/board.c
 create mode 100644 arch/openrisc/lib/bootm.c
 create mode 100644 arch/openrisc/lib/timer.c
 create mode 100644 board/openrisc/openrisc-generic/Makefile
 create mode 100644 board/openrisc/openrisc-generic/config.mk
 create mode 100644 board/openrisc/openrisc-generic/openrisc-generic.c
 create mode 100644 board/openrisc/openrisc-generic/or1ksim.cfg
 create mode 100644 board/openrisc/openrisc-generic/u-boot.lds
 create mode 100644 include/configs/openrisc-generic.h
Signature · 1 line
1.7.5.4
author maintainer
#1 lore raw

PATCH v2 1/9 openrisc: Add architecture header files

---

Changes in v2:
- Copyright/license information added to headers
- ptrace.h updated from Linux

 arch/openrisc/include/asm/bitops.h       |   28 ++
 arch/openrisc/include/asm/bitops/ffs.h   |   26 ++
 arch/openrisc/include/asm/bitops/fls.h   |   26 ++
 arch/openrisc/include/asm/byteorder.h    |    1 +
 arch/openrisc/include/asm/cache.h        |   35 ++
 arch/openrisc/include/asm/config.h       |   24 ++
 arch/openrisc/include/asm/errno.h        |    1 +
 arch/openrisc/include/asm/global_data.h  |   74 ++++
 arch/openrisc/include/asm/gpio.h         |   84 +++++
 arch/openrisc/include/asm/io.h           |  112 ++++++
 arch/openrisc/include/asm/openrisc_exc.h |   41 +++
 arch/openrisc/include/asm/posix_types.h  |   72 ++++
 arch/openrisc/include/asm/processor.h    |    4 +
 arch/openrisc/include/asm/ptrace.h       |  131 +++++++
 arch/openrisc/include/asm/spr-defs.h     |  567 ++++++++++++++++++++++++++++++
 arch/openrisc/include/asm/string.h       |    4 +
 arch/openrisc/include/asm/system.h       |   39 ++
 arch/openrisc/include/asm/types.h        |   79 ++++
 arch/openrisc/include/asm/u-boot.h       |   48 +++
 arch/openrisc/include/asm/unaligned.h    |    1 +
 20 files changed, 1397 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/include/asm/bitops.h
 create mode 100644 arch/openrisc/include/asm/bitops/ffs.h
 create mode 100644 arch/openrisc/include/asm/bitops/fls.h
 create mode 100644 arch/openrisc/include/asm/byteorder.h
 create mode 100644 arch/openrisc/include/asm/cache.h
 create mode 100644 arch/openrisc/include/asm/config.h
 create mode 100644 arch/openrisc/include/asm/errno.h
 create mode 100644 arch/openrisc/include/asm/global_data.h
 create mode 100644 arch/openrisc/include/asm/gpio.h
 create mode 100644 arch/openrisc/include/asm/io.h
 create mode 100644 arch/openrisc/include/asm/openrisc_exc.h
 create mode 100644 arch/openrisc/include/asm/posix_types.h
 create mode 100644 arch/openrisc/include/asm/processor.h
 create mode 100644 arch/openrisc/include/asm/ptrace.h
 create mode 100644 arch/openrisc/include/asm/spr-defs.h
 create mode 100644 arch/openrisc/include/asm/string.h
 create mode 100644 arch/openrisc/include/asm/system.h
 create mode 100644 arch/openrisc/include/asm/types.h
 create mode 100644 arch/openrisc/include/asm/u-boot.h
 create mode 100644 arch/openrisc/include/asm/unaligned.h
arch/openrisc/include/asm/bitops.h new file +28 -0
new file mode 100644
index 0000000..c001a5d
@@ -0,0 +1,28 @@
+/*
+ * (C) Copyright 2011, Stefan Kristiansson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_OPENRISC_BITOPS_H
+#define __ASM_OPENRISC_BITOPS_H
+
+#define PLATFORM_FLS
+#include <asm/bitops/fls.h>
+#define PLATFORM_FFS
+#include <asm/bitops/ffs.h>
+
+#endif /* __ASM_GENERIC_BITOPS_H */
arch/openrisc/include/asm/bitops/ffs.h new file +26 -0
new file mode 100644
index 0000000..1de5295
@@ -0,0 +1,26 @@
+/*
+ * OpenRISC Linux
+ *
+ * Copyright (C) 2010-2011 Jonas Bonn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __ASM_OPENRISC_FFS_H
+#define __ASM_OPENRISC_FFS_H
+
+static inline int ffs(int x)
+{
+	int ret;
+
+	__asm__ ("l.ff1 %0,%1"
+		 : "=r" (ret)
+		 : "r" (x));
+
+	return ret;
+}
+
+#endif /* __ASM_OPENRISC_FFS_H */
arch/openrisc/include/asm/bitops/fls.h new file +26 -0
new file mode 100644
index 0000000..8c77c13
@@ -0,0 +1,26 @@
+/*
+ * OpenRISC Linux
+ *
+ * Copyright (C) 2010-2011 Jonas Bonn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __ASM_OPENRISC_FLS_H
+#define __ASM_OPENRISC_FLS_H
+
+static inline int fls(int x)
+{
+	int ret;
+
+	__asm__ ("l.fl1 %0,%1"
+		 : "=r" (ret)
+		 : "r" (x));
+
+	return ret;
+}
+
+#endif /* __ASM_OPENRISC_FLS_H */
arch/openrisc/include/asm/byteorder.h new file +1 -0
new file mode 100644
index 0000000..60d14f7
@@ -0,0 +1 @@
+#include <linux/byteorder/big_endian.h>
arch/openrisc/include/asm/cache.h new file +35 -0
new file mode 100644
index 0000000..0faaec7
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2011, Stefan Kristiansson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_OPENRISC_CACHE_H_
+#define __ASM_OPENRISC_CACHE_H_
+
+/*
+ * Valid L1 data cache line sizes for the OpenRISC architecture are
+ * 16 and 32 bytes.
+ * If the board configuration has not specified one we default to the
+ * largest of these values for alignment of DMA buffers.
+ */
+#ifdef CONFIG_SYS_CACHELINE_SIZE
+#define ARCH_DMA_MINALIGN       CONFIG_SYS_CACHELINE_SIZE
+#else
+#define ARCH_DMA_MINALIGN       32
+#endif
+
+#endif /* __ASM_OPENRISC_CACHE_H_ */
arch/openrisc/include/asm/config.h new file +24 -0
new file mode 100644
index 0000000..049c44e
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#ifndef _ASM_CONFIG_H_
+#define _ASM_CONFIG_H_
+
+#endif
arch/openrisc/include/asm/errno.h new file +1 -0
new file mode 100644
index 0000000..4c82b50
@@ -0,0 +1 @@
+#include <asm-generic/errno.h>
arch/openrisc/include/asm/global_data.h new file +74 -0

74 lines not on this page · raw message

arch/openrisc/include/asm/gpio.h new file +84 -0

84 lines not on this page · raw message

arch/openrisc/include/asm/io.h new file +112 -0

112 lines not on this page · raw message

arch/openrisc/include/asm/openrisc_exc.h new file +41 -0

41 lines not on this page · raw message

arch/openrisc/include/asm/posix_types.h new file +72 -0

72 lines not on this page · raw message

arch/openrisc/include/asm/processor.h new file +4 -0
new file mode 100644
index 0000000..304c95f
@@ -0,0 +1,4 @@
+#ifndef __ASM_OPENRISC_PROCESSOR_H
+#define __ASM_OPENRISC_PROCESSOR_H
+
+#endif
arch/openrisc/include/asm/ptrace.h new file +131 -0

131 lines not on this page · raw message

arch/openrisc/include/asm/spr-defs.h new file +567 -0

567 lines not on this page · raw message

arch/openrisc/include/asm/string.h new file +4 -0
new file mode 100644
index 0000000..73e2655
@@ -0,0 +1,4 @@
+#ifndef __ASM_OPENRISC_STRING_H
+#define __ASM_OPENRISC_STRING_H
+
+#endif
arch/openrisc/include/asm/system.h new file +39 -0
new file mode 100644
index 0000000..d680363
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2011, Julius Baxter <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASM_OPENRISC_SYSTEM_H
+#define __ASM_OPENRISC_SYSTEM_H
+
+#include <asm/spr-defs.h>
+
+static inline unsigned long mfspr(unsigned long add)
+{
+	unsigned long ret;
+
+	__asm__ __volatile__ ("l.mfspr %0,r0,%1" : "=r" (ret) : "K" (add));
+
+	return ret;
+}
+
+static inline void mtspr(unsigned long add, unsigned long val)
+{
+	__asm__ __volatile__ ("l.mtspr r0,%1,%0" : : "K" (add), "r" (val));
+}
+
+#endif /* __ASM_OPENRISC_SYSTEM_H */
arch/openrisc/include/asm/types.h new file +79 -0

79 lines not on this page · raw message

arch/openrisc/include/asm/u-boot.h new file +48 -0

48 lines not on this page · raw message

arch/openrisc/include/asm/unaligned.h new file +1 -0
new file mode 100644
index 0000000..6cecbbb
@@ -0,0 +1 @@
+#include <asm-generic/unaligned.h>
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH v2 1/9 openrisc: Add architecture header files

Dear Stefan Kristiansson,

Quoted 40 lines · In message <1322370297-22892-2-git-send-email-stefan.kristiansson@saunalahti.fi…

---

Changes in v2:
- Copyright/license information added to headers
- ptrace.h updated from Linux

 arch/openrisc/include/asm/bitops.h       |   28 ++
 arch/openrisc/include/asm/bitops/ffs.h   |   26 ++
 arch/openrisc/include/asm/bitops/fls.h   |   26 ++
 arch/openrisc/include/asm/byteorder.h    |    1 +
 arch/openrisc/include/asm/cache.h        |   35 ++
 arch/openrisc/include/asm/config.h       |   24 ++
 arch/openrisc/include/asm/errno.h        |    1 +
 arch/openrisc/include/asm/global_data.h  |   74 ++++
 arch/openrisc/include/asm/gpio.h         |   84 +++++
 arch/openrisc/include/asm/io.h           |  112 ++++++
 arch/openrisc/include/asm/openrisc_exc.h |   41 +++
 arch/openrisc/include/asm/posix_types.h  |   72 ++++
 arch/openrisc/include/asm/processor.h    |    4 +
 arch/openrisc/include/asm/ptrace.h       |  131 +++++++
 arch/openrisc/include/asm/spr-defs.h     |  567 ++++++++++++++++++++++++++++++
 arch/openrisc/include/asm/string.h       |    4 +
 arch/openrisc/include/asm/system.h       |   39 ++
 arch/openrisc/include/asm/types.h        |   79 ++++
 arch/openrisc/include/asm/u-boot.h       |   48 +++
 arch/openrisc/include/asm/unaligned.h    |    1 +
 20 files changed, 1397 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/include/asm/bitops.h
 create mode 100644 arch/openrisc/include/asm/bitops/ffs.h
 create mode 100644 arch/openrisc/include/asm/bitops/fls.h
 create mode 100644 arch/openrisc/include/asm/byteorder.h
 create mode 100644 arch/openrisc/include/asm/cache.h
 create mode 100644 arch/openrisc/include/asm/config.h
 create mode 100644 arch/openrisc/include/asm/errno.h
 create mode 100644 arch/openrisc/include/asm/global_data.h
 create mode 100644 arch/openrisc/include/asm/gpio.h
 create mode 100644 arch/openrisc/include/asm/io.h
 create mode 100644 arch/openrisc/include/asm/openrisc_exc.h
 create mode 100644 arch/openrisc/include/asm/posix_types.h
Quoted 8 lines
 create mode 100644 arch/openrisc/include/asm/processor.h
 create mode 100644 arch/openrisc/include/asm/ptrace.h
 create mode 100644 arch/openrisc/include/asm/spr-defs.h
 create mode 100644 arch/openrisc/include/asm/string.h
 create mode 100644 arch/openrisc/include/asm/system.h
 create mode 100644 arch/openrisc/include/asm/types.h
 create mode 100644 arch/openrisc/include/asm/u-boot.h
 create mode 100644 arch/openrisc/include/asm/unaligned.h

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Even if you can deceive people about  a  product  through  misleading
statements, sooner or later the product will speak for itself.
- Hajime Karatsu
author maintainer
#3 lore raw

PATCH v2 2/9 openrisc: Add architecture image support

In reply to Stefan Kristiansson

---

Changes in v2:
- None

 common/image.c  |    1 +
 include/image.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
common/image.c +1 -0
index 555d9d9..564dee1 100644
@@ -94,6 +94,7 @@ static const table_entry_t uimage_arch[] = {
 	{	IH_ARCH_BLACKFIN,	"blackfin",	"Blackfin",	},
 	{	IH_ARCH_AVR32,		"avr32",	"AVR32",	},
 	{	IH_ARCH_NDS32,		"nds32",	"NDS32",	},
+	{	IH_ARCH_OPENRISC,	"or1k",		"OpenRISC 1000",},
 	{	-1,			"",		"",		},
 };
 
include/image.h +1 -0
index 6a41c2e..daf9ac8 100644
@@ -108,6 +108,7 @@
 #define IH_ARCH_ST200	        18	/* STMicroelectronics ST200  */
 #define IH_ARCH_SANDBOX		19	/* Sandbox architecture (test only) */
 #define IH_ARCH_NDS32	        20	/* ANDES Technology - NDS32  */
+#define IH_ARCH_OPENRISC        21	/* OpenRISC 1000  */
 
 /*
  * Image Types
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v2 2/9 openrisc: Add architecture image support

Dear Stefan Kristiansson,

Quoted 9 lines · In message <1322370297-22892-3-git-send-email-stefan.kristiansson@saunalahti.fi…

---

Changes in v2:
- None

 common/image.c  |    1 +
 include/image.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Very ugly or very beautiful women should be flattered on their
understanding, and mediocre ones on their beauty.
                                       -- Philip Earl of Chesterfield
author maintainer
#5 lore raw

PATCH v2 3/9 openrisc: Add cpu files

In reply to Stefan Kristiansson

---

Changes in v2:
- Fix missing newline
- Bugfix for cache line size reading
- Make l.nop asm statements volatile
- Fix include order (asm after non-asm)
- Add static to functions only called locally
- Make unhandled exception printout into a look-up table

 arch/openrisc/config.mk        |   27 ++++
 arch/openrisc/cpu/Makefile     |   47 ++++++
 arch/openrisc/cpu/cache.c      |  151 ++++++++++++++++++
 arch/openrisc/cpu/cpu.c        |  157 +++++++++++++++++++
 arch/openrisc/cpu/exceptions.c |   85 ++++++++++
 arch/openrisc/cpu/interrupts.c |  121 +++++++++++++++
 arch/openrisc/cpu/start.S      |  335 ++++++++++++++++++++++++++++++++++++++++
 7 files changed, 923 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/config.mk
 create mode 100644 arch/openrisc/cpu/Makefile
 create mode 100644 arch/openrisc/cpu/cache.c
 create mode 100644 arch/openrisc/cpu/cpu.c
 create mode 100644 arch/openrisc/cpu/exceptions.c
 create mode 100644 arch/openrisc/cpu/interrupts.c
 create mode 100644 arch/openrisc/cpu/start.S
arch/openrisc/config.mk new file +27 -0
new file mode 100644
index 0000000..521e73a
@@ -0,0 +1,27 @@
+#
+# (C) Copyright 2011
+# Julius Baxter <[email protected]>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+CROSS_COMPILE ?= or32-elf-
+
+# r10 used for global object pointer, already set in OR32 GCC but just to be
+# clear
+PLATFORM_CPPFLAGS += -DCONFIG_OPENRISC -D__OR1K__ -ffixed-r10
+
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
arch/openrisc/cpu/Makefile new file +47 -0

47 lines not on this page · raw message

arch/openrisc/cpu/cache.c new file +151 -0

151 lines not on this page · raw message

arch/openrisc/cpu/cpu.c new file +157 -0

157 lines not on this page · raw message

arch/openrisc/cpu/exceptions.c new file +85 -0

85 lines not on this page · raw message

arch/openrisc/cpu/interrupts.c new file +121 -0

121 lines not on this page · raw message

arch/openrisc/cpu/start.S new file +335 -0

335 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#6 lore raw

PATCH v2 3/9 openrisc: Add cpu files

Quoted 219 lines · Stefan Kristiansson

---

Changes in v2:
- Fix missing newline
- Bugfix for cache line size reading
- Make l.nop asm statements volatile
- Fix include order (asm after non-asm)
- Add static to functions only called locally
- Make unhandled exception printout into a look-up table

 arch/openrisc/config.mk        |   27 ++++
 arch/openrisc/cpu/Makefile     |   47 ++++++
 arch/openrisc/cpu/cache.c      |  151 ++++++++++++++++++
 arch/openrisc/cpu/cpu.c        |  157 +++++++++++++++++++
 arch/openrisc/cpu/exceptions.c |   85 ++++++++++
 arch/openrisc/cpu/interrupts.c |  121 +++++++++++++++
 arch/openrisc/cpu/start.S      |  335 ++++++++++++++++++++++++++++++++++++++++
 7 files changed, 923 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/config.mk
 create mode 100644 arch/openrisc/cpu/Makefile
 create mode 100644 arch/openrisc/cpu/cache.c
 create mode 100644 arch/openrisc/cpu/cpu.c
 create mode 100644 arch/openrisc/cpu/exceptions.c
 create mode 100644 arch/openrisc/cpu/interrupts.c
 create mode 100644 arch/openrisc/cpu/start.S
arch/openrisc/config.mk new file +27 -0
new file mode 100644
index 0000000..521e73a
@@ -0,0 +1,27 @@
+#
+# (C) Copyright 2011
+# Julius Baxter <[email protected]>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+CROSS_COMPILE ?= or32-elf-
+
+# r10 used for global object pointer, already set in OR32 GCC but just to be
+# clear
+PLATFORM_CPPFLAGS += -DCONFIG_OPENRISC -D__OR1K__ -ffixed-r10
+
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
arch/openrisc/cpu/Makefile new file +47 -0
new file mode 100644
index 0000000..b3b1a24
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2011
+# Julius Baxter <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(CPU).o
+
+START	= start.o
+COBJS-y	= cache.o cpu.o exceptions.o interrupts.o
+
+SRCS	:= $(START:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(START) $(LIB)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/openrisc/cpu/cache.c new file +100 -0
new file mode 100644
index 0000000..2a73a4f
@@ -0,0 +1,151 @@
+/*
+ * (C) Copyright 2011, Stefan Kristiansson <[email protected]>
+ * (C) Copyright 2011, Julius Baxter <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/system.h>
+
+void flush_dcache_range(unsigned long addr, unsigned long stop)
+{
+	ulong block_size = (mfspr(SPR_DCCFGR) & SPR_DCCFGR_CBS) ? 32 : 16;
+
+	while (addr < stop) {
+		mtspr(SPR_DCBFR, addr);
+		addr += block_size;
+	}
+}
+
+void invalidate_dcache_range(unsigned long addr, unsigned long stop)
+{
+	ulong block_size = (mfspr(SPR_DCCFGR) & SPR_DCCFGR_CBS) ? 32 : 16;
+
+	while (addr < stop) {
+		mtspr(SPR_DCBIR, addr);
+		addr += block_size;
+	}
+}
+
+static void invalidate_icache_range(unsigned long addr, unsigned long stop)
+{
+	ulong block_size = (mfspr(SPR_ICCFGR) & SPR_ICCFGR_CBS) ? 32 : 16;
+
+	while (addr < stop) {
+		mtspr(SPR_ICBIR, addr);
+		addr += block_size;
+	}
+}
+
+void flush_cache(unsigned long addr, unsigned long size)
+{
+	flush_dcache_range(addr, addr + size);
+	invalidate_icache_range(addr, addr + size);
+}
+
+int icache_status(void)
+{
+	return mfspr(SPR_SR) & SPR_SR_ICE;
+}
+
+int checkicache(void)
+{
+	unsigned long iccfgr;
+	unsigned long cache_set_size;
+	unsigned long cache_ways;
+	unsigned long cache_block_size;
+
+	iccfgr = mfspr(SPR_ICCFGR);
+	cache_ways = 1 << (iccfgr & SPR_ICCFGR_NCW);
+	cache_set_size = 1 << ((iccfgr & SPR_ICCFGR_NCS) >> 3);
+	cache_block_size = (iccfgr & SPR_ICCFGR_CBS) ? 32 : 16;
+
+	return cache_set_size * cache_ways * cache_block_size;
+}
+
+int dcache_status(void)
+{
+	return mfspr(SPR_SR) & SPR_SR_DCE;
+}
+
+int checkdcache(void)
+{
+	unsigned long dccfgr;
+	unsigned long cache_set_size;
+	unsigned long cache_ways;
+	unsigned long cache_block_size;
+
+	dccfgr = mfspr(SPR_DCCFGR);
+	cache_ways = 1 << (dccfgr & SPR_DCCFGR_NCW);
+	cache_set_size = 1 << ((dccfgr & SPR_DCCFGR_NCS) >> 3);
+	cache_block_size = (dccfgr & SPR_DCCFGR_CBS) ? 32 : 16;
+
+	return cache_set_size * cache_ways * cache_block_size;
+}
+
+void dcache_enable(void)

arch/openrisc/cpu/cache.c line 110

Quoted 10 lines
arch/openrisc/cpu/cache.c new file +10 -0
+{
+	mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_DCE);
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");

This is interesting. Are there 8 nops?
Is there any reason for that? Is it just any waiting? If yes, maybe it will be worth to add any comment.

Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
author maintainer
#7 lore raw

PATCH v2 3/9 openrisc: Add cpu files

Quoted 18 lines · Michal Simek

arch/openrisc/cpu/cache.c line 110

Quoted 12 lines · Stefan Kristiansson
arch/openrisc/cpu/cache.c new file +12 -0
+
+void dcache_enable(void)
+{
+	mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_DCE);
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");

This is interesting. Are there 8 nops?
Is there any reason for that? Is it just any waiting? If yes, maybe it will be worth to add any comment.

Yes, the number of nops are kind of arbitrary,
they are there to add some headroom for the cache
to startup without any load/stores in flight.

But you are right, a comment about this might be in place.

Stefan

#8 lore raw

PATCH v2 3/9 openrisc: Add cpu files

Quoted 19 lines · On Thursday 22 December 2011 06:39:32 Stefan Kristiansson wrote:
Quoted 17 lines · Michal Simek

arch/openrisc/cpu/cache.c line 110

Quoted 12 lines · Stefan Kristiansson
arch/openrisc/cpu/cache.c new file +12 -0
+
+void dcache_enable(void)
+{
+	mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_DCE);
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");

This is interesting. Are there 8 nops?
Is there any reason for that? Is it just any waiting? If yes, maybe it will be worth to add any comment.

Quoted 5 lines

Yes, the number of nops are kind of arbitrary,
they are there to add some headroom for the cache
to startup without any load/stores in flight.

But you are right, a comment about this might be in place.

this is usually why the ISA provides some sort of sync or latch mechanism. that way code is deterministic instead of being unsettling arbitrary (like it is here).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120105/5c8b20c5/attachment.pgp>

author maintainer
#9 lore raw

PATCH v2 3/9 openrisc: Add cpu files

Quoted 24 lines · Mike Frysinger
Quoted 23 lines · On Thursday 22 December 2011 06:39:32 Stefan Kristiansson wrote:
Quoted 17 lines · Michal Simek

arch/openrisc/cpu/cache.c line 110

Quoted 12 lines · Stefan Kristiansson
arch/openrisc/cpu/cache.c new file +12 -0
+
+void dcache_enable(void)
+{
+	mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_DCE);
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");

This is interesting. Are there 8 nops?
Is there any reason for that? Is it just any waiting? If yes, maybe it will be worth to add any comment.

Yes, the number of nops are kind of arbitrary,
they are there to add some headroom for the cache
to startup without any load/stores in flight.

Quoted 5 lines
Quoted 1 line

But you are right, a comment about this might be in place.

this is usually why the ISA provides some sort of sync or latch mechanism. that way code is deterministic instead of being unsettling arbitrary (like it is here).

The OpenRISC ISA does provide synch mechanisms, but they are unfortunately optional and not supported by the (currently) only open implementation (or1200).

Stefan

#10 lore raw

PATCH v2 3/9 openrisc: Add cpu files

Quoted 27 lines · On Friday 06 January 2012 08:22:54 Stefan Kristiansson wrote:
Quoted 26 lines · Mike Frysinger
Quoted 24 lines · On Thursday 22 December 2011 06:39:32 Stefan Kristiansson wrote:
Quoted 17 lines · Michal Simek

arch/openrisc/cpu/cache.c line 110

Quoted 12 lines · Stefan Kristiansson
arch/openrisc/cpu/cache.c new file +12 -0
+
+void dcache_enable(void)
+{
+	mtspr(SPR_SR, mfspr(SPR_SR) | SPR_SR_DCE);
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");
+	asm volatile("l.nop");

This is interesting. Are there 8 nops?
Is there any reason for that? Is it just any waiting? If yes, maybe it will be worth to add any comment.

Yes, the number of nops are kind of arbitrary,
they are there to add some headroom for the cache
to startup without any load/stores in flight.

But you are right, a comment about this might be in place.

Quoted 7 lines
Quoted 3 lines

this is usually why the ISA provides some sort of sync or latch mechanism. that way code is deterministic instead of being unsettling arbitrary (like it is here).

The OpenRISC ISA does provide synch mechanisms, but they are unfortunately optional and not supported by the (currently) only open implementation (or1200).

sounds like a CONFIG knob for people :). i imagine the # of nop's require depends heavily on how the core is laid out in hardware, the speed, etc... -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120106/fae0e421/attachment.pgp>

#11 lore raw

PATCH v2 3/9 openrisc: Add cpu files

In reply to Stefan Kristiansson

Dear Stefan Kristiansson,

Quoted 11 lines · In message <1322370297-22892-4-git-send-email-stefan.kristiansson@saunalahti.fi…

---

Changes in v2:
- Fix missing newline
- Bugfix for cache line size reading
- Make l.nop asm statements volatile
- Fix include order (asm after non-asm)
- Add static to functions only called locally
- Make unhandled exception printout into a look-up table

Quoted 15 lines
 arch/openrisc/config.mk        |   27 ++++
 arch/openrisc/cpu/Makefile     |   47 ++++++
 arch/openrisc/cpu/cache.c      |  151 ++++++++++++++++++
 arch/openrisc/cpu/cpu.c        |  157 +++++++++++++++++++
 arch/openrisc/cpu/exceptions.c |   85 ++++++++++
 arch/openrisc/cpu/interrupts.c |  121 +++++++++++++++
 arch/openrisc/cpu/start.S      |  335 ++++++++++++++++++++++++++++++++++++++++
 7 files changed, 923 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/config.mk
 create mode 100644 arch/openrisc/cpu/Makefile
 create mode 100644 arch/openrisc/cpu/cache.c
 create mode 100644 arch/openrisc/cpu/cpu.c
 create mode 100644 arch/openrisc/cpu/exceptions.c
 create mode 100644 arch/openrisc/cpu/interrupts.c
 create mode 100644 arch/openrisc/cpu/start.S

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Is truth not truth for all?
	-- Natira, "For the World is Hollow and I have Touched
		   the Sky", stardate 5476.4.
author maintainer
#12 lore raw

PATCH v2 4/9 openrisc: Add library functions

In reply to Stefan Kristiansson

---

Changes in v2:
- Remove superfluous extern statements
- Use ARRAY_SIZE to determine end of function pointer list
- Remove references to deprecated CONFIG_NET_MULTI
- Fix include order (asm after non-asm)
- Remove function pointer typedef
- Remove simulation specific l.nop

 arch/openrisc/lib/Makefile |   47 ++++++++++++
 arch/openrisc/lib/board.c  |  168 ++++++++++++++++++++++++++++++++++++++++++++
 arch/openrisc/lib/bootm.c  |   84 ++++++++++++++++++++++
 arch/openrisc/lib/timer.c  |  104 +++++++++++++++++++++++++++
 4 files changed, 403 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/lib/Makefile
 create mode 100644 arch/openrisc/lib/board.c
 create mode 100644 arch/openrisc/lib/bootm.c
 create mode 100644 arch/openrisc/lib/timer.c
arch/openrisc/lib/Makefile new file +47 -0
new file mode 100644
index 0000000..db3c657
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2003-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(ARCH).o
+
+SOBJS-y	+=
+
+COBJS-y	+= board.o
+COBJS-y	+= bootm.o
+COBJS-y	+= timer.o
+
+SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/openrisc/lib/board.c new file +168 -0

168 lines not on this page · raw message

arch/openrisc/lib/bootm.c new file +84 -0

84 lines not on this page · raw message

arch/openrisc/lib/timer.c new file +104 -0

104 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#13 lore raw

PATCH v2 4/9 openrisc: Add library functions

Dear Stefan Kristiansson,

Quoted 11 lines · In message <1322370297-22892-5-git-send-email-stefan.kristiansson@saunalahti.fi…

---

Changes in v2:
- Remove superfluous extern statements
- Use ARRAY_SIZE to determine end of function pointer list
- Remove references to deprecated CONFIG_NET_MULTI
- Fix include order (asm after non-asm)
- Remove function pointer typedef
- Remove simulation specific l.nop

Quoted 9 lines
 arch/openrisc/lib/Makefile |   47 ++++++++++++
 arch/openrisc/lib/board.c  |  168 ++++++++++++++++++++++++++++++++++++++++++++
 arch/openrisc/lib/bootm.c  |   84 ++++++++++++++++++++++
 arch/openrisc/lib/timer.c  |  104 +++++++++++++++++++++++++++
 4 files changed, 403 insertions(+), 0 deletions(-)
 create mode 100644 arch/openrisc/lib/Makefile
 create mode 100644 arch/openrisc/lib/board.c
 create mode 100644 arch/openrisc/lib/bootm.c
 create mode 100644 arch/openrisc/lib/timer.c

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
He had been eight years upon a project for extracting sunbeams out of
cucumbers, which were to be put in vials hermetically sealed, and let
out to warm the air in raw inclement summers.        - Jonathan Swift
              _Gulliver's Travels_ ``A Voyage to Laputa, etc.'' ch. 5
author maintainer
#14 lore raw

PATCH v2 5/9 openrisc: Add board info printout to cmd_bdinfo

In reply to Stefan Kristiansson

---

Changes in v2:
- None

 common/cmd_bdinfo.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
common/cmd_bdinfo.c +22 -0
index 688b238..1cd69b5 100644
@@ -460,6 +460,28 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
+#elif defined(CONFIG_OPENRISC)
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	bd_t *bd = gd->bd;
+
+	print_num("mem start",		(ulong)bd->bi_memstart);
+	print_lnum("mem size",		(u64)bd->bi_memsize);
+	print_num("flash start",	(ulong)bd->bi_flashstart);
+	print_num("flash size",		(ulong)bd->bi_flashsize);
+	print_num("flash offset",	(ulong)bd->bi_flashoffset);
+
+#if defined(CONFIG_CMD_NET)
+	print_eth(0);
+	printf("ip_addr     = %pI4\n", &bd->bi_ip_addr);
+#endif
+
+	printf("baudrate    = %ld bps\n", bd->bi_baudrate);
+
+	return 0;
+}
+
 #else
  #error "a case for this architecture does not exist!"
 #endif
Signature · 1 line
1.7.5.4
#15 lore raw

PATCH v2 5/9 openrisc: Add board info printout to cmd_bdinfo

Dear Stefan Kristiansson,

Quoted 8 lines · In message <1322370297-22892-6-git-send-email-stefan.kristiansson@saunalahti.fi…

---

Changes in v2:
- None

 common/cmd_bdinfo.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Conscious is when you are aware of something, and conscience is  when
you wish you weren't.
author maintainer
#16 lore raw

PATCH v2 6/9 openrisc: Add support for standalone programs

In reply to Stefan Kristiansson

---

Changes in v2:
- None

 examples/standalone/stubs.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
examples/standalone/stubs.c +14 -0
index 11c7565..8b291db 100644
@@ -180,6 +180,20 @@ gd_t *global_data;
 "	lwi	$r16, [$r16 + (%1)]\n"	\
 "	jr	$r16\n"			\
 	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "$r16");
+#elif defined(CONFIG_OPENRISC)
+/*
+ * r10 holds the pointer to the global_data, r13 is a call-clobbered
+ * register
+ */
+#define EXPORT_FUNC(x) \
+	asm volatile (			\
+"	.globl " #x "\n"		\
+#x ":\n"				\
+"	l.lwz	r13, %0(r10)\n"	\
+"	l.lwz	r13, %1(r13)\n"	\
+"	l.jr	r13\n"		\
+"	l.nop\n"				\
+	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r13");
 #else
 /*"	addi	$sp, $sp, -24\n"	\
 "	br	$r16\n"			\*/
Signature · 1 line
1.7.5.4
#17 lore raw

PATCH v2 6/9 openrisc: Add support for standalone programs

Dear Stefan Kristiansson,

Quoted 8 lines · In message <1322370297-22892-7-git-send-email-stefan.kristiansson@saunalahti.fi…

---

Changes in v2:
- None

 examples/standalone/stubs.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An expert is a person who avoids the small errors while  sweeping  on
to the grand fallacy.
author maintainer
#18 lore raw

PATCH v2 7/9 openrisc: Add openrisc-generic example board

In reply to Stefan Kristiansson

---

Changes in v2:
- Remove references to deprecated CONFIG_NET_MULTI

 board/openrisc/openrisc-generic/Makefile           |   43 +
 board/openrisc/openrisc-generic/config.mk          |   24 +
 board/openrisc/openrisc-generic/openrisc-generic.c |   55 ++
 board/openrisc/openrisc-generic/or1ksim.cfg        |  882 ++++++++++++++++++++
 board/openrisc/openrisc-generic/u-boot.lds         |   75 ++
 boards.cfg                                         |    1 +
 include/configs/openrisc-generic.h                 |  158 ++++
 7 files changed, 1238 insertions(+), 0 deletions(-)
 create mode 100644 board/openrisc/openrisc-generic/Makefile
 create mode 100644 board/openrisc/openrisc-generic/config.mk
 create mode 100644 board/openrisc/openrisc-generic/openrisc-generic.c
 create mode 100644 board/openrisc/openrisc-generic/or1ksim.cfg
 create mode 100644 board/openrisc/openrisc-generic/u-boot.lds
 create mode 100644 include/configs/openrisc-generic.h
board/openrisc/openrisc-generic/Makefile new file +43 -0
new file mode 100644
index 0000000..4890aac
@@ -0,0 +1,43 @@
+#
+# (C) Copyright 2001-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS-y	:= $(BOARD).o
+
+SRCS	:= $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/openrisc/openrisc-generic/config.mk new file +24 -0
new file mode 100644
index 0000000..c3dc232
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2011, Julius Baxter <[email protected]>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+PLATFORM_CPPFLAGS += -mhard-mul -mhard-div
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
board/openrisc/openrisc-generic/openrisc-generic.c new file +55 -0

55 lines not on this page · raw message

board/openrisc/openrisc-generic/or1ksim.cfg new file +882 -0

882 lines not on this page · raw message

board/openrisc/openrisc-generic/u-boot.lds new file +75 -0

75 lines not on this page · raw message

boards.cfg +1 -0
index c83d861..f90c856 100644
@@ -351,6 +351,7 @@ adp-ag101                    nds32       n1213       adp-ag101           AndesTe
 adp-ag101p                   nds32       n1213       adp-ag101p          AndesTech      ag101
 PCI5441                      nios2       nios2       pci5441             psyent
 PK1C20                       nios2       nios2       pk1c20              psyent
+openrisc-generic             openrisc    or1200      openrisc-generic    openrisc       -
 EVB64260                     powerpc     74xx_7xx    evb64260            -              -           EVB64260
 EVB64260_750CX               powerpc     74xx_7xx    evb64260            -              -           EVB64260
 P3G4                         powerpc     74xx_7xx    evb64260
include/configs/openrisc-generic.h new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#19 lore raw

PATCH v2 7/9 openrisc: Add openrisc-generic example board

Dear Stefan Kristiansson,

Quoted 6 lines · In message <1322370297-22892-8-git-send-email-stefan.kristiansson@saunalahti.fi…

---

Changes in v2:
- Remove references to deprecated CONFIG_NET_MULTI

Quoted 14 lines
 board/openrisc/openrisc-generic/Makefile           |   43 +
 board/openrisc/openrisc-generic/config.mk          |   24 +
 board/openrisc/openrisc-generic/openrisc-generic.c |   55 ++
 board/openrisc/openrisc-generic/or1ksim.cfg        |  882 ++++++++++++++++++++
 board/openrisc/openrisc-generic/u-boot.lds         |   75 ++
 boards.cfg                                         |    1 +
 include/configs/openrisc-generic.h                 |  158 ++++
 7 files changed, 1238 insertions(+), 0 deletions(-)
 create mode 100644 board/openrisc/openrisc-generic/Makefile
 create mode 100644 board/openrisc/openrisc-generic/config.mk
 create mode 100644 board/openrisc/openrisc-generic/openrisc-generic.c
 create mode 100644 board/openrisc/openrisc-generic/or1ksim.cfg
 create mode 100644 board/openrisc/openrisc-generic/u-boot.lds
 create mode 100644 include/configs/openrisc-generic.h

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A Freudian slip is when you say one thing but mean your mother.
author maintainer
#20 lore raw

PATCH v2 8/9 openrisc: Add architecture to MAKEALL

In reply to Stefan Kristiansson

---

Changes in v2:
- None

 MAKEALL |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAKEALL +5 -0
index 95b7cd3..f45f767 100755
@@ -416,6 +416,11 @@ LIST_mips_el="			\
 	${LIST_mips5kc_el}	\
 	${LIST_au1xx0_el}	\
 "
+#########################################################################
+## OpenRISC Systems
+#########################################################################
+
+LIST_openrisc="$(boards_by_arch openrisc)"
 
 #########################################################################
 ## x86 Systems
Signature · 1 line
1.7.5.4
#21 lore raw

PATCH v2 8/9 openrisc: Add architecture to MAKEALL

Dear Stefan Kristiansson,

Quoted 8 lines · In message <1322370297-22892-9-git-send-email-stefan.kristiansson@saunalahti.fi…

---

Changes in v2:
- None

 MAKEALL |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Remember that Beethoven wrote his first symphony in C ...
author maintainer
#22 lore raw

PATCH v2 9/9 openrisc: Add MAINTAINERS entry

In reply to Stefan Kristiansson

---

Changes in v2:
- None

 MAINTAINERS |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
MAINTAINERS +11 -0
index f6f6b72..bf144cc 100644
@@ -1147,5 +1147,16 @@ Macpaul Lin <[email protected]>
 	ADP-AG101P	N1213 (AG101P XC5 FPGA)
 
 #########################################################################
+# OpenRISC Systems:							#
+#									#
+# Maintainer Name, Email Address					#
+#	Board		CPU						#
+#########################################################################
+
+Stefan Kristiansson <[email protected]>
+
+	openrisc-generic	OpenRISC
+
+#########################################################################
 # End of MAINTAINERS list						#
 #########################################################################
Signature · 1 line
1.7.5.4
#23 lore raw

PATCH v2 9/9 openrisc: Add MAINTAINERS entry

Dear Stefan Kristiansson,

Quoted 8 lines · In message <1322370297-22892-10-git-send-email-stefan.kristiansson@saunalahti.f…

---

Changes in v2:
- None

 MAINTAINERS |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Programmer's Lament: (Shakespeare, Macbeth, Act I, Scene vii)
        "That we but teach bloody instructions,
        which, being taught, return to plague the inventor..."
author maintainer
#24 lore raw

v2 cover Add support for the OpenRISC architecture

In reply to Stefan Kristiansson

Hi Wolfgang,

Quoted 14 lines · Stefan Kristiansson

This patch series adds support for the OpenRISC 1000 architecture.

The OpenRISC architecture has been around for about a decade and has experienced a revival in the last couple of years from the efforts of a small, but dedicated community compound of both commercial and independent contributors.

Most of the development takes place on opencores.org/or1k and openrisc.net.

The patches included in this series are also available in the 'for-upstream' branch in the following git repository:

git://openrisc.net/stefan/u-boot

Quoted 8 lines

which is also browsable here:

http://git.openrisc.net/cgit.cgi/stefan/u-boot/?h=for-upstream

NOTE: The openrisc-generic board depends on this pending patch to build properly:
net/ethoc: use flush_dcache_range instead of flush_dcache
(http://patchwork.ozlabs.org/patch/123622/)

I have not received any comments (or complaints, depending how you look at it) on the v2 of those patches.

I saw your message about the next branch, so would you please consider applying those to that, if nobody has any further comments or objections?

Thanks

Stefan