[PATCH v4 0/3] riscv: sophgo: milkv_duo: add support for Milk-V Duo board

The Milk-V Duo board is built upon Sophgo's CV1800B SoC, featuring two XuanTie C906 CPUs running at 1.0GHz and 700MHz, respectively.
This series introduces fundamental support for the Milk-V Duo board, encompassing UART, CPU, and PLIC support. This ensures that U-Boot can operate in serial console mode.
Changes in v4: - Sync dts files with Linux kernel
Changes in v3: - Swap patch 1 and 2 duo to dependency of defconfig and device tree - Enable EFI loader - Add brief description of the procedure to run u-boot-dtb.bin
Changes in v2: - Fold the defconfig patch to first patch - Remove unnecessary environment settings of consoledev and baudrate in config
Kongyang Liu (3): riscv: dts: sophgo: add basic device tree for Milk-V Duo board riscv: sophgo: milkv_duo: initial support added doc: sophgo: milkv_duo: document Milk-V Duo board
arch/riscv/Kconfig | 4 + arch/riscv/dts/Makefile | 1 + arch/riscv/dts/cv1800b-milkv-duo.dts | 38 ++++++ arch/riscv/dts/cv1800b.dtsi | 18 +++ arch/riscv/dts/cv18xx.dtsi | 192 +++++++++++++++++++++++++++ board/sophgo/milkv_duo/Kconfig | 28 ++++ board/sophgo/milkv_duo/MAINTAINERS | 6 + board/sophgo/milkv_duo/Makefile | 5 + board/sophgo/milkv_duo/board.c | 9 ++ configs/milkv_duo_defconfig | 23 ++++ doc/board/index.rst | 1 + doc/board/sophgo/index.rst | 8 ++ doc/board/sophgo/milkv_duo.rst | 64 +++++++++ include/configs/milkv_duo.h | 12 ++ 14 files changed, 409 insertions(+) create mode 100644 arch/riscv/dts/cv1800b-milkv-duo.dts create mode 100644 arch/riscv/dts/cv1800b.dtsi create mode 100644 arch/riscv/dts/cv18xx.dtsi create mode 100644 board/sophgo/milkv_duo/Kconfig create mode 100644 board/sophgo/milkv_duo/MAINTAINERS create mode 100644 board/sophgo/milkv_duo/Makefile create mode 100644 board/sophgo/milkv_duo/board.c create mode 100644 configs/milkv_duo_defconfig create mode 100644 doc/board/sophgo/index.rst create mode 100644 doc/board/sophgo/milkv_duo.rst create mode 100644 include/configs/milkv_duo.h

