Skip to contentSkip to conversation

riscv: dts: sophgo: add initial Milk-V Duo S board device tree

PATCH In review [email protected] 6 participants 13 messages Apr 9, 2024 – Apr 11, 2024

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

PATCH 1/1 riscv: dts: sophgo: add initial Milk-V Duo S board device tree

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 and read-only SD card support, allowing to boot Linux to the command line.

---

Tested with linux-next as of Apr 9, 2024,
using the risc-v "defconfig" configuration.

---
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 38 +++++++++++++++++++
 2 files changed, 39 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 +38 -0
new file mode 100644
index 000000000000..cf2cec3cc369
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1800b.dtsi"
+
+/ {
+	model = "Milk-V Duo S";
+	compatible = "milkv,duos", "sophgo,sg2000";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};
+};
+
+&osc {
+	clock-frequency = <25000000>;
+};
+
+&sdhci0 {
+	status = "okay";
+};
+
+&uart0 {
+	status = "okay";
+};
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · On Tue, Apr 09, 2024 at 08:45:04AM +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

Hi Michael,

I think your patch losts the board binding and have wrong compatiable. Also, the SD can have rw support with proper property. See link [1] (need 'disable-wp').

I suggest you resubmitting this patch after applying clk patchs. This could reduce some unnecessary change. For now, you can just use the dts for huashan-pi (with changed memory size).

