From: Chen-Yu Yeh <[email protected]>

The Milk-V Duo 256M is a small form factor development board based on
the Sophgo SG2002 SoC.

This patch adds basic device tree support for the board, including:
- UART console
- SD/MMC controller
- USB host
- Onboard blue status LED (connected to PWR_GPIO[2] / porte 2)

Tested on actual Milk-V Duo 256M hardware, verified boot to shell and
heartbeat LED functionality.

Signed-off-by: Chen-Yu Yeh <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Inochi Amaoto <[email protected]>
Signed-off-by: Chen Wang <[email protected]>

[ upstream commit: 59c682ffc76ebda27ecbbbd1423e23ec482d61b9 ]

(cherry picked from commit ed2cfe3354c657cd7b6ed1b678169edd0f146f2f)
---
 .../src/riscv/sophgo/sg2002-milkv-duo256m.dts      | 121 +++++++++++++++++++++
 1 file changed, 121 insertions(+)

diff --git a/dts/upstream/src/riscv/sophgo/sg2002-milkv-duo256m.dts 
b/dts/upstream/src/riscv/sophgo/sg2002-milkv-duo256m.dts
new file mode 100644
index 00000000000..a2797c0bd76
--- /dev/null
+++ b/dts/upstream/src/riscv/sophgo/sg2002-milkv-duo256m.dts
@@ -0,0 +1,121 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2023 Jisheng Zhang <[email protected]>
+ * Copyright (C) 2026 Chen-Yu Yeh <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "sg2002.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       model = "Milk-V Duo 256M";
+       compatible = "milkv,duo256m", "sophgo,sg2002";
+
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+               serial3 = &uart3;
+               serial4 = &uart4;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led-0 {
+                       gpios = <&porte 2 GPIO_ACTIVE_HIGH>;
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               coprocessor_rtos: region@8fe00000 {
+                       reg = <0x8fe00000 0x200000>;
+                       no-map;
+               };
+       };
+};
+
+&osc {
+       clock-frequency = <25000000>;
+};
+
+&pinctrl {
+       uart0_cfg: uart0-cfg {
+               uart0-pins {
+                       pinmux = <PINMUX(PIN_UART0_TX, 0)>,
+                                <PINMUX(PIN_UART0_RX, 0)>;
+                       bias-pull-up;
+                       drive-strength-microamp = <10800>;
+                       power-source = <3300>;
+               };
+       };
+
+       sdhci0_cfg: sdhci0-cfg {
+               sdhci0-clk-pins {
+                       pinmux = <PINMUX(PIN_SD0_CLK, 0)>;
+                       bias-pull-up;
+                       drive-strength-microamp = <16100>;
+                       power-source = <3300>;
+               };
+
+               sdhci0-cmd-pins {
+                       pinmux = <PINMUX(PIN_SD0_CMD, 0)>;
+                       bias-pull-up;
+                       drive-strength-microamp = <10800>;
+                       power-source = <3300>;
+               };
+
+               sdhci0-data-pins {
+                       pinmux = <PINMUX(PIN_SD0_D0, 0)>,
+                                <PINMUX(PIN_SD0_D1, 0)>,
+                                <PINMUX(PIN_SD0_D2, 0)>,
+                                <PINMUX(PIN_SD0_D3, 0)>;
+                       bias-pull-up;
+                       drive-strength-microamp = <10800>;
+                       power-source = <3300>;
+               };
+
+               sdhci0-cd-pins {
+                       pinmux = <PINMUX(PIN_SD0_CD, 0)>;
+                       bias-pull-up;
+                       drive-strength-microamp = <10800>;
+                       power-source = <3300>;
+               };
+       };
+};
+
+&sdhci0 {
+       pinctrl-0 = <&sdhci0_cfg>;
+       pinctrl-names = "default";
+       status = "okay";
+       bus-width = <4>;
+       no-1-8-v;
+       no-mmc;
+       no-sdio;
+       disable-wp;
+};
+
+&uart0 {
+       pinctrl-0 = <&uart0_cfg>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&usb {
+       dr_mode = "host";
+       status = "okay";
+};

-- 
2.55.0

Reply via email to