Import device tree from Linux kernel to add basic support for CPU, PLIC, UART and Timer. The name cv1800b in the filename represent the chip used on Milk-V Duo board.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
---
Changes in v4: - Sync dts files with Linux kernel
Changes in v3: - Swap patch 1 and 2 duo to dependency of defconfig and device tree
arch/riscv/dts/Makefile | 1 + arch/riscv/dts/cv1800b-milkv-duo.dts | 38 ++++++ arch/riscv/dts/cv1800b.dtsi | 18 +++ arch/riscv/dts/cv18xx.dtsi | 192 +++++++++++++++++++++++++++ 4 files changed, 249 insertions(+) create mode 100644 arch/riscv/dts/cv1800b-milkv-duo.dts create mode 100644 arch/riscv/dts/cv1800b.dtsi create mode 100644 arch/riscv/dts/cv18xx.dtsi
diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile index b05bb5607f..17cda483e1 100644 --- a/arch/riscv/dts/Makefile +++ b/arch/riscv/dts/Makefile @@ -2,6 +2,7 @@
dtb-$(CONFIG_TARGET_ANDES_AE350) += ae350_32.dtb ae350_64.dtb dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += mpfs-icicle-kit.dtb +dtb-$(CONFIG_TARGET_MILKV_DUO) += cv1800b-milkv-duo.dtb dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb diff --git a/arch/riscv/dts/cv1800b-milkv-duo.dts b/arch/riscv/dts/cv1800b-milkv-duo.dts new file mode 100644 index 0000000000..3af9e34b3b --- /dev/null +++ b/arch/riscv/dts/cv1800b-milkv-duo.dts @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2023 Jisheng Zhang jszhang@kernel.org + */ + +/dts-v1/; + +#include "cv1800b.dtsi" + +/ { + model = "Milk-V Duo"; + compatible = "milkv,duo", "sophgo,cv1800b"; + + aliases { + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; + serial3 = &uart3; + serial4 = &uart4; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@80000000 { + device_type = "memory"; + reg = <0x80000000 0x3f40000>; + }; +}; + +&osc { + clock-frequency = <25000000>; +}; + +&uart0 { + status = "okay"; +}; diff --git a/arch/riscv/dts/cv1800b.dtsi b/arch/riscv/dts/cv1800b.dtsi new file mode 100644 index 0000000000..165e9e320a --- /dev/null +++ b/arch/riscv/dts/cv1800b.dtsi @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2023 Jisheng Zhang jszhang@kernel.org + */ + +#include "cv18xx.dtsi" + +/ { + compatible = "sophgo,cv1800b"; +}; + +&plic { + compatible = "sophgo,cv1800b-plic", "thead,c900-plic"; +}; + +&clint { + compatible = "sophgo,cv1800b-clint", "thead,c900-clint"; +}; diff --git a/arch/riscv/dts/cv18xx.dtsi b/arch/riscv/dts/cv18xx.dtsi new file mode 100644 index 0000000000..2d6f4a4b1e --- /dev/null +++ b/arch/riscv/dts/cv18xx.dtsi @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2023 Jisheng Zhang jszhang@kernel.org + * Copyright (C) 2023 Inochi Amaoto inochiama@outlook.com + */ + +#include <dt-bindings/interrupt-controller/irq.h> + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus: cpus { + #address-cells = <1>; + #size-cells = <0>; + timebase-frequency = <25000000>; + + cpu0: cpu@0 { + compatible = "thead,c906", "riscv"; + device_type = "cpu"; + reg = <0>; + d-cache-block-size = <64>; + d-cache-sets = <512>; + d-cache-size = <65536>; + i-cache-block-size = <64>; + i-cache-sets = <128>; + i-cache-size = <32768>; + mmu-type = "riscv,sv39"; + riscv,isa = "rv64imafdc"; + riscv,isa-base = "rv64i"; + riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "zicntr", "zicsr", + "zifencei", "zihpm"; + + cpu0_intc: interrupt-controller { + compatible = "riscv,cpu-intc"; + interrupt-controller; + #interrupt-cells = <1>; + }; + }; + }; + + osc: oscillator { + compatible = "fixed-clock"; + clock-output-names = "osc_25m"; + #clock-cells = <0>; + }; + + soc { + compatible = "simple-bus"; + interrupt-parent = <&plic>; + #address-cells = <1>; + #size-cells = <1>; + dma-noncoherent; + ranges; + + gpio0: gpio@3020000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x3020000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + porta: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <60 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + gpio1: gpio@3021000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x3021000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + portb: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <61 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + gpio2: gpio@3022000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x3022000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + portc: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <62 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + gpio3: gpio@3023000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x3023000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + portd: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <63 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + uart0: serial@4140000 { + compatible = "snps,dw-apb-uart"; + reg = <0x04140000 0x100>; + interrupts = <44 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&osc>; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + uart1: serial@4150000 { + compatible = "snps,dw-apb-uart"; + reg = <0x04150000 0x100>; + interrupts = <45 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&osc>; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + uart2: serial@4160000 { + compatible = "snps,dw-apb-uart"; + reg = <0x04160000 0x100>; + interrupts = <46 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&osc>; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + uart3: serial@4170000 { + compatible = "snps,dw-apb-uart"; + reg = <0x04170000 0x100>; + interrupts = <47 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&osc>; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + uart4: serial@41c0000 { + compatible = "snps,dw-apb-uart"; + reg = <0x041c0000 0x100>; + interrupts = <48 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&osc>; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; + }; + + plic: interrupt-controller@70000000 { + reg = <0x70000000 0x4000000>; + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <2>; + riscv,ndev = <101>; + }; + + clint: timer@74000000 { + reg = <0x74000000 0x10000>; + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>; + }; + }; +};

