Skip to contentSkip to conversation

riscv: spacemit: add support for bananapi-f3

PATCH Superseded Huan Zhou 3 participants 11 messages Nov 29, 2024 – Dec 12, 2024

Subsystems (2)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Huan Zhou

author
#0 lore raw

v4 cover riscv: spacemit: add support for bananapi-f3

Banana Pi F3 board is a industrial grade RISC-V development board, it design with SpacemiT K1 8 core RISC-V chip, CPU integrates 2.0 TOPs AI computing power. 4G DDR and 16G eMMC onboard. 2x GbE Ethernet port, 4x USB 3.0 and PCIe for M.2 interface, support HDMI and Dual MIPI-CSI Camera.

This patch introduces fundamental support for the Banana Pi F3 board, encompassing UART, CPU, and PLIC support. This ensures that U-Boot can operate in serial console mode.

Changes in v4:
- Change uart compatible in k1.dtsi in v3, cause related driver in not implemented in u-boot.
- Update doc, show how to validate the patch.
- Update maintainer, remove kongyang cause he lefted.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Add base commit
- Clear redifinition warning while building in UART_IIR_ID
- Change underscore to dash in bananapi*f3
- Update maintainer
- link to v2 https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
- Change license to GPL-2.0-or-later
- Add memory node for dts
- Add ft_board_setup function for kernel memory init
- Use default prompt
- links to v1 https://lore.kernel.org/u-boot/[email protected]/

---
Kongyang Liu (2):
riscv: spacemit: bananapi_f3: initial support added
doc: spacemit: bananapi_f3: document Banana Pi F3 board

 arch/riscv/Kconfig                     |   5 +
 arch/riscv/cpu/k1/Kconfig              |  18 ++
 arch/riscv/cpu/k1/Makefile             |   6 +
 arch/riscv/cpu/k1/cpu.c                |   9 +
 arch/riscv/cpu/k1/dram.c               |  54 ++++
 arch/riscv/dts/Makefile                |   1 +
 arch/riscv/dts/k1-bananapi-f3.dts      |  25 ++
 arch/riscv/dts/k1.dtsi                 | 459 +++++++++++++++++++++++++++++++++
 board/spacemit/bananapi-f3/Kconfig     |  25 ++
 board/spacemit/bananapi-f3/MAINTAINERS |   6 +
 board/spacemit/bananapi-f3/Makefile    |   5 +
 board/spacemit/bananapi-f3/board.c     |   9 +
 configs/bananapi-f3_defconfig          |  20 ++
 doc/board/index.rst                    |   1 +
 doc/board/spacemit/bananapi-f3.rst     |  86 ++++++
 doc/board/spacemit/index.rst           |   8 +
 include/configs/bananapi-f3.h          |  13 +
 17 files changed, 750 insertions(+)

---
base-commit: 40c45a57974bdb09fffa31dde65ddf69e5de53eb
change-id: 20241112-pickup-bpif3-245ab208b9a4

Best regards,

Signature · 1 line
Huan Zhou <[email protected]>
author
#1 lore raw

PATCH v4 1/2 riscv: spacemit: bananapi_f3: initial support added

From: Kongyang Liu <[email protected]>

Add basic support for SpacemiT's Banana Pi F3 board. Update the k1.dtsi align with mainline.
Note that the device tree files follow the mainline Linux source[1].

[1]. https://patches.linaro.org/project/linux-serial/patch/[email protected]/

---
 arch/riscv/Kconfig                     |   5 +
 arch/riscv/cpu/k1/Kconfig              |  18 ++
 arch/riscv/cpu/k1/Makefile             |   6 +
 arch/riscv/cpu/k1/cpu.c                |   9 +
 arch/riscv/cpu/k1/dram.c               |  54 ++++
 arch/riscv/dts/Makefile                |   1 +
 arch/riscv/dts/k1-bananapi-f3.dts      |  25 ++
 arch/riscv/dts/k1.dtsi                 | 459 +++++++++++++++++++++++++++++++++
 board/spacemit/bananapi-f3/Kconfig     |  25 ++
 board/spacemit/bananapi-f3/MAINTAINERS |   6 +
 board/spacemit/bananapi-f3/Makefile    |   5 +
 board/spacemit/bananapi-f3/board.c     |   9 +
 configs/bananapi-f3_defconfig          |  20 ++
 include/configs/bananapi-f3.h          |  13 +
 14 files changed, 655 insertions(+)
arch/riscv/Kconfig +5 -0
index fa3b016c52728862019c426f031262c40901ee51..bf810735aa3349e511b461a89e1833948711f5c3 100644
@@ -11,6 +11,9 @@ choice
 config TARGET_ANDES_AE350
 	bool "Support Andes ae350"
 
+config TARGET_BANANAPI_F3
+	bool "Support BananaPi F3 Board"
+
 config TARGET_MICROCHIP_ICICLE
 	bool "Support Microchip PolarFire-SoC Icicle Board"
 
@@ -88,6 +91,7 @@ source "board/sifive/unleashed/Kconfig"
 source "board/sifive/unmatched/Kconfig"
 source "board/sipeed/maix/Kconfig"
 source "board/sophgo/milkv_duo/Kconfig"
+source "board/spacemit/bananapi-f3/Kconfig"
 source "board/starfive/visionfive2/Kconfig"
 source "board/thead/th1520_lpi4a/Kconfig"
 source "board/xilinx/mbv/Kconfig"
@@ -99,6 +103,7 @@ source "arch/riscv/cpu/fu540/Kconfig"
 source "arch/riscv/cpu/fu740/Kconfig"
 source "arch/riscv/cpu/generic/Kconfig"
 source "arch/riscv/cpu/jh7110/Kconfig"
+source "arch/riscv/cpu/k1/Kconfig"
 
 # architecture-specific options below
 
arch/riscv/cpu/k1/Kconfig new file +18 -0
new file mode 100644
index 0000000000000000000000000000000000000000..d9cd8dce96426bb4cbe9ff38385a4c66116fe341
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (C) 2024, Kongyang Liu <[email protected]>
+
+config SPACEMIT_K1
+	bool
+	select BINMAN
+	select ARCH_EARLY_INIT_R
+	select SYS_CACHE_SHIFT_6
+	imply CPU
+	imply CPU_RISCV
+	imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE)
+	imply RISCV_ACLINT if RISCV_MMODE
+	imply SPL_RISCV_ACLINT if SPL_RISCV_MMODE
+	imply CMD_CPU
+	imply SPL_CPU
+	imply SPL_OPENSBI
+	imply SPL_LOAD_FIT
arch/riscv/cpu/k1/Makefile new file +6 -0
new file mode 100644
index 0000000000000000000000000000000000000000..bad4f4cf46fb6eb44053dc52df1837b58046c745
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (c) 2024, Kongyang Liu <[email protected]>
+
+obj-y += dram.o
+obj-y += cpu.o
arch/riscv/cpu/k1/cpu.c new file +9 -0
new file mode 100644
index 0000000000000000000000000000000000000000..41a4a1b95e6e4b6dd1580b5f714107cac6c1dc02
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2024, Kongyang Liu <[email protected]>
+ */
+
+int cleanup_before_linux(void)
+{
+	return 0;
+}
arch/riscv/cpu/k1/dram.c new file +54 -0

54 lines not on this page · raw message

