Skip to contentSkip to conversation

add initial Milk-V Duo S board support

PATCH Superseded [email protected] 6 participants 15 messages Apr 17, 2024 – Apr 23, 2024

Subsystems (3)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover add initial Milk-V Duo S board support

From: Michael Opdenacker <[email protected]>

This adds an initial device tree for the Milk-V Duo S board. Last tested on linux-next on April 17, 2024.

- Changes in V5
- Fix the commit message describing the board DTS. MMC is not supported yet.

- Changes in V4
- Remove mmc device (&sdhci0) as not working yet with linux-next
- Use "sophgo,cv1812h" compatible as on the Huashan Pi board. Should I call the DTS cv1812h-milkv-duos.dts instead of sg2000-milkv-duos.dts?

- Changes in V3
- Fix enum in devicetree/bindings/riscv/sophgo.yaml

- Changes in V2:
- Add a first patch to register the new compatible string for this board.
- Use a correct SoC compatible string
- Add "disable-wp" (disable write protect) property to enable write access to the external SD card.

Michael Opdenacker (2):
dt-bindings: riscv: add Milk-V Duo S board compatibles
riscv: dts: sophgo: add initial Milk-V Duo S board support

 .../devicetree/bindings/riscv/sophgo.yaml     |  1 +
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
Signature · 7 lines
2.34.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw

PATCH v5 1/2 dt-bindings: riscv: add Milk-V Duo S board compatibles

From: Michael Opdenacker <[email protected]>

Document the compatible strings for the Milk-V Duo S board[1] which uses the SOPHGO SG2000 SoC, compatible with the SOPHGO CV1800B SoC[2].

---
 Documentation/devicetree/bindings/riscv/sophgo.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/riscv/sophgo.yaml +1 -0
index 9bc813dad098..1837bc550056 100644
@@ -21,6 +21,7 @@ properties:
       - items:
           - enum:
               - milkv,duo
+              - milkv,duos
           - const: sophgo,cv1800b
       - items:
           - enum:
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v5 1/2] dt-bindings: riscv: add Milk-V Duo S board compatibles

Quoted 18 lines · On Wed, Apr 17, 2024 at 08:53:10AM GMT, [email protected] wrote:

From: Michael Opdenacker <[email protected]>

Document the compatible strings for the Milk-V Duo S board[1] which uses the SOPHGO SG2000 SoC, compatible with the SOPHGO CV1800B SoC[2].

---
 Documentation/devicetree/bindings/riscv/sophgo.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/riscv/sophgo.yaml +0 -0
index 9bc813dad098..1837bc550056 100644

Documentation/devicetree/bindings/riscv/sophgo.yaml properties: · line 24

Quoted 4 lines
Documentation/devicetree/bindings/riscv/sophgo.yaml +1 -0
@@ -21,6 +21,7 @@ properties:
       - items:
           - enum:
               - milkv,duo
+              - milkv,duos

Please ADD CPU COMPATIBLE, AND NOT JUST USE CV1800B. I do not want to say this again.

Quoted 6 lines
Documentation/devicetree/bindings/riscv/sophgo.yaml +0 -0
           - const: sophgo,cv1800b
       - items:
           - enum:
Signature · 1 line
2.34.1
#3 lore raw

PATCH v5 2/2 riscv: dts: sophgo: add initial Milk-V Duo S board support

In reply to [email protected]

From: Michael Opdenacker <[email protected]>

This adds initial support for the Milk-V Duo S board
(https://milkv.io/duo-s), enabling the serial port, making it possible to boot Linux to the command line.

---
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6..e008acb5240f 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) += sg2000-milkv-duos.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +34 -0
new file mode 100644
index 000000000000..c1ecf97d5e93
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1812h.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,cv1812h";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};
+};
+
+&osc {
+	clock-frequency = <25000000>;
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v5 2/2] riscv: dts: sophgo: add initial Milk-V Duo S board support

Quoted 46 lines · On Wed, Apr 17, 2024 at 08:53:11AM GMT, [email protected] wrote:

From: Michael Opdenacker <[email protected]>

This adds initial support for the Milk-V Duo S board
(https://milkv.io/duo-s), enabling the serial port, making it possible to boot Linux to the command line.

---
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6..e008acb5240f 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) += sg2000-milkv-duos.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +15 -0
new file mode 100644
index 000000000000..c1ecf97d5e93
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1812h.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,cv1812h";
+
+	aliases {
+		serial0 = &uart0;

arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts line 25

Quoted 10 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +10 -0
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};

