Skip to contentSkip to conversation

Add initial Milk-V Duo S board support

PATCH Applied Joshua Milas 3 participants 8 messages Jun 15 – Jul 29

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

v6 cover Add initial Milk-V Duo S board support

This adds an initial device tree for the Milk-V Duo S board with support for reading from the SD card and network over Ethernet. This is continued work from Michael Opdenacker's v6 series [1] on the ARM64 and RISCV side. It has been tested with ARM64 and RISCV64 to boot from an SD card, have networking from ethernet, enumerate the wifi chip, have bluetooth, and can read a I2C slave device over i2c4.

---

v6
- Patches 1,3 from v5 were applied
- Rebased to latest sophgo/for-next
- Added mmc1, mmc2, serial4 aliases
- Removed spi3 alias and node as it was conflicting with sdhci1/wifi
- Added wifi_pwrseq node for wifi chip
- Added pinctrl configs for enabled devices
- Reordered &sdhci0 properties
- Updated &sdhci1 node properties for wifi chip
- Added uart4 for bluetooth
- Changed memory from 256 MB to 512 MB on riscv side

v5: https://lore.kernel.org/sophgo/[email protected]/
- Fixes spaces at beginning of line in &usb node of DTS

v4: https://lore.kernel.org/sophgo/[email protected]/
- Rebased to latest sophogo/for-next
- Added usb node to arm64 and riscv DTS
- Removed sg200x link in commit messages
- Added missing change to v3 and removed link from v2

v3: https://lore.kernel.org/sophgo/[email protected]/
- Added sg2000 interrupt controller and timer to documentation
- Added sg2000.dtsi for RISCV and moved DTS over to use it
- remove devices from DTS's to match what is available in the default pinmux config. spi0-2, i2c0-3, uart1-4
- Added i2c4 and spi3 aliases
- Removed milkv,duo-s from sophgo,cv1812h in documentation

v2: https://lore.kernel.org/sophgo/[email protected]/
- Made new entry in docs to avoid DTC error
- "Milk-V DuoS" -> "Milk-V Duo S"
- Sorting of aliases
- Added uart*, emmc, mdio, gmac0, i2c*, spi*, dmac, saradc
to device tree matching what is available on the pinout
- Removal of 'no-mmc' and 'no-sdio' for sdhci0 as it works without
- Added riscv device tree

v1: https://lore.kernel.org/sophgo/[email protected]/

Joshua Milas (3):
arm64: dts: sophgo: add initial Milk-V Duo S board support
riscv64: dts: sophgo: add SG2000 dtsi
riscv64: dts: sophgo: add initial Milk-V Duo S board support

 arch/arm64/boot/dts/sophgo/Makefile           |   1 +
 .../boot/dts/sophgo/sg2000-milkv-duo-s.dts    | 245 ++++++++++++++++++
 arch/riscv/boot/dts/sophgo/Makefile           |   1 +
 .../boot/dts/sophgo/sg2000-milkv-duo-s.dts    | 245 ++++++++++++++++++
 arch/riscv/boot/dts/sophgo/sg2000.dtsi        |  53 ++++
 5 files changed, 545 insertions(+)
 create mode 100644 arch/arm64/boot/dts/sophgo/sg2000-milkv-duo-s.dts
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000.dtsi

base-commit: f7337210bede62fc7c6230ef58013dddf7e0a921

Signature · 1 line
2.54.0
#1 lore raw

PATCH v6 1/3 arm64: dts: sophgo: add initial Milk-V Duo S board support

Adds initial arm64 support for the Milk-V Duo S board
[1] making it possible to boot Linux to the command line.

---
 arch/arm64/boot/dts/sophgo/Makefile           |   1 +
 .../boot/dts/sophgo/sg2000-milkv-duo-s.dts    | 245 ++++++++++++++++++
 2 files changed, 246 insertions(+)
 create mode 100644 arch/arm64/boot/dts/sophgo/sg2000-milkv-duo-s.dts
arch/arm64/boot/dts/sophgo/Makefile +1 -0
index 94f52cd7d994..68aace728223 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2000-milkv-duo-module-01-evb.dtb
+dtb-$(CONFIG_ARCH_SOPHGO) += sg2000-milkv-duo-s.dtb
arch/arm64/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +245 -0

245 lines not on this page · raw message

Signature · 1 line
2.54.0
#2 lore raw

