Message ID | 32dabb5c-00ec-8793-17e1-9f946ff4f6a0@birger-koblitz.de |
---|---|
State | Superseded |
Headers | show |
Series | [OpenWrt-Devel] ramips: add support for Asus RT-AC85P | expand |
Hi, > -----Original Message----- > From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] > On Behalf Of Birger Koblitz > Sent: Samstag, 20. Juli 2019 19:36 > To: openwrt-devel@lists.openwrt.org > Subject: [OpenWrt-Devel] [PATCH] ramips: add support for Asus RT-AC85P > > ramips: add Asus RT-AC85P > > SoC: MediaTek MT7621AT dual-core @ 880MHz > RAM: 256M (Winbond W632GG6KB-1) > FLASH: 128MB (Macronix MX30LF1G18AC-TI) > WiFi: - 2.4GHz MediaTek MT7615N bgn > - 5GHz MediaTek MT7615N nac > Switch: SoC integrated Gigabit Switch (4 x LAN, 1 x WAN) > USB: 1 x USB 3.1 (Gen 1) > BTN: Reset, WPS > LED: - Power (blue) > - 5Ghz (blue) > - 2.4GHz (blue) > - Internet (blue) > - 4x LAN (blue) > (LAN/WAN leds are not controllable by GPIOs) > UART: UART is present as Pads marked J4 on the PCB. > 3.3V - TX - RX - GND / 57600-8N1 > 3.3V is the square pad > MAC: The MAC address on the router-label matches the MAC of > the 2.4 GHz WiFi. > LAN and WAN MAC are identical: MAC_LABEL+4 > 5 GHz WiFi MAC: also MAC_LABEL+4 That's a nice idea. We should encourage adding similar description for other device support commits, too. Question: So, LAN MAC, WAN MAC AND 5 GHz MAC are the same? > + asus,rt-ac85p|\ > dlink,dir-860l-b1|\ > elecom,wrc-1167ghbk2-s|\ > elecom,wrc-1900gst|\ Please move the block so sorting of blocks keep correct. > @@ -532,6 +533,9 @@ ramips_setup_macs() > lan_mac=$(macaddr_setbit_la "$lan_mac") > wan_mac=$(mtd_get_mac_binary factory 32772) > ;; > + asus,rt-ac85p) > + wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr) > + ;; This should be before asus,rt-n56u. Despite, if WAN_MAC and ethernet MAC address are really the same, you technically would not need to set eth0.2 (wan) MAC address again. However, if you completely remove the case here, you will fall into default and set wrong addresses. So, one could just set the wan_mac anyway or just add an "empty" case: > + asus,rt-ac85p) > + ;; ... > + compatible = "asus,rt-ac85p", "mediatek,mt7621-soc"; > + model = "Asus RC-AC85P"; RT instead of RC? > + leds { > + compatible = "gpio-leds"; Add an empty line here. > + led_power: power { > + label = "rt-ac85p:blue:power"; > + gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; > + linux,default-trigger = "phy0tpt"; > + }; > + wlan2g { > + label = "rt-ac85p:blue:wlan2g"; > + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; > + linux,default-trigger = "phy0radio"; > + }; > + > + wlan5g { > + label = "rt-ac85p:blue:wlan5g"; > + gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; > + linux,default-trigger = "phy1radio"; > + }; > + }; > +}; > + > +&sdhci { > + status = "okay"; > +}; > + > +&nand { > + status = "okay"; > + > + partitions { > + compatible = "fixed-partitions"; > + #address-cells = <1>; > + #size-cells = <1>; > + > + partition@0 { > + label = "u-boot"; > + reg = <0x0 0xe0000>; > + read-only; > + }; > + > + partition@e0000 { > + label = "u-boot-env"; > + reg = <0xe0000 0x100000>; > + read-only; > + }; > + > + factory: partition@1e0000 { > + label = "factory"; > + reg = <0x1e0000 0x100000>; > + read-only; > + }; > + > + factory2: partition@2e0000 { > + label = "factory2"; > + reg = <0x2e0000 0x100000>; > + read-only; > + }; > + > + partition@3e0000 { > + label = "kernel"; > + reg = <0x3e0000 0x400000>; > + }; > + > + partition@7e0000 { > + label = "ubi"; > + reg = <0x7e0000 0x2e00000>; > + }; > + > + partition@35e0000 { > + label = "firmware2"; Where is firmware1? kernel+ubi? > + reg = <0x35e0000 0x3200000>; > + }; > + }; > +}; > + > +&pcie { > + status = "okay"; > +}; > + > +&pcie0 { > + wifi@0,0 { Maybe add "wifi0:" here. > + compatible = "pci14c3,7603"; > + reg = <0x0000 0 0 0 0>; > + mediatek,mtd-eeprom = <&factory 0x0000>; > + ieee80211-freq-limit = <2400000 2500000>; > + mtd-mac-address = <&factory 0x4>; > + }; > +}; > + > +&pcie1 { > + wifi@0,0 { Maybe add "wifi1:" here. > + compatible = "pci14c3,7662"; > + reg = <0x0000 0 0 0 0>; > + mediatek,mtd-eeprom = <&factory 0x8000>; > + ieee80211-freq-limit = <5000000 6000000>; > + mtd-mac-address = <&factory 0x8004>; > + }; > +}; > + > +ðernet { > + mtd-mac-address = <&factory 0xe000>; So, this is the same as <&factory 0x8004>, but stored twice? > + mediatek,portmap = "wllll"; > + port@5 { > + status = "disabled"; > + }; > +}; > + > +&i2c { > + status = "disabled"; > +}; > + > +&pinctrl { > + state_default: pinctrl0 { > + gpio { > + ralink,group = "uart2", "uart3", "i2c"; > + ralink,function = "gpio"; > + }; > + }; > +}; > diff --git a/target/linux/ramips/image/mt7621.mk > b/target/linux/ramips/image/mt7621.mk > index 73ded64e74..c1f07ca746 100644 > --- a/target/linux/ramips/image/mt7621.mk > +++ b/target/linux/ramips/image/mt7621.mk > @@ -115,6 +115,22 @@ define Device/asus_rt-ac57u endef > TARGET_DEVICES += asus_rt-ac57u > > +define Device/asus_rt-ac85p > + MTK_SOC := mt7621 > + DEVICE_VENDOR := Asus Use all caps as for the rt-ac57u. Best Adrian
Hi, On 20.07.19 22:15, mail@adrianschmutzler.de wrote: > Hi, > >> -----Original Message----- >> MAC: The MAC address on the router-label matches the MAC of >> the 2.4 GHz WiFi. >> LAN and WAN MAC are identical: MAC_LABEL+4 >> 5 GHz WiFi MAC: also MAC_LABEL+4 > > That's a nice idea. We should encourage adding similar description for other device support commits, too. > > Question: So, LAN MAC, WAN MAC AND 5 GHz MAC are the same? Yes, indeed, this is the setup of the original firmware. It is quite strange that the 3 addresses in between are nowhere used. > >> + asus,rt-ac85p|\ >> dlink,dir-860l-b1|\ >> elecom,wrc-1167ghbk2-s|\ >> elecom,wrc-1900gst|\ > > Please move the block so sorting of blocks keep correct. Will do. > >> @@ -532,6 +533,9 @@ ramips_setup_macs() >> lan_mac=$(macaddr_setbit_la "$lan_mac") >> wan_mac=$(mtd_get_mac_binary factory 32772) >> ;; >> + asus,rt-ac85p) >> + wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr) >> + ;; > > This should be before asus,rt-n56u. Will do. > > Despite, if WAN_MAC and ethernet MAC address are really the same, you technically would not need to set eth0.2 (wan) MAC address again. > However, if you completely remove the case here, you will fall into default and set wrong addresses. > So, one could just set the wan_mac anyway or just add an "empty" case: >> + asus,rt-ac85p) >> + ;; I would prefer to keep this as is, since it allows to configure the MAC in the U-Boot environment. Also Asus might discover in a later FW version they could make use of the 3 addresses they were assigned, and do not currently use... > > ... > >> + compatible = "asus,rt-ac85p", "mediatek,mt7621-soc"; >> + model = "Asus RC-AC85P"; > > RT instead of RC? Ooops. > >> + leds { >> + compatible = "gpio-leds"; > > Add an empty line here. > Will do. >> +&nand { >> + status = "okay"; >> + >> + partitions { >> + compatible = "fixed-partitions"; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + >> + partition@0 { >> + label = "u-boot"; >> + reg = <0x0 0xe0000>; >> + read-only; >> + }; >> + >> + partition@e0000 { >> + label = "u-boot-env"; >> + reg = <0xe0000 0x100000>; >> + read-only; >> + }; >> + >> + factory: partition@1e0000 { >> + label = "factory"; >> + reg = <0x1e0000 0x100000>; >> + read-only; >> + }; >> + >> + factory2: partition@2e0000 { >> + label = "factory2"; >> + reg = <0x2e0000 0x100000>; >> + read-only; >> + }; >> + >> + partition@3e0000 { >> + label = "kernel"; >> + reg = <0x3e0000 0x400000>; >> + }; >> + >> + partition@7e0000 { >> + label = "ubi"; >> + reg = <0x7e0000 0x2e00000>; >> + }; >> + >> + partition@35e0000 { >> + label = "firmware2"; > > Where is firmware1? kernel+ubi? Yes, indeed. The router uses an interesting setup. Both the web-interface and the tftp in U-Boot always install the firmware twice into the partitions firmware 1: 3e0000 - 35dffff firmware 2: 35e0000 - 67e0000 During boot U-Boot verifies the checksums of both partitions. If one is not OK, the content of the other is copied over. It then boots the first partition. The second partition never gets active and therefore should not be made available to OpenWRT apart from this blob. One idea I had would be for sysupgrade to clear the checksum of the firmware2 partition after a sysupgrade and have U-Boot make a backup of firmware1 into firmware2 on the subsequent reboot. Alternatively, before a sysupgrade, a backup from firmware 1 to firmware 2 is made. However, the present setup also has its advantage: I did manage to have sysupgrade mess-up the first partition and U-Boot happily corrected this... >> +&pcie0 { >> + wifi@0,0 {> > Maybe add "wifi0:" here. Will do. > >> + compatible = "pci14c3,7603"; >> + reg = <0x0000 0 0 0 0>; >> + mediatek,mtd-eeprom = <&factory 0x0000>; >> + ieee80211-freq-limit = <2400000 2500000>; >> + mtd-mac-address = <&factory 0x4>; >> + }; >> +}; >> + >> +&pcie1 { >> + wifi@0,0 { > > Maybe add "wifi1:" here. Will do. > >> + compatible = "pci14c3,7662"; >> + reg = <0x0000 0 0 0 0>; >> + mediatek,mtd-eeprom = <&factory 0x8000>; >> + ieee80211-freq-limit = <5000000 6000000>; >> + mtd-mac-address = <&factory 0x8004>; >> + }; >> +}; >> + >> +ðernet { >> + mtd-mac-address = <&factory 0xe000>; > > So, this is the same as <&factory 0x8004>, but stored twice? Yes: birger@AMDDesktop:~/router/rt-ac85p$ hd backup-OpenWrt-factory-2019-07-10.bin|grep 00000000 00000000 15 76 a0 00 04 92 XX YY ZZ 90 15 76 c3 14 00 00 |.v....&E...v....| birger@AMDDesktop:~/router/rt-ac85p$ hd backup-OpenWrt-factory-2019-07-10.bin|grep 00008000 00008000 15 76 a0 00 04 92 XX YY ZZ 94 15 76 c3 14 00 80 |.v....&E...v....| birger@AMDDesktop:~/router/rt-ac85p$ hd backup-OpenWrt-factory-2019-07-10.bin|grep 0000e000 0000e000 04 92 XX YY ZZ 94 04 92 XX YY ZZ 90 ff ff ff ff |..&E....&E......| > >> +define Device/asus_rt-ac85p >> + MTK_SOC := mt7621 >> + DEVICE_VENDOR := Asus > > Use all caps as for the rt-ac57u. Will do. Cheers, Birger
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network index a2b7d1cf33..da26715c2e 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -298,6 +298,7 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0" ;; + asus,rt-ac85p|\ dlink,dir-860l-b1|\ elecom,wrc-1167ghbk2-s|\ elecom,wrc-1900gst|\ @@ -532,6 +533,9 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + asus,rt-ac85p) + wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr) + ;; belkin,f9k1109v1) wan_mac=$(mtd_get_mac_ascii uboot-env HW_WAN_MAC) lan_mac=$(mtd_get_mac_ascii uboot-env HW_LAN_MAC) diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index ae7a72c649..002e9c976b 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -32,6 +32,7 @@ platform_do_upgrade() { esac case "$board" in + asus,rt-ac85p|\ hiwifi,hc5962|\ netgear,r6220|\ netgear,r6350|\ diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts new file mode 100644 index 0000000000..9dd29ed80a --- /dev/null +++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts @@ -0,0 +1,163 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7621.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> + +/ { + compatible = "asus,rt-ac85p", "mediatek,mt7621-soc"; + model = "Asus RC-AC85P"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + palmbus: palmbus@1E000000 { + i2c@900 { + status = "okay"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + linux,code = <KEY_RESTART>; + }; + + wps { + label = "wps"; + gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; + linux,code = <KEY_WPS_BUTTON>; + }; + }; + + leds { + compatible = "gpio-leds"; + led_power: power { + label = "rt-ac85p:blue:power"; + gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + wlan2g { + label = "rt-ac85p:blue:wlan2g"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0radio"; + }; + + wlan5g { + label = "rt-ac85p:blue:wlan5g"; + gpios = <&gpio0 8 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1radio"; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0xe0000>; + read-only; + }; + + partition@e0000 { + label = "u-boot-env"; + reg = <0xe0000 0x100000>; + read-only; + }; + + factory: partition@1e0000 { + label = "factory"; + reg = <0x1e0000 0x100000>; + read-only; + }; + + factory2: partition@2e0000 { + label = "factory2"; + reg = <0x2e0000 0x100000>; + read-only; + }; + + partition@3e0000 { + label = "kernel"; + reg = <0x3e0000 0x400000>; + }; + + partition@7e0000 { + label = "ubi"; + reg = <0x7e0000 0x2e00000>; + }; + + partition@35e0000 { + label = "firmware2"; + reg = <0x35e0000 0x3200000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + mtd-mac-address = <&factory 0x4>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + mtd-mac-address = <&factory 0x8004>; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; + mediatek,portmap = "wllll"; + port@5 { + status = "disabled"; + }; +}; + +&i2c { + status = "disabled"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uart2", "uart3", "i2c"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 73ded64e74..c1f07ca746 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -115,6 +115,22 @@ define Device/asus_rt-ac57u endef TARGET_DEVICES += asus_rt-ac57u +define Device/asus_rt-ac85p + MTK_SOC := mt7621 + DEVICE_VENDOR := Asus + DEVICE_MODEL := RT-AC85P + IMAGE_SIZE := 51200k + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + IMAGES += factory.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE) + DEVICE_PACKAGES := kmod-usb3 kmod-mt76x2 kmod-mt7615 wpad-basic uboot-envtools +endef +TARGET_DEVICES += asus_rt-ac85p + define Device/buffalo_wsr-1166dhp MTK_SOC := mt7621 IMAGE/sysupgrade.bin := trx | pad-rootfs | append-metadata diff --git a/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch b/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch index d50e689110..d2d69b4ff4 100644 --- a/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch +++ b/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch @@ -4256,7 +4256,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> +#endif /* __NAND_DEF_H__ */ --- /dev/null +++ b/drivers/mtd/nand/nand_device_list.h -@@ -0,0 +1,59 @@ +@@ -0,0 +1,60 @@ +/* Copyright Statement: + * + * This software/firmware and related documentation ("MediaTek Software") are @@ -4308,6 +4308,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + {0xC8DC, 0x909554, 5, 8, 512, 128, 2048, 64, 0x30C77fff, "F59L4G81A", 0}, + {0xECD3, 0x519558, 5, 8, 1024, 128, 2048, 64, 0x44333, "K9K8G8000", 0}, + {0xC2F1, 0x801DC2, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "MX30LF1G08AA", 0}, ++ {0xC2F1, 0x809502, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "MX30LF1G18AC", 0}, + {0x98D3, 0x902676, 5, 8, 1024, 256, 4096, 224, 0x00C25332, "TC58NVG3S0F", 0}, + {0x01DA, 0x909546, 5, 8, 256, 128, 2048, 128, 0x30C77fff, "S34ML02G200TF", 0}, + {0x01DC, 0x909556, 5, 8, 512, 128, 2048, 128, 0x30C77fff, "S34ML04G200TF", 0},
ramips: add Asus RT-AC85P SoC: MediaTek MT7621AT dual-core @ 880MHz RAM: 256M (Winbond W632GG6KB-1) FLASH: 128MB (Macronix MX30LF1G18AC-TI) WiFi: - 2.4GHz MediaTek MT7615N bgn - 5GHz MediaTek MT7615N nac Switch: SoC integrated Gigabit Switch (4 x LAN, 1 x WAN) USB: 1 x USB 3.1 (Gen 1) BTN: Reset, WPS LED: - Power (blue) - 5Ghz (blue) - 2.4GHz (blue) - Internet (blue) - 4x LAN (blue) (LAN/WAN leds are not controllable by GPIOs) UART: UART is present as Pads marked J4 on the PCB. 3.3V - TX - RX - GND / 57600-8N1 3.3V is the square pad MAC: The MAC address on the router-label matches the MAC of the 2.4 GHz WiFi. LAN and WAN MAC are identical: MAC_LABEL+4 5 GHz WiFi MAC: also MAC_LABEL+4 Installation ------------ Via U-Boot tftpd: Switch on device, within 2s press reset button and keep pressed until power LED starts blinking slowly. Upload factory image via tftp put, the router's ip is 192.168.1.1 and expects the client on 192.168.1.75. Signed-off-by: Birger Koblitz <mail@birger-koblitz.de> ---