arch/riscv/dts/Makefile +1 -0
index 17cda483e128996bb944f5a2b9b7676d32e45ae5..71267f96f80214e8e4b11970a5a4a79e537bf633 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 dtb-$(CONFIG_TARGET_ANDES_AE350) += ae350_32.dtb ae350_64.dtb
+dtb-$(CONFIG_TARGET_BANANAPI_F3) += k1-bananapi-f3.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
arch/riscv/dts/k1-bananapi-f3.dts new file +25 -0
new file mode 100644
index 0000000000000000000000000000000000000000..d2486f70906143ad1f2bde753f12dea5bab2e5ab
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/*
+ * Copyright (C) 2024 Yangyu Chen <[email protected]>
+ */
+
+#include "k1.dtsi"
+#include "binman.dtsi"
+
+/ {
+	model = "Banana Pi BPI-F3";
+	compatible = "bananapi,bpi-f3", "spacemit,k1";
+
+	chosen {
+		stdout-path = "serial0";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00000000 0x00000000 0x00000000 0x80000000>;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
arch/riscv/dts/k1.dtsi new file +459 -0

460 lines not on this page · raw message

board/spacemit/bananapi-f3/Kconfig new file +25 -0
new file mode 100644
index 0000000000000000000000000000000000000000..f89fa9af2c7d92e87722a54c4df9216d76376de9
@@ -0,0 +1,25 @@
+if TARGET_BANANAPI_F3
+
+config SYS_BOARD
+	default "bananapi-f3"
+
+config SYS_VENDOR
+	default "spacemit"
+
+config SYS_CPU
+	default "k1"
+
+config SYS_CONFIG_NAME
+	default "bananapi-f3"
+
+config TEXT_BASE
+	default 0x00200000
+
+config SPL_OPENSBI_LOAD_ADDR
+	default 0x00000000
+
+config BOARD_SPECIFIC_OPTIONS
+	def_bool y
+	select SPACEMIT_K1
+
+endif
board/spacemit/bananapi-f3/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000000000000000000000000000000000..131bad03181021bb10b8f2189f00870f45f6dac1
@@ -0,0 +1,6 @@
+BananaPi F3
+M:	Huan Zhou <pericycle.cc@@gmail.com>
+S:	Maintained
+F:	board/spacemit/bananapi-f3/
+F:	configs/bananapi-f3_defconfig
+F:	doc/board/spacemit/bananapi-f3.rst
board/spacemit/bananapi-f3/Makefile new file +5 -0
new file mode 100644
index 0000000000000000000000000000000000000000..2168698402b6d1d26988ca4e3a8e55367db51532
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (c) 2024, Kongyang Liu <[email protected]>
+
+obj-y := board.o
board/spacemit/bananapi-f3/board.c new file +9 -0
new file mode 100644
index 0000000000000000000000000000000000000000..2631cdd49e0eb4afde0efadb2f3014fd623f78f2
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2024, Kongyang Liu <[email protected]>
+ */
+
+int board_init(void)
+{
+	return 0;
+}
configs/bananapi-f3_defconfig new file +20 -0
new file mode 100644
index 0000000000000000000000000000000000000000..6363620208757df185e3a11ee1260eb57256ac68
@@ -0,0 +1,20 @@
+CONFIG_RISCV=y
+CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_NR_DRAM_BANKS=2
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1000000
+CONFIG_DEFAULT_DEVICE_TREE="k1-bananapi-f3"
+CONFIG_SYS_LOAD_ADDR=0x200000
+CONFIG_TARGET_BANANAPI_F3=y
+CONFIG_ARCH_RV64I=y
+CONFIG_RISCV_SMODE=y
+CONFIG_FIT=y
+CONFIG_SYS_BOOTM_LEN=0xa000000
+CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_SYS_CBSIZE=256
+CONFIG_SYS_PBSIZE=276
+CONFIG_HUSH_PARSER=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_SYS_NS16550=y
+CONFIG_SYS_NS16550_MEM32=y
include/configs/bananapi-f3.h new file +13 -0
new file mode 100644
index 0000000000000000000000000000000000000000..aecf69cd4cf8ddaea7dee57bf1a8ce8dc5db513d
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2024, Kongyang Liu <[email protected]>
+ *
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CFG_SYS_SDRAM_BASE         0x0
+#define CFG_SYS_NS16550_IER        0x40
+
+#endif /* __CONFIG_H */
Signature · 1 line
2.39.5
author
#2 lore raw

PATCH v4 2/2 doc: spacemit: bananapi_f3: document Banana Pi F3 board

In reply to Huan Zhou

From: Kongyang Liu <[email protected]>

Add document for Banana Pi F3 board which based on SpacemiT's K1 SoC.

---
 doc/board/index.rst                |  1 +
 doc/board/spacemit/bananapi-f3.rst | 86 ++++++++++++++++++++++++++++++++++++++
 doc/board/spacemit/index.rst       |  8 ++++
 3 files changed, 95 insertions(+)
doc/board/index.rst +1 -0
index 417c128c7af6ad2267ef1bc743c7f10ae70b6de7..367da2d62316d4cab25ecc53f852ef742eba13dd 100644
@@ -51,6 +51,7 @@ Board-specific doc
    sipeed/index
    socionext/index
    sophgo/index
+   spacemit/index
    st/index
    starfive/index
    ste/index
doc/board/spacemit/bananapi-f3.rst new file +86 -0

86 lines not on this page · raw message

doc/board/spacemit/index.rst new file +8 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3fb7d804ac8fc8dd4c7ee67ffc877f9ad323162d
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+SpacemiT
+========
+.. toctree::
+   :maxdepth: 1
+
+   bananapi-f3
Signature · 1 line
2.39.5
#3 lore raw

Re: [PATCH v4 2/2] doc: spacemit: bananapi_f3: document Banana Pi F3 board

Hi Huan Zhou

Quoted 30 lines · Huan Zhou

From: Kongyang Liu <[email protected]>

Add document for Banana Pi F3 board which based on SpacemiT's K1 SoC.

---
 doc/board/index.rst                |  1 + doc/board/spacemit/bananapi-f3.rst | 86 ++++++++++++++++++++++++++++++++++++++ doc/board/spacemit/index.rst       |  8 ++++

 3 files changed, 95 insertions(+)
doc/board/index.rst +0 -0
index 417c128c7af6ad2267ef1bc743c7f10ae70b6de7..367da2d62316d4cab25ecc53f852ef742eba13dd 100644
@@ -51,6 +51,7 @@ Board-specific doc

    sipeed/index
    socionext/index
    sophgo/index
+   spacemit/index
    st/index
    starfive/index
    ste/index

doc/board/spacemit/bananapi-f3.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1e6d6ef19be7e25684966bd4a727bd21b147330a

doc/board/spacemit/bananapi-f3.rst line 3

Quoted 3 lines
doc/board/spacemit/bananapi-f3.rst new file +3 -0
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Banana Pi F3

Officially they call it Banana Pi BPI-F3.

doc/board/spacemit/bananapi-f3.rst line 8

Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+============
+
+Building
+~~~~~~~~
+1. Install the spacemit riscv cross compile toolchain_, or skip it if riscv toolchain is installed.

I would not use a specific such toolchain but rather a regular RISC-V one e.g.

https://github.com/riscv-collab/riscv-gnu-toolchain

Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+
+.. _toolchain: https://archive.spacemit.com/toolchain/
+
+2. Setup cross compilation environment variable:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 25

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   export CROSS_COMPILE=<riscv64 toolchain prefix, e.g /opt/spacemit/bin/riscv64-unknown-linux-gnu->
+
+3. Before building U-Boot, OpenSBI should be built first. OpenSBI can be
+built for SpacemiT K1 SoC as below:
+
+.. code-block:: console
+
+   git clone https://github.com/cyyself/opensbi -b k1-opensbi
+   cd opensbi
+   make PLATFORM=generic

What speaks against using regular master opensbi?

Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+
+4. Then build U-Boot as following:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 40

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   cd <U-Boot-dir>
+   make bananapi-f3_defconfig
+   make OPENSBI=<OpenSBI-dir>/build/platform/generic/firmware/fw_dynamic.bin
+
+This will generate u-boot.itb
+
+Booting
+~~~~~~~
+Actually, we can replace the uboot part from bianbu linux which is the bsp_ to validate this patch,
+use `balena etcher` to burn the bianbu-minimal.img to the sd card, 

trailing whitespace

doc/board/spacemit/bananapi-f3.rst line 46

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+and replace the /dev/sdx4 where places the uboot_ with the `u-boot.itb` generated from this patch.
+
+.. _bsp: https://archive.spacemit.com/image/k1/version/bianbu/v2.0/
+.. _uboot: https://bianbu-linux.spacemit.com/en/device/boot#21-firmware-layout
+
+Sample boot log from Banana Pi F3 board

BPI-F3

Quoted 12 lines
doc/board/spacemit/bananapi-f3.rst new file +12 -0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. code-block:: none
+
+   try sd...
+   bm:3
+   j...
+
+   U-Boot SPL 2022.10spacemit-dirty (Oct 21 2024 - 09:01:13 +0000)
+   [   0.279] DDR type LPDDR4X
+   [   0.292] lpddr4_silicon_init consume 13ms
+   [   0.293] Change DDR data rate to 2400MT/s
+   [   0.430] ## Checking hash(es) for config conf-1 ... OK

doc/board/spacemit/bananapi-f3.rst line 68

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   [   0.432] ## Checking hash(es) for Image opensbi ... OK
+   [   0.437] ## Checking hash(es) for Image uboot ... OK
+   [   0.443] ## Checking hash(es) for Image fdt-1 ... OK
+   [   0.488] ## Checking hash(es) for config config_1 ... OK
+   [   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK
+
+
+   U-Boot 2024.10-rc4-00462-g5b138cfcc587-dirty (Nov 28 2024 - 14:56:49 +0800)
+
+   DRAM:  4 GiB

I guess it does not yet detect the amount of RAM available.

Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+   Core:  19 devices, 8 uclasses, devicetree: separate
+   Loading Environment from nowhere... OK
+   In:    serial@d4017000
+   Out:   serial@d4017000
+   Err:   serial@d4017000
+   Net:   No ethernet found.
+   => cpu list

doc/board/spacemit/bananapi-f3.rst line 85

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   0: cpu@0      spacemit,x60
+   1: cpu@1      spacemit,x60
+   2: cpu@2      spacemit,x60
+   3: cpu@3      spacemit,x60
+   4: cpu@4      spacemit,x60
+   5: cpu@5      spacemit,x60
+   6: cpu@6      spacemit,x60
+   7: cpu@7      spacemit,x60
+   => test
+   => 

trailing whitespace

Quoted 8 lines
doc/board/spacemit/bananapi-f3.rst new file +1 -0
+
doc/board/spacemit/index.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3fb7d804ac8fc8dd4c7ee67ffc877f9ad323162d

doc/board/spacemit/index.rst line 8

Quoted 8 lines
doc/board/spacemit/index.rst new file +8 -0
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+SpacemiT
+========
+.. toctree::
+   :maxdepth: 1
+
+   bananapi-f3

new blank line at EOF

Cheers

Marcel

#4 lore raw

Re: [PATCH v4 2/2] doc: spacemit: bananapi_f3: document Banana Pi F3 board

Hi Marcel, Huan

Quoted 47 lines · Marcel Ziswiler

Hi Huan Zhou

Quoted 30 lines · Huan Zhou

From: Kongyang Liu <[email protected]>

Add document for Banana Pi F3 board which based on SpacemiT's K1 SoC.

---
 doc/board/index.rst                |  1 + doc/board/spacemit/bananapi-f3.rst | 86 ++++++++++++++++++++++++++++++++++++++ doc/board/spacemit/index.rst       |  8 ++++

 3 files changed, 95 insertions(+)
doc/board/index.rst +0 -0
index 417c128c7af6ad2267ef1bc743c7f10ae70b6de7..367da2d62316d4cab25ecc53f852ef742eba13dd 100644
@@ -51,6 +51,7 @@ Board-specific doc

    sipeed/index
    socionext/index
    sophgo/index
+   spacemit/index
    st/index
    starfive/index
    ste/index

doc/board/spacemit/bananapi-f3.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1e6d6ef19be7e25684966bd4a727bd21b147330a

doc/board/spacemit/bananapi-f3.rst line 3

Quoted 3 lines
doc/board/spacemit/bananapi-f3.rst new file +3 -0
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Banana Pi F3

Officially they call it Banana Pi BPI-F3.

doc/board/spacemit/bananapi-f3.rst line 8

Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+============
+
+Building
+~~~~~~~~
+1. Install the spacemit riscv cross compile toolchain_, or skip it if riscv toolchain is installed.

I would not use a specific such toolchain but rather a regular RISC-V one e.g.

Quoted 2 lines

https://github.com/riscv-collab/riscv-gnu-toolchain

I think any riscv toolchain should work fine here, as I'm using Gentoo specific riscv toolchain.. so consider it's merely an example provided to demonstrate whole process working

Quoted 11 lines
Quoted 11 lines
doc/board/spacemit/bananapi-f3.rst new file +11 -0
+
+.. _toolchain: https://archive.spacemit.com/toolchain/
+
+2. Setup cross compilation environment variable:
+
+.. code-block:: console
+
+   export CROSS_COMPILE=<riscv64 toolchain prefix, e.g /opt/spacemit/bin/riscv64-unknown-linux-gnu->
+
+3. Before building U-Boot, OpenSBI should be built first. OpenSBI can be
+built for SpacemiT K1 SoC as below:
Quoted 9 lines

doc/board/spacemit/bananapi-f3.rst line 25

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+
+.. code-block:: console
+
+   git clone https://github.com/cyyself/opensbi -b k1-opensbi
+   cd opensbi
+   make PLATFORM=generic

What speaks against using regular master opensbi?

no idea if master of opensbi would work here, we can certainly try.. but I think it's another story, as we are focusing on mainlining uboot

FWIK, this branch is generally same version as vendor opensbi, but slightly
rebase to more recent opensbi version

Quoted 43 lines
Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+
+4. Then build U-Boot as following:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 40

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   cd <U-Boot-dir>
+   make bananapi-f3_defconfig
+   make OPENSBI=<OpenSBI-dir>/build/platform/generic/firmware/fw_dynamic.bin
+
+This will generate u-boot.itb
+
+Booting
+~~~~~~~
+Actually, we can replace the uboot part from bianbu linux which is the bsp_ to validate this patch,
+use `balena etcher` to burn the bianbu-minimal.img to the sd card, 

trailing whitespace

doc/board/spacemit/bananapi-f3.rst line 46

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+and replace the /dev/sdx4 where places the uboot_ with the `u-boot.itb` generated from this patch.
+
+.. _bsp: https://archive.spacemit.com/image/k1/version/bianbu/v2.0/
+.. _uboot: https://bianbu-linux.spacemit.com/en/device/boot#21-firmware-layout
+
+Sample boot log from Banana Pi F3 board

BPI-F3

Quoted 16 lines
doc/board/spacemit/bananapi-f3.rst new file +16 -0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. code-block:: none
+
+   try sd...
+   bm:3
+   j...
+
+   U-Boot SPL 2022.10spacemit-dirty (Oct 21 2024 - 09:01:13 +0000)
+   [   0.279] DDR type LPDDR4X
+   [   0.292] lpddr4_silicon_init consume 13ms
+   [   0.293] Change DDR data rate to 2400MT/s
+   [   0.430] ## Checking hash(es) for config conf-1 ... OK
+   [   0.432] ## Checking hash(es) for Image opensbi ... OK
+   [   0.437] ## Checking hash(es) for Image uboot ... OK
+   [   0.443] ## Checking hash(es) for Image fdt-1 ... OK
+   [   0.488] ## Checking hash(es) for config config_1 ... OK
Quoted 9 lines

doc/board/spacemit/bananapi-f3.rst line 68

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+   [   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK
+
+
+   U-Boot 2024.10-rc4-00462-g5b138cfcc587-dirty (Nov 28 2024 - 14:56:49 +0800)
+
+   DRAM:  4 GiB

I guess it does not yet detect the amount of RAM available.

I would be fine with this, as currently the memory size is hardcoded, we should work on follow-up patch to auto probe DDR size, and corret it

Quoted 42 lines
Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+   Core:  19 devices, 8 uclasses, devicetree: separate
+   Loading Environment from nowhere... OK
+   In:    serial@d4017000
+   Out:   serial@d4017000
+   Err:   serial@d4017000
+   Net:   No ethernet found.
+   => cpu list

doc/board/spacemit/bananapi-f3.rst line 85

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   0: cpu@0      spacemit,x60
+   1: cpu@1      spacemit,x60
+   2: cpu@2      spacemit,x60
+   3: cpu@3      spacemit,x60
+   4: cpu@4      spacemit,x60
+   5: cpu@5      spacemit,x60
+   6: cpu@6      spacemit,x60
+   7: cpu@7      spacemit,x60
+   => test
+   => 

trailing whitespace

Quoted 8 lines
doc/board/spacemit/bananapi-f3.rst new file +1 -0
+
doc/board/spacemit/index.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3fb7d804ac8fc8dd4c7ee67ffc877f9ad323162d

doc/board/spacemit/index.rst line 8

Quoted 8 lines
doc/board/spacemit/index.rst new file +8 -0
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+SpacemiT
+========
+.. toctree::
+   :maxdepth: 1
+
+   bananapi-f3

new blank line at EOF

Cheers

Marcel

Signature · 3 lines
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55
#5 lore raw

Re: [PATCH v4 2/2] doc: spacemit: bananapi_f3: document Banana Pi F3 board

Hi Yixun Lan

Quoted 50 lines · Yixun Lan

Hi Marcel, Huan

Quoted 47 lines · Marcel Ziswiler

Hi Huan Zhou

Quoted 30 lines · Huan Zhou

From: Kongyang Liu <[email protected]>

Add document for Banana Pi F3 board which based on SpacemiT's K1 SoC.

---
 doc/board/index.rst                |  1 + doc/board/spacemit/bananapi-f3.rst | 86 ++++++++++++++++++++++++++++++++++++++ doc/board/spacemit/index.rst       |  8 ++++

 3 files changed, 95 insertions(+)
doc/board/index.rst +0 -0
index 417c128c7af6ad2267ef1bc743c7f10ae70b6de7..367da2d62316d4cab25ecc53f852ef742eba13dd 100644
@@ -51,6 +51,7 @@ Board-specific doc

    sipeed/index
    socionext/index
    sophgo/index
+   spacemit/index
    st/index
    starfive/index
    ste/index

doc/board/spacemit/bananapi-f3.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1e6d6ef19be7e25684966bd4a727bd21b147330a

doc/board/spacemit/bananapi-f3.rst line 3

Quoted 3 lines
doc/board/spacemit/bananapi-f3.rst new file +3 -0
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Banana Pi F3

Officially they call it Banana Pi BPI-F3.

doc/board/spacemit/bananapi-f3.rst line 8

Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+============
+
+Building
+~~~~~~~~
+1. Install the spacemit riscv cross compile toolchain_, or skip it if riscv toolchain is installed.

I would not use a specific such toolchain but rather a regular RISC-V one e.g.

Quoted 5 lines
Quoted 2 lines

https://github.com/riscv-collab/riscv-gnu-toolchain

I think any riscv toolchain should work fine here, as I'm using Gentoo specific riscv toolchain.. so consider it's merely an example provided to demonstrate whole process working

Okay.

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
doc/board/spacemit/bananapi-f3.rst new file +11 -0
+
+.. _toolchain: https://archive.spacemit.com/toolchain/
+
+2. Setup cross compilation environment variable:
+
+.. code-block:: console
+
+   export CROSS_COMPILE=<riscv64 toolchain prefix, e.g /opt/spacemit/bin/riscv64-unknown-linux-gnu->
+
+3. Before building U-Boot, OpenSBI should be built first. OpenSBI can be
+built for SpacemiT K1 SoC as below:
Quoted 9 lines

doc/board/spacemit/bananapi-f3.rst line 25

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+
+.. code-block:: console
+
+   git clone https://github.com/cyyself/opensbi -b k1-opensbi
+   cd opensbi
+   make PLATFORM=generic

What speaks against using regular master opensbi?

Quoted 1 line

no idea if master of opensbi would work here, we can certainly try..

I tried and it seems to work fine, resp. the only difference I could spot is that instead of 'crc32+ OK' it prints some random ASCII characters in the last line before any U-Boot output:

[   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK
Quoted 1 line

but I think it's another story, as we are focusing on mainlining uboot

Yes, exactly. I am just curious if it needs combining with some obscure vendor stuff.

Quoted 55 lines

FWIK, this branch is generally same version as vendor opensbi, but slightly rebase to more recent opensbi version

Quoted 43 lines
Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+
+4. Then build U-Boot as following:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 40

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   cd <U-Boot-dir>
+   make bananapi-f3_defconfig
+   make OPENSBI=<OpenSBI-dir>/build/platform/generic/firmware/fw_dynamic.bin
+
+This will generate u-boot.itb
+
+Booting
+~~~~~~~
+Actually, we can replace the uboot part from bianbu linux which is the bsp_ to validate this patch,
+use `balena etcher` to burn the bianbu-minimal.img to the sd card, 

trailing whitespace

doc/board/spacemit/bananapi-f3.rst line 46

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+and replace the /dev/sdx4 where places the uboot_ with the `u-boot.itb` generated from this patch.
+
+.. _bsp: https://archive.spacemit.com/image/k1/version/bianbu/v2.0/
+.. _uboot: https://bianbu-linux.spacemit.com/en/device/boot#21-firmware-layout
+
+Sample boot log from Banana Pi F3 board

BPI-F3

Quoted 16 lines
doc/board/spacemit/bananapi-f3.rst new file +16 -0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. code-block:: none
+
+   try sd...
+   bm:3
+   j...
+
+   U-Boot SPL 2022.10spacemit-dirty (Oct 21 2024 - 09:01:13 +0000)
+   [   0.279] DDR type LPDDR4X
+   [   0.292] lpddr4_silicon_init consume 13ms
+   [   0.293] Change DDR data rate to 2400MT/s
+   [   0.430] ## Checking hash(es) for config conf-1 ... OK
+   [   0.432] ## Checking hash(es) for Image opensbi ... OK
+   [   0.437] ## Checking hash(es) for Image uboot ... OK
+   [   0.443] ## Checking hash(es) for Image fdt-1 ... OK
+   [   0.488] ## Checking hash(es) for config config_1 ... OK
Quoted 9 lines

doc/board/spacemit/bananapi-f3.rst line 68

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+   [   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK
+
+
+   U-Boot 2024.10-rc4-00462-g5b138cfcc587-dirty (Nov 28 2024 - 14:56:49 +0800)
+
+   DRAM:  4 GiB

I guess it does not yet detect the amount of RAM available.

Quoted 2 lines

I would be fine with this, as currently the memory size is hardcoded, we should work on follow-up patch to auto probe DDR size, and corret it

Yes, I agree.

Quoted 30 lines
Quoted 30 lines
Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+   Core:  19 devices, 8 uclasses, devicetree: separate
+   Loading Environment from nowhere... OK
+   In:    serial@d4017000
+   Out:   serial@d4017000
+   Err:   serial@d4017000
+   Net:   No ethernet found.
+   => cpu list

doc/board/spacemit/bananapi-f3.rst line 85

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   0: cpu@0      spacemit,x60
+   1: cpu@1      spacemit,x60
+   2: cpu@2      spacemit,x60
+   3: cpu@3      spacemit,x60
+   4: cpu@4      spacemit,x60
+   5: cpu@5      spacemit,x60
+   6: cpu@6      spacemit,x60
+   7: cpu@7      spacemit,x60
+   => test
+   => 

trailing whitespace

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +1 -0
+
doc/board/spacemit/index.rst new file +3 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3fb7d804ac8fc8dd4c7ee67ffc877f9ad323162d
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+SpacemiT
Quoted 8 lines
Quoted 8 lines

doc/board/spacemit/index.rst line 8

Quoted 6 lines
doc/board/spacemit/index.rst new file +5 -0
+========
+.. toctree::
+   :maxdepth: 1
+
+   bananapi-f3

new blank line at EOF

Thanks!

Cheers

Marcel

Quoted 1 line
author
#6 lore raw

Re: [PATCH v4 2/2] doc: spacemit: bananapi_f3: document Banana Pi F3 board

Quoted 81 lines · Marcel Ziswiler

Hi Yixun Lan

Quoted 50 lines · Yixun Lan

Hi Marcel, Huan

Quoted 47 lines · Marcel Ziswiler

Hi Huan Zhou

Quoted 30 lines · Huan Zhou

From: Kongyang Liu <[email protected]>

Add document for Banana Pi F3 board which based on SpacemiT's K1 SoC.

---
 doc/board/index.rst                |  1 + doc/board/spacemit/bananapi-f3.rst | 86 ++++++++++++++++++++++++++++++++++++++ doc/board/spacemit/index.rst       |  8 ++++

 3 files changed, 95 insertions(+)
doc/board/index.rst +0 -0
index 417c128c7af6ad2267ef1bc743c7f10ae70b6de7..367da2d62316d4cab25ecc53f852ef742eba13dd 100644
@@ -51,6 +51,7 @@ Board-specific doc

    sipeed/index
    socionext/index
    sophgo/index
+   spacemit/index
    st/index
    starfive/index
    ste/index

doc/board/spacemit/bananapi-f3.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1e6d6ef19be7e25684966bd4a727bd21b147330a

doc/board/spacemit/bananapi-f3.rst line 3

Quoted 3 lines
doc/board/spacemit/bananapi-f3.rst new file +3 -0
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Banana Pi F3

Officially they call it Banana Pi BPI-F3.

doc/board/spacemit/bananapi-f3.rst line 8

Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+============
+
+Building
+~~~~~~~~
+1. Install the spacemit riscv cross compile toolchain_, or skip it if riscv toolchain is installed.

I would not use a specific such toolchain but rather a regular RISC-V one e.g.

Quoted 5 lines
Quoted 2 lines

https://github.com/riscv-collab/riscv-gnu-toolchain

I think any riscv toolchain should work fine here, as I'm using Gentoo specific riscv toolchain.. so consider it's merely an example provided to demonstrate whole process working

Okay.

Quoted 20 lines
Quoted 20 lines
Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+
+.. _toolchain: https://archive.spacemit.com/toolchain/
+
+2. Setup cross compilation environment variable:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 25

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   export CROSS_COMPILE=<riscv64 toolchain prefix, e.g /opt/spacemit/bin/riscv64-unknown-linux-gnu->
+
+3. Before building U-Boot, OpenSBI should be built first. OpenSBI can be
+built for SpacemiT K1 SoC as below:
+
+.. code-block:: console
+
+   git clone https://github.com/cyyself/opensbi -b k1-opensbi
+   cd opensbi
+   make PLATFORM=generic

What speaks against using regular master opensbi?

Quoted 4 lines
Quoted 1 line

no idea if master of opensbi would work here, we can certainly try..

I tried and it seems to work fine, resp. the only difference I could spot is that instead of 'crc32+ OK' it prints some random ASCII characters in the last line before any U-Boot output:

do you mean the extra '\n'?

Quoted 6 lines
[   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK
Quoted 1 line

but I think it's another story, as we are focusing on mainlining uboot

Yes, exactly. I am just curious if it needs combining with some obscure vendor stuff.

the spl phase need some obscure vendor stuff.

Quoted 56 lines
Quoted 56 lines

FWIK, this branch is generally same version as vendor opensbi, but slightly rebase to more recent opensbi version

Quoted 52 lines
Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+
+4. Then build U-Boot as following:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 40

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   cd <U-Boot-dir>
+   make bananapi-f3_defconfig
+   make OPENSBI=<OpenSBI-dir>/build/platform/generic/firmware/fw_dynamic.bin
+
+This will generate u-boot.itb
+
+Booting
+~~~~~~~
+Actually, we can replace the uboot part from bianbu linux which is the bsp_ to validate this patch,
+use `balena etcher` to burn the bianbu-minimal.img to the sd card, 

trailing whitespace

doc/board/spacemit/bananapi-f3.rst line 46

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+and replace the /dev/sdx4 where places the uboot_ with the `u-boot.itb` generated from this patch.
+
+.. _bsp: https://archive.spacemit.com/image/k1/version/bianbu/v2.0/
+.. _uboot: https://bianbu-linux.spacemit.com/en/device/boot#21-firmware-layout
+
+Sample boot log from Banana Pi F3 board

BPI-F3

Quoted 12 lines
doc/board/spacemit/bananapi-f3.rst new file +12 -0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. code-block:: none
+
+   try sd...
+   bm:3
+   j...
+
+   U-Boot SPL 2022.10spacemit-dirty (Oct 21 2024 - 09:01:13 +0000)
+   [   0.279] DDR type LPDDR4X
+   [   0.292] lpddr4_silicon_init consume 13ms
+   [   0.293] Change DDR data rate to 2400MT/s
+   [   0.430] ## Checking hash(es) for config conf-1 ... OK

doc/board/spacemit/bananapi-f3.rst line 68

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   [   0.432] ## Checking hash(es) for Image opensbi ... OK
+   [   0.437] ## Checking hash(es) for Image uboot ... OK
+   [   0.443] ## Checking hash(es) for Image fdt-1 ... OK
+   [   0.488] ## Checking hash(es) for config config_1 ... OK
+   [   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK
+
+
+   U-Boot 2024.10-rc4-00462-g5b138cfcc587-dirty (Nov 28 2024 - 14:56:49 +0800)
+
+   DRAM:  4 GiB

I guess it does not yet detect the amount of RAM available.

Quoted 43 lines
Quoted 2 lines

I would be fine with this, as currently the memory size is hardcoded, we should work on follow-up patch to auto probe DDR size, and corret it

Yes, I agree.

Quoted 38 lines
Quoted 38 lines
Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+   Core:  19 devices, 8 uclasses, devicetree: separate
+   Loading Environment from nowhere... OK
+   In:    serial@d4017000
+   Out:   serial@d4017000
+   Err:   serial@d4017000
+   Net:   No ethernet found.
+   => cpu list

doc/board/spacemit/bananapi-f3.rst line 85

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   0: cpu@0      spacemit,x60
+   1: cpu@1      spacemit,x60
+   2: cpu@2      spacemit,x60
+   3: cpu@3      spacemit,x60
+   4: cpu@4      spacemit,x60
+   5: cpu@5      spacemit,x60
+   6: cpu@6      spacemit,x60
+   7: cpu@7      spacemit,x60
+   => test
+   => 

trailing whitespace

Quoted 8 lines
doc/board/spacemit/bananapi-f3.rst new file +1 -0
+
doc/board/spacemit/index.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3fb7d804ac8fc8dd4c7ee67ffc877f9ad323162d

doc/board/spacemit/index.rst line 8

Quoted 8 lines
doc/board/spacemit/index.rst new file +8 -0
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+SpacemiT
+========
+.. toctree::
+   :maxdepth: 1
+
+   bananapi-f3

new blank line at EOF

fixed.

Quoted 7 lines

Thanks!

Cheers

Marcel

Quoted 1 line
#7 lore raw

Re: [PATCH v4 2/2] doc: spacemit: bananapi_f3: document Banana Pi F3 board

Hi Huan

Quoted 82 lines · Huan Zhou
Quoted 81 lines · Marcel Ziswiler

Hi Yixun Lan

Quoted 50 lines · Yixun Lan

Hi Marcel, Huan

Quoted 47 lines · Marcel Ziswiler

Hi Huan Zhou

Quoted 30 lines · Huan Zhou

From: Kongyang Liu <[email protected]>

Add document for Banana Pi F3 board which based on SpacemiT's K1 SoC.

---
 doc/board/index.rst                |  1 + doc/board/spacemit/bananapi-f3.rst | 86 ++++++++++++++++++++++++++++++++++++++ doc/board/spacemit/index.rst       |  8 ++++

 3 files changed, 95 insertions(+)
doc/board/index.rst +0 -0
index 417c128c7af6ad2267ef1bc743c7f10ae70b6de7..367da2d62316d4cab25ecc53f852ef742eba13dd 100644
@@ -51,6 +51,7 @@ Board-specific doc

    sipeed/index
    socionext/index
    sophgo/index
+   spacemit/index
    st/index
    starfive/index
    ste/index

doc/board/spacemit/bananapi-f3.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1e6d6ef19be7e25684966bd4a727bd21b147330a

doc/board/spacemit/bananapi-f3.rst line 3

Quoted 3 lines
doc/board/spacemit/bananapi-f3.rst new file +3 -0
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Banana Pi F3

Officially they call it Banana Pi BPI-F3.

doc/board/spacemit/bananapi-f3.rst line 8

Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+============
+
+Building
+~~~~~~~~
+1. Install the spacemit riscv cross compile toolchain_, or skip it if riscv toolchain is installed.

I would not use a specific such toolchain but rather a regular RISC-V one e.g.

Quoted 5 lines
Quoted 2 lines

https://github.com/riscv-collab/riscv-gnu-toolchain

I think any riscv toolchain should work fine here, as I'm using Gentoo specific riscv toolchain.. so consider it's merely an example provided to demonstrate whole process working

Okay.

Quoted 20 lines
Quoted 20 lines
Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+
+.. _toolchain: https://archive.spacemit.com/toolchain/
+
+2. Setup cross compilation environment variable:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 25

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   export CROSS_COMPILE=<riscv64 toolchain prefix, e.g /opt/spacemit/bin/riscv64-unknown-linux-gnu->
+
+3. Before building U-Boot, OpenSBI should be built first. OpenSBI can be
+built for SpacemiT K1 SoC as below:
+
+.. code-block:: console
+
+   git clone https://github.com/cyyself/opensbi -b k1-opensbi
+   cd opensbi
+   make PLATFORM=generic

What speaks against using regular master opensbi?

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

no idea if master of opensbi would work here, we can certainly try..

I tried and it seems to work fine, resp. the only difference I could spot is that instead of 'crc32+ OK' it prints some random ASCII characters in the last line before any U-Boot output:

do you mean the extra '\n'?

No, it literally printed some random chars, but now it seems fine. Probably some unrelated glitch maybe UART related.

Actually, one out of five to ten boots it prints such random chars: �,��&�%Hj�H�

I tried cyyself opensbi again and after 10 boots it also printed similar random chars. Actually, it even always prints the exact same ones when it happens. I guess, sooner than later, somebody might need to debug into what exactly is happening there (;-p).

[   0.579] ## Checking hash(es) for Image opensbi ...�,��&�%Hj�H�

Anyway, regular upstream opensbi seems to work just fine, good.

Quoted 6 lines
Quoted 5 lines

[   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK

Quoted 1 line

but I think it's another story, as we are focusing on mainlining uboot

Yes, exactly. I am just curious if it needs combining with some obscure vendor stuff.

the spl phase need some obscure vendor stuff.

Sure, but I hope we can still upstream it after this first part landed.

Quoted 98 lines
Quoted 55 lines
Quoted 55 lines

FWIK, this branch is generally same version as vendor opensbi, but slightly rebase to more recent opensbi version

Quoted 52 lines
Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+
+4. Then build U-Boot as following:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 40

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   cd <U-Boot-dir>
+   make bananapi-f3_defconfig
+   make OPENSBI=<OpenSBI-dir>/build/platform/generic/firmware/fw_dynamic.bin
+
+This will generate u-boot.itb
+
+Booting
+~~~~~~~
+Actually, we can replace the uboot part from bianbu linux which is the bsp_ to validate this patch,
+use `balena etcher` to burn the bianbu-minimal.img to the sd card, 

trailing whitespace

doc/board/spacemit/bananapi-f3.rst line 46

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+and replace the /dev/sdx4 where places the uboot_ with the `u-boot.itb` generated from this patch.
+
+.. _bsp: https://archive.spacemit.com/image/k1/version/bianbu/v2.0/
+.. _uboot: https://bianbu-linux.spacemit.com/en/device/boot#21-firmware-layout
+
+Sample boot log from Banana Pi F3 board

BPI-F3

Quoted 12 lines
doc/board/spacemit/bananapi-f3.rst new file +12 -0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. code-block:: none
+
+   try sd...
+   bm:3
+   j...
+
+   U-Boot SPL 2022.10spacemit-dirty (Oct 21 2024 - 09:01:13 +0000)
+   [   0.279] DDR type LPDDR4X
+   [   0.292] lpddr4_silicon_init consume 13ms
+   [   0.293] Change DDR data rate to 2400MT/s
+   [   0.430] ## Checking hash(es) for config conf-1 ... OK

doc/board/spacemit/bananapi-f3.rst line 68

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   [   0.432] ## Checking hash(es) for Image opensbi ... OK
+   [   0.437] ## Checking hash(es) for Image uboot ... OK
+   [   0.443] ## Checking hash(es) for Image fdt-1 ... OK
+   [   0.488] ## Checking hash(es) for config config_1 ... OK
+   [   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK
+
+
+   U-Boot 2024.10-rc4-00462-g5b138cfcc587-dirty (Nov 28 2024 - 14:56:49 +0800)
+
+   DRAM:  4 GiB

I guess it does not yet detect the amount of RAM available.

Quoted 43 lines
Quoted 2 lines

I would be fine with this, as currently the memory size is hardcoded, we should work on follow-up patch to auto probe DDR size, and corret it

Yes, I agree.

Quoted 38 lines
Quoted 38 lines
Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+   Core:  19 devices, 8 uclasses, devicetree: separate
+   Loading Environment from nowhere... OK
+   In:    serial@d4017000
+   Out:   serial@d4017000
+   Err:   serial@d4017000
+   Net:   No ethernet found.
+   => cpu list

doc/board/spacemit/bananapi-f3.rst line 85

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   0: cpu@0      spacemit,x60
+   1: cpu@1      spacemit,x60
+   2: cpu@2      spacemit,x60
+   3: cpu@3      spacemit,x60
+   4: cpu@4      spacemit,x60
+   5: cpu@5      spacemit,x60
+   6: cpu@6      spacemit,x60
+   7: cpu@7      spacemit,x60
+   => test
+   => 

trailing whitespace

Quoted 8 lines
doc/board/spacemit/bananapi-f3.rst new file +1 -0
+
doc/board/spacemit/index.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3fb7d804ac8fc8dd4c7ee67ffc877f9ad323162d

doc/board/spacemit/index.rst line 8

Quoted 8 lines
doc/board/spacemit/index.rst new file +8 -0
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+SpacemiT
+========
+.. toctree::
+   :maxdepth: 1
+
+   bananapi-f3

new blank line at EOF

Quoted 1 line

fixed.

Thanks!

Cheers

Marcel

Signature · 4 lines
Marcel Ziswiler         | mailto:[email protected]
Chäppelirain 4          | https://www.ziswiler.net
CH-6018 Buttisholz      | mobile: +41 (76) 338-0382
Switzerland             | phone: +41 (41) 928-0509
author
#8 lore raw

Re: [PATCH v4 2/2] doc: spacemit: bananapi_f3: document Banana Pi F3 board

Quoted 85 lines · Marcel Ziswiler

Hi Huan

Quoted 82 lines · Huan Zhou
Quoted 81 lines · Marcel Ziswiler

Hi Yixun Lan

Quoted 50 lines · Yixun Lan

Hi Marcel, Huan

Quoted 47 lines · Marcel Ziswiler

Hi Huan Zhou

Quoted 30 lines · Huan Zhou

From: Kongyang Liu <[email protected]>

Add document for Banana Pi F3 board which based on SpacemiT's K1 SoC.

---
 doc/board/index.rst                |  1 + doc/board/spacemit/bananapi-f3.rst | 86 ++++++++++++++++++++++++++++++++++++++ doc/board/spacemit/index.rst       |  8 ++++

 3 files changed, 95 insertions(+)
doc/board/index.rst +0 -0
index 417c128c7af6ad2267ef1bc743c7f10ae70b6de7..367da2d62316d4cab25ecc53f852ef742eba13dd 100644
@@ -51,6 +51,7 @@ Board-specific doc

    sipeed/index
    socionext/index
    sophgo/index
+   spacemit/index
    st/index
    starfive/index
    ste/index

doc/board/spacemit/bananapi-f3.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1e6d6ef19be7e25684966bd4a727bd21b147330a

doc/board/spacemit/bananapi-f3.rst line 3

Quoted 3 lines
doc/board/spacemit/bananapi-f3.rst new file +3 -0
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Banana Pi F3

Officially they call it Banana Pi BPI-F3.

doc/board/spacemit/bananapi-f3.rst line 8

Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+============
+
+Building
+~~~~~~~~
+1. Install the spacemit riscv cross compile toolchain_, or skip it if riscv toolchain is installed.

I would not use a specific such toolchain but rather a regular RISC-V one e.g.

Quoted 5 lines
Quoted 2 lines

https://github.com/riscv-collab/riscv-gnu-toolchain

I think any riscv toolchain should work fine here, as I'm using Gentoo specific riscv toolchain.. so consider it's merely an example provided to demonstrate whole process working

Okay.

Quoted 20 lines
Quoted 20 lines
Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+
+.. _toolchain: https://archive.spacemit.com/toolchain/
+
+2. Setup cross compilation environment variable:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 25

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   export CROSS_COMPILE=<riscv64 toolchain prefix, e.g /opt/spacemit/bin/riscv64-unknown-linux-gnu->
+
+3. Before building U-Boot, OpenSBI should be built first. OpenSBI can be
+built for SpacemiT K1 SoC as below:
+
+.. code-block:: console
+
+   git clone https://github.com/cyyself/opensbi -b k1-opensbi
+   cd opensbi
+   make PLATFORM=generic

What speaks against using regular master opensbi?

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

no idea if master of opensbi would work here, we can certainly try..

I tried and it seems to work fine, resp. the only difference I could spot is that instead of 'crc32+ OK' it prints some random ASCII characters in the last line before any U-Boot output:

do you mean the extra '\n'?

No, it literally printed some random chars, but now it seems fine. Probably some unrelated glitch maybe UART related.

i think it may be your baud rate setting problem?
I use xshell and the baud rate is set to 115200 and the random char issue never happens to me.

Quoted 130 lines

Actually, one out of five to ten boots it prints such random chars: �,��&�%Hj�H�

I tried cyyself opensbi again and after 10 boots it also printed similar random chars. Actually, it even always prints the exact same ones when it happens. I guess, sooner than later, somebody might need to debug into what exactly is happening there (;-p).

[   0.579] ## Checking hash(es) for Image opensbi ...�,��&�%Hj�H�

Anyway, regular upstream opensbi seems to work just fine, good.

Quoted 6 lines
Quoted 5 lines

[   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK

Quoted 1 line

but I think it's another story, as we are focusing on mainlining uboot

Yes, exactly. I am just curious if it needs combining with some obscure vendor stuff.

the spl phase need some obscure vendor stuff.

Sure, but I hope we can still upstream it after this first part landed.

Quoted 98 lines
Quoted 55 lines
Quoted 55 lines

FWIK, this branch is generally same version as vendor opensbi, but slightly rebase to more recent opensbi version

Quoted 52 lines
Quoted 5 lines
doc/board/spacemit/bananapi-f3.rst new file +5 -0
+
+4. Then build U-Boot as following:
+
+.. code-block:: console
+

doc/board/spacemit/bananapi-f3.rst line 40

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   cd <U-Boot-dir>
+   make bananapi-f3_defconfig
+   make OPENSBI=<OpenSBI-dir>/build/platform/generic/firmware/fw_dynamic.bin
+
+This will generate u-boot.itb
+
+Booting
+~~~~~~~
+Actually, we can replace the uboot part from bianbu linux which is the bsp_ to validate this patch,
+use `balena etcher` to burn the bianbu-minimal.img to the sd card, 

trailing whitespace

doc/board/spacemit/bananapi-f3.rst line 46

Quoted 6 lines
doc/board/spacemit/bananapi-f3.rst new file +6 -0
+and replace the /dev/sdx4 where places the uboot_ with the `u-boot.itb` generated from this patch.
+
+.. _bsp: https://archive.spacemit.com/image/k1/version/bianbu/v2.0/
+.. _uboot: https://bianbu-linux.spacemit.com/en/device/boot#21-firmware-layout
+
+Sample boot log from Banana Pi F3 board

BPI-F3

Quoted 12 lines
doc/board/spacemit/bananapi-f3.rst new file +12 -0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. code-block:: none
+
+   try sd...
+   bm:3
+   j...
+
+   U-Boot SPL 2022.10spacemit-dirty (Oct 21 2024 - 09:01:13 +0000)
+   [   0.279] DDR type LPDDR4X
+   [   0.292] lpddr4_silicon_init consume 13ms
+   [   0.293] Change DDR data rate to 2400MT/s
+   [   0.430] ## Checking hash(es) for config conf-1 ... OK

doc/board/spacemit/bananapi-f3.rst line 68

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   [   0.432] ## Checking hash(es) for Image opensbi ... OK
+   [   0.437] ## Checking hash(es) for Image uboot ... OK
+   [   0.443] ## Checking hash(es) for Image fdt-1 ... OK
+   [   0.488] ## Checking hash(es) for config config_1 ... OK
+   [   0.490] ## Checking hash(es) for Image opensbi ... crc32+ OK
+
+
+   U-Boot 2024.10-rc4-00462-g5b138cfcc587-dirty (Nov 28 2024 - 14:56:49 +0800)
+
+   DRAM:  4 GiB

I guess it does not yet detect the amount of RAM available.

Quoted 43 lines
Quoted 2 lines

I would be fine with this, as currently the memory size is hardcoded, we should work on follow-up patch to auto probe DDR size, and corret it

Yes, I agree.

Quoted 38 lines
Quoted 38 lines
Quoted 7 lines
doc/board/spacemit/bananapi-f3.rst new file +7 -0
+   Core:  19 devices, 8 uclasses, devicetree: separate
+   Loading Environment from nowhere... OK
+   In:    serial@d4017000
+   Out:   serial@d4017000
+   Err:   serial@d4017000
+   Net:   No ethernet found.
+   => cpu list

doc/board/spacemit/bananapi-f3.rst line 85

Quoted 10 lines
doc/board/spacemit/bananapi-f3.rst new file +10 -0
+   0: cpu@0      spacemit,x60
+   1: cpu@1      spacemit,x60
+   2: cpu@2      spacemit,x60
+   3: cpu@3      spacemit,x60
+   4: cpu@4      spacemit,x60
+   5: cpu@5      spacemit,x60
+   6: cpu@6      spacemit,x60
+   7: cpu@7      spacemit,x60
+   => test
+   => 

trailing whitespace

Quoted 8 lines
doc/board/spacemit/bananapi-f3.rst new file +1 -0
+
doc/board/spacemit/index.rst new file +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3fb7d804ac8fc8dd4c7ee67ffc877f9ad323162d

doc/board/spacemit/index.rst line 8

Quoted 8 lines
doc/board/spacemit/index.rst new file +8 -0
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+SpacemiT
+========
+.. toctree::
+   :maxdepth: 1
+
+   bananapi-f3

new blank line at EOF

Quoted 1 line

fixed.

Thanks!

Cheers

Marcel

Signature · 4 lines
Marcel Ziswiler         | mailto:[email protected]
Chäppelirain 4          | https://www.ziswiler.net
CH-6018 Buttisholz      | mobile: +41 (76) 338-0382
Switzerland             | phone: +41 (41) 928-0509
#9 lore raw

Re: [PATCH v4 2/2] doc: spacemit: bananapi_f3: document Banana Pi F3 board

Hi Huan

Quoted 1 line · Huan Zhou

On Wed, Dec 11, 2024 at 09:35:12AM +0100, Marcel Ziswiler wrote:

[snap]

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

I tried and it seems to work fine, resp. the only difference I could spot is that instead of 'crc32+ OK' it
prints some random ASCII characters in the last line before any U-Boot output:

do you mean the extra '\n'?

No, it literally printed some random chars, but now it seems fine. Probably some unrelated glitch maybe UART
related.

i think it may be your baud rate setting problem?
I use xshell and the baud rate is set to 115200 and the random char issue never happens to me.

Yes, could indeed be. However, I do use a quality FTDI FT232R with proper voltage-level translation circuitry and also set it to 115200 baud. If I get time I will hook up my scope to see what that tells us.

Quoted 11 lines
Quoted 11 lines

Actually, one out of five to ten boots it prints such random chars: �,��&�%Hj�H�

I tried cyyself opensbi again and after 10 boots it also printed similar random chars. Actually, it even always
prints the exact same ones when it happens. I guess, sooner than later, somebody might need to debug into what
exactly is happening there (;-p).

[   0.579] ## Checking hash(es) for Image opensbi ...�,��&�%Hj�H�

Anyway, regular upstream opensbi seems to work just fine, good.

[snap]

Thanks!

Cheers

Marcel

Tested-by on the v4 series
#10 lore raw
In reply to Huan Zhou

Hi Huan Zhou

Thanks for taking this one step further.

Quoted 3 lines · Huan Zhou

Banana Pi F3 board is a industrial grade RISC-V development board, it design with SpacemiT K1 8 core RISC-V chip, CPU integrates 2.0 TOPs AI computing power. 4G DDR and 16G eMMC onboard.

There are also variants with different sizes of DDR and/or eMMC available. I do e.g. have one with 16 GB DDR and 128 GB eMMC.

Quoted 6 lines

2x GbE Ethernet port, 4x USB
3.0 and PCIe for M.2 interface, support HDMI and Dual MIPI-CSI Camera.

This patch introduces fundamental support for the Banana Pi F3 board, encompassing UART, CPU, and PLIC support. This ensures that U-Boot can operate in serial console mode.

I have only some minor comments on the second patch (see separate email).

Plus you could mention that this patch set is against the top of the riscv custodian's next branch.

Quoted 20 lines

Changes in v4:
- Change uart compatible in k1.dtsi in v3, cause related driver in not implemented in u-boot.
- Update doc, show how to validate the patch.
- Update maintainer, remove kongyang cause he lefted.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Add base commit
- Clear redifinition warning while building in UART_IIR_ID
- Change underscore to dash in bananapi*f3
- Update maintainer
- link to v2 https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
- Change license to GPL-2.0-or-later
- Add memory node for dts
- Add ft_board_setup function for kernel memory init
- Use default prompt
- links to v1 https://lore.kernel.org/u-boot/[email protected]/

Quoted 2 lines

Whole series

Quoted 22 lines

---
Kongyang Liu (2):
      riscv: spacemit: bananapi_f3: initial support added
      doc: spacemit: bananapi_f3: document Banana Pi F3 board

 arch/riscv/Kconfig                     |   5 + arch/riscv/cpu/k1/Kconfig              |  18 ++ arch/riscv/cpu/k1/Makefile             |   6 + arch/riscv/cpu/k1/cpu.c                |   9 + arch/riscv/cpu/k1/dram.c               |  54 ++++ arch/riscv/dts/Makefile                |   1 + arch/riscv/dts/k1-bananapi-f3.dts      |  25 ++ arch/riscv/dts/k1.dtsi                 | 459 +++++++++++++++++++++++++++++++++ board/spacemit/bananapi-f3/Kconfig     |  25 ++ board/spacemit/bananapi-f3/MAINTAINERS |   6 + board/spacemit/bananapi-f3/Makefile    |   5 + board/spacemit/bananapi-f3/board.c     |   9 + configs/bananapi-f3_defconfig          |  20 ++ doc/board/index.rst                    |   1 + doc/board/spacemit/bananapi-f3.rst     |  86 ++++++ doc/board/spacemit/index.rst           |   8 + include/configs/bananapi-f3.h          |  13 +

Quoted 6 lines
 17 files changed, 750 insertions(+)

---
base-commit: 40c45a57974bdb09fffa31dde65ddf69e5de53eb
change-id: 20241112-pickup-bpif3-245ab208b9a4

Best regards,

Cheers

Marcel