linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH v2 9/9] powerpc/boot: Add a boot wrapper for Microwatt
Date: Fri, 18 Jun 2021 13:49:43 +1000	[thread overview]
Message-ID: <YMwX19wym3kQ7guu@thinks.paulus.ozlabs.org> (raw)
In-Reply-To: <YMwWPcsaWzMlDPqQ@thinks.paulus.ozlabs.org>

From: Joel Stanley <joel@jms.id.au>

This allows microwatt's kernel to be built with an embedded device tree.

Load to arch/powerpc/boot/dtbImage.microwatt to 0x500000:

 mw_debug -b fpga stop load arch/powerpc/boot/dtbImage.microwatt 500000 start

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 arch/powerpc/boot/Makefile    |  4 ++++
 arch/powerpc/boot/microwatt.c | 24 ++++++++++++++++++++++++
 arch/powerpc/boot/wrapper     |  5 +++++
 3 files changed, 33 insertions(+)
 create mode 100644 arch/powerpc/boot/microwatt.c

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 2b8da923ceca..dfaa4094fcae 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -163,6 +163,8 @@ src-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S
 src-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S
 src-plat-$(CONFIG_MVME7100) += motload-head.S mvme7100.c
 
+src-plat-$(CONFIG_PPC_MICROWATT) += fixed-head.S microwatt.c
+
 src-wlib := $(sort $(src-wlib-y))
 src-plat := $(sort $(src-plat-y))
 src-boot := $(src-wlib) $(src-plat) empty.c
@@ -355,6 +357,8 @@ image-$(CONFIG_MVME5100)		+= dtbImage.mvme5100
 # Board port in arch/powerpc/platform/amigaone/Kconfig
 image-$(CONFIG_AMIGAONE)		+= cuImage.amigaone
 
+image-$(CONFIG_PPC_MICROWATT)		+= dtbImage.microwatt
+
 # For 32-bit powermacs, build the COFF and miboot images
 # as well as the ELF images.
 ifdef CONFIG_PPC32
diff --git a/arch/powerpc/boot/microwatt.c b/arch/powerpc/boot/microwatt.c
new file mode 100644
index 000000000000..ca9d83617fc1
--- /dev/null
+++ b/arch/powerpc/boot/microwatt.c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <stddef.h>
+#include "stdio.h"
+#include "types.h"
+#include "io.h"
+#include "ops.h"
+
+BSS_STACK(8192);
+
+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
+{
+	unsigned long heapsize = 16*1024*1024 - (unsigned long)_end;
+
+	/*
+	 * Disable interrupts and turn off MSR_RI, since we'll
+	 * shortly be overwriting the interrupt vectors.
+	 */
+	__asm__ volatile("mtmsrd %0,1" : : "r" (0));
+
+	simple_alloc_init(_end, heapsize, 32, 64);
+	fdt_init(_dtb_start);
+	serial_console_init();
+}
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 41fa0a8715e3..ae48fffa1e13 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -342,6 +342,11 @@ gamecube|wii)
     link_address='0x600000'
     platformo="$object/$platform-head.o $object/$platform.o"
     ;;
+microwatt)
+    link_address='0x500000'
+    platformo="$object/fixed-head.o $object/$platform.o"
+    binary=y
+    ;;
 treeboot-currituck)
     link_address='0x1000000'
     ;;
-- 
2.31.1


  parent reply	other threads:[~2021-06-18  3:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18  3:42 [PATCH v2 0/9] powerpc: Add support for Microwatt soft-core Paul Mackerras
2021-06-18  3:43 ` [PATCH v2 1/9] powerpc: Add Microwatt platform Paul Mackerras
2021-06-19  3:03   ` Nicholas Piggin
2021-06-18  3:44 ` [PATCH v2 2/9] powerpc: Add Microwatt device tree Paul Mackerras
2021-06-19 14:26   ` Segher Boessenkool
2021-06-20 12:08     ` Paul Mackerras
2021-06-21 13:54       ` Segher Boessenkool
2021-06-18  3:45 ` [PATCH v2 3/9] powerpc/microwatt: Populate platform bus from device-tree Paul Mackerras
2021-06-18  3:45 ` [PATCH v2 4/9] powerpc/xics: Add a native ICS backend for microwatt Paul Mackerras
2021-06-18  3:46 ` [PATCH v2 5/9] powerpc/microwatt: Use standard 16550 UART for console Paul Mackerras
2021-06-18  7:40   ` Nicholas Piggin
2021-06-18 12:12     ` Paul Mackerras
2021-06-19  2:58       ` Nicholas Piggin
2021-08-12 13:14   ` Christophe Leroy
2021-08-12 16:09     ` Segher Boessenkool
2021-06-18  3:47 ` [PATCH v2 6/9] powerpc/microwatt: Add support for hardware random number generator Paul Mackerras
2021-06-19  3:08   ` Nicholas Piggin
2021-06-19 14:36     ` Segher Boessenkool
2021-06-20  8:19       ` Nicholas Piggin
2021-06-18  3:48 ` [PATCH v2 7/9] powerpc/microwatt: Add microwatt_defconfig Paul Mackerras
2021-06-18  3:49 ` [PATCH v2 8/9] powerpc/boot: Fixup device-tree on little endian Paul Mackerras
2021-06-19  3:14   ` Nicholas Piggin
2021-06-18  3:49 ` Paul Mackerras [this message]
2021-06-19  3:16   ` [PATCH v2 9/9] powerpc/boot: Add a boot wrapper for Microwatt Nicholas Piggin
2021-06-19 14:45 ` [PATCH v2 0/9] powerpc: Add support for Microwatt soft-core Segher Boessenkool
2021-06-24 14:03 ` Michael Ellerman

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=YMwX19wym3kQ7guu@thinks.paulus.ozlabs.org \
    --to=paulus@ozlabs.org \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).