From 775e76fabc69f67d430a594a876e2403614d9962 Mon Sep 17 00:00:00 2001
From: exkc <exkc@exkc.moe>
Date: Tue, 28 Oct 2025 08:25:19 +0800
Subject: [PATCH] Add WD MyCloud Gen2 Device Tree

---
 arch/arm/boot/dts/marvell/Makefile            |   3 +-
 .../dts/marvell/armada-375-wd-glacier.dts     | 131 ++++++++++++++++++
 2 files changed, 133 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/marvell/armada-375-wd-glacier.dts

diff --git a/arch/arm/boot/dts/marvell/Makefile b/arch/arm/boot/dts/marvell/Makefile
index 1e0f5ff49..d0e1fb72c 100644
--- a/arch/arm/boot/dts/marvell/Makefile
+++ b/arch/arm/boot/dts/marvell/Makefile
@@ -30,7 +30,8 @@ dtb-$(CONFIG_MACH_ARMADA_370) += \
 	armada-370-seagate-personal-cloud-2bay.dtb \
 	armada-370-synology-ds213j.dtb
 dtb-$(CONFIG_MACH_ARMADA_375) += \
-	armada-375-db.dtb
+	armada-375-db.dtb \
+	armada-375-wd-glacier.dtb
 dtb-$(CONFIG_MACH_ARMADA_38X) += \
 	armada-381-netgear-gs110emx.dtb \
 	armada-382-rd-ac3x-48g4x2xl.dtb \
diff --git a/arch/arm/boot/dts/marvell/armada-375-wd-glacier.dts b/arch/arm/boot/dts/marvell/armada-375-wd-glacier.dts
new file mode 100644
index 000000000..bb65e9f15
--- /dev/null
+++ b/arch/arm/boot/dts/marvell/armada-375-wd-glacier.dts
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for WD MyCloud Gen2
+ * Copyright (C) 2025 exkc <exkc@exkc.moe>
+ * Based https://github.com/Heisath/wdmc2-kernel/blob/master/dts/armada-375-wdmc-gen2.dts and armada-375-db.dts
+ */
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include "armada-375.dtsi"
+
+/ {
+	model = "WD MyCloud Gen2";
+	compatible = "wd,glacier", "marvell,armada375";
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00000000 0x20000000>; /* 512 MB */
+	};
+
+	soc {
+		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
+			  MBUS_ID(0x01, 0x1d) 0 0xfff00000 0x100000
+			  MBUS_ID(0x09, 0x09) 0 0xf1100000 0x10000
+			  MBUS_ID(0x09, 0x05) 0 0xf1110000 0x10000>;
+
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&sys_led_pins>;
+
+		system-red {
+			label = "system:red";
+			gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
+			default-state = "off";
+		};
+		system-green {
+			label = "system:green";
+			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
+			default-state = "off";
+		}; 
+		system-blue {
+			label = "system:blue";
+			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
+			default-state = "on";
+		};
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+		pinctrl-names = "default";
+		pinctrl-0 = <&btn_reset_pins>;
+
+		btn-reset {
+			label = "btn-reset";
+			gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+			gpio-key,wakeup;
+		};
+	};
+};
+
+&spi0 {
+	pinctrl-0 = <&spi0_pins>;
+	pinctrl-names = "default";
+
+	spi-flash@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "mxicy,mx25l8005", "jedec,spi-nor";
+		reg = <0>; /* Chip select 0 */
+		spi-max-frequency = <108000000>;
+		partition@0 {
+			label = "u-boot";
+			reg = <0x0 0x100000>;
+		};
+	};
+};
+
+&sata {
+	status = "okay";
+	nr-ports = <1>;
+};
+
+&mdio {
+	phy0: ethernet-phy@0 {
+		reg = <0>;
+	};
+};
+
+&ethernet {
+	status = "okay";
+};
+
+
+&eth0 {
+	status = "okay";
+	phy = <&phy0>;
+	phy-mode = "rgmii-id";
+};
+
+&pinctrl {
+	sys_led_pins: sys-led-pins {
+		marvell,pins = "mpp20", "mpp43", "mpp22"; // R G B
+		marvell,function = "gpio";
+	};
+
+	btn_reset_pins: btn-reset-pins {
+		marvell,pins = "mpp44";
+		marvell,function = "gpio";
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&usb1 {
+	status = "okay";
+};
+
+&usb2 {
+	status = "okay";
+};
-- 
2.52.0

