summaryrefslogtreecommitdiff
path: root/arch/riscv/cpu/qemu
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-10-03 08:09:53 -0400
committerTom Rini <trini@konsulko.com>2018-10-03 08:09:53 -0400
commit94228a9188803473206544c8f33649ea72bf1ee1 (patch)
tree90404ec7c59822c3706f3051e393001a5c53aef5 /arch/riscv/cpu/qemu
parente5145ad0e8c2a21f1db376b01c676907f1500ac6 (diff)
parent5845f6612372a63877b2175e058a841e1237ffd6 (diff)
Merge git://git.denx.de/u-boot-riscv
- QEMU support
Diffstat (limited to 'arch/riscv/cpu/qemu')
-rw-r--r--arch/riscv/cpu/qemu/Makefile6
-rw-r--r--arch/riscv/cpu/qemu/cpu.c21
-rw-r--r--arch/riscv/cpu/qemu/dram.c17
3 files changed, 44 insertions, 0 deletions
diff --git a/arch/riscv/cpu/qemu/Makefile b/arch/riscv/cpu/qemu/Makefile
new file mode 100644
index 0000000000..258e4620dd
--- /dev/null
+++ b/arch/riscv/cpu/qemu/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+
+obj-y += dram.o
+obj-y += cpu.o
diff --git a/arch/riscv/cpu/qemu/cpu.c b/arch/riscv/cpu/qemu/cpu.c
new file mode 100644
index 0000000000..6c7a32755a
--- /dev/null
+++ b/arch/riscv/cpu/qemu/cpu.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+#include <common.h>
+
+/*
+ * cleanup_before_linux() is called just before we call linux
+ * it prepares the processor for linux
+ *
+ * we disable interrupt and caches.
+ */
+int cleanup_before_linux(void)
+{
+ disable_interrupts();
+
+ /* turn off I/D-cache */
+
+ return 0;
+}
diff --git a/arch/riscv/cpu/qemu/dram.c b/arch/riscv/cpu/qemu/dram.c
new file mode 100644
index 0000000000..84d87d2a7f
--- /dev/null
+++ b/arch/riscv/cpu/qemu/dram.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+
+int dram_init(void)
+{
+ return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+ return fdtdec_setup_memory_banksize();
+}