Re: [PATCH v6 1/3] arm64: dts: sophgo: add initial Milk-V Duo S board support

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `no-1-8-v` property in the `&emmc` node artificially restricts eMMC performance…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The no-1-8-v property in the &emmc node artificially restricts eMMC performance, contradicting the 1.8V pinctrl pad configuration. --

commit 16f792133b8071df278eace7bc1ca7b6e4b52d31
Author: Joshua Milas <[email protected]>

arm64: dts: sophgo: add initial Milk-V Duo S board support

Adds initial arm64 support for the Milk-V Duo S board making it possible to boot Linux to the command line.

Quoted 5 lines
arch/arm64/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +0 -0
new file mode 100644
index 0000000000000..f56bfddeacc40

[ ... ]

Quoted 14 lines
arch/arm64/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +14 -0
+	emmc_cfg: emmc-cfg {
+		emmc-rstn-pins {
+			pinmux = <PINMUX(PIN_EMMC_RSTN, 0)>;
+			bias-pull-up;
+			drive-strength-microamp = <10800>;
+			power-source = <1800>;
+		};
+
+		emmc-clk-pins {
+			pinmux = <PINMUX(PIN_EMMC_CLK, 0)>;
+			bias-pull-up;
+			drive-strength-microamp = <10800>;
+			power-source = <1800>;
+		};

[ ... ]

arch/arm64/boot/dts/sophgo/sg2000-milkv-duo-s.dts

Quoted 3 lines

+&emmc {

arch/arm64/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +2 -0
+	bus-width = <4>;
+	no-1-8-v;

[Severity: Medium]
The emmc node specifies no-1-8-v, but the emmc_cfg pinctrl configures the eMMC pins for 1.8V logic using power-source = <1800>. Is the board physically wired to operate the eMMC at 1.8V?

If the hardware supports 1.8V, is it possible that setting no-1-8-v artificially restricts the eMMC from utilizing high-speed capabilities like HS200 and HS400?

Quoted 8 lines
arch/arm64/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +8 -0
+	cap-mmc-hw-reset;
+	no-sd;
+	no-sdio;
+	non-removable;
+	pinctrl-0 = <&emmc_cfg>;
+	pinctrl-names = "default";
+	status = "okay";
+};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH v6 2/3 riscv64: dts: sophgo: add SG2000 dtsi

In reply to Joshua Milas

Adds sg2000.dtsi on the RISCV side.

---
 arch/riscv/boot/dts/sophgo/sg2000.dtsi | 53 ++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000.dtsi
arch/riscv/boot/dts/sophgo/sg2000.dtsi new file +53 -0
new file mode 100644
index 000000000000..38462769574f
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+#define SOC_PERIPHERAL_IRQ(nr)	((nr) + 16)
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/pinctrl/pinctrl-sg2000.h>
+#include "cv180x-cpus.dtsi"
+#include "cv180x.dtsi"
+#include "cv181x.dtsi"
+
+/ {
+	compatible = "sophgo,sg2000";
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x20000000>;
+	};
+
+	soc {
+		interrupt-parent = <&plic>;
+		dma-noncoherent;
+
+		pinctrl: pinctrl@3001000 {
+			compatible = "sophgo,sg2000-pinctrl";
+			reg = <0x03001000 0x1000>,
+			      <0x05027000 0x1000>;
+			reg-names = "sys", "rtc";
+		};
+
+		clk: clock-controller@3002000 {
+			compatible = "sophgo,sg2000-clk";
+			reg = <0x03002000 0x1000>;
+			clocks = <&osc>;
+			#clock-cells = <1>;
+		};
+
+		plic: interrupt-controller@70000000 {
+			compatible = "sophgo,sg2000-plic", "thead,c900-plic";
+			reg = <0x70000000 0x4000000>;
+			interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <2>;
+			riscv,ndev = <101>;
+		};
+
+		clint: timer@74000000 {
+			compatible = "sophgo,sg2000-clint", "thead,c900-clint";
+			reg = <0x74000000 0x10000>;
+			interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
+		};
+	};
+};
Signature · 1 line
2.54.0
#4 lore raw

PATCH v6 3/3 riscv64: dts: sophgo: add initial Milk-V Duo S board support

In reply to Joshua Milas

This adds initial riscv support for the Milk-V Duo S board
[1] making it possible to boot Linux to the command line.

