Skip to contentSkip to conversation

Add board support for Sipeed LicheeRV Nano

PATCH Applied Thomas Bonnefille 3 participants 8 messages Oct 10, 2024 – Oct 28, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v5 cover Add board support for Sipeed LicheeRV Nano

The LicheeRV Nano is a RISC-V SBC based on the Sophgo SG2002 chip. Adds minimal device tree files for this board to make it boot to a basic shell.

---
Changes in v5:
- Add support for pinctrl
- Remove nodes for i2c0 and uart1
- Drop dt-bindings patch that are already applied
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Add correct bindings configuration for SG2002 sdhci
- Drop commit "dt-bindings: timer: Add SOPHGO SG2002 clint" because it has already been merged in Daniel Lezcano git tree.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Remove /dts-v1/ directive from sg2002.dtsi file
- Add disable-wp property to sdhci node to avoid having a write protected SD card
- Drop changes in cv18xx.dtsi and cv1800b.dtsi
- Add fallback compatible to cv1800b in SDHCI node of sg2002.dtsi
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Add SDHCI support
- Change device tree name to match the Makefile
- Add oscillator frequency
- Add aliases to other UARTs
- Add aliases to GPIOs
- Move compatible for SDHCI from common DT to specific DT
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Thomas Bonnefille (2):
riscv: dts: sophgo: Add initial SG2002 SoC device tree
riscv: dts: sophgo: Add LicheeRV Nano board device tree

 arch/riscv/boot/dts/sophgo/Makefile                |  1 +
 .../boot/dts/sophgo/sg2002-licheerv-nano-b.dts     | 95 ++++++++++++++++++++++
 arch/riscv/boot/dts/sophgo/sg2002.dtsi             | 42 ++++++++++
 3 files changed, 138 insertions(+)

---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20240515-sg2002-93dce1d263be

Best regards,

Signature · 1 line
Thomas Bonnefille <[email protected]>
#1 lore raw

PATCH v5 1/2 riscv: dts: sophgo: Add initial SG2002 SoC device tree

Add initial device tree for the SG2002 RISC-V SoC by SOPHGO.

---
The commit adding the bindings for the compatible "sophgo,sg2002-clint" has been applied to Daniel Lezcano git tree. This commit may trigger the bots because of this missing binding.

---
 arch/riscv/boot/dts/sophgo/sg2002.dtsi | 42 ++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
arch/riscv/boot/dts/sophgo/sg2002.dtsi new file +42 -0
new file mode 100644
index 0000000000000000000000000000000000000000..242fde84443f0d6a2c8476666dfa3d72727071b1
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Thomas Bonnefille <[email protected]>
+ */
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/pinctrl/pinctrl-sg2002.h>
+#include "cv18xx.dtsi"
+
+/ {
+	compatible = "sophgo,sg2002";
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x10000000>;
+	};
+
+	soc {
+		pinctrl: pinctrl@3008000 {
+			compatible = "sophgo,sg2002-pinctrl";
+			reg = <0x03001000 0x1000>,
+			      <0x05027000 0x1000>;
+			reg-names = "sys", "rtc";
+		};
+	};
+};
+
+&plic {
+	compatible = "sophgo,sg2002-plic", "thead,c900-plic";
+};
+
+&clint {
+	compatible = "sophgo,sg2002-clint", "thead,c900-clint";
+};
+
+&clk {
+	compatible = "sophgo,sg2000-clk";
+};
+
+&sdhci0 {
+	compatible = "sophgo,sg2002-dwcmshc";
+};
Signature · 1 line
2.47.0
#2 lore raw

Re: [PATCH v5 1/2] riscv: dts: sophgo: Add initial SG2002 SoC device tree

Hello, sorry for the double email.

Quoted 8 lines · Thomas Bonnefille

Add initial device tree for the SG2002 RISC-V SoC by SOPHGO.

---
The commit adding the bindings for the compatible "sophgo,sg2002-clint" has been applied to Daniel Lezcano git tree. This commit may trigger the bots because of this missing binding.
---

I wanted to say, that the comment above is no longer relevant because Daniel Lezcano's branch was applied in 6.11.

Best regards,
Thomas

#3 lore raw

Re: [PATCH v5 1/2] riscv: dts: sophgo: Add initial SG2002 SoC device tree

Quoted 5 lines · Thomas Bonnefille

Hello, sorry for the double email.

Quoted 2 lines · Thomas Bonnefille

Add initial device tree for the SG2002 RISC-V SoC by SOPHGO.

Quoted 8 lines
Quoted 6 lines

---
The commit adding the bindings for the compatible "sophgo,sg2002-clint" has been applied to Daniel Lezcano git tree. This commit may trigger the bots because of this missing binding.
---

I wanted to say, that the comment above is no longer relevant because Daniel Lezcano's branch was applied in 6.11.

OK, I will remove it when PR this patch.

Thanks,

Chen

Quoted 3 lines

Best regards,
Thomas

maintainer
#4 lore raw

Re: [PATCH v5 1/2] riscv: dts: sophgo: Add initial SG2002 SoC device tree

In reply to Thomas Bonnefille
Quoted 26 lines · Thomas Bonnefille

Add initial device tree for the SG2002 RISC-V SoC by SOPHGO.

---
The commit adding the bindings for the compatible "sophgo,sg2002-clint" has been applied to Daniel Lezcano git tree. This commit may trigger the bots because of this missing binding.