Add a cpu specific file, and move this to it.

Quoted 12 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +9 -0
+};
+
+&osc {
+	clock-frequency = <25000000>;
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.34.1

Add necessary DT node in the cpu specific file. (clint, plic and clk). You also need to rebase your patch based on sophgo/for-next.

#5 lore raw

Re: [PATCH v5 2/2] riscv: dts: sophgo: add initial Milk-V Duo S board support

Quoted 51 lines · Inochi Amaoto
Quoted 50 lines · On Wed, Apr 17, 2024 at 08:53:11AM GMT, [email protected] wrote:

From: Michael Opdenacker <[email protected]>

This adds initial support for the Milk-V Duo S board
(https://milkv.io/duo-s), enabling the serial port, making it possible to boot Linux to the command line.

---
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6..e008acb5240f 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) += sg2000-milkv-duos.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +19 -0
new file mode 100644
index 000000000000..c1ecf97d5e93
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1812h.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,cv1812h";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
Quoted 8 lines

arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts line 25

Quoted 6 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +6 -0
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};

Add a cpu specific file, and move this to it.

I take it that the memory is integrated into the package then?

#6 lore raw

Re: [PATCH v5 2/2] riscv: dts: sophgo: add initial Milk-V Duo S board support

Quoted 61 lines · Conor Dooley
Quoted 51 lines · Inochi Amaoto
Quoted 50 lines · On Wed, Apr 17, 2024 at 08:53:11AM GMT, [email protected] wrote:

From: Michael Opdenacker <[email protected]>

This adds initial support for the Milk-V Duo S board
(https://milkv.io/duo-s), enabling the serial port, making it possible to boot Linux to the command line.

---
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6..e008acb5240f 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) += sg2000-milkv-duos.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +19 -0
new file mode 100644
index 000000000000..c1ecf97d5e93
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1812h.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,cv1812h";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
Quoted 8 lines

arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts line 25

Quoted 6 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +6 -0
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};

Add a cpu specific file, and move this to it.

Quoted 1 line

I take it that the memory is integrated into the package then?

Yes, of course.

#7 lore raw

Re: [PATCH v5 2/2] riscv: dts: sophgo: add initial Milk-V Duo S board support

In reply to Inochi Amaoto

Hi Inochi

Thanks for your advice!

Quoted 50 lines · Inochi Amaoto
Quoted 49 lines · On Wed, Apr 17, 2024 at 08:53:11AM GMT, [email protected] wrote:

From: Michael Opdenacker <[email protected]>

This adds initial support for the Milk-V Duo S board
(https://milkv.io/duo-s), enabling the serial port, making it possible to boot Linux to the command line.

---
  arch/riscv/boot/dts/sophgo/Makefile           |  1 +
  .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
  2 files changed, 35 insertions(+)

create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts

arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6..e008acb5240f 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) += sg2000-milkv-duos.dtb
  dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +18 -0
new file mode 100644
index 000000000000..c1ecf97d5e93
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1812h.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,cv1812h";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
Quoted 8 lines

arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts line 25

Quoted 7 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +7 -0
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};

Add a cpu specific file, and move this to it.

Now that I'm including "cv1812h.dtsi", which has the same structure, all I need is to change the reg setting to have 512 MB of RAM instead of 256MB, right? See the V6 I'm sending soon.

Quoted 16 lines
Quoted 13 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +9 -0
+};
+
+&osc {
+	clock-frequency = <25000000>;
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.34.1

Add necessary DT node in the cpu specific file. (clint, plic and clk). You also need to rebase your patch based on sophgo/for-next.

Same here, cv1812h.dtsi already configures &clint, &plic and &clk, so it seems to me I don't need to make changes again here. At least the board boots fine for me as it is. Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#8 lore raw

Re: [PATCH v5 2/2] riscv: dts: sophgo: add initial Milk-V Duo S board support

Quoted 64 lines · Michael Opdenacker

Hi Inochi

Thanks for your advice!

Quoted 50 lines · Inochi Amaoto
Quoted 49 lines · On Wed, Apr 17, 2024 at 08:53:11AM GMT, [email protected] wrote:

From: Michael Opdenacker <[email protected]>

This adds initial support for the Milk-V Duo S board
(https://milkv.io/duo-s), enabling the serial port, making it possible to boot Linux to the command line.

---
  arch/riscv/boot/dts/sophgo/Makefile           |  1 +
  .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
  2 files changed, 35 insertions(+)

create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts

arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6..e008acb5240f 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) += sg2000-milkv-duos.dtb
  dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +18 -0
new file mode 100644
index 000000000000..c1ecf97d5e93
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1812h.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,cv1812h";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
Quoted 8 lines

arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts line 25

Quoted 7 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +7 -0
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};