---
 arch/riscv/boot/dts/sophgo/Makefile           |   1 +
 .../boot/dts/sophgo/sg2000-milkv-duo-s.dts    | 245 ++++++++++++++++++
 2 files changed, 246 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 6f65526d4193..58cc6b70d8de 100644
@@ -1,6 +1,7 @@
 # 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-duo-s.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-licheerv-nano-b.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v1.dtb
arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +245 -0

245 lines not on this page · raw message

Signature · 1 line
2.54.0
#5 lore raw

Re: [PATCH v6 3/3] riscv64: dts: sophgo: add initial Milk-V Duo S board support

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Contradictory eMMC voltage configuration artificially restricts eMMC speed capabilities --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Contradictory eMMC voltage configuration artificially restricts eMMC speed capabilities --

commit 9d652e59c7623b46a5dd7a0a5954061467e5aea7
Author: Joshua Milas <[email protected]>

riscv64: dts: sophgo: add initial Milk-V Duo S board support

This adds initial riscv support for the Milk-V Duo S board making it possible to boot Linux to the command line.

Quoted 5 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +0 -0
new file mode 100644
index 0000000000000..f56bfddeacc40

[ ... ]

Quoted 8 lines

+&pinctrl {

arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +7 -0
+	emmc_cfg: emmc-cfg {
+		emmc-rstn-pins {
+			pinmux = <PINMUX(PIN_EMMC_RSTN, 0)>;
+			bias-pull-up;
+			drive-strength-microamp = <10800>;
+			power-source = <1800>;
+		};

[ ... ]

arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts

Quoted 3 lines

+&emmc {

arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +2 -0
+	bus-width = <4>;
+	no-1-8-v;

[Severity: Medium]
Is this contradictory eMMC voltage configuration intentional?

The pinctrl node emmc_cfg explicitly configures the eMMC pins to operate at 1.8V (power-source = <1800>), but the &emmc node here specifies the no-1-8-v property.

Since the hardware pads are physically configured for 1.8V, the interface actually does support 1.8V signaling. Specifying no-1-8-v here artificially restricts the eMMC to legacy, slower modes instead of negotiating faster modes like HS200.

Quoted 8 lines
arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts new file +8 -0
+	cap-mmc-hw-reset;
+	no-sd;
+	no-sdio;
+	non-removable;
+	pinctrl-0 = <&emmc_cfg>;
+	pinctrl-names = "default";
+	status = "okay";
+};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
maintainer Applied
#6 lore raw

Re: (subset) [PATCH v6 0/3] Add initial Milk-V Duo S board support

In reply to Joshua Milas
Quoted 9 lines · Joshua Milas

This adds an initial device tree for the Milk-V Duo S board with support for reading from the SD card and network over Ethernet. This is continued work from Michael Opdenacker's v6 series [1] on the ARM64 and RISCV side. It has been tested with ARM64 and RISCV64 to boot from an SD card, have networking from ethernet, enumerate the wifi chip, have bluetooth, and can read a I2C slave device over i2c4.

[...]

Applied to dt/arm, thanks!

[1/3] arm64: dts: sophgo: add initial Milk-V Duo S board support

      https://github.com/sophgo/linux/commit/fd2544c8cffa6a53ef8faeedbf9a66a171de0fcc

Thanks,
Inochi

maintainer Applied
#7 lore raw

Re: (subset) [PATCH v6 0/3] Add initial Milk-V Duo S board support

In reply to Joshua Milas
Quoted 9 lines · Joshua Milas

This adds an initial device tree for the Milk-V Duo S board with support for reading from the SD card and network over Ethernet. This is continued work from Michael Opdenacker's v6 series [1] on the ARM64 and RISCV side. It has been tested with ARM64 and RISCV64 to boot from an SD card, have networking from ethernet, enumerate the wifi chip, have bluetooth, and can read a I2C slave device over i2c4.

[...]

Applied to dt/riscv, thanks!

[2/3] riscv64: dts: sophgo: add SG2000 dtsi

      https://github.com/sophgo/linux/commit/022d1bd8b08257966c4a00fc21fb72a828bca870
[3/3] riscv64: dts: sophgo: add initial Milk-V Duo S board support
      https://github.com/sophgo/linux/commit/0cef4f813649eb19476c98f763128561f5bdf969

Thanks,
Inochi