Cudy X6 / AX 1800, how to flash successfully?

What original Cudy webinterface tells me about the revision:

cudyX6

do you know the kernel version of this cudy build?

https://www.cudytech.com/filedownload/606053 includes a mt7621_cudy-x6.dts with the following content:

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "mt7621.dtsi"

#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>

/ {
	compatible = "cudy-x6", "mediatek,mt7621-soc";
	model = "CUDY X6";

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x10000000>;
	};

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};

		wps {
			label = "wps";
			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};

	leds {
		compatible = "gpio-leds";

		led_blue: blue {
			label = "blue";
			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
		};

		led_red: red {
			label = "red";
			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
		};
	};

};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <80000000>;
		m25p,fast-read;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "u-boot-env";
				reg = <0x30000 0x10000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
			};

			debug: partition@1fd0000 {
				label = "debug";
				reg = <0x1fd0000 0x10000>;
			};

			backup: partition@1fe0000 {
				label = "backup";
				reg = <0x1fe0000 0x10000>;
			};

			bdinfo: partition@ff0000 {
				label = "bdinfo";
				reg = <0x1ff0000 0x10000>;
				read-only;
			};

			firmware: partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0x1f80000>;
			};
		};
	};
};

&pcie {
	status = "okay";
};

&pcie1 {
	wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x0000>;
	};
};

&gmac0 {
	mtd-mac-address = <&bdinfo 0xDE00>;
};

&switch0 {
	ports {
		port@0 {
			status = "okay";
			label = "lan1";
		};

		port@1 {
			status = "okay";
			label = "lan2";
		};

		port@2 {
			status = "okay";
			label = "lan3";
		};

		port@3 {
			status = "okay";
			label = "lan4";
		};

		port@4 {
			status = "okay";
			label = "wan";
			mtd-mac-address = <&factory 0xA>;
		};
	};
};

&state_default {
	gpio {
		groups = "i2c", "wdt";
		function = "gpio";
	};
};

For the kernel version I have to look into tomorrow, when I have access to the device again.

Kernel in the Cudy customized firmware:

root@OpenWrt:~# uname -a
Linux OpenWrt 5.4.119 #0 SMP Thu Apr 7 14:23:37 2022 mips GNU/Linux
root@OpenWrt:~# opkg list | grep ^kernel
kernel - 5.4.119-1-1ef2f668119a44ee47519a13132bbbda

And no, even https://github.com/waja/openwrt-cudy-x6-firmware/releases/download/2022.11.28-2204/openwrt-ramips-mt7621-cudy_x6-squashfs-sysupgrade.bin with their DTS file from their developer directory does boot up on my two devices.

The interesting part: their provided DTS file for V1 and V2 differs a lot:

✦ ❯ diff -Nur X6\ V1/Developer/mt7621_cudy-x6.dts X6\ V2/Developer/mt7621_cudy_x6v2.dts 
--- "X6 V1/Developer/mt7621_cudy-x6.dts"	2022-09-07 09:28:50.000000000 +0200
+++ "X6 V2/Developer/mt7621_cudy_x6v2.dts"	2022-10-18 09:49:12.000000000 +0200
@@ -2,16 +2,19 @@
 
 #include "mt7621.dtsi"
 
-#include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
-	compatible = "cudy-x6", "mediatek,mt7621-soc";
+	compatible = "cudy,x6", "mediatek,mt7621-soc";
 	model = "CUDY X6";
 