Add a cpu specific file, and move this to it.

Quoted 4 lines

Now that I'm including "cv1812h.dtsi", which has the same structure, all I need is to change the reg setting to have 512 MB of RAM instead of 256MB, right? See the V6 I'm sending soon.

No, Duo S does not use cv1812h, in any means. I just told you to use cv1812h for local test. If you want to upstream Duo S, you must add the right cpu compatibles and necessary nodes. These two are different things.

Quoted 30 lines
Quoted 16 lines
Quoted 13 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +9 -0
+};
+
+&osc {
+	clock-frequency = <25000000>;
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.34.1

Add necessary DT node in the cpu specific file. (clint, plic and clk). You also need to rebase your patch based on sophgo/for-next.

Same here, cv1812h.dtsi already configures &clint, &plic and &clk, so it seems to me I don't need to make changes again here. At least the board boots fine for me as it is.
Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

Re: [PATCH v5 2/2] riscv: dts: sophgo: add initial Milk-V Duo S board support

Hi Inochi,

Thanks for the advice.

Quoted 29 lines · Inochi Amaoto

On Sun, Apr 21, 2024 at 07:57:01AM GMT, Michael Opdenacker wrote:
+++ b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts

arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +25 -0
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1812h.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,cv1812h";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};
Quoted 1 line
Quoted 1 line

Add a cpu specific file, and move this to it.

Quoted 8 lines
Quoted 4 lines

Now that I'm including "cv1812h.dtsi", which has the same structure, all I need is to change the reg setting to have 512 MB of RAM instead of 256MB, right? See the V6 I'm sending soon.

No, Duo S does not use cv1812h, in any means. I just told you to use cv1812h for local test. If you want to upstream Duo S, you must add the right cpu compatibles and necessary nodes. These two are different things.

So, do you mean I should create a new "sophgo,sg2000" compatible, together with  a new "sg2000.dtsi" (or "sg200x.dtsi"?) file? Could this file include "cv18xx.dtsi"?

By the way, where's the best source of information about the Sophgo sg2000 and sg2002 processors? Even the Sophgo website doesn't seem to have them :-/ . It just mentions the CV18xx ones.

Thanks again
Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#10 lore raw

Re: [PATCH v5 2/2] riscv: dts: sophgo: add initial Milk-V Duo S board support

Hello Michael,

Quoted 1 line

By the way, where's the best source of information about the Sophgo sg2000 and sg2002 processors? Even the Sophgo website doesn't seem to have them :-/ . It just mentions the CV18xx ones.

The best source of information I found for the Sophgo SG2002 and SG200 is this Github repository from Sophgo :
https://github.com/sophgo/sophgo-doc
It contains the Technical Reference Manual for the Sophgo SG2000, SG2002 and SG2042.

#11 lore raw

Re: [PATCH v5 2/2] riscv: dts: sophgo: add initial Milk-V Duo S board support

In reply to Michael Opdenacker
Quoted 38 lines · Michael Opdenacker

Hi Inochi,

Thanks for the advice.

Quoted 33 lines · Inochi Amaoto

On Sun, Apr 21, 2024 at 07:57:01AM GMT, Michael Opdenacker wrote:
+++ b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts

arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts new file +25 -0
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1812h.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,cv1812h";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};
Quoted 5 lines
Quoted 1 line

Add a cpu specific file, and move this to it.

Now that I'm including "cv1812h.dtsi", which has the same structure, all I need is to change the reg setting to have 512 MB of RAM instead of 256MB, right? See the V6 I'm sending soon.

Quoted 9 lines
Quoted 4 lines

No, Duo S does not use cv1812h, in any means. I just told you to use cv1812h for local test. If you want to upstream Duo S, you must add the right cpu compatibles and necessary nodes. These two are different things.

So, do you mean I should create a new "sophgo,sg2000" compatible, together with  a new "sg2000.dtsi" (or "sg200x.dtsi"?) file? Could this file include "cv18xx.dtsi"?

Right. For the second question, it must. "cv18xx.dtsi" is the common file for the whole series. You can check the existed cpu file in sophgo upstream
repository: https://github.com/sophgo/linux/tree/for-next.

Quoted 4 lines

By the way, where's the best source of information about the Sophgo sg2000 and sg2002 processors? Even the Sophgo website doesn't seem to have them :-/ . It just mentions the CV18xx ones.

In additional to the doc mentioned by Thomas, I think you may need to check Duo docs from milkv: https://github.com/milkv-duo/duo-files. It contains all you need for Duo S.

Quoted 9 lines

Thanks again
Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#12 lore raw
In reply to [email protected]
Quoted 4 lines · michael.opdenacker@ wrote:

From: Michael Opdenacker <[email protected]>

This adds an initial device tree for the Milk-V Duo S board. Last tested on linux-next on April 17, 2024.

Hi Michael.

Sorry for the late reply. It seems to me like spaces are usually repaced by dashes (-'s) in device trees, so I would have expected milkv,duo-s and sg2000-milkv-duo-s.dts so it's not confused with a Milk-V Duos board.

/Emil

Quoted 31 lines

- Changes in V5
- Fix the commit message describing the board DTS. MMC is not supported yet.

- Changes in V4
- Remove mmc device (&sdhci0) as not working yet with linux-next
- Use "sophgo,cv1812h" compatible as on the Huashan Pi board. Should I call the DTS cv1812h-milkv-duos.dts instead of sg2000-milkv-duos.dts?

- Changes in V3
- Fix enum in devicetree/bindings/riscv/sophgo.yaml

- Changes in V2:
- Add a first patch to register the new compatible string for this board.
- Use a correct SoC compatible string
- Add "disable-wp" (disable write protect) property to enable write access to the external SD card.

Michael Opdenacker (2):
dt-bindings: riscv: add Milk-V Duo S board compatibles
riscv: dts: sophgo: add initial Milk-V Duo S board support

 .../devicetree/bindings/riscv/sophgo.yaml     |  1 +
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
Quoted 8 lines

--
2.34.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#13 lore raw

Hi Emil

Quoted 5 lines · Emil Renner Berthing
Quoted 4 lines · michael.opdenacker@ wrote:

From: Michael Opdenacker <[email protected]>

This adds an initial device tree for the Milk-V Duo S board. Last tested on linux-next on April 17, 2024.

Quoted 7 lines

Hi Michael.

Sorry for the late reply. It seems to me like spaces are usually repaced by dashes (-'s) in device trees, so I would have expected milkv,duo-s and sg2000-milkv-duo-s.dts so it's not confused with a Milk-V Duos board.

/Emil

Good to know, many thanks!
I've just done that in my V6 series.
Cheers
Michael.

Signature · 9 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer
#14 lore raw
In reply to [email protected]
Quoted 35 lines · On Wed, 17 Apr 2024 08:53:09 +0200, [email protected] wrote:

From: Michael Opdenacker <[email protected]>

This adds an initial device tree for the Milk-V Duo S board. Last tested on linux-next on April 17, 2024.

- Changes in V5
- Fix the commit message describing the board DTS. MMC is not supported yet.

- Changes in V4
- Remove mmc device (&sdhci0) as not working yet with linux-next
- Use "sophgo,cv1812h" compatible as on the Huashan Pi board. Should I call the DTS cv1812h-milkv-duos.dts instead of sg2000-milkv-duos.dts?

- Changes in V3
- Fix enum in devicetree/bindings/riscv/sophgo.yaml

- Changes in V2:
- Add a first patch to register the new compatible string for this board.
- Use a correct SoC compatible string
- Add "disable-wp" (disable write protect) property to enable write access to the external SD card.

Michael Opdenacker (2):
dt-bindings: riscv: add Milk-V Duo S board compatibles
riscv: dts: sophgo: add initial Milk-V Duo S board support

 .../devicetree/bindings/riscv/sophgo.yaml     |  1 +
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 34 +++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
Quoted 10 lines

--
2.34.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y sophgo/sg2000-milkv-duos.dtb' for [email protected]:

arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dtb: /: compatible: 'oneOf' conditional failed, one must be fixed:
'milkv,duos' is not one of ['sophgo,huashan-pi']
'milkv,duos' is not one of ['milkv,pioneer']
'sophgo,cv1800b' was expected
'sophgo,sg2042' was expected
from schema $id: http://devicetree.org/schemas/riscv/sophgo.yaml#

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv