From: Mathias Kresin <dev@kresin.me>
Date: Wed, 12 Apr 2017 05:53:56 +0000 (+0200)
Subject: ramips: add ZBT-WE826 32MB variant
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=2ddaf96a77a92186447ca18935b8a36d46d3db95;p=openwrt%2Fstaging%2Fldir.git

ramips: add ZBT-WE826 32MB variant

The ZBT-WG826 is available with 16 or 32 MByte of flash. Split the
device tree source file, rename the currently supported 16 MByte
version and add the 32 MByte variant.

Signed-off-by: Mathias Kresin <dev@kresin.me>
---

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 213f2edc26..d11d9c3df8 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -395,10 +395,11 @@ zbt-wa05)
 zbt-we2026)
 	set_wifi_led "$board:green:wlan"
 	;;
-zbt-we826)
-	ucidef_set_led_default "power" "power" "$board:green:power" "1"
-	set_wifi_led "$board:green:wifi"
-	set_usb_led "$board:green:usb"
+zbt-we826-16M|\
+zbt-we826-32M)
+	ucidef_set_led_default "power" "power" "zbt-we826:green:power" "1"
+	set_wifi_led "zbt-we826:green:wifi"
+	set_usb_led "zbt-we826:green:usb"
 	;;
 zbt-wr8305rt)
 	ucidef_set_led_default "power" "power" "$board:green:sys" "1"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 016d293cf8..80a3bc2c51 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -112,7 +112,8 @@ ramips_setup_interfaces()
 	youku-yk1|\
 	zbt-ape522ii|\
 	zbt-we1326|\
-	zbt-we826|\
+	zbt-we826-16M|\
+	zbt-we826-32M|\
 	zbt-wg2626|\
 	zbt-wg3526-16M|\
 	zbt-wg3526-32M|\
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 8b5e260f1f..f2aca340dd 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -189,8 +189,7 @@ get_status_led() {
 		status_led="$board:amber:system"
 		;;
 	oy-0001|\
-	sl-r7205|\
-	zbt-we826)
+	sl-r7205)
 		status_led="$board:green:wifi"
 		;;
 	psr-680w)
@@ -273,6 +272,10 @@ get_status_led() {
 	zbt-cpe102)
 		status_led="$board:green:4g-0"
 		;;
+	zbt-we826-16M|\
+	zbt-we826-32M)
+		status_led="zbt-we826:green:wifi"
+		;;
 	zbt-wg3526-16M|\
 	zbt-wg3526-32M)
 		status_led="zbt-wg3526:green:status"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 3342a8f0c4..87cb7ffb91 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -652,8 +652,11 @@ ramips_board_detect() {
 	*"ZBT-WE2026")
 		name="zbt-we2026"
 		;;
