diff mbox series

[OpenWrt-Devel,v3] ramips: add Asus RT-AC85P

Message ID 3f82a09f-916b-3ba0-c595-b1d5fc7226cc@birger-koblitz.de
State Superseded, archived
Headers show
Series [OpenWrt-Devel,v3] ramips: add Asus RT-AC85P | expand

Commit Message

Birger Koblitz Aug. 4, 2019, 4:46 a.m. UTC
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.

The images also work on the Asus RT-AC65P models as tested by Gabor.

Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
Tested-by: Gabor Varga <vargagab@gmail.com>

---

v2: Corrected sorting of entries in 02_network
    Model name corrected in .dts
    Whitespace fixes in .dts
    wifi0/1 labels added to wifi nodes in .dts
    Device name capitalized in mt7621.mk

v3: Added firmware backup to firmware2 partition before sysupgrade
    Corrected modules included in image

   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},

Comments

Gábor Varga Aug. 5, 2019, 8:13 a.m. UTC | #1
As I wrote to Birger, I think the Asus RT-AC85P and the Asus RT-AC65P
boards - despite the Asus specifications and the Wikidevi informations -
are identical.

1. As you can see, the board ha 3 external and 1 internal antenna:
https://drive.google.com/open?id=1cOlX_P2O-UtMcjFVxJT54Sodn8cmxp0_
2. On the Asus RT-AC65P board are two MT7615N radios:
https://drive.google.com/open?id=1jfMKkwtNuOiYyegT2Mtu--n1QY6Xr3Vx,
https://drive.google.com/open?id=1TIVwYlEAraymv4y8piAARNIew6XVP7sY
3. The Asus factory firmware says too, that the device has a 600 Mbps and
an 1733 Mbps radio:
admin@RT-AC65P:/tmp/home/root# iwconfig ra0
ra0 RTWIFI SoftAP ESSID:"AC65p_24"
Mode:Managed Channel=3 Access Point: 04:92:26:47:56:08
Bit Rate=600 Mb/s

admin@RT-AC65P:/tmp/home/root# iwconfig rai0
rai0 RTWIFI SoftAP ESSID:"AC65p_5"
Mode:Managed Channel=36 Access Point: 04:92:26:47:56:0C
Bit Rate=1.732 Gb/s

Gabor Varga

Birger Koblitz <mail@birger-koblitz.de> ezt írta (időpont: 2019. aug. 4.,
V, 6:46):

> 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.
>
> The images also work on the Asus RT-AC65P models as tested by Gabor.
>
> Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
> Tested-by: Gabor Varga <vargagab@gmail.com>
>
> ---
>
> v2: Corrected sorting of entries in 02_network
>     Model name corrected in .dts
>     Whitespace fixes in .dts
>     wifi0/1 labels added to wifi nodes in .dts
>     Device name capitalized in mt7621.mk
>
> v3: Added firmware backup to firmware2 partition before sysupgrade
>     Corrected modules included in image
>
> 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 2f9a02256e..ab90041d92 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -231,6 +231,17 @@ ramips_setup_interfaces()
>          ucidef_add_switch "switch0" \
>              "0:lan" "1:wan" "6@eth0"
>          ;;
> +    asus,rt-ac85p|\
> +    dlink,dir-860l-b1|\
> +    elecom,wrc-1167ghbk2-s|\
> +    elecom,wrc-1900gst|\
> +    elecom,wrc-2533gst|\
> +    huawei,hg255d|\
> +    iodata,wn-ax1167gr|\
> +    iodata,wn-gx300gr)
> +        ucidef_add_switch "switch0" \
> +            "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
> +        ;;
>      asus,rt-n15|\
>      belkin,f9k1109v1|\
>      sitecom,wl-351)
> @@ -298,16 +309,6 @@ ramips_setup_interfaces()
>          ucidef_add_switch "switch0" \
>              "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
>          ;;
> -    dlink,dir-860l-b1|\
> -    elecom,wrc-1167ghbk2-s|\
> -    elecom,wrc-1900gst|\
> -    elecom,wrc-2533gst|\
> -    huawei,hg255d|\
> -    iodata,wn-ax1167gr|\
> -    iodata,wn-gx300gr)
> -        ucidef_add_switch "switch0" \
> -            "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
> -        ;;
>      dlink,dwr-118-a1)
>          ucidef_add_switch "switch0" \
>              "1:lan:2" "2:lan:3" "3:lan:1" "4:lan:0" "5:wan" "6@eth0"
> @@ -531,6 +532,9 @@ ramips_setup_macs()
>          lan_mac=$(mtd_get_mac_binary factory 57344)
>          wan_mac=$(mtd_get_mac_binary factory 57350)
>          ;;
> +    asus,rt-ac85p)
> +        wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr)
> +        ;;
>      asus,rt-n56u)
>          lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
>          wan_mac=$(mtd_get_mac_binary factory 32772)
> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> index a65492a309..cd9d8ae650 100755
> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> @@ -18,9 +18,16 @@ platform_do_upgrade() {
>      mikrotik,rbm33g)
>          [ -z "$(rootfs_type)" ] && mtd erase firmware
>          ;;
> +       asus,rt-ac85p)
> +        echo "Backing up firmware"
> +        dd if=/dev/mtd4 bs=1024 count=4096  > /tmp/backup_firmware.bin
> +        dd if=/dev/mtd5 bs=1024 count=52224 >> /tmp/backup_firmware.bin
> +        mtd -e firmware2 write /tmp/backup_firmware.bin firmware2
> +        ;;
>      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..7aea207fad
> --- /dev/null
> +++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
> @@ -0,0 +1,164 @@
> +// 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 RT-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 {
> +    wifi0: 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 {
> +    wifi1: 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>;
> +    };
> +};
> +
> +&ethernet {
> +    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 d86eb8cc34..c036a1c308 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-mt7615e 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},
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
Gábor Varga Aug. 23, 2019, 9:04 a.m. UTC | #2
Hi!

