diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index ee2d95115c..a59f647685 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -25,6 +25,10 @@ allnet,all0256n-8m|\ allnet,all5002) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; +ampedwireless,ally-00x19k|\ +ampedwireless,ally-r1900k) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" "4" + ;; buffalo,wsr-1166dhp|\ buffalo,wsr-600dhp|\ mediatek,linkit-smart-7688|\ diff --git a/target/linux/ramips/dts/mt7621_ampedwireless_ally-00x19k.dts b/target/linux/ramips/dts/mt7621_ampedwireless_ally-00x19k.dts new file mode 100644 index 0000000000..51d41c7fb4 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_ampedwireless_ally-00x19k.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_ampedwireless_ally.dtsi" + +/ { + compatible = "ampedwireless,ally-00x19k", "mediatek,mt7621-soc"; + model = "Amped Wireless ALLY-00X19K"; +}; + +&switch0 { + ports { + port@2 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/mt7621_ampedwireless_ally-r1900k.dts b/target/linux/ramips/dts/mt7621_ampedwireless_ally-r1900k.dts new file mode 100644 index 0000000000..cd2536e179 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_ampedwireless_ally-r1900k.dts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_ampedwireless_ally.dtsi" + +/ { + compatible = "ampedwireless,ally-r1900k", "mediatek,mt7621-soc"; + model = "Amped Wireless ALLY-R1900K"; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "wan"; + }; + + port@2 { + status = "okay"; + label = "lan1"; + }; + + port@3 { + status = "okay"; + label = "lan2"; + }; + + port@4 { + status = "okay"; + label = "lan3"; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_ampedwireless_ally.dtsi b/target/linux/ramips/dts/mt7621_ampedwireless_ally.dtsi new file mode 100644 index 0000000000..7736b06e43 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_ampedwireless_ally.dtsi @@ -0,0 +1,179 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_status_amber; + led-failsafe = &led_status_amber; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; + + keys { + compatible = "gpio-keys"; + + led_switch { + label = "led_switch"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + linux,code = ; + linux,input-type = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: status_red { + label = "red:status"; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + }; + + led_status_amber: status_amber { + label = "amber:status"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7615"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7615"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&state_default { + gpio { + groups = "uart2", "uart3", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&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; + }; + + /* + * uboot expects to find kernels at 0x140000 & 0x2140000, + * referred to as Uimage & Uimage1 in factory FW, respectively. + * U-boot variable 'bootImage' controls which is booted; + * 0 for the first, 1 for the 2nd. + * There's a 3rd partition, Uimage2 (0x4140000), which + * I expected to be a recovery image, but is actually blank. + * + * A kernel is considered suitable for handing control over + * if its linux magic number exists & uImage CRC are correct. + * If either of those conditions fail, 'bootImage' value + * is toggled in uboot env & a restart performed in the hope that the + * alternate kernel is okay. + * + * Note uboot's tftp flash install writes the transferred + * image to the active kernel partition. + */ + + partition@140000 { + label = "kernel"; + reg = <0x140000 0x400000>; + }; + + partition@540000 { + label = "ubi"; + reg = <0x540000 0x1c00000>; + }; + + partition@2140000 { + label = "oem"; + reg = <0x2140000 0x2000000>; + }; + + partition@4140000 { + label = "backup"; + reg = <0x4140000 0x2000000>; + }; + + partition@6140000 { + label = "chime"; + reg = <0x6140000 0xa00000>; + }; + + partition@6b40000 { + label = "data"; + reg = <0x6b40000 0xa00000>; + }; + + partition@7540000 { + label = "reserved"; + reg = <0x7540000 0x840000>; + read-only; + }; + + partition@7d80000 { + label = "nvram"; + reg = <0x7d80000 0x100000>; + read-only; + }; + + partition@7e80000 { + label = "hwconfig"; + reg = <0x7e80000 0x100000>; + read-only; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 04f84ac1fe..4b8ec4ceb1 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -126,6 +126,33 @@ define Device/alfa-network_quad-e4g endef TARGET_DEVICES += alfa-network_quad-e4g +define Device/ampedwireless_ally_common + $(Device/dsa-migration) + DEVICE_VENDOR := Amped Wireless + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware uboot-envtools + IMAGE_SIZE := 32768k + KERNEL_SIZE := 4096k + BLOCKSIZE := 128k + PAGESIZE := 2048 + UBINIZE_OPTS := -E 5 + KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma -n 'flashable-initramfs' |\ + edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef + +define Device/ampedwireless_ally-r1900k + $(Device/ampedwireless_ally_common) + DEVICE_MODEL := ALLY-R1900K + DEVICE_PACKAGES += kmod-usb3 +endef +TARGET_DEVICES += ampedwireless_ally-r1900k + +define Device/ampedwireless_ally-00x19k + $(Device/ampedwireless_ally_common) + DEVICE_MODEL := ALLY-00X19K +endef +TARGET_DEVICES += ampedwireless_ally-00x19k + define Device/asiarf_ap7621-001 $(Device/dsa-migration) IMAGE_SIZE := 16000k 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 df69e1c432..b31c99e6f1 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 @@ -8,6 +8,26 @@ ramips_setup_interfaces() local board="$1" case $board in + ampedwireless,ally-00x19k|\ + edimax,re23s|\ + mikrotik,routerboard-m11g|\ + netgear,ex6150|\ + thunder,timecloud|\ + tplink,re350-v1|\ + tplink,re500-v1|\ + tplink,re650-v1|\ + ubnt,unifi-6-lite|\ + ubnt,unifi-nanohd) + ucidef_set_interface_lan "lan" + ;; + ampedwireless,ally-r1900k|\ + gehua,ghl-r-001|\ + hiwifi,hc5962|\ + xiaomi,mi-router-3-pro|\ + xiaomi,mi-router-ac2100|\ + xiaomi,redmi-router-ac2100) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" + ;; asiarf,ap7621-001|\ winstars,ws-wn583a6) ucidef_set_interfaces_lan_wan "lan" "wan" @@ -23,24 +43,6 @@ ramips_setup_interfaces() xiaomi,mi-router-4a-gigabit) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; - edimax,re23s|\ - mikrotik,routerboard-m11g|\ - netgear,ex6150|\ - thunder,timecloud|\ - tplink,re350-v1|\ - tplink,re500-v1|\ - tplink,re650-v1|\ - ubnt,unifi-6-lite|\ - ubnt,unifi-nanohd) - ucidef_set_interface_lan "lan" - ;; - gehua,ghl-r-001|\ - hiwifi,hc5962|\ - xiaomi,mi-router-3-pro|\ - xiaomi,mi-router-ac2100|\ - xiaomi,redmi-router-ac2100) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" - ;; gnubee,gb-pc1|\ gnubee,gb-pc2) ucidef_set_interface_lan "lan1 lan2" @@ -85,6 +87,15 @@ ramips_setup_macs() local label_mac="" case $board in + ampedwireless,ally-00x19k) + lan_mac=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address) + label_mac=$lan_mac + ;; + ampedwireless,ally-r1900k) + lan_mac=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address) + wan_mac=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address) + label_mac=$lan_mac + ;; asus,rt-ac65p|\ asus,rt-ac85p) wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr) 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 7b57ee7776..689a0e51ae 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -27,6 +27,12 @@ platform_do_upgrade() { fi } ;; + ampedwireless,ally-00x19k|\ + ampedwireless,ally-r1900k) + if [ "$(fw_printenv --lock / -n bootImage 2>/dev/null)" != "0" ]; then + fw_setenv --lock / bootImage 0 || exit 1 + fi + ;; mikrotik,routerboard-750gr3|\ mikrotik,routerboard-760igs|\ mikrotik,routerboard-m11g|\ @@ -43,6 +49,8 @@ platform_do_upgrade() { esac case "$board" in + ampedwireless,ally-00x19k|\ + ampedwireless,ally-r1900k|\ asus,rt-ac65p|\ asus,rt-ac85p|\ dlink,dir-1960-a1|\