diff --git a/target/linux/ramips/dts/mt7621_iodata_wn-deax1800gr.dts b/target/linux/ramips/dts/mt7621_iodata_wn-deax1800gr.dts new file mode 100644 index 00000000000..10959a1fcdc --- /dev/null +++ b/target/linux/ramips/dts/mt7621_iodata_wn-deax1800gr.dts @@ -0,0 +1,239 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> + +/ { + compatible = "iodata,wn-deax1800gr", "mediatek,mt7621-soc"; + model = "I-O DATA WN-DEAX1800GR"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-upgrade = &led_status_green; + label-mac-device = &gmac1; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: led-0 { + label = "green:status"; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_STATUS; + }; + + led_status_red: led-1 { + label = "red:status"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_STATUS; + }; + + led-2 { + label = "green:wps_wifi"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WPS; + }; + + led-3 { + label = "green:power"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_POWER; + default-state = "on"; + }; + + led-4 { + label = "green:router"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_INDICATOR; + }; + + led-5 { + label = "green:internet"; + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_WAN; + }; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,code = <KEY_WPS_BUTTON>; + }; + + reset { + label = "reset"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = <KEY_RESTART>; + }; + + led_on { + label = "led_on"; + gpios = <&gpio 10 GPIO_ACTIVE_HIGH>; + linux,code = <BTN_0>; + linux,input-type = <EV_SW>; + }; + }; +}; + +&nand { + status = "okay"; + + mediatek,nmbm; + mediatek,bmt-remap-range = + <0x0000000 0x780000>, /* u-boot - kernel1(6 MiB) */ + <0x2f80000 0x600000>, /* kernel2 - kernel2(6 MiB) */ + <0x5d80000 0x780000>; /* storage - working */ + + 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>; + read-only; + }; + + partition@100000 { + compatible = "nvmem-cells"; + label = "factory"; + reg = <0x100000 0x80000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom: eeprom@0 { + reg = <0x0 0x1aa20>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@180000 { + label = "kernel"; + reg = <0x180000 0x600000>; + }; + + partition@580000 { + label = "ubi"; + reg = <0x780000 0x2800000>; + }; + + partition@2f80000 { + label = "firmware2"; + reg = <0x2f80000 0x2e00000>; + }; + + partition@5d80000 { + label = "storage"; + reg = <0x5d80000 0x600000>; + read-only; + }; + + partition@6380000 { + label = "idmkey"; + reg = <0x6380000 0x100000>; + read-only; + }; + + partition@6480000 { + label = "working"; + reg = <0x6480000 0x80000>; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4 0>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_4 2>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan1"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +/* + * pcie0: MT7915 HIF (14c3,7916) + * pcie1: MT7915 (14c3,7915) + */ +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + + nvmem-cells = <&eeprom>; + nvmem-cell-names = "eeprom"; + }; +}; + +&state_default { + gpio { + groups = "i2c", "jtag", "uart2", "uart3"; + function = "gpio"; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 07e8aea182a..ad45613a0b4 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -58,6 +58,37 @@ define Build/iodata-mstc-header ) endef +define Build/iodata-mstc-header2 + $(eval model=$(word 1,$(1))) + $(eval model_id=$(word 2,$(1))) + + ( \ + fw_len_crc=$$(gzip -c $@ | tail -c 8 | \ + od -An -tx8 --endian little); \ + printf "\x03\x1d\x61\x29\x07$(model)" | \ + dd bs=21 count=1 conv=sync 2>/dev/null; \ + printf "0.00.000" | dd bs=16 count=1 conv=sync 2>/dev/null; \ + printf "$$(echo $(REVISION) | cut -d- -f1 | head -c8)" | \ + dd bs=9 count=1 conv=sync 2>/dev/null; \ + printf "$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)" | \ + dd bs=33 count=1 conv=sync 2>/dev/null; \ + date -d "@$(SOURCE_DATE_EPOCH)" "+%F" | tr -d "\n" | \ + dd bs=15 count=1 conv=sync 2>/dev/null; \ + printf "$$(echo $(model_id) | sed 's/../\\x&/g')" | \ + dd bs=8 count=1 conv=sync 2>/dev/null; \ + printf "$$(echo $$fw_len_crc | sed 's/../\\x&/g')" | \ + dd bs=14 count=1 conv=sync 2>/dev/null; \ + cat $@; \ + ) > $@.new + ( \ + header_crc="$$(head -c116 $@.new | gzip -c | tail -c8 | \ + od -An -tx4 -N4 --endian little)"; \ + printf "$$(echo $$header_crc | sed 's/../\\x&/g')"; \ + ) | dd of=$@.new bs=4 oflag=seek_bytes seek=110 conv=notrunc + + mv $@.new $@ +endef + define Build/znet-header $(eval version=$(word 1,$(1))) ( \ @@ -1195,6 +1226,27 @@ define Device/iodata_wn-ax2033gr endef TARGET_DEVICES += iodata_wn-ax2033gr +define Device/iodata_wn-deax1800gr + $(Device/dsa-migration) + DEVICE_VENDOR := I-O DATA + DEVICE_MODEL := WN-DEAX1800GR + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 6144k + IMAGE_SIZE := 47104k + UBINIZE_OPTS := -E 5 + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + ARTIFACTS := initramfs-factory.bin + ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \ + check-size | xor-image -p 29944a25120984c2 -x | \ + iodata-mstc-header2 WN-DEAX1800GR 00021003 + DEVICE_PACKAGES := kmod-mt7915-firmware +endef +TARGET_DEVICES += iodata_wn-deax1800gr + define Device/iodata_wn-dx1167r $(Device/iodata_nand) DEVICE_MODEL := WN-DX1167R 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 8039c9ede10..bd4cb508126 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 @@ -67,6 +67,7 @@ ramips_setup_interfaces() beeline,smartbox-flash|\ beeline,smartbox-giga|\ glinet,gl-mt1300|\ + iodata,wn-deax1800gr|\ iptime,a3002mesh|\ jcg,q20|\ lenovo,newifi-d1|\ 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 85e97b4f839..203872394bd 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -129,6 +129,10 @@ platform_do_upgrade() { iodata_mstc_set_flag "bootnum" "persist" "0x4" "1,2" "1" nand_do_upgrade "$1" ;; + iodata,wn-deax1800gr) + iodata_mstc_set_flag "bootnum" "working" "0x4" "0,1" "0" + nand_do_upgrade "$1" + ;; iodata,wn-dx1200gr) iodata_mstc_set_flag "debugflag" "factory" "0x1fe75" "0,1" "1" iodata_mstc_set_flag "bootnum" "persist" "0x4" "1,2" "1"