Although it looks like the Asus RT-AC85P and the Asus RT-AC65P models are
identical, but I have separated them into two dts and have introduced the
HW version into the names (for the new versions in the future).

I have an alternative installation method via SSH:

Note: The user/password for SSH is identical with the one used in the
Web-interface.

1. Complete the initial setup wizard.
2. Activate SSH under "Administration" -> "System".
3. Transfer the OpenWrt factory image via scp:
 > scp openwrt-ramips-mt7621-asus_rt-ac65p-r01-squashfs-factory.bin
admin@192.168.50.1:/tmp
4. Connect via SSH to the router.
 > ssh admin@192.168.50.1
5. Write the OpenWrt image to flash.
 > mtd-write -i
/tmp/openwrt-ramips-mt7621-asus_rt-ac65p-r01-squashfs-factory.bin -d linux
6. Reboot the router
 > reboot

Another thing: I don't know, if it's good method to replace the second
firmware partition with OpenWrt image during sysupgrade. When we don't do
that, than we have always a factory firmware on the secondary firmware
partition, so the back to the factory firmware would be much easier.

So, the new patch for the separated models:

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 c0de9d4e50..110e921f38 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -300,6 +300,8 @@ 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-ac65p-r01|\
+ asus,rt-ac85p-r01|\
  dlink,dir-860l-b1|\
  elecom,wrc-1167ghbk2-s|\
  elecom,wrc-1900gst|\
@@ -537,6 +539,10 @@ ramips_setup_macs()
  lan_mac=$(mtd_get_mac_binary factory 0xe000)
  wan_mac=$(mtd_get_mac_binary factory 0xe006)
  ;;
+ asus,rt-ac65p-r01|\
+ asus,rt-ac85p-r01)
+ wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr)
+ ;;
  asus,rt-n56u)
  lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
  wan_mac=$(mtd_get_mac_binary factory 0x8004)
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index a65492a309..7a50c61b1d 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -18,9 +18,18 @@ platform_do_upgrade() {
  mikrotik,rbm33g)
  [ -z "$(rootfs_type)" ] && mtd erase firmware
  ;;
+ asus,rt-ac65p-r01|\
+ asus,rt-ac85p-r01)
+ echo "Backing up firmware"
+ dd if=/dev/mtd4 bs=1024 count=4096  > /tmp/backup_firmware.bin
+ dd if=/dev/mtd5 bs=1024 count=52224 >> /tmp/backup_firmware.bin
+ mtd -e firmware2 write /tmp/backup_firmware.bin firmware2
+ ;;
  esac

  case "$board" in