On Sun, Jan 28, 2024 at 03:05:24PM +0800, Kongyang Liu wrote:
Import device tree from Linux kernel to add basic support for CPU, PLIC, UART and Timer. The name cv1800b in the filename represent the chip used on Milk-V Duo board.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
Changes in v4:
- Sync dts files with Linux kernel
Changes in v3:
- Swap patch 1 and 2 duo to dependency of defconfig and device tree
arch/riscv/dts/Makefile | 1 + arch/riscv/dts/cv1800b-milkv-duo.dts | 38 ++++++ arch/riscv/dts/cv1800b.dtsi | 18 +++ arch/riscv/dts/cv18xx.dtsi | 192 +++++++++++++++++++++++++++ 4 files changed, 249 insertions(+) create mode 100644 arch/riscv/dts/cv1800b-milkv-duo.dts create mode 100644 arch/riscv/dts/cv1800b.dtsi create mode 100644 arch/riscv/dts/cv18xx.dtsi
Reviewed-by: Leo Yu-Chi Liang ycliang@andestech.com

Add support for Sophgo's Milk-V Duo board, only minimal device tree and serial console are enabled, and it can boot via vendor first stage bootloader.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
---
(no changes since v3)
Changes in v3: - Enable EFI loader
Changes in v2: - Fold the defconfig patch to first patch - Remove unnecessary environment settings of consoledev and baudrate in config
arch/riscv/Kconfig | 4 ++++ board/sophgo/milkv_duo/Kconfig | 28 ++++++++++++++++++++++++++++ board/sophgo/milkv_duo/MAINTAINERS | 6 ++++++ board/sophgo/milkv_duo/Makefile | 5 +++++ board/sophgo/milkv_duo/board.c | 9 +++++++++ configs/milkv_duo_defconfig | 23 +++++++++++++++++++++++ include/configs/milkv_duo.h | 12 ++++++++++++ 7 files changed, 87 insertions(+) create mode 100644 board/sophgo/milkv_duo/Kconfig create mode 100644 board/sophgo/milkv_duo/MAINTAINERS create mode 100644 board/sophgo/milkv_duo/Makefile create mode 100644 board/sophgo/milkv_duo/board.c create mode 100644 configs/milkv_duo_defconfig create mode 100644 include/configs/milkv_duo.h
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 67126d96af..ac52c5e6da 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -14,6 +14,9 @@ config TARGET_ANDES_AE350 config TARGET_MICROCHIP_ICICLE bool "Support Microchip PolarFire-SoC Icicle Board"
+config TARGET_MILKV_DUO + bool "Support Milk-v Duo Board" + config TARGET_OPENPITON_RISCV64 bool "Support RISC-V cores on OpenPiton SoC"
@@ -83,6 +86,7 @@ source "board/openpiton/riscv64/Kconfig" source "board/sifive/unleashed/Kconfig" source "board/sifive/unmatched/Kconfig" source "board/sipeed/maix/Kconfig" +source "board/sophgo/milkv_duo/Kconfig" source "board/starfive/visionfive2/Kconfig" source "board/thead/th1520_lpi4a/Kconfig" source "board/xilinx/mbv/Kconfig" diff --git a/board/sophgo/milkv_duo/Kconfig b/board/sophgo/milkv_duo/Kconfig new file mode 100644 index 0000000000..2a458f291c --- /dev/null +++ b/board/sophgo/milkv_duo/Kconfig @@ -0,0 +1,28 @@ +if TARGET_MILKV_DUO + +config SYS_BOARD + default "milkv_duo" + +config SYS_VENDOR + default "sophgo" + +config SYS_CPU + default "generic" + +config SYS_CONFIG_NAME + default "milkv_duo" + +config TEXT_BASE + default 0x80200000 + +config ENV_SIZE + default 0x20000 + +config ENV_SECT_SIZE + default 0x40000 + +config BOARD_SPECIFIC_OPTIONS + def_bool y + select GENERIC_RISCV + +endif diff --git a/board/sophgo/milkv_duo/MAINTAINERS b/board/sophgo/milkv_duo/MAINTAINERS new file mode 100644 index 0000000000..651a0592f7 --- /dev/null +++ b/board/sophgo/milkv_duo/MAINTAINERS @@ -0,0 +1,6 @@ +Milk-V Duo +M: Kongyang Liu seashell11234455@gmail.com +S: Maintained +F: board/sophgo/milkv_duo/ +F: configs/milkv_duo_defconfig +F: doc/board/sophgo/milkv_duo.rst diff --git a/board/sophgo/milkv_duo/Makefile b/board/sophgo/milkv_duo/Makefile new file mode 100644 index 0000000000..a087013f5c --- /dev/null +++ b/board/sophgo/milkv_duo/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2024, Kongyang Liu seashell11234455@gmail.com + +obj-y := board.o diff --git a/board/sophgo/milkv_duo/board.c b/board/sophgo/milkv_duo/board.c new file mode 100644 index 0000000000..eaa47be173 --- /dev/null +++ b/board/sophgo/milkv_duo/board.c @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2024, Kongyang Liu seashell11234455@gmail.com + */ + +int board_init(void) +{ + return 0; +} diff --git a/configs/milkv_duo_defconfig b/configs/milkv_duo_defconfig new file mode 100644 index 0000000000..9eca6abfbc --- /dev/null +++ b/configs/milkv_duo_defconfig @@ -0,0 +1,23 @@ +CONFIG_RISCV=y +CONFIG_SYS_MALLOC_LEN=0x820000 +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x82300000 +CONFIG_DEFAULT_DEVICE_TREE="cv1800b-milkv-duo" +CONFIG_IDENT_STRING="milkv_duo" +CONFIG_SYS_LOAD_ADDR=0x80080000 +CONFIG_TARGET_MILKV_DUO=y +CONFIG_ARCH_RV64I=y +CONFIG_RISCV_SMODE=y +CONFIG_FIT=y +CONFIG_SUPPORT_RAW_INITRD=y +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="milkv_duo# " +CONFIG_SYS_MAXARGS=64 +CONFIG_SYS_CBSIZE=512 +CONFIG_SYS_PBSIZE=544 +CONFIG_SYS_BOOTM_LEN=0x4000000 +CONFIG_ENV_OVERWRITE=y +CONFIG_SYS_NS16550=y +CONFIG_SYS_NS16550_MEM32=y diff --git a/include/configs/milkv_duo.h b/include/configs/milkv_duo.h new file mode 100644 index 0000000000..0b4109dc1f --- /dev/null +++ b/include/configs/milkv_duo.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2024, Kongyang Liu seashell11234455@gmail.com + * + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CFG_SYS_SDRAM_BASE 0x80000000 + +#endif /* __CONFIG_H */