-	*"ZBT-WE826")
-		name="zbt-we826"
+	*"ZBT-WE826 (16M)")
+		name="zbt-we826-16M"
+		;;
+	*"ZBT-WE826 (32M)")
+		name="zbt-we826-32M"
 		;;
 	*"ZBT-WG2626")
 		name="zbt-wg2626"
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 8c7f9591ce..adad8dae75 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -193,7 +193,8 @@ platform_check_image() {
 	zbt-wa05|\
 	zbt-we1326|\
 	zbt-we2026|\
-	zbt-we826|\
+	zbt-we826-16M|\
+	zbt-we826-32M|\
 	zbt-wg2626|\
 	zbt-wg3526-16M|\
 	zbt-wg3526-32M|\
diff --git a/target/linux/ramips/dts/ZBT-WE826-16M.dts b/target/linux/ramips/dts/ZBT-WE826-16M.dts
new file mode 100644
index 0000000000..de3c4c135d
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WE826-16M.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "ZBT-WG3526.dtsi"
+
+/ {
+	compatible = "zbtlink,zbt-we826-16m", "zbtlink,zbt-we826", "ralink,mt7620a-soc";
+	model = "ZBT-WE826 (16M)";
+};
+
+&firmware {
+	reg = <0x50000 0xfb0000>;
+};
\ No newline at end of file
diff --git a/target/linux/ramips/dts/ZBT-WE826-32M.dts b/target/linux/ramips/dts/ZBT-WE826-32M.dts
new file mode 100644
index 0000000000..c8383cbb64
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WE826-32M.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+#include "ZBT-WG3526.dtsi"
+
+/ {
+	compatible = "zbtlink,zbt-we826-32m", "zbtlink,zbt-we826", "ralink,mt7620a-soc";
+	model = "ZBT-WE826 (32M)";
+};
+
+&firmware {
+	reg = <0x50000 0x1fb0000>;
+};
\ No newline at end of file
diff --git a/target/linux/ramips/dts/ZBT-WE826.dts b/target/linux/ramips/dts/ZBT-WE826.dts
deleted file mode 100644
index 8a453bca32..0000000000
--- a/target/linux/ramips/dts/ZBT-WE826.dts
+++ /dev/null
@@ -1,123 +0,0 @@
-/dts-v1/;
-
-#include "mt7620a.dtsi"
-
-#include <dt-bindings/input/input.h>
-
-/ {
-	compatible = "zbtlink,zbt-we826", "ralink,mt7620a-soc";
-	model = "ZBT-WE826";
-
-	chosen {
-		bootargs = "console=ttyS0,115200";
-	};
-
-	gpio-leds {
-		compatible = "gpio-leds";
-		power {
-			label = "zbt-we826:green:power";
-			gpios = <&gpio1 14 0>;
-		};
-		usb {
-			label = "zbt-we826:green:usb";
-			gpios = <&gpio1 15 0>;
-		};
-		air {
-			label = "zbt-we826:green:wifi";
-			gpios = <&gpio3 0 1>;
-		};
-	};
-
-	gpio-keys-polled {
-		compatible = "gpio-keys-polled";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		poll-interval = <20>;
-		reset {
-			label = "reset";
-			gpios = <&gpio0 1 1>;
-			linux,code = <KEY_RESTART>;
-		};
-	};
-};
-
-&gpio0 {
-	status = "okay";
-};
-
-&gpio1 {
-	status = "okay";
-};
-
-&gpio3 {
-	status = "okay";
-};
-
-&spi0 {
-	status = "okay";
-
-	en25q128@0 {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "jedec,spi-nor";
-		reg = <0>;
-		spi-max-frequency = <10000000>;
-
-		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>;
-			read-only;
-		};
-
-		partition@50000 {
-			label = "firmware";
-			reg = <0x50000 0xfb0000>;
-		};
-	};
-};
-
-&sdhci {
-	status = "okay";
-};
-
-&ehci {
-	status = "okay";
-};
-
-&ohci {
-	status = "okay";
-};
-
-&ethernet {
-	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = "wllll";
-};
-
-&wmac {
-	ralink,mtd-eeprom = <&factory 0>;
-};
-
-&pinctrl {
-	state_default: pinctrl0 {
-		default {
-			ralink,group = "i2c", "uartf", "wled", "spi refclk", "pa";
-			ralink,function = "gpio";
-		};
-	};
-};
-
-&pcie {
-	status = "okay";
-};
diff --git a/target/linux/ramips/dts/ZBT-WE826.dtsi b/target/linux/ramips/dts/ZBT-WE826.dtsi
new file mode 100644
index 0000000000..62ea4195a8
--- /dev/null
+++ b/target/linux/ramips/dts/ZBT-WE826.dtsi
@@ -0,0 +1,119 @@
+/dts-v1/;
+
+#include "mt7620a.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		power {
+			label = "zbt-we826:green:power";
+			gpios = <&gpio1 14 0>;
+		};
+		usb {
+			label = "zbt-we826:green:usb";
+			gpios = <&gpio1 15 0>;
+		};
+		air {
+			label = "zbt-we826:green:wifi";
+			gpios = <&gpio3 0 1>;
+		};
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+		reset {
+			label = "reset";
+			gpios = <&gpio0 1 1>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+};
+
+&gpio0 {
+	status = "okay";
+};
+
+&gpio1 {
+	status = "okay";
+};
+
+&gpio3 {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+
+	en25q128@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+
+		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>;
+			read-only;
+		};
+
+		firmware: partition@50000 {
+			label = "firmware";
+		};
+	};
+};
+
+&sdhci {
+	status = "okay";
+};
+
+&ehci {
+	status = "okay";
+};
+
+&ohci {
+	status = "okay";
+};
+
+&ethernet {
+	mtd-mac-address = <&factory 0x4>;
+	mediatek,portmap = "wllll";
+};
+
+&wmac {
+	ralink,mtd-eeprom = <&factory 0>;
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		default {
+			ralink,group = "i2c", "uartf", "wled", "spi refclk", "pa";
+			ralink,function = "gpio";
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+};
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 83c9a7f0a0..71b651cda6 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -484,13 +484,22 @@ define Device/zbt-we2026
 endef
 TARGET_DEVICES += zbt-we2026
 
-define Device/zbt-we826
-  DTS := ZBT-WE826
+define Device/zbt-we826-16M
+  DTS := ZBT-WE826-16M
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
-  DEVICE_TITLE := Zbtlink ZBT-WE826
+  SUPPORTED_DEVICES += zbt-we826
+  DEVICE_TITLE := Zbtlink ZBT-WE826 (16M)
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620 
 endef
-TARGET_DEVICES += zbt-we826
+TARGET_DEVICES += zbt-we826-16M
+
+define Device/zbt-we826-32M
+  DTS := ZBT-WE826-32M
+  IMAGE_SIZE := $(ralink_default_fw_size_32M)
+  DEVICE_TITLE := Zbtlink ZBT-WE826 (32M)
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620
+endef
+TARGET_DEVICES += zbt-we826-32M
 
 define Device/zbt-wr8305rt
   DTS := ZBT-WR8305RT