+ asus,rt-ac65p-r01|\
+ asus,rt-ac85p-r01|\
  hiwifi,hc5962|\
  netgear,r6220|\
  netgear,r6350|\
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac65p-r01.dts
b/target/linux/ramips/dts/mt7621_asus_rt-ac65p-r01.dts
new file mode 100644
index 0000000000..3d2d1bfe6d
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac65p-r01.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621_asus_rt-ac85p.dtsi"
+
+/ {
+    compatible = "asus,rt-ac65p-r01", "mediatek,mt7621-soc";
+    model = "Asus RT-AC65P R01";
+};
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac85p-r01.dts
b/target/linux/ramips/dts/mt7621_asus_rt-ac85p-r01.dts
new file mode 100644
index 0000000000..115d52c71c
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p-r01.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621_asus_rt-ac85p.dtsi"
+
+/ {
+    compatible = "asus,rt-ac85p-r01", "mediatek,mt7621-soc";
+    model = "Asus RT-AC85P R01";
+};
diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dtsi
b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dtsi
new file mode 100644
index 0000000000..aa1229ab03
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dtsi
@@ -0,0 +1,161 @@
+// 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>
+
+/ {
+    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 {
+    wifi0: 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 {
+    wifi1: 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>;
+    };
+};
+
+&ethernet {
+    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 d32feb7eab..7efe2cdc7f 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -115,6 +115,40 @@ define Device/asus_rt-ac57u
 endef
 TARGET_DEVICES += asus_rt-ac57u

+define Device/asus_rt-ac65p-r01
+  MTK_SOC := mt7621
+  DEVICE_VENDOR := ASUS
+  DEVICE_MODEL := RT-AC65P
+  DEVICE_VARIANT := R01
+  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-mt7615e wpad-basic uboot-envtools
+endef
+TARGET_DEVICES += asus_rt-ac65p-r01
+
+define Device/asus_rt-ac85p-r01
+  MTK_SOC := mt7621
+  DEVICE_VENDOR := ASUS
+  DEVICE_MODEL := RT-AC85P
+  DEVICE_VARIANT := R01
+  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-mt7615e wpad-basic uboot-envtools
+endef
+TARGET_DEVICES += asus_rt-ac85p-r01
+
 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},



Birger Koblitz <mail@birger-koblitz.de> ezt írta (időpont: 2019. aug. 4.,
V, 6:46):

> 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.
>
> The images also work on the Asus RT-AC65P models as tested by Gabor.
>
> Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
> Tested-by: Gabor Varga <vargagab@gmail.com>
>
> ---
>
> v2: Corrected sorting of entries in 02_network
>     Model name corrected in .dts
>     Whitespace fixes in .dts
>     wifi0/1 labels added to wifi nodes in .dts
>     Device name capitalized in mt7621.mk
>
> v3: Added firmware backup to firmware2 partition before sysupgrade
>     Corrected modules included in image
>
> 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 2f9a02256e..ab90041d92 100755
> --- a/target/linux/ramips/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
> @@ -231,6 +231,17 @@ ramips_setup_interfaces()
>          ucidef_add_switch "switch0" \
>              "0:lan" "1:wan" "6@eth0"
>          ;;
> +    asus,rt-ac85p|\
> +    dlink,dir-860l-b1|\
> +    elecom,wrc-1167ghbk2-s|\
> +    elecom,wrc-1900gst|\
> +    elecom,wrc-2533gst|\
> +    huawei,hg255d|\
> +    iodata,wn-ax1167gr|\
> +    iodata,wn-gx300gr)
> +        ucidef_add_switch "switch0" \
> +            "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
> +        ;;
>      asus,rt-n15|\
>      belkin,f9k1109v1|\
>      sitecom,wl-351)
> @@ -298,16 +309,6 @@ ramips_setup_interfaces()
>          ucidef_add_switch "switch0" \
>              "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
>          ;;
> -    dlink,dir-860l-b1|\
> -    elecom,wrc-1167ghbk2-s|\
> -    elecom,wrc-1900gst|\
> -    elecom,wrc-2533gst|\
> -    huawei,hg255d|\
> -    iodata,wn-ax1167gr|\
> -    iodata,wn-gx300gr)
> -        ucidef_add_switch "switch0" \
> -            "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
> -        ;;
>      dlink,dwr-118-a1)
>          ucidef_add_switch "switch0" \
>              "1:lan:2" "2:lan:3" "3:lan:1" "4:lan:0" "5:wan" "6@eth0"
> @@ -531,6 +532,9 @@ ramips_setup_macs()
>          lan_mac=$(mtd_get_mac_binary factory 57344)
>          wan_mac=$(mtd_get_mac_binary factory 57350)
>          ;;
> +    asus,rt-ac85p)
> +        wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr)
> +        ;;
>      asus,rt-n56u)
>          lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
>          wan_mac=$(mtd_get_mac_binary factory 32772)
> diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> index a65492a309..cd9d8ae650 100755
> --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
> @@ -18,9 +18,16 @@ platform_do_upgrade() {
>      mikrotik,rbm33g)
>          [ -z "$(rootfs_type)" ] && mtd erase firmware
>          ;;
> +       asus,rt-ac85p)
> +        echo "Backing up firmware"
> +        dd if=/dev/mtd4 bs=1024 count=4096  > /tmp/backup_firmware.bin
> +        dd if=/dev/mtd5 bs=1024 count=52224 >> /tmp/backup_firmware.bin
> +        mtd -e firmware2 write /tmp/backup_firmware.bin firmware2
> +        ;;
>      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..7aea207fad
> --- /dev/null
> +++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
> @@ -0,0 +1,164 @@
> +// 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 RT-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 {
> +    wifi0: 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 {
> +    wifi1: 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>;
> +    };
> +};
> +
> +&ethernet {
> +    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 d86eb8cc34..c036a1c308 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-mt7615e 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},
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
Birger Koblitz Aug. 23, 2019, 9:56 a.m. UTC | #3
Hi,