On Sun, Jan 28, 2024 at 03:05:25PM +0800, Kongyang Liu wrote:
Add support for Sophgo's Milk-V Duo board, only minimal device tree and serial console are enabled, and it can boot via vendor first stage bootloader.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
(no changes since v3)
Changes in v3:
- Enable EFI loader
Changes in v2:
- Fold the defconfig patch to first patch
- Remove unnecessary environment settings of consoledev and baudrate in config
arch/riscv/Kconfig | 4 ++++ board/sophgo/milkv_duo/Kconfig | 28 ++++++++++++++++++++++++++++ board/sophgo/milkv_duo/MAINTAINERS | 6 ++++++ board/sophgo/milkv_duo/Makefile | 5 +++++ board/sophgo/milkv_duo/board.c | 9 +++++++++ configs/milkv_duo_defconfig | 23 +++++++++++++++++++++++ include/configs/milkv_duo.h | 12 ++++++++++++ 7 files changed, 87 insertions(+) create mode 100644 board/sophgo/milkv_duo/Kconfig create mode 100644 board/sophgo/milkv_duo/MAINTAINERS create mode 100644 board/sophgo/milkv_duo/Makefile create mode 100644 board/sophgo/milkv_duo/board.c create mode 100644 configs/milkv_duo_defconfig create mode 100644 include/configs/milkv_duo.h
Reviewed-by: Leo Yu-Chi Liang ycliang@andestech.com

