From 6448427eec470b0090f52652d6fb5e869ae4d26c Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 1 Jan 2022 16:11:32 +0100 Subject: [PATCH] mt7621: add support for CIG WF808 Signed-off-by: John Crispin --- .../0005-mt7621-add-CIG-WF808-support.patch | 249 ++++++++++++++++++ profiles/cig_wf808.yml | 8 + 2 files changed, 257 insertions(+) create mode 100644 patches/ramips/0005-mt7621-add-CIG-WF808-support.patch create mode 100644 profiles/cig_wf808.yml diff --git a/patches/ramips/0005-mt7621-add-CIG-WF808-support.patch b/patches/ramips/0005-mt7621-add-CIG-WF808-support.patch new file mode 100644 index 000000000..7c8af1f32 --- /dev/null +++ b/patches/ramips/0005-mt7621-add-CIG-WF808-support.patch @@ -0,0 +1,249 @@ +From 1ece0fbb9f49d3a43c10e61e696ba19804c20ac5 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Fri, 17 Dec 2021 16:11:07 +0100 +Subject: [PATCH] mt7621: add CIG WF808 support + +Signed-off-by: John Crispin +--- + package/boot/uboot-envtools/files/ramips | 3 + + target/linux/ramips/dts/mt7621_cig_wf808.dts | 131 ++++++++++++++++++ + target/linux/ramips/image/mt7621.mk | 10 ++ + .../mt7621/base-files/etc/board.d/02_network | 7 + + .../mt7621/base-files/etc/init.d/bootcount | 10 ++ + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + + 6 files changed, 162 insertions(+) + create mode 100644 target/linux/ramips/dts/mt7621_cig_wf808.dts + +diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips +index c711cc0a12..33af86c846 100644 +--- a/package/boot/uboot-envtools/files/ramips ++++ b/package/boot/uboot-envtools/files/ramips +@@ -42,6 +42,9 @@ zbtlink,zbt-wg2626|\ + zte,mf283plus) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" + ;; ++cig,wf808) ++ ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x80000" ++ ;; + hootoo,ht-tm05|\ + ravpower,rp-wd03) + idx="$(find_mtd_index u-boot-env)" +diff --git a/target/linux/ramips/dts/mt7621_cig_wf808.dts b/target/linux/ramips/dts/mt7621_cig_wf808.dts +new file mode 100644 +index 0000000000..e08f87fb06 +--- /dev/null ++++ b/target/linux/ramips/dts/mt7621_cig_wf808.dts +@@ -0,0 +1,131 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++#include "mt7621.dtsi" ++ ++#include ++#include ++ ++/ { ++ compatible = "cig,wf808", "mediatek,mt7621-soc"; ++ model = "CIG WF-808"; ++ ++ aliases { ++ led-boot = &led_power; ++ led-failsafe = &led_power; ++ led-running = &led_power; ++ led-upgrade = &led_power; ++ }; ++ ++ chosen { ++ bootargs = "console=ttyS0,57600"; ++ }; ++ ++ reserved-memory { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges; ++ ++ ramoops@ec0000 { ++ compatible = "ramoops"; ++ reg = <0xec0000 0x140000>; ++ record-size = <0x1000>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ red { ++ label = "red:power"; ++ gpios = <&gpio 13 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led_power: green { ++ label = "green:power"; ++ gpios = <&gpio 14 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ }; ++ ++ blue { ++ label = "blue:power"; ++ gpios = <&gpio 15 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&nand { ++ status = "okay"; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "u-boot"; ++ reg = <0x0 0x80000>; ++ read-only; ++ }; ++ ++ partition@80000 { ++ label = "u-boot-env"; ++ reg = <0x80000 0x80000>; ++ }; ++ ++ factory: partition@100000 { ++ label = "factory"; ++ reg = <0x100000 0x40000>; ++ read-only; ++ }; ++ ++ partition@1400000 { ++ label = "kernel"; ++ reg = <0x140000 0x4c0000>; ++ }; ++ ++ partition@600000 { ++ label = "ubi"; ++ reg = <0x600000 0x1a00000>; ++ }; ++ }; ++}; ++ ++&state_default { ++ gpio { ++ groups = "uart2", "uart3", "jtag"; ++ function = "gpio"; ++ }; ++}; ++ ++&pcie { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ mt76@0,0 { ++ compatible = "mediatek,mt76"; ++ reg = <0x0000 0 0 0 0>; ++ mediatek,mtd-eeprom = <&factory 0x0000>; ++ }; ++}; ++ ++&pcie1 { ++ mt76@0,0 { ++ compatible = "mediatek,mt76"; ++ reg = <0x0000 0 0 0 0>; ++ mediatek,mtd-eeprom = <&factory 0x8000>; ++ }; ++}; ++ ++&switch0 { ++ ports { ++ port@0 { ++ status = "okay"; ++ label = "wan"; ++ }; ++ }; ++}; ++ ++&xhci { ++ status = "disabled"; ++}; +diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk +index eebd49d86c..c3a1f68d84 100644 +--- a/target/linux/ramips/image/mt7621.mk ++++ b/target/linux/ramips/image/mt7621.mk +@@ -261,6 +261,16 @@ define Device/buffalo_wsr-600dhp + endef + TARGET_DEVICES += buffalo_wsr-600dhp + ++define Device/cig_wf808 ++ $(Device/dsa-migration) ++ DEVICE_VENDOR := CIG ++ DEVICE_MODEL := WF808 ++ IMAGE_SIZE := 25000kk ++ DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware uboot-envtools ++ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata ++endef ++TARGET_DEVICES += cig_wf808 ++ + define Device/cudy_wr1300 + $(Device/dsa-migration) + IMAGE_SIZE := 15872k +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 53910135cc..0e171f457b 100755 +--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network ++++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +@@ -46,6 +46,9 @@ ramips_setup_interfaces() + xiaomi,mi-router-4a-gigabit) + ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" + ;; ++ cig,wf808) ++ ucidef_set_interface_wan "wan" ++ ;; + gnubee,gb-pc1|\ + gnubee,gb-pc2) + ucidef_set_interface_lan "lan1 lan2" +@@ -109,6 +112,10 @@ ramips_setup_macs() + wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)" + lan_mac=$wan_mac + ;; ++ cig,wf808) ++ wan_mac=$(mtd_get_mac_ascii u-boot-env mac1) ++ label_mac=$wan_mac ++ ;; + dlink,dir-860l-b1) + lan_mac=$(mtd_get_mac_ascii factory lanmac) + wan_mac=$(mtd_get_mac_ascii factory wanmac) +diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +index d3525ea0c9..90d88049b6 100755 +--- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount ++++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +@@ -8,6 +8,16 @@ boot() { + [ -n "$(fw_printenv bootcount bootchanged 2>/dev/null)" ] &&\ + echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s - + ;; ++ cig,wf808) ++ stable=`fw_printenv -n Image1Stable 2>/dev/null` ++ if [ "${stable}" -ne 1 ]; then ++ fw_setenv Image1Stable 1 ++ fi ++ try=`fw_printenv -n Image1Try 2>/dev/null` ++ if [ "${try}" -ne 0 ]; then ++ fw_setenv Image1Try 0 ++ fi ++ ;; + linksys,e5600|\ + linksys,ea7300-v1|\ + linksys,ea7300-v2|\ +diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +index 1f1ecb33d9..f044325752 100755 +--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +@@ -53,6 +53,7 @@ platform_do_upgrade() { + ampedwireless,ally-r1900k|\ + asus,rt-ac65p|\ + asus,rt-ac85p|\ ++ cig,wf808|\ + dlink,dir-1960-a1|\ + dlink,dir-2640-a1|\ + dlink,dir-2660-a1|\ +-- +2.25.1 + diff --git a/profiles/cig_wf808.yml b/profiles/cig_wf808.yml new file mode 100644 index 000000000..cebb784ee --- /dev/null +++ b/profiles/cig_wf808.yml @@ -0,0 +1,8 @@ +--- +profile: cig_wf808 +target: ramips +subtarget: mt7621 +description: Build image for the CIG WF-808 +image: bin/targets/ramips/mt7621/openwrt-ramips-mt7621-cig_wf808-squashfs-sysupgrade.bin +include: + - ucentral-ap