On 23.08.19 11:04, Gábor Varga wrote:
> Hi!
>
> Although it looks like the Asus RT-AC85P and the Asus RT-AC65P models
> are identical, but I have separated them into two dts and have
> introduced the HW version into the names (for the new versions in the
> future).

Are you sure that is necessary? AFAIK there are no different versions of
the routers around and Asus seems to have a policy of constantly
churning out new router models without upgrading existing routers to new
revisions.


>
> I have an alternative installation method via SSH:
>
> Note: The user/password for SSH is identical with the one used in the
> Web-interface.
>
> 1. Complete the initial setup wizard.
> 2. Activate SSH under "Administration" -> "System".
> 3. Transfer the OpenWrt factory image via scp:
>  > scp openwrt-ramips-mt7621-asus_rt-ac65p-r01-squashfs-factory.bin
> admin@192.168.50.1:/tmp
> 4. Connect via SSH to the router.
>  > ssh admin@192.168.50.1 <mailto:admin@192.168.50.1>
> 5. Write the OpenWrt image to flash.
>  > mtd-write -i
> /tmp/openwrt-ramips-mt7621-asus_rt-ac65p-r01-squashfs-factory.bin -d linux
> 6. Reboot the router
>  > reboot
>
> Another thing: I don't know, if it's good method to replace the second
> firmware partition with OpenWrt image during sysupgrade. When we don't
> do that, than we have always a factory firmware on the secondary
> firmware partition, so the back to the factory firmware would be much
> easier.

I don't have a strong opinion on this. Both ways have their advantages.
If during sysupgrade both copies of the FW are written, then this is
consistent with the original software's behavior and additionally, the
outcome is independent of the OpenWRT initial installation method. When
using tftp (or the Web-GUI should someone figure out the exact format)
both copies are written, only ssh and serial port allow to install only
one copy. Not copying over the previous OpenWRT image to the second
partition during sysupgrade allows having a copy of the factory firmware
around (but which needs to be written to the first partition again to be
booted).

Cheers,

  Birger
Gábor Varga Aug. 23, 2019, 10:47 a.m. UTC | #4
Hi!

Birger Koblitz <mail@birger-koblitz.de> ezt írta (időpont: 2019. aug. 23.,
P, 11:56):

> Hi,
>
> On 23.08.19 11:04, Gábor Varga wrote:
> > Hi!
> >
> > Although it looks like the Asus RT-AC85P and the Asus RT-AC65P models
> > are identical, but I have separated them into two dts and have
> > introduced the HW version into the names (for the new versions in the
> > future).
>
> Are you sure that is necessary? AFAIK there are no different versions of
> the routers around and Asus seems to have a policy of constantly
> churning out new router models without upgrading existing routers to new
> revisions.


I introduced the HW revision because according to the Asus specification
the two routers should be different at least at the radio hardware. Maybe
Asus can't buy only temporarily MT7615S and MT7615B radios, and fix this in
the next hardware release. Otherwise the Asus has more routers with same
name and different HW version with fully different hardware. For example:
RT-N10 rev A1 has a BroadCom SoC, the rev. C1 has a RaLink SoC.
Or you mean, why have I separated the two models? I have made this, because
with only one dts the model of the router under OpenWrt would be in both
case Asus RT-AC85P.