Add document for Milk-V Duo board which based on Sophgo's CV1800B SoC.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
---
(no changes since v3)
Changes in v3: - Add brief description of the procedure to run u-boot-dtb.bin
doc/board/index.rst | 1 + doc/board/sophgo/index.rst | 8 +++++ doc/board/sophgo/milkv_duo.rst | 64 ++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 doc/board/sophgo/index.rst create mode 100644 doc/board/sophgo/milkv_duo.rst
diff --git a/doc/board/index.rst b/doc/board/index.rst index c96e5fda28..d0f9f355d2 100644 --- a/doc/board/index.rst +++ b/doc/board/index.rst @@ -46,6 +46,7 @@ Board-specific doc sifive/index sipeed/index socionext/index + sophgo/index st/index starfive/index ste/index diff --git a/doc/board/sophgo/index.rst b/doc/board/sophgo/index.rst new file mode 100644 index 0000000000..e097afdac6 --- /dev/null +++ b/doc/board/sophgo/index.rst @@ -0,0 +1,8 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Sophgo +====== +.. toctree:: + :maxdepth: 1 + + milkv_duo diff --git a/doc/board/sophgo/milkv_duo.rst b/doc/board/sophgo/milkv_duo.rst new file mode 100644 index 0000000000..cb2ed1ad98 --- /dev/null +++ b/doc/board/sophgo/milkv_duo.rst @@ -0,0 +1,64 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Milk-V Duo +========== + +CV1800B RISC-V SoC +------------------ +The CV1800B is a high-performance, low-power 1+1 64-bit RISC-V SoC from Sophgo. + +Mainline support +---------------- +The support for following drivers are already enabled: +1. ns16550 UART Driver. + +Building +~~~~~~~~ +1. Add the RISC-V toolchain to your PATH. +2. Setup ARCH & cross compilation environment variable: + +.. code-block:: console + + export CROSS_COMPILE=<riscv64 toolchain prefix> + cd <U-Boot-dir> + make milkv_duo_defconfig + make + +This will generate u-boot-dtb.bin + +Booting +~~~~~~~ +Currently, we rely on vendor FSBL(First Stage Boot Loader) to initialize the +clock and load the u-boot image, then bootup from it. + +Alternatively, to run u-boot-dtb.bin on top of FSBL, follow these steps: + +1. Use the vendor-provided tool to create a unified fip.bin file containing + FSBL, OpenSBI, and U-Boot. + +2. Place the generated fip.bin file into the FAT partition of the SD card. + +3. Insert the SD card into the board and power it on. + +The board will automatically execute the FSBL from the fip.bin file. +Subsequently, it will transition to OpenSBI, and finally, OpenSBI will invoke +U-Boot. + + +Sample boot log from Milk-V Duo board +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. code-block:: none + + U-Boot 2024.01-rc5-00010-g51965baa36 (Dec 28 2023 - 13:15:53 +0800)milkv_duo + + DRAM: 63.3 MiB + Core: 10 devices, 8 uclasses, devicetree: separate + Loading Environment from nowhere... OK + In: serial@4140000 + Out: serial@4140000 + Err: serial@4140000 + Net: No ethernet found. + milkv_duo# cpu detail + 0: cpu@0 rv64imafdc + ID = 0, freq = 0 Hz: L1 cache, MMU + milkv_duo#

