ramips: add support for Belkin RT1800
Belkin RT1800 is an 802.11ax (Wi-Fi 6) router, based on MediaTek MT7621A. Specifications: - SoC: MT7621 (880MHz, 2 Cores) - RAM: 256 MB - Flash: 128 MB NAND - Wi-Fi: - MT7915D: 2.4/5 GHz (DBDC) - Ethernet: 5x 1GiE MT7530 - USB: 1x USB 3.0 - UART: J4 (57600 baud) - Pinout: [3V3] (TXD) (RXD) (blank) (GND) Notes: * This device has a dual-boot partition scheme, but this firmware works only on boot partition 1. Installation: Upload the generated factory.bin image via the stock web firmware updater. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
		 Rosen Penev
					Rosen Penev
				
			
				
					committed by
					
						 Hauke Mehrtens
						Hauke Mehrtens
					
				
			
			
				
	
			
			
			 Hauke Mehrtens
						Hauke Mehrtens
					
				
			
						parent
						
							fe609889e2
						
					
				
				
					commit
					26a6a6a60b
				
			| @@ -47,6 +47,7 @@ zbtlink,zbt-wg2626|\ | |||||||
| zte,mf283plus) | zte,mf283plus) | ||||||
| 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" | 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" | ||||||
| 	;; | 	;; | ||||||
|  | belkin,rt1800|\ | ||||||
| h3c,tx1800-plus|\ | h3c,tx1800-plus|\ | ||||||
| h3c,tx1801-plus|\ | h3c,tx1801-plus|\ | ||||||
| h3c,tx1806|\ | h3c,tx1806|\ | ||||||
|   | |||||||
							
								
								
									
										165
									
								
								target/linux/ramips/dts/mt7621_belkin_rt1800.dts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										165
									
								
								target/linux/ramips/dts/mt7621_belkin_rt1800.dts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,165 @@ | |||||||