[1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/

#2 lore raw

Hi Inochi

Thanks for the review and tips!

Quoted 8 lines · Inochi Amaoto
Quoted 7 lines · On Tue, Apr 09, 2024 at 08:45:04AM +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

Quoted 5 lines

Hi Michael,

I think your patch losts the board binding and have wrong compatiable. Also, the SD can have rw support with proper property. See link [1] (need 'disable-wp').

Right, ""sophgo,sg2000" doesn't exist yet, so it will be indeed cleaner to use "sophgo,cv1812h" instead.

Quoted 6 lines

I suggest you resubmitting this patch after applying clk patchs. This could reduce some unnecessary change. For now, you can just use the dts for huashan-pi (with changed memory size).

[1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/

Good to know. That was next on my list.
I'll submit a V2 in the next days.
Thanks again
Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw
In reply to Inochi Amaoto
Quoted 9 lines · Inochi Amaoto
Quoted 7 lines · On Tue, Apr 09, 2024 at 08:45:04AM +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

Quoted 5 lines

Hi Michael,

I think your patch losts the board binding and have wrong compatiable. Also, the SD can have rw support with proper property. See link [1] (need 'disable-wp').

[1] doesn't go anywhere useful.

Quoted 3 lines

I suggest you resubmitting this patch after applying clk patchs. This could reduce some unnecessary change. For now, you can just use the dts for huashan-pi (with changed memory size).

Why would using patched huashan-pi dts be more suitable than carrying a local patch for duo-s devicetree? What am I missing?

Cheers,
Conor.

Quoted 2 lines

[1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/

#4 lore raw
Quoted 10 lines · Conor Dooley
Quoted 9 lines · Inochi Amaoto
Quoted 7 lines · On Tue, Apr 09, 2024 at 08:45:04AM +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

Quoted 8 lines
Quoted 5 lines

Hi Michael,

I think your patch losts the board binding and have wrong compatiable. Also, the SD can have rw support with proper property. See link [1] (need 'disable-wp').

[1] doesn't go anywhere useful.

This is my fault, I copied the wrong url. The right patch is
https://lore.kernel.org/r/[email protected].

Quoted 4 lines
Quoted 3 lines

I suggest you resubmitting this patch after applying clk patchs. This could reduce some unnecessary change. For now, you can just use the dts for huashan-pi (with changed memory size).

Quoted 8 lines

Why would using patched huashan-pi dts be more suitable than carrying a local patch for duo-s devicetree? What am I missing?

Cheers,
Conor.

Quoted 2 lines

[1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/

I think you miss nothing. Using huashan-pi dts as a temporary solution is just because they are both CV181X series. Since only a few peripherals are supported, it is also OK to use duo dts with local change. They're not significantly different. This is also the reason I did not prepare any patch for the new board. (such as lichee RV NANO, duo 256).

#5 lore raw
Quoted 17 lines · Inochi Amaoto
Quoted 16 lines · Conor Dooley
Quoted 14 lines · Inochi Amaoto
Quoted 7 lines · On Tue, Apr 09, 2024 at 08:45:04AM +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

Hi Michael,

I think your patch losts the board binding and have wrong compatiable. Also, the SD can have rw support with proper property. See link [1] (need 'disable-wp').

Quoted 6 lines
Quoted 2 lines

[1] doesn't go anywhere useful.

This is my fault, I copied the wrong url. The right patch is
https://lore.kernel.org/r/[email protected].

FYI, Michael. This is the right url for sdhci dts. The previous is wrong.

Quoted 19 lines
Quoted 4 lines
Quoted 3 lines

I suggest you resubmitting this patch after applying clk patchs. This could reduce some unnecessary change. For now, you can just use the dts for huashan-pi (with changed memory size).

Quoted 8 lines

Why would using patched huashan-pi dts be more suitable than carrying a local patch for duo-s devicetree? What am I missing?

Cheers,
Conor.

Quoted 2 lines

[1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/

I think you miss nothing. Using huashan-pi dts as a temporary solution is just because they are both CV181X series. Since only a few peripherals are supported, it is also OK to use duo dts with local change. They're not significantly different. This is also the reason I did not prepare any patch for the new board. (such as lichee RV NANO, duo 256).

#6 lore raw
In reply to Inochi Amaoto

Hi Inochi

Quoted 12 lines · Inochi Amaoto
Quoted 11 lines · Conor Dooley
Quoted 10 lines · Inochi Amaoto
Quoted 7 lines · On Tue, Apr 09, 2024 at 08:45:04AM +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

Hi Michael,

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I think your patch losts the board binding and have wrong compatiable. Also, the SD can have rw support with proper property. See link [1] (need 'disable-wp').

[1] doesn't go anywhere useful.

This is my fault, I copied the wrong url. The right patch is
https://lore.kernel.org/r/[email protected].

No problem, I found out.
I confirm that using the "disable-wp;" property does the trick to make the MMC writable.

However, it wasn't mentioned in the above URL...

By the way, do I really need those under &sdhci0?

+ bus-width = <4>; + no-1-8-v; + no-mmc; + no-sdio;

My board looks happy so far without them ;-)
Thanks again for your help
Cheers
Michael.

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

Hi Inochi

Quoted 12 lines · Inochi Amaoto
Quoted 11 lines · Conor Dooley
Quoted 10 lines · Inochi Amaoto
Quoted 7 lines · On Tue, Apr 09, 2024 at 08:45:04AM +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

Hi Michael,

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I think your patch losts the board binding and have wrong compatiable. Also, the SD can have rw support with proper property. See link [1] (need 'disable-wp').

[1] doesn't go anywhere useful.

This is my fault, I copied the wrong url. The right patch is
https://lore.kernel.org/r/[email protected].

No problem, I found out.
I confirm that using the "disable-wp;" property does the trick to make the MMC writable.

Quoted 7 lines

However, it wasn't mentioned in the above URL...

By the way, do I really need those under &sdhci0?

+ bus-width = <4>; + no-1-8-v; + no-mmc; + no-sdio;

My board looks happy so far without them ;-)

FYI, Jisheng. Could you share some suggestions?

Quoted 9 lines

Thanks again for your help
Cheers
Michael.

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

Hi Inochi

Quoted 12 lines · Inochi Amaoto
Quoted 11 lines · Conor Dooley
Quoted 10 lines · Inochi Amaoto
Quoted 7 lines · On Tue, Apr 09, 2024 at 08:45:04AM +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

Hi Michael,

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I think your patch losts the board binding and have wrong compatiable. Also, the SD can have rw support with proper property. See link [1] (need 'disable-wp').

[1] doesn't go anywhere useful.

This is my fault, I copied the wrong url. The right patch is
https://lore.kernel.org/r/[email protected].

No problem, I found out.
I confirm that using the "disable-wp;" property does the trick to make the MMC writable.

Quoted 7 lines
Quoted 7 lines

However, it wasn't mentioned in the above URL...

By the way, do I really need those under &sdhci0?

+ bus-width = <4>; + no-1-8-v; + no-mmc; + no-sdio;

My board looks happy so far without them ;-)

setting the correct bus-width is necessary for better performance no-1-8-v can be removed, but it doesn't harm anything because the board doesn't supply 1.8v

no-mmc and no-sdio to make the probe a bit quicker

Quoted 12 lines

FYI, Jisheng. Could you share some suggestions?

Quoted 9 lines

Thanks again for your help
Cheers
Michael.

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

Hi Jisheng,

Quoted 5 lines · Jisheng Zhang

setting the correct bus-width is necessary for better performance no-1-8-v can be removed, but it doesn't harm anything because the board doesn't supply 1.8v

no-mmc and no-sdio to make the probe a bit quicker

Many thanks for your advice!

However, whether I apply these changes or not, git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git is now broken for me:
Error: arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts:32.1-8 Label or path sdhci0 not found

I was previously testing with linux-next, but it's now broken too, though in a different way:
[    1.306811] /dev/root: Can't open blockdev
[    1.311200] VFS: Cannot open root device "/dev/mmcblk0p2" or unknown-block(0,0): error -6

Shall I submit my updates anyway?
Cheers
Michael.

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

Hi Jisheng,

Quoted 5 lines · Jisheng Zhang

setting the correct bus-width is necessary for better performance no-1-8-v can be removed, but it doesn't harm anything because the board doesn't supply 1.8v

no-mmc and no-sdio to make the probe a bit quicker

Quoted 7 lines

Many thanks for your advice!

However, whether I apply these changes or not, git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git is now broken for me:
Error: arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts:32.1-8 Label or path sdhci0 not found

This is probably just because you need to use the for-next branch of
https://github.com/sophgo/linux.git as your base. Palmer doesn't apply dts patchs to the riscv repo. Usually working on linux-next is fine for these kinds of activities.

Quoted 7 lines

I was previously testing with linux-next, but it's now broken too, though in a different way:
[    1.306811] /dev/root: Can't open blockdev
[    1.311200] VFS: Cannot open root device "/dev/mmcblk0p2" or unknown-block(0,0): error -6

Shall I submit my updates anyway?

This is probably worth investigating by someone, providing a longer log would help if you don't wanna do so yourself. Did you rebase on a more recent linux-next and this cropped up?

#11 lore raw
In reply to [email protected]
Quoted 7 lines · On 09/04/2024 08:45, [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 and read-only SD card support, allowing to boot Linux to the command line.

Quoted 6 lines

---

Tested with linux-next as of Apr 9, 2024, using the risc-v "defconfig" configuration.

Please include in your tests what submitting patches and your maintainer profile asks you. checkpatch and testing of DTS.

Please run scripts/checkpatch.pl and fix reported warnings. Then please run scripts/checkpatch.pl --strict and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Best regards,
Krzysztof

maintainer
#12 lore raw
In reply to [email protected]
Quoted 11 lines · On Tue, 09 Apr 2024 08:45:04 +0200, [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 and read-only SD card support, allowing to boot Linux to the command line.

---

Quoted 8 lines

Tested with linux-next as of Apr 9, 2024, using the risc-v "defconfig" configuration.

---
 arch/riscv/boot/dts/sophgo/Makefile           |  1 +
 .../boot/dts/sophgo/sg2000-milkv-duos.dts     | 38 +++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts

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: /: failed to match any schema with compatible: ['milkv,duos', 'sophgo,sg2000'] arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dtb: /: failed to match any schema with compatible: ['milkv,duos', 'sophgo,sg2000']