On 1/28/24 08:05, Kongyang Liu wrote:
Add document for Milk-V Duo board which based on Sophgo's CV1800B SoC.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
(no changes since v3)
Changes in v3:
Add brief description of the procedure to run u-boot-dtb.bin
doc/board/index.rst | 1 + doc/board/sophgo/index.rst | 8 +++++ doc/board/sophgo/milkv_duo.rst | 64 ++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 doc/board/sophgo/index.rst create mode 100644 doc/board/sophgo/milkv_duo.rst
diff --git a/doc/board/index.rst b/doc/board/index.rst index c96e5fda28..d0f9f355d2 100644 --- a/doc/board/index.rst +++ b/doc/board/index.rst @@ -46,6 +46,7 @@ Board-specific doc sifive/index sipeed/index socionext/index
- sophgo/index st/index starfive/index ste/index
diff --git a/doc/board/sophgo/index.rst b/doc/board/sophgo/index.rst new file mode 100644 index 0000000000..e097afdac6 --- /dev/null +++ b/doc/board/sophgo/index.rst @@ -0,0 +1,8 @@ +.. SPDX-License-Identifier: GPL-2.0+
+Sophgo +====== +.. toctree::
- :maxdepth: 1
- milkv_duo
diff --git a/doc/board/sophgo/milkv_duo.rst b/doc/board/sophgo/milkv_duo.rst new file mode 100644 index 0000000000..cb2ed1ad98 --- /dev/null +++ b/doc/board/sophgo/milkv_duo.rst @@ -0,0 +1,64 @@ +.. SPDX-License-Identifier: GPL-2.0+
+Milk-V Duo +==========
+CV1800B RISC-V SoC +------------------ +The CV1800B is a high-performance, low-power 1+1 64-bit RISC-V SoC from Sophgo.
+Mainline support +---------------- +The support for following drivers are already enabled: +1. ns16550 UART Driver.
+Building +~~~~~~~~ +1. Add the RISC-V toolchain to your PATH. +2. Setup ARCH & cross compilation environment variable:
+.. code-block:: console
- export CROSS_COMPILE=<riscv64 toolchain prefix>
- cd <U-Boot-dir>
- make milkv_duo_defconfig
- make
+This will generate u-boot-dtb.bin
+Booting +~~~~~~~ +Currently, we rely on vendor FSBL(First Stage Boot Loader) to initialize the +clock and load the u-boot image, then bootup from it.
+Alternatively, to run u-boot-dtb.bin on top of FSBL, follow these steps:
+1. Use the vendor-provided tool to create a unified fip.bin file containing
- FSBL, OpenSBI, and U-Boot.
Hello Kongyang,
thank you for providing a documentation for the board.
Concerning the usage of fip.bin it would be helpful to add more detail:
* From where can the vendor code be downloaded? * Which are the commands to execute?
Best regards
Heinrich
+2. Place the generated fip.bin file into the FAT partition of the SD card.
+3. Insert the SD card into the board and power it on.
+The board will automatically execute the FSBL from the fip.bin file. +Subsequently, it will transition to OpenSBI, and finally, OpenSBI will invoke +U-Boot.
+Sample boot log from Milk-V Duo board +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. code-block:: none
- U-Boot 2024.01-rc5-00010-g51965baa36 (Dec 28 2023 - 13:15:53 +0800)milkv_duo
- DRAM: 63.3 MiB
- Core: 10 devices, 8 uclasses, devicetree: separate
- Loading Environment from nowhere... OK
- In: serial@4140000
- Out: serial@4140000
- Err: serial@4140000
- Net: No ethernet found.
- milkv_duo# cpu detail
0: cpu@0 rv64imafdc
ID = 0, freq = 0 Hz: L1 cache, MMU
- milkv_duo#