|  | // 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 = "belkin,rt1800", "mediatek,mt7621-soc"; | ||||||
|  | 	model = "Belkin RT1800"; | ||||||
|  |  | ||||||
|  | 	aliases { | ||||||
|  | 		led-boot = &led_power; | ||||||
|  | 		led-failsafe = &led_power; | ||||||
|  | 		led-running = &led_power; | ||||||
|  | 		led-upgrade = &led_power; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	chosen { | ||||||
|  | 		bootargs = "console=ttyS0,115200"; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	keys { | ||||||
|  | 		compatible = "gpio-keys"; | ||||||
|  |  | ||||||
|  | 		reset { | ||||||
|  | 			label = "reset"; | ||||||
|  | 			gpios = <&gpio 6 GPIO_ACTIVE_LOW>; | ||||||
|  | 			linux,code = <KEY_RESTART>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		wps { | ||||||
|  | 			label = "wps"; | ||||||
|  | 			gpios = <&gpio 18 GPIO_ACTIVE_LOW>; | ||||||
|  | 			linux,code = <KEY_WPS_BUTTON>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	leds { | ||||||
|  | 		compatible = "gpio-leds"; | ||||||
|  |  | ||||||
|  | 		led_power: led-power { | ||||||
|  | 			label = "white:power"; | ||||||
|  | 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>; | ||||||
|  | 			default-state = "on"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		led-wan { | ||||||
|  | 			color = <LED_COLOR_ID_WHITE>; | ||||||
|  | 			function = LED_FUNCTION_WAN; | ||||||
|  | 			gpios = <&switch0 0 GPIO_ACTIVE_LOW>; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &nand { | ||||||
|  | 	status = "okay"; | ||||||
|  |  | ||||||
|  | 	partitions { | ||||||
|  | 		compatible = "fixed-partitions"; | ||||||
|  | 		#address-cells = <1>; | ||||||
|  | 		#size-cells = <1>; | ||||||
|  |  | ||||||
|  | 		partition@0 { | ||||||
|  | 			label = "Boot"; | ||||||
|  | 			reg = <0x0 0x80000>; | ||||||
|  | 			read-only; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		partition@80000 { | ||||||
|  | 			label = "Config"; | ||||||
|  | 			reg = <0x80000 0x80000>; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		factory: partition@100000 { | ||||||
|  | 			label = "Factory"; | ||||||
|  | 			reg = <0x100000 0x80000>; | ||||||
|  | 			read-only; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		partition@180000 { | ||||||
|  | 			label = "firmware"; | ||||||
|  | 			reg = <0x180000 0x3000000>; | ||||||
|  |  | ||||||
|  | 			compatible = "fixed-partitions"; | ||||||
|  | 			#address-cells = <1>; | ||||||
|  | 			#size-cells = <1>; | ||||||
|  |  | ||||||
|  | 			partition@0 { | ||||||
|  | 				label = "kernel"; | ||||||
|  | 				reg = <0x0 0x400000>; | ||||||
|  | 			}; | ||||||
|  |  | ||||||
|  | 			partition@400000 { | ||||||
|  | 				label = "ubi"; | ||||||
|  | 				reg = <0x400000 0x2c00000>; | ||||||
|  | 			}; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		partition@3180000 { | ||||||
|  | 			label = "alt_firmware"; | ||||||
|  | 			reg = <0x3180000 0x3000000>; | ||||||
|  | 			read-only; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		partition@6180000 { | ||||||
|  | 			label = "cbtinfo"; | ||||||
|  | 			reg = <0x6180000 0x80000>; | ||||||
|  | 			read-only; | ||||||
|  | 		}; | ||||||
|  | 		/* seems to be the end here. Can't read past 0x6200000 */ | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &pcie { | ||||||
|  | 	status = "okay"; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &pcie1 { | ||||||
|  | 	wifi@0,0 { | ||||||
|  | 		compatible = "mediatek,mt76"; | ||||||
|  | 		reg = <0x0000 0 0 0 0>; | ||||||
|  | 		mediatek,mtd-eeprom = <&factory 0x0000>; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &gmac1 { | ||||||
|  | 	status = "okay"; | ||||||
|  | 	label = "wan"; | ||||||
|  | 	phy-handle = <ðphy0>; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &mdio { | ||||||
|  | 	ethphy0: ethernet-phy@0 { | ||||||
|  | 		reg = <0>; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | &switch0 { | ||||||
|  | 	gpio-controller; | ||||||
|  | 	#gpio-cells = <2>; | ||||||
|  |  | ||||||
|  | 	ports { | ||||||
|  | 		port@1 { | ||||||
|  | 			status = "okay"; | ||||||
|  | 			label = "lan4"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		port@2 { | ||||||
|  | 			status = "okay"; | ||||||
|  | 			label = "lan3"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		port@3 { | ||||||
|  | 			status = "okay"; | ||||||
|  | 			label = "lan2"; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		port@4 { | ||||||
|  | 			status = "okay"; | ||||||
|  | 			label = "lan1"; | ||||||
|  | 		}; | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
| @@ -70,6 +70,30 @@ define Build/iodata-mstc-header | |||||||
| 	) | 	) | ||||||
| endef | endef | ||||||
|  |  | ||||||
|  | define Build/belkin-header | ||||||
|  | 	$(eval magic=$(word 1,$(1))) | ||||||
|  | 	$(eval hw_ver=$(word 2,$(1))) | ||||||
|  | 	$(eval fw_ver=$(word 3,$(1))) | ||||||
|  |  | ||||||
|  | 	( \ | ||||||
|  | 		type_fw_date=$$(printf "01%02x%02x%02x" \ | ||||||
|  | 			$$(date -d "@$(SOURCE_DATE_EPOCH)" "+%y %m %d")); \ | ||||||
|  | 		hw_fw_ver=$$(printf "%02x%02x%02x%02x" \ | ||||||
|  | 			$(hw_ver) $$(echo $(fw_ver) | cut -d. -f-3 | tr . ' ')); \ | ||||||
|  | 		fw_len_crc=$$(gzip -c $@ | tail -c 8 | od -An -tx8 | tr -d ' \n'); \ | ||||||
|  | 		fw_crc_len="$${fw_len_crc:8:8}$${fw_len_crc:0:8}"; \ | ||||||
|  | 		\ | ||||||
|  | 		printf "$(magic)" | dd bs=4 count=1 conv=sync 2>/dev/null; \ | ||||||
|  | 		printf "$$(echo $${type_fw_date}$${hw_fw_ver} | \ | ||||||
|  | 			sed 's/../\\x&/g')"; \ | ||||||
|  | 		printf "$$(echo $${fw_crc_len}$${fw_crc_len} | \ | ||||||
|  | 			sed 's/../\\x&/g')"; \ | ||||||
|  | 		printf "\x5c\x78\x00\x00"; \ | ||||||
|  | 		cat $@; \ | ||||||
|  | 	) > $@.new | ||||||
|  | 	mv $@.new $@ | ||||||
|  | endef | ||||||
|  |  | ||||||
| define Build/ubnt-erx-factory-image | define Build/ubnt-erx-factory-image | ||||||
| 	if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \ | 	if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \ | ||||||
| 		echo '21001:7' > $(1).compat; \ | 		echo '21001:7' > $(1).compat; \ | ||||||
| @@ -341,6 +365,27 @@ define Device/beeline_smartbox-turbo | |||||||
| endef | endef | ||||||
| TARGET_DEVICES += beeline_smartbox-turbo | TARGET_DEVICES += beeline_smartbox-turbo | ||||||
|  |  | ||||||
|  | define Device/belkin_rt1800 | ||||||
|  |   $(Device/dsa-migration) | ||||||
|  |   BLOCKSIZE := 128k | ||||||
|  |   PAGESIZE := 2048 | ||||||
|  |   KERNEL_SIZE := 4096k | ||||||
|  |   IMAGE_SIZE := 49152k | ||||||
|  |   DEVICE_VENDOR := Belkin | ||||||
|  |   DEVICE_MODEL := RT1800 | ||||||
|  |   DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 uboot-envtools | ||||||
|  |   UBINIZE_OPTS := -E 5 | ||||||
|  |   KERNEL_LOADADDR := 0x82000000 | ||||||
|  |   KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ | ||||||
|  | 	fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | \ | ||||||
|  | 	append-squashfs4-fakeroot | ||||||
|  |   IMAGES += factory.bin | ||||||
|  |   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | ||||||
|  |   IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ | ||||||
|  | 	append-ubi | check-size | belkin-header RT18 1 9.9.9 | ||||||
|  | endef | ||||||
|  | TARGET_DEVICES += belkin_rt1800 | ||||||
|  |  | ||||||
| define Device/buffalo_wsr-1166dhp | define Device/buffalo_wsr-1166dhp | ||||||
|   $(Device/dsa-migration) |   $(Device/dsa-migration) | ||||||
|   $(Device/uimage-lzma-loader) |   $(Device/uimage-lzma-loader) | ||||||
|   | |||||||
| @@ -28,6 +28,9 @@ beeline,smartbox-giga|\ | |||||||
| beeline,smartbox-turbo) | beeline,smartbox-turbo) | ||||||
| 	ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" | 	ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" | ||||||
| 	;; | 	;; | ||||||
|  | belkin,rt1800) | ||||||
|  | 	ucidef_set_led_netdev "wan" "wan" "white:wan" "wan" | ||||||
|  | 	;; | ||||||
| cudy,wr2100) | cudy,wr2100) | ||||||
| 	ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" | 	ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" | ||||||
| 	ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" | 	ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" | ||||||
|   | |||||||
| @@ -205,6 +205,11 @@ ramips_setup_macs() | |||||||
| 		wan_mac=$lan_mac | 		wan_mac=$lan_mac | ||||||
| 		label_mac=$lan_mac | 		label_mac=$lan_mac | ||||||
| 		;; | 		;; | ||||||
|  | 	belkin,rt1800) | ||||||
|  | 		lan_mac=$(mtd_get_mac_ascii Config lan_hwaddr) | ||||||
|  | 		wan_mac=$(mtd_get_mac_ascii Config wan_hwaddr) | ||||||
|  | 		label_mac=$lan_mac | ||||||
|  | 		;; | ||||||
| 	mikrotik,routerboard-750gr3|\ | 	mikrotik,routerboard-750gr3|\ | ||||||
| 	mikrotik,routerboard-760igs|\ | 	mikrotik,routerboard-760igs|\ | ||||||
| 	mikrotik,routerboard-m11g|\ | 	mikrotik,routerboard-m11g|\ | ||||||
|   | |||||||
| @@ -84,6 +84,11 @@ case "$board" in | |||||||
| 		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress | 		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress | ||||||
| 		[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress | 		[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress | ||||||
| 		;; | 		;; | ||||||
|  | 	belkin,rt1800) | ||||||
|  | 		hw_mac_addr=$(mtd_get_mac_ascii Config wan_hwaddr) | ||||||
|  | 		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress | ||||||
|  | 		[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress | ||||||
|  | 		;; | ||||||
| 	netgear,wax202) | 	netgear,wax202) | ||||||
| 		hw_mac_addr=$(mtd_get_mac_ascii Config mac) | 		hw_mac_addr=$(mtd_get_mac_ascii Config mac) | ||||||
| 		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress | 		[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ boot() { | |||||||
| 	linksys,ea8100-v2) | 	linksys,ea8100-v2) | ||||||
| 		mtd resetbc s_env || true | 		mtd resetbc s_env || true | ||||||
| 		;; | 		;; | ||||||
|  | 	belkin,rt1800|\ | ||||||
| 	samknows,whitebox-v8) | 	samknows,whitebox-v8) | ||||||
| 		fw_setenv bootcount 0 | 		fw_setenv bootcount 0 | ||||||
| 		;; | 		;; | ||||||
|   | |||||||
| @@ -57,6 +57,7 @@ platform_do_upgrade() { | |||||||
| 	beeline,smartbox-flash|\ | 	beeline,smartbox-flash|\ | ||||||
| 	beeline,smartbox-giga|\ | 	beeline,smartbox-giga|\ | ||||||
| 	beeline,smartbox-turbo|\ | 	beeline,smartbox-turbo|\ | ||||||
|  | 	belkin,rt1800|\ | ||||||
| 	dlink,dir-1960-a1|\ | 	dlink,dir-1960-a1|\ | ||||||
| 	dlink,dir-2640-a1|\ | 	dlink,dir-2640-a1|\ | ||||||
| 	dlink,dir-2660-a1|\ | 	dlink,dir-2660-a1|\ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user