---
 arch/riscv/boot/dts/sophgo/sg2002.dtsi | 42 ++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
arch/riscv/boot/dts/sophgo/sg2002.dtsi new file +9 -0
new file mode 100644
index 0000000000000000000000000000000000000000..242fde84443f0d6a2c8476666dfa3d72727071b1
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Thomas Bonnefille <[email protected]>
+ */
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/pinctrl/pinctrl-sg2002.h>
+#include "cv18xx.dtsi"
+

arch/riscv/boot/dts/sophgo/sg2002.dtsi line 19

Quoted 10 lines
arch/riscv/boot/dts/sophgo/sg2002.dtsi new file +10 -0
+/ {
+	compatible = "sophgo,sg2002";
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x10000000>;
+	};
+
+	soc {
+		pinctrl: pinctrl@3008000 {

I got the following waring:
arch/riscv/boot/dts/sophgo/sg2002.dtsi:20.28-25.5: Warning (simple_bus_reg): /soc/pinctrl@3008000: simple-bus unit address format error, expected "3001000"

Could you send a fix patch?

Regards,
Inochi

Quoted 27 lines
arch/riscv/boot/dts/sophgo/sg2002.dtsi new file +23 -0
+			compatible = "sophgo,sg2002-pinctrl";
+			reg = <0x03001000 0x1000>,
+			      <0x05027000 0x1000>;
+			reg-names = "sys", "rtc";
+		};
+	};
+};
+
+&plic {
+	compatible = "sophgo,sg2002-plic", "thead,c900-plic";
+};
+
+&clint {
+	compatible = "sophgo,sg2002-clint", "thead,c900-clint";
+};
+
+&clk {
+	compatible = "sophgo,sg2000-clk";
+};
+
+&sdhci0 {
+	compatible = "sophgo,sg2002-dwcmshc";
+};
Signature · 2 lines
-- 
2.47.0
#5 lore raw

PATCH v5 2/2 riscv: dts: sophgo: Add LicheeRV Nano board device tree

In reply to Thomas Bonnefille

LicheeRV Nano B [1] is an embedded development platform based on the SOPHGO SG2002 chip, the B(ase) version is deprived of Wifi/Bluetooth and Ethernet.

Add only support for UART and SDHCI.

---
 arch/riscv/boot/dts/sophgo/Makefile                |  1 +
 .../boot/dts/sophgo/sg2002-licheerv-nano-b.dts     | 95 ++++++++++++++++++++++
 2 files changed, 96 insertions(+)
arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6fc25f72d0ade991e33feaa53266e..47d4243a8f35a7d5572dbf5ef9899297b908afde 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_SOPHGO) += cv1800b-milkv-duo.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += cv1812h-huashan-pi.dtb
+dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-licheerv-nano-b.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2002-licheerv-nano-b.dts new file +95 -0

95 lines not on this page · raw message

Signature · 1 line
2.47.0
maintainer Reviewed-by on the v5 series
#6 lore raw
In reply to Thomas Bonnefille
Quoted 44 lines · Thomas Bonnefille

The LicheeRV Nano is a RISC-V SBC based on the Sophgo SG2002 chip. Adds minimal device tree files for this board to make it boot to a basic shell.

---
Changes in v5:
- Add support for pinctrl
- Remove nodes for i2c0 and uart1
- Drop dt-bindings patch that are already applied
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Add correct bindings configuration for SG2002 sdhci
- Drop commit "dt-bindings: timer: Add SOPHGO SG2002 clint" because it has already been merged in Daniel Lezcano git tree.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Remove /dts-v1/ directive from sg2002.dtsi file
- Add disable-wp property to sdhci node to avoid having a write protected SD card
- Drop changes in cv18xx.dtsi and cv1800b.dtsi
- Add fallback compatible to cv1800b in SDHCI node of sg2002.dtsi
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Add SDHCI support
- Change device tree name to match the Makefile
- Add oscillator frequency
- Add aliases to other UARTs
- Add aliases to GPIOs
- Move compatible for SDHCI from common DT to specific DT
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Thomas Bonnefille (2):
riscv: dts: sophgo: Add initial SG2002 SoC device tree
riscv: dts: sophgo: Add LicheeRV Nano board device tree

 arch/riscv/boot/dts/sophgo/Makefile                |  1 +
 .../boot/dts/sophgo/sg2002-licheerv-nano-b.dts     | 95 ++++++++++++++++++++++
 arch/riscv/boot/dts/sophgo/sg2002.dtsi             | 42 ++++++++++
 3 files changed, 138 insertions(+)
Quoted 8 lines

---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20240515-sg2002-93dce1d263be

Best regards,

Signature · 1 line
Thomas Bonnefille <[email protected]>

LGTM.

maintainer Applied
#7 lore raw
In reply to Thomas Bonnefille
Quoted 5 lines · Thomas Bonnefille

The LicheeRV Nano is a RISC-V SBC based on the Sophgo SG2002 chip. Adds minimal device tree files for this board to make it boot to a basic shell.

Applied to for-next, thanks!

[1/2] riscv: dts: sophgo: Add initial SG2002 SoC device tree

      https://github.com/sophgo/linux/commit/93b61555f5095a44fe00df27399270867fbf278a
[2/2] riscv: dts: sophgo: Add LicheeRV Nano board device tree
      https://github.com/sophgo/linux/commit/d32552307b6c526aa75a9f9a0ea29a4a7f1746b9

Thanks,
Inochi