Heinrich Schuchardt xypron.glpk@gmx.de 于2024年1月28日周日 17:16写道:
On 1/28/24 08:05, Kongyang Liu wrote:
Add document for Milk-V Duo board which based on Sophgo's CV1800B SoC.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
(no changes since v3)
Changes in v3:
Add brief description of the procedure to run u-boot-dtb.bin
doc/board/index.rst | 1 + doc/board/sophgo/index.rst | 8 +++++ doc/board/sophgo/milkv_duo.rst | 64 ++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 doc/board/sophgo/index.rst create mode 100644 doc/board/sophgo/milkv_duo.rst
diff --git a/doc/board/index.rst b/doc/board/index.rst index c96e5fda28..d0f9f355d2 100644 --- a/doc/board/index.rst +++ b/doc/board/index.rst @@ -46,6 +46,7 @@ Board-specific doc sifive/index sipeed/index socionext/index
- sophgo/index st/index starfive/index ste/index
diff --git a/doc/board/sophgo/index.rst b/doc/board/sophgo/index.rst new file mode 100644 index 0000000000..e097afdac6 --- /dev/null +++ b/doc/board/sophgo/index.rst @@ -0,0 +1,8 @@ +.. SPDX-License-Identifier: GPL-2.0+
+Sophgo +====== +.. toctree::
- :maxdepth: 1
- milkv_duo
diff --git a/doc/board/sophgo/milkv_duo.rst b/doc/board/sophgo/milkv_duo.rst new file mode 100644 index 0000000000..cb2ed1ad98 --- /dev/null +++ b/doc/board/sophgo/milkv_duo.rst @@ -0,0 +1,64 @@ +.. SPDX-License-Identifier: GPL-2.0+
+Milk-V Duo +==========
+CV1800B RISC-V SoC +------------------ +The CV1800B is a high-performance, low-power 1+1 64-bit RISC-V SoC from Sophgo.
+Mainline support +---------------- +The support for following drivers are already enabled: +1. ns16550 UART Driver.
+Building +~~~~~~~~ +1. Add the RISC-V toolchain to your PATH. +2. Setup ARCH & cross compilation environment variable:
+.. code-block:: console
- export CROSS_COMPILE=<riscv64 toolchain prefix>
- cd <U-Boot-dir>
- make milkv_duo_defconfig
- make
+This will generate u-boot-dtb.bin
+Booting +~~~~~~~ +Currently, we rely on vendor FSBL(First Stage Boot Loader) to initialize the +clock and load the u-boot image, then bootup from it.
+Alternatively, to run u-boot-dtb.bin on top of FSBL, follow these steps:
+1. Use the vendor-provided tool to create a unified fip.bin file containing
- FSBL, OpenSBI, and U-Boot.
Hello Kongyang,
thank you for providing a documentation for the board.
Concerning the usage of fip.bin it would be helpful to add more detail:
- From where can the vendor code be downloaded?
- Which are the commands to execute?
We have leveraged the BuildSDK from the Milk-V Duo project (https://github.com/milkv-duo/duo-buildroot-sdk) and made slight modifications to ensure compatibility with the mainline OpenSBI and U-Boot. After the repository reaches a stable state, we will publish it on GitHub.
Best regards Kongyang Liu
Best regards
Heinrich
+2. Place the generated fip.bin file into the FAT partition of the SD card.
+3. Insert the SD card into the board and power it on.
+The board will automatically execute the FSBL from the fip.bin file. +Subsequently, it will transition to OpenSBI, and finally, OpenSBI will invoke +U-Boot.
+Sample boot log from Milk-V Duo board +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. code-block:: none
- U-Boot 2024.01-rc5-00010-g51965baa36 (Dec 28 2023 - 13:15:53 +0800)milkv_duo
- DRAM: 63.3 MiB
- Core: 10 devices, 8 uclasses, devicetree: separate
- Loading Environment from nowhere... OK
- In: serial@4140000
- Out: serial@4140000
- Err: serial@4140000
- Net: No ethernet found.
- milkv_duo# cpu detail
0: cpu@0 rv64imafdc
ID = 0, freq = 0 Hz: L1 cache, MMU
- milkv_duo#

Hi Heinrich S
On 10:16 Sun 28 Jan , Heinrich Schuchardt wrote:
On 1/28/24 08:05, Kongyang Liu wrote:
Add document for Milk-V Duo board which based on Sophgo's CV1800B SoC.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
(no changes since v3)
Changes in v3:
Add brief description of the procedure to run u-boot-dtb.bin
doc/board/index.rst | 1 + doc/board/sophgo/index.rst | 8 +++++ doc/board/sophgo/milkv_duo.rst | 64 ++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 doc/board/sophgo/index.rst create mode 100644 doc/board/sophgo/milkv_duo.rst
diff --git a/doc/board/index.rst b/doc/board/index.rst index c96e5fda28..d0f9f355d2 100644 --- a/doc/board/index.rst +++ b/doc/board/index.rst @@ -46,6 +46,7 @@ Board-specific doc sifive/index sipeed/index socionext/index
- sophgo/index st/index starfive/index ste/index
diff --git a/doc/board/sophgo/index.rst b/doc/board/sophgo/index.rst new file mode 100644 index 0000000000..e097afdac6 --- /dev/null +++ b/doc/board/sophgo/index.rst @@ -0,0 +1,8 @@ +.. SPDX-License-Identifier: GPL-2.0+
+Sophgo +====== +.. toctree::
- :maxdepth: 1
- milkv_duo
diff --git a/doc/board/sophgo/milkv_duo.rst b/doc/board/sophgo/milkv_duo.rst new file mode 100644 index 0000000000..cb2ed1ad98 --- /dev/null +++ b/doc/board/sophgo/milkv_duo.rst @@ -0,0 +1,64 @@ +.. SPDX-License-Identifier: GPL-2.0+
+Milk-V Duo +==========
+CV1800B RISC-V SoC +------------------ +The CV1800B is a high-performance, low-power 1+1 64-bit RISC-V SoC from Sophgo.
+Mainline support +---------------- +The support for following drivers are already enabled: +1. ns16550 UART Driver.
+Building +~~~~~~~~ +1. Add the RISC-V toolchain to your PATH. +2. Setup ARCH & cross compilation environment variable:
+.. code-block:: console
- export CROSS_COMPILE=<riscv64 toolchain prefix>
- cd <U-Boot-dir>
- make milkv_duo_defconfig
- make
+This will generate u-boot-dtb.bin
+Booting +~~~~~~~ +Currently, we rely on vendor FSBL(First Stage Boot Loader) to initialize the +clock and load the u-boot image, then bootup from it.
+Alternatively, to run u-boot-dtb.bin on top of FSBL, follow these steps:
+1. Use the vendor-provided tool to create a unified fip.bin file containing
- FSBL, OpenSBI, and U-Boot.
Hello Kongyang,
thank you for providing a documentation for the board.
Concerning the usage of fip.bin it would be helpful to add more detail:
- From where can the vendor code be downloaded?
..
- Which are the commands to execute?
for fip.bin, which is located inside the first vfat partition of SD card, it will be parsed & loaded & excuted by ROM after power on (haven't looked too deep into this)
also the fip.bin image is a combination of FSBL+DDR param+ATF?/OpenSBI+U-boot please see the link below if you're interested https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/fsbl/plat/cv180x...
Best regards
Heinrich
+2. Place the generated fip.bin file into the FAT partition of the SD card.
+3. Insert the SD card into the board and power it on.
+The board will automatically execute the FSBL from the fip.bin file. +Subsequently, it will transition to OpenSBI, and finally, OpenSBI will invoke +U-Boot.
+Sample boot log from Milk-V Duo board +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. code-block:: none
- U-Boot 2024.01-rc5-00010-g51965baa36 (Dec 28 2023 - 13:15:53 +0800)milkv_duo
- DRAM: 63.3 MiB
- Core: 10 devices, 8 uclasses, devicetree: separate
- Loading Environment from nowhere... OK
- In: serial@4140000
- Out: serial@4140000
- Err: serial@4140000
- Net: No ethernet found.
- milkv_duo# cpu detail
0: cpu@0 rv64imafdc
ID = 0, freq = 0 Hz: L1 cache, MMU
- milkv_duo#

On Sun, Jan 28, 2024 at 03:05:26PM +0800, Kongyang Liu wrote:
Add document for Milk-V Duo board which based on Sophgo's CV1800B SoC.
Signed-off-by: Kongyang Liu seashell11234455@gmail.com
(no changes since v3)
Changes in v3:
- Add brief description of the procedure to run u-boot-dtb.bin
doc/board/index.rst | 1 + doc/board/sophgo/index.rst | 8 +++++ doc/board/sophgo/milkv_duo.rst | 64 ++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 doc/board/sophgo/index.rst create mode 100644 doc/board/sophgo/milkv_duo.rst
Reviewed-by: Leo Yu-Chi Liang ycliang@andestech.com
participants (4)
-
Heinrich Schuchardt
-
Kongyang Liu
-
Leo Liang
-
Yixun Lan