From: INAGAKI Hiroshi <musashino.open@gmail.com>
Date: Sat, 1 Oct 2022 12:22:20 +0000 (+0900)
Subject: ramips: add support for ELECOM WRC-2533GHBK2-T
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=1f5f2e588aba66719b240f80432ebed395749d14;p=openwrt%2Fstaging%2Fnbd.git

ramips: add support for ELECOM WRC-2533GHBK2-T

ELECOM WRC-2533GHBK2-T is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based
on MT7621A.

Specification:

- SoC      : MediaTek MT7621A
- RAM      : DDR3 128 MiB
- Flash    : SPI-NOR 16 MiB (Macronix MX25L12835FM2I-10G)
- WLAN     : 2.4/5 GHz 4T4R (2x MediaTek MT7615)
- Ethernet : 10/100/1000 Mbps x5
  - Switch : MediaTek MT7530 (SoC)
- LED/keys : 4x/3x (2x buttons, 1x slide-switch)
- UART     : through-hole on PCB
  - J4: 3.3V, RX, GND, TX from SoC side
  - 57600n8
- Power    : 12 VDC, 1.5 A

Flash instruction using factory image:

1. Boot WRC-2533GHBK2-T normally
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button
4. Wait ~150 seconds to complete flashing

MAC addresses:

LAN    : BC:5C:4C:xx:xx:FD (Config,  "ethaddr" (text))
WAN    : BC:5C:4C:xx:xx:FC (Config,  "wanaddr" (text), Label)
2.4 GHz: BC:5C:4C:xx:xx:FE (Factory, 0x4       (hex))
5 GHz  : BC:5C:4C:xx:xx:FF (Factory, 0x8004    (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
---

diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk2-t.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk2-t.dts
new file mode 100644
index 0000000000..f17c2c7112
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk2-t.dts
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621_elecom_wrc-2533ghbk.dtsi"
+
+/ {
+	compatible = "elecom,wrc-2533ghbk2-t", "mediatek,mt7621-soc";
+	model = "ELECOM WRC-2533GHBK2-T";
+};
+
+&partitions {
+	partition@50000 {
+		compatible = "denx,uimage";
+		label = "firmware";
+		reg = <0x50000 0x7a0000>;
+	};
+
+	partition@7f0000 {
+		label = "TM_1";
+		reg = <0x7f0000 0x200000>;
+		read-only;
+	};
+
+	partition@9f0000 {
+		label = "TM_2";
+		reg = <0x9f0000 0x400000>;
+		read-only;
+	};
+
+	partition@df0000 {
+		label = "manufacture";
+		reg = <0xdf0000 0x190000>;
+		read-only;
+	};
+
+	partition@f80000 {
+		label = "storage";
+		reg = <0xf80000 0x80000>;
+		read-only;
+	};
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 2269833e48..f2ca2a971d 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -789,6 +789,20 @@ define Device/elecom_wrc-1900gst
 endef
 TARGET_DEVICES += elecom_wrc-1900gst
 
+define Device/elecom_wrc-2533ghbk2-t
+  $(Device/dsa-migration)
+  $(Device/uimage-lzma-loader)
+  DEVICE_VENDOR := ELECOM
+  DEVICE_MODEL := WRC-2533GHBK2-T
+  IMAGE_SIZE := 7808k
+  IMAGES += factory.bin
+  IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \
+	elx-header 0107003b 8844A2D168B45A2D | \
+	elecom-product-header WRC-2533GHBK2-T
+  DEVICE_PACKAGES := kmod-mt7615-firmware
+endef
+TARGET_DEVICES += elecom_wrc-2533ghbk2-t
+
 define Device/elecom_wrc-2533ghbk-i
   $(Device/dsa-migration)
   $(Device/uimage-lzma-loader)
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 9a8e385a31..027457d39c 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -174,6 +174,7 @@ ramips_setup_macs()
 		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
 		wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
 		;;
+	elecom,wrc-2533ghbk2-t|\
 	elecom,wrc-2533ghbk-i)
 		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
 		wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)