> >
> > I have an alternative installation method via SSH:
> >
> > Note: The user/password for SSH is identical with the one used in the
> > Web-interface.
> >
> > 1. Complete the initial setup wizard.
> > 2. Activate SSH under "Administration" -> "System".
> > 3. Transfer the OpenWrt factory image via scp:
> >  > scp openwrt-ramips-mt7621-asus_rt-ac65p-r01-squashfs-factory.bin
> > admin@192.168.50.1:/tmp
> > 4. Connect via SSH to the router.
> >  > ssh admin@192.168.50.1 <mailto:admin@192.168.50.1>
> > 5. Write the OpenWrt image to flash.
> >  > mtd-write -i
> > /tmp/openwrt-ramips-mt7621-asus_rt-ac65p-r01-squashfs-factory.bin -d
> linux
> > 6. Reboot the router
> >  > reboot
> >
> > Another thing: I don't know, if it's good method to replace the second
> > firmware partition with OpenWrt image during sysupgrade. When we don't
> > do that, than we have always a factory firmware on the secondary
> > firmware partition, so the back to the factory firmware would be much
> > easier.
>
> I don't have a strong opinion on this. Both ways have their advantages.
> If during sysupgrade both copies of the FW are written, then this is
> consistent with the original software's behavior and additionally, the
> outcome is independent of the OpenWRT initial installation method. When
> using tftp (or the Web-GUI should someone figure out the exact format)
> both copies are written, only ssh and serial port allow to install only
> one copy. Not copying over the previous OpenWRT image to the second
> partition during sysupgrade allows having a copy of the factory firmware
> around (but which needs to be written to the first partition again to be
> booted).
>

I don't know what is the best option. But, when we leave the second
partition untouched, than the user go back to the factory firmware, when he
write only one block to the firmware partition (and the checksum will be
wrong, so the bootloader overwrites the first partition with the second
one.

Cheers,

Gabor Varga

>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
diff mbox series

Patch

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 2f9a02256e..ab90041d92 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -231,6 +231,17 @@  ramips_setup_interfaces()
         ucidef_add_switch "switch0" \
             "0:lan" "1:wan" "6@eth0"
         ;;
+    asus,rt-ac85p|\
+    dlink,dir-860l-b1|\
+    elecom,wrc-1167ghbk2-s|\
+    elecom,wrc-1900gst|\
+    elecom,wrc-2533gst|\
+    huawei,hg255d|\
+    iodata,wn-ax1167gr|\
+    iodata,wn-gx300gr)
+        ucidef_add_switch "switch0" \
+            "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
+        ;;
     asus,rt-n15|\
     belkin,f9k1109v1|\
     sitecom,wl-351)
@@ -298,16 +309,6 @@  ramips_setup_interfaces()
         ucidef_add_switch "switch0" \
             "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
         ;;
-    dlink,dir-860l-b1|\
-    elecom,wrc-1167ghbk2-s|\
-    elecom,wrc-1900gst|\
-    elecom,wrc-2533gst|\
-    huawei,hg255d|\
-    iodata,wn-ax1167gr|\
-    iodata,wn-gx300gr)
-        ucidef_add_switch "switch0" \
-            "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
-        ;;
     dlink,dwr-118-a1)
         ucidef_add_switch "switch0" \
             "1:lan:2" "2:lan:3" "3:lan:1" "4:lan:0" "5:wan" "6@eth0"
@@ -531,6 +532,9 @@  ramips_setup_macs()
         lan_mac=$(mtd_get_mac_binary factory 57344)
         wan_mac=$(mtd_get_mac_binary factory 57350)
         ;;
+    asus,rt-ac85p)
+        wan_mac=$(mtd_get_mac_ascii u-boot-env et1macaddr)
+        ;;
     asus,rt-n56u)
         lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
         wan_mac=$(mtd_get_mac_binary factory 32772)
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index a65492a309..cd9d8ae650 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -18,9 +18,16 @@  platform_do_upgrade() {
     mikrotik,rbm33g)
         [ -z "$(rootfs_type)" ] && mtd erase firmware
         ;;
+       asus,rt-ac85p)
+        echo "Backing up firmware"
+        dd if=/dev/mtd4 bs=1024 count=4096  > /tmp/backup_firmware.bin
+        dd if=/dev/mtd5 bs=1024 count=52224 >> /tmp/backup_firmware.bin
+        mtd -e firmware2 write /tmp/backup_firmware.bin firmware2
+        ;;
     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..7aea207fad
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_asus_rt-ac85p.dts
@@ -0,0 +1,164 @@ 
+// 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 RT-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 {
+    wifi0: 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 {
+    wifi1: 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>;
+    };
+};
+
+&ethernet {
+    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 d86eb8cc34..c036a1c308 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-mt7615e wpad-basic uboot-envtools
+endef
+TARGET_DEVICES += asus_rt-ac85p
+
 define Device/buffalo_wsr-1166dhp
   MTK_SOC := mt7621