powerpc: Add Microwatt platform
authorPaul Mackerras <paulus@ozlabs.org>
Fri, 18 Jun 2021 03:43:41 +0000 (13:43 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 21 Jun 2021 11:15:26 +0000 (21:15 +1000)
Microwatt is a FPGA-based implementation of the Power ISA.  It
currently only implements little-endian 64-bit mode, and does
not (yet) support SMP, VMX, VSX or transactional memory.  It has an
optional FPU, and an optional MMU (required for running Linux,
obviously) which implements a configurable radix tree but not
hypervisor mode or nested radix translation.

This adds a new machine type to support FPGA-based SoCs with a
Microwatt core.  CONFIG_MATH_EMULATION can be selected for Microwatt
SOCs which don't have the FPU.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/YMwWbZVREsVug9R0@thinks.paulus.ozlabs.org
arch/powerpc/Kconfig
arch/powerpc/platforms/Kconfig
arch/powerpc/platforms/Makefile
arch/powerpc/platforms/microwatt/Kconfig [new file with mode: 0644]
arch/powerpc/platforms/microwatt/Makefile [new file with mode: 0644]
arch/powerpc/platforms/microwatt/setup.c [new file with mode: 0644]

index 72f307f..9bf52e2 100644 (file)
@@ -430,7 +430,7 @@ source "kernel/Kconfig.hz"
 
 config MATH_EMULATION
        bool "Math emulation"
-       depends on 4xx || PPC_8xx || PPC_MPC832x || BOOKE
+       depends on 4xx || PPC_8xx || PPC_MPC832x || BOOKE || PPC_MICROWATT
        select PPC_FPU_REGS
        help
          Some PowerPC chips designed for embedded applications do not have
index 594544a..2f071fb 100644 (file)
@@ -21,6 +21,7 @@ source "arch/powerpc/platforms/44x/Kconfig"
 source "arch/powerpc/platforms/40x/Kconfig"
 source "arch/powerpc/platforms/amigaone/Kconfig"
 source "arch/powerpc/platforms/book3s/Kconfig"
+source "arch/powerpc/platforms/microwatt/Kconfig"
 
 config KVM_GUEST
        bool "KVM Guest support"
index 0e75d7d..94470fb 100644 (file)
@@ -23,3 +23,4 @@ obj-$(CONFIG_PPC_PS3)         += ps3/
 obj-$(CONFIG_EMBEDDED6xx)      += embedded6xx/
 obj-$(CONFIG_AMIGAONE)         += amigaone/
 obj-$(CONFIG_PPC_BOOK3S)       += book3s/
+obj-$(CONFIG_PPC_MICROWATT)    += microwatt/
diff --git a/arch/powerpc/platforms/microwatt/Kconfig b/arch/powerpc/platforms/microwatt/Kconfig
new file mode 100644 (file)
index 0000000..3be01e7
--- /dev/null
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+config PPC_MICROWATT
+       depends on PPC_BOOK3S_64 && !SMP
+       bool "Microwatt SoC platform"
+       select PPC_XICS
+       select PPC_NATIVE
+       help
+          This option enables support for FPGA-based Microwatt implementations.
+
diff --git a/arch/powerpc/platforms/microwatt/Makefile b/arch/powerpc/platforms/microwatt/Makefile
new file mode 100644 (file)
index 0000000..e6885b3
--- /dev/null
@@ -0,0 +1 @@
+obj-y  += setup.o
diff --git a/arch/powerpc/platforms/microwatt/setup.c b/arch/powerpc/platforms/microwatt/setup.c
new file mode 100644 (file)
index 0000000..d80d526
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Microwatt FPGA-based SoC platform setup code.
+ *
+ * Copyright 2020 Paul Mackerras (paulus@ozlabs.org), IBM Corp.
+ */
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/stddef.h>
+#include <linux/init.h>
+#include <asm/machdep.h>
+#include <asm/time.h>
+
+static int __init microwatt_probe(void)
+{
+       return of_machine_is_compatible("microwatt-soc");
+}
+
+define_machine(microwatt) {
+       .name                   = "microwatt",
+       .probe                  = microwatt_probe,
+       .calibrate_decr         = generic_calibrate_decr,
+};