From: Kongyang Liu <seashell11234455@gmail.com>
To: u-boot@lists.denx.de
Cc: Anup Patel <anup@brainfault.org>, Bin Meng <bmeng@tinylab.org>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Leo <ycliang@andestech.com>, Michal Simek <michal.simek@amd.com>,
Randolph <randolph@andestech.com>, Rick Chen <rick@andestech.com>,
Samuel Holland <samuel@sholland.org>,
Shengyu Qu <wiagn233@outlook.com>, Tom Rini <trini@konsulko.com>,
Yu Chien Peter Lin <peterlin@andestech.com>
Subject: [PATCH v2 1/2] riscv: cpu: cv1800b: Add support for cv1800b SoC
Date: Sun, 10 Mar 2024 00:54:56 +0800 [thread overview]
Message-ID: <20240309165533.48795-2-seashell11234455@gmail.com> (raw)
In-Reply-To: <20240309165533.48795-1-seashell11234455@gmail.com>
Add Sophgo cv1800b SoC to support RISC-V arch.
Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
---
Changes in v2:
- Remove duplicate code in function cleanup_before_linux
arch/riscv/Kconfig | 1 +
arch/riscv/cpu/cv1800b/Kconfig | 12 ++++++++++++
arch/riscv/cpu/cv1800b/Makefile | 6 ++++++
arch/riscv/cpu/cv1800b/cpu.c | 9 +++++++++
arch/riscv/cpu/cv1800b/dram.c | 21 +++++++++++++++++++++
board/sophgo/milkv_duo/Kconfig | 4 ++--
6 files changed, 51 insertions(+), 2 deletions(-)
create mode 100644 arch/riscv/cpu/cv1800b/Kconfig
create mode 100644 arch/riscv/cpu/cv1800b/Makefile
create mode 100644 arch/riscv/cpu/cv1800b/cpu.c
create mode 100644 arch/riscv/cpu/cv1800b/dram.c
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index ac52c5e6da..2c92b0d9f6 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -93,6 +93,7 @@ source "board/xilinx/mbv/Kconfig"
# platform-specific options below
source "arch/riscv/cpu/andesv5/Kconfig"
+source "arch/riscv/cpu/cv1800b/Kconfig"
source "arch/riscv/cpu/fu540/Kconfig"
source "arch/riscv/cpu/fu740/Kconfig"
source "arch/riscv/cpu/generic/Kconfig"
diff --git a/arch/riscv/cpu/cv1800b/Kconfig b/arch/riscv/cpu/cv1800b/Kconfig
new file mode 100644
index 0000000000..7225b1210c
--- /dev/null
+++ b/arch/riscv/cpu/cv1800b/Kconfig
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
+
+config SOPHGO_CV1800B
+ bool
+ select ARCH_EARLY_INIT_R
+ select SYS_CACHE_SHIFT_6
+ imply CPU
+ imply CPU_RISCV
+ imply RISCV_TIMER
+ imply CMD_CPU
diff --git a/arch/riscv/cpu/cv1800b/Makefile b/arch/riscv/cpu/cv1800b/Makefile
new file mode 100644
index 0000000000..da12e0f64e
--- /dev/null
+++ b/arch/riscv/cpu/cv1800b/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
+
+obj-y += dram.o
+obj-y += cpu.o
diff --git a/arch/riscv/cpu/cv1800b/cpu.c b/arch/riscv/cpu/cv1800b/cpu.c
new file mode 100644
index 0000000000..233a6a3d64
--- /dev/null
+++ b/arch/riscv/cpu/cv1800b/cpu.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
+ */
+
+int cleanup_before_linux(void)
+{
+ return 0;
+}
diff --git a/arch/riscv/cpu/cv1800b/dram.c b/arch/riscv/cpu/cv1800b/dram.c
new file mode 100644
index 0000000000..91007c0a3d
--- /dev/null
+++ b/arch/riscv/cpu/cv1800b/dram.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+#include <fdtdec.h>
+#include <init.h>
+#include <asm/global_data.h>
+#include <linux/sizes.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+ return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+ return fdtdec_setup_memory_banksize();
+}
diff --git a/board/sophgo/milkv_duo/Kconfig b/board/sophgo/milkv_duo/Kconfig
index 2a458f291c..040a7487f1 100644
--- a/board/sophgo/milkv_duo/Kconfig
+++ b/board/sophgo/milkv_duo/Kconfig
@@ -7,7 +7,7 @@ config SYS_VENDOR
default "sophgo"
config SYS_CPU
- default "generic"
+ default "cv1800b"
config SYS_CONFIG_NAME
default "milkv_duo"
@@ -23,6 +23,6 @@ config ENV_SECT_SIZE
config BOARD_SPECIFIC_OPTIONS
def_bool y
- select GENERIC_RISCV
+ select SOPHGO_CV1800B
endif
--
2.41.0
next prev parent reply other threads:[~2024-03-09 21:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-09 16:54 [PATCH v2 0/2] riscv: cpu: Add support for cv1800b SoC Kongyang Liu
2024-03-09 16:54 ` Kongyang Liu [this message]
2024-03-12 9:42 ` [PATCH v2 1/2] riscv: cpu: cv1800b: " Leo Liang
2024-03-09 16:54 ` [PATCH v2 2/2] riscv: cache: Implement dcache for cv1800b Kongyang Liu
2024-03-12 9:44 ` Leo Liang
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=20240309165533.48795-2-seashell11234455@gmail.com \
--to=seashell11234455@gmail.com \
--cc=anup@brainfault.org \
--cc=bmeng@tinylab.org \
--cc=michal.simek@amd.com \
--cc=peterlin@andestech.com \
--cc=randolph@andestech.com \
--cc=rick@andestech.com \
--cc=samuel@sholland.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=wiagn233@outlook.com \
--cc=xypron.glpk@gmx.de \
--cc=ycliang@andestech.com \
/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