-	memory@0 {
-		device_type = "memory";
-		reg = <0x0 0x10000000>;
+	aliases {
+		led-boot = &led_internet_blue;
+		led-failsafe = &led_internet_blue;
+		led-running = &led_internet_blue;
+		led-upgrade = &led_internet_blue;
+		label-mac-device = &gmac0;
 	};
 
 	chosen {
@@ -37,13 +40,13 @@
 	leds {
 		compatible = "gpio-leds";
 
-		led_blue: blue {
-			label = "blue";
-			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
+		led_internet_blue: internet_blue {
+			label = "blue:internet";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
 		};
 
-		led_red: red {
-			label = "red";
+		internet_red {
+			label = "red:internet";
 			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
 		};
 	};
@@ -56,8 +59,7 @@
 	flash@0 {
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		spi-max-frequency = <80000000>;
-		m25p,fast-read;
+		spi-max-frequency = <50000000>;
 
 		partitions {
 			compatible = "fixed-partitions";
@@ -79,29 +81,32 @@
 			factory: partition@40000 {
 				label = "factory";
 				reg = <0x40000 0x10000>;
+				read-only;
 			};
 
-			debug: partition@1fd0000 {
+			partition@50000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x50000 0xf80000>;
+			};
+
+			partition@fd0000 {
 				label = "debug";
-				reg = <0x1fd0000 0x10000>;
+				reg = <0xfd0000 0x10000>;
+				read-only;
 			};
 
-			backup: partition@1fe0000 {
+			partition@fe0000 {
 				label = "backup";
-				reg = <0x1fe0000 0x10000>;
+				reg = <0xfe0000 0x10000>;
+				read-only;
 			};
 
 			bdinfo: partition@ff0000 {
 				label = "bdinfo";
-				reg = <0x1ff0000 0x10000>;
+				reg = <0xff0000 0x10000>;
 				read-only;
 			};
-
-			firmware: partition@50000 {
-				compatible = "denx,uimage";
-				label = "firmware";
-				reg = <0x50000 0x1f80000>;
-			};
 		};
 	};
 };
@@ -119,7 +124,8 @@
 };
 
 &gmac0 {
-	mtd-mac-address = <&bdinfo 0xDE00>;
+	nvmem-cells = <&macaddr_bdinfo_de00>;
+	nvmem-cell-names = "mac-address";
 };
 
 &switch0 {
@@ -147,14 +153,26 @@
 		port@4 {
 			status = "okay";
 			label = "wan";
-			mtd-mac-address = <&factory 0xA>;
+			nvmem-cells = <&macaddr_bdinfo_de00>;
+			nvmem-cell-names = "mac-address";
+			mac-address-increment = <1>;
 		};
 	};
 };
 
 &state_default {
 	gpio {
-		groups = "i2c", "wdt";
+		groups = "uart3", "jtag";
 		function = "gpio";
 	};
 };
+
+&bdinfo {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_bdinfo_de00: macaddr@de00 {
+		reg = <0xde00 0x6>;
+	};
+};

Looks like the V2 DTS looks similar to the openwrt 22.03 one... and indeed:

✦ ❯ diff -Nur X6\ V2/Developer/mt7621_cudy_x6v2.dts /tmp/mt7621_cudy_x6.dts 
--- "X6 V2/Developer/mt7621_cudy_x6v2.dts"	2022-10-18 09:49:12.000000000 +0200
+++ /tmp/mt7621_cudy_x6.dts	2022-11-29 09:37:14.026935703 +0100
@@ -87,24 +87,24 @@
 			partition@50000 {
 				compatible = "denx,uimage";
 				label = "firmware";
-				reg = <0x50000 0xf80000>;
+				reg = <0x50000 0x1f80000>;
 			};
 
-			partition@fd0000 {
+			partition@1fd0000 {
 				label = "debug";
-				reg = <0xfd0000 0x10000>;
+				reg = <0x1fd0000 0x10000>;
 				read-only;
 			};
 
-			partition@fe0000 {
+			partition@1fe0000 {
 				label = "backup";
-				reg = <0xfe0000 0x10000>;
+				reg = <0x1fe0000 0x10000>;
 				read-only;
 			};
 
-			bdinfo: partition@ff0000 {
+			bdinfo: partition@1ff0000 {
 				label = "bdinfo";
-				reg = <0xff0000 0x10000>;
+				reg = <0x1ff0000 0x10000>;
 				read-only;
 			};
 		};

check mt7621.dtsi in 21.02.x see if is the same as 22.03.2

Indeed, there are a bunch of changes:

✦ ❯ diff -Nur openwrt-21.02-mt7621.dtsi openwrt-22.03-mt7621.dtsi
--- openwrt-21.02-mt7621.dtsi	2022-11-29 11:47:04.447286478 +0100
+++ openwrt-22.03-mt7621.dtsi	2022-11-29 11:46:51.639170790 +0100
@@ -9,6 +9,10 @@
 	#size-cells = <1>;
 	compatible = "mediatek,mt7621-soc";
 
+	aliases {
+		serial0 = &uartlite;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -33,10 +37,6 @@
 		compatible = "mti,cpu-interrupt-controller";
 	};
 
-	aliases {
-		serial0 = &uartlite;
-	};
-
 	chosen {
 		bootargs = "console=ttyS0,57600";
 	};
@@ -56,16 +56,16 @@
 		clock-frequency = <50000000>;
 	};
 
-	palmbus: palmbus@1E000000 {
+	palmbus: palmbus@1e000000 {
 		compatible = "palmbus";
-		reg = <0x1E000000 0x100000>;
-		ranges = <0x0 0x1E000000 0x0FFFFF>;
+		reg = <0x1e000000 0x100000>;
+		ranges = <0x0 0x1e000000 0x0fffff>;
 
 		#address-cells = <1>;
 		#size-cells = <1>;
 
-		sysc: sysc@0 {
-			compatible = "mtk,mt7621-sysc";
+		sysc: syscon@0 {
+			compatible = "mtk,mt7621-sysc", "syscon";
 			reg = <0x0 0x100>;
 		};
 
@@ -136,21 +136,11 @@
 			interrupts = <GIC_SHARED 5 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
-		memc: memc@5000 {
-			compatible = "mtk,mt7621-memc";
+		memc: syscon@5000 {
+			compatible = "mtk,mt7621-memc", "syscon";
 			reg = <0x5000 0x1000>;
 		};
 
-		cpc: cpc@1fbf0000 {
-			compatible = "mtk,mt7621-cpc";
-			reg = <0x1fbf0000 0x8000>;
-		};
-
-		mc: mc@1fbf8000 {
-			compatible = "mtk,mt7621-mc";
-			reg = <0x1fbf8000 0x8000>;
-		};
-
 		uartlite: uartlite@c00 {
 			compatible = "ns16550a";
 			reg = <0xc00 0x100>;
@@ -227,7 +217,7 @@
 			reset-names = "dma";
 
 			interrupt-parent = <&gic>;
-			interrupts = <0 13 4>;
+			interrupts = <0 13 IRQ_TYPE_LEVEL_HIGH>;
 
 			#dma-cells = <1>;
 			#dma-channels = <16>;
@@ -244,7 +234,7 @@
 			reset-names = "hsdma";
 
 			interrupt-parent = <&gic>;
-			interrupts = <0 11 4>;
+			interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
 
 			#dma-cells = <1>;
 			#dma-channels = <1>;
@@ -355,11 +345,11 @@
 		#clock-cells = <1>;
 	};
 
-	sdhci: sdhci@1E130000 {
+	sdhci: sdhci@1e130000 {
 		status = "disabled";
 
 		compatible = "ralink,mt7620-sdhci";
-		reg = <0x1E130000 0x4000>;
+		reg = <0x1e130000 0x4000>;
 
 		interrupt-parent = <&gic>;
 		interrupts = <GIC_SHARED 20 IRQ_TYPE_LEVEL_HIGH>;
@@ -368,7 +358,7 @@
 		pinctrl-0 = <&sdhci_pins>;
 	};
 
-	xhci: xhci@1E1C0000 {
+	xhci: xhci@1e1c0000 {
 		#address-cells = <1>;
 		#size-cells = <0>;
 
@@ -426,6 +416,16 @@
 		clock-frequency = <125000000>;
 	};
 
+	cpc: cpc@1fbf0000 {
+		compatible = "mti,mips-cpc";
+		reg = <0x1fbf0000 0x8000>;
+	};
+
+	mc: mc@1fbf8000 {
+		compatible = "mti,mips-cdmm";
+		reg = <0x1fbf8000 0x8000>;
+	};
+
 	nand: nand@1e003000 {
 		status = "disabled";
 
@@ -438,13 +438,6 @@
 		clock-names = "nfi_clk";
 	};
 
-	ethsys: syscon@1e000000 {
-		compatible = "mediatek,mt7621-ethsys",
-			     "syscon";
-		reg = <0x1e000000 0x1000>;
-		#clock-cells = <1>;
-	};
-
 	ethernet: ethernet@1e100000 {
 		compatible = "mediatek,mt7621-eth";
 		reg = <0x1e100000 0x10000>;
@@ -461,7 +454,10 @@
 		interrupt-parent = <&gic>;
 		interrupts = <GIC_SHARED 3 IRQ_TYPE_LEVEL_HIGH>;
 
-		mediatek,ethsys = <&ethsys>;
+		mediatek,ethsys = <&sysc>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>;
 
 		gmac0: mac@0 {
 			compatible = "mediatek,eth-mac";
@@ -488,17 +484,17 @@
 
 			switch0: switch@1f {
 				compatible = "mediatek,mt7621";
-				#address-cells = <1>;
-				#size-cells = <0>;
 				reg = <0x1f>;
 				mediatek,mcm;
 				resets = <&rstctrl 2>;
 				reset-names = "mcm";
+				interrupt-controller;
+				#interrupt-cells = <1>;
+				interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
 
 				ports {
 					#address-cells = <1>;
 					#size-cells = <0>;
-					reg = <0>;
 
 					port@0 {
 						status = "disabled";
@@ -539,6 +535,7 @@
 						fixed-link {
 							speed = <1000>;
 							full-duplex;
+							pause;
 						};
 					};
 				};
@@ -546,19 +543,12 @@
 		};
 	};
 
-	gsw: gsw@1e110000 {
-		compatible = "mediatek,mt7621-gsw";
-		reg = <0x1e110000 0x8000>;
-		interrupt-parent = <&gic>;
-		interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
-	};
-
 	pcie: pcie@1e140000 {
 		compatible = "mediatek,mt7621-pci";
-		reg = <0x1e140000 0x100     /* host-pci bridge registers */
-			0x1e142000 0x100    /* pcie port 0 RC control registers */
-			0x1e143000 0x100    /* pcie port 1 RC control registers */
-			0x1e144000 0x100>;  /* pcie port 2 RC control registers */
+		reg = <0x1e140000 0x100>, /* host-pci bridge registers */
+		      <0x1e142000 0x100>, /* pcie port 0 RC control registers */
+		      <0x1e143000 0x100>, /* pcie port 1 RC control registers */
+		      <0x1e144000 0x100>; /* pcie port 2 RC control registers */
 		#address-cells = <3>;
 		#size-cells = <2>;
 
@@ -567,11 +557,8 @@
 
 		device_type = "pci";
 
-		bus-range = <0 255>;
-		ranges = <
-			0x02000000 0 0x00000000 0x60000000 0 0x10000000 /* pci memory */
-			0x01000000 0 0x00000000 0x1e160000 0 0x00010000 /* io space */
-		>;
+		ranges = <0x02000000 0 0x00000000 0x60000000 0 0x10000000>, /* pci memory */
+			 <0x01000000 0 0x00000000 0x1e160000 0 0x00010000>; /* io space */
 
 		interrupt-parent = <&gic>;
 		interrupts = <GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH
@@ -580,9 +567,9 @@
 
 		status = "disabled";
 
-		resets = <&rstctrl 24 &rstctrl 25 &rstctrl 26>;
+		resets = <&rstctrl 24>, <&rstctrl 25>, <&rstctrl 26>;
 		reset-names = "pcie0", "pcie1", "pcie2";
-		clocks = <&clkctrl 24 &clkctrl 25 &clkctrl 26>;
+		clocks = <&clkctrl 24>, <&clkctrl 25>, <&clkctrl 26>;
 		clock-names = "pcie0", "pcie1", "pcie2";
 		phys = <&pcie0_phy 1>, <&pcie2_phy 0>;
 		phy-names = "pcie-phy0", "pcie-phy2";
@@ -593,24 +580,24 @@
 			reg = <0x0000 0 0 0 0>;
 			#address-cells = <3>;
 			#size-cells = <2>;
+			device_type = "pci";
 			ranges;
-			bus-range = <0x00 0xff>;
 		};
 
 		pcie1: pcie@1,0 {
 			reg = <0x0800 0 0 0 0>;
 			#address-cells = <3>;
 			#size-cells = <2>;
+			device_type = "pci";
 			ranges;
-			bus-range = <0x00 0xff>;
 		};
 
 		pcie2: pcie@2,0 {
 			reg = <0x1000 0 0 0 0>;
 			#address-cells = <3>;
 			#size-cells = <2>;
+			device_type = "pci";
 			ranges;
-			bus-range = <0x00 0xff>;
 		};
 	};

try to compile with cudy dts and this old mt7621.dtsi

Nope ... didn't worked out ... https://github.com/waja/openwrt-cudy-x6-firmware/commit/26f4c47111366b21621cfa45d73eea766a0fe17c resulted into https://github.com/waja/openwrt-cudy-x6-firmware/commit/26f4c47111366b21621cfa45d73eea766a0fe17c but same result ... reboot loop :frowning:

ok now it's a game let's fix that!
can you try:

flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,fast-read;

please try on 22.03.2

Good morning,

still unlucky. I tried https://github.com/waja/openwrt-cudy-x6-firmware/commit/656a454cf5b2f95bca8aab1f8a6175324bea92fd with resulting https://github.com/waja/openwrt-cudy-x6-firmware/releases/tag/2022.11.29-2312.

@waja You'll really need serial here to see any error messages printed at boot. Without, you're going blind.

Actually, I would try to avoid to make adjustments on the hardware, cause I'm still able to return them to the dealer. :confused:
I'm asking me, if it's much better to try to get a V2 somewhere, as Cudy seems to provide a customized OpenWRT firmware which seems based on 22.03. But for this I would like to able to return the V1, if possible.

yes try that check only the u-boot partition if is the same.

Hi,

thanks to the help in https://github.com/openwrt/openwrt/issues/11333#issuecomment-1333530476 I learned, that
https://github.com/openwrt/openwrt/issues/11333#issuecomment-1333871978 is fixing the issue.

For completeness, it seems it's a Rev 1.3 like you can see on this

.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.