openwrt/target/linux
Mikhail Zhilkin 7ff95775a2 mediatek: add support for Mercusys MR90X v1
This commit adds support for Mercusys MR90X(EU) v1 router.

Device specification
--------------------
SoC Type:   MediaTek MT7986BLA, Cortex-A53, 64-bit
RAM:        MediaTek MT7986BLA (512MB)
Flash:      SPI NAND GigaDevice GD5F1GQ5UEYIGY (128 MB)
Ethernet:   MediaTek MT7531AE + 2.5GbE MaxLinear GPY211C0VC (SLNW8)
Ethernet:   1x2.5Gbe (WAN/LAN 2.5Gbps), 3xGbE (WAN/LAN 1Gbps, LAN1, LAN2)
WLAN 2g:    MediaTek MT7975N, b/g/n/ax, MIMO 4x4
WLAN 5g:    MediaTek MT7975P(N), a/n/ac/ax, MIMO 4x4
LEDs:       1 orange and 1 green status LEDs, 4 green gpio-controlled
            LEDs on ethernet ports
Button:     1 (Reset)
USB ports:  No
Power:      12 VDC, 2 A
Connector:  Barrel
Bootloader: Main U-Boot - U-Boot 2022.01-rc4. Additionally, both UBI
            slots contain "seconduboot" (also U-Boot 2022.01-rc4)

Serial console (UART)
---------------------
                            V
+-------+-------+-------+-------+
| +3.3V |  GND  |  TX   |  RX   |
+---+---+-------+-------+-------+
    |
    +--- Don't connect

The R3 (TX line) and R6 (RX line) are absent on the PCB. You should
solder them or solder the jumpers.

Installation (UART)
-------------------
1. Place OpenWrt initramfs image on tftp server with IP 192.168.1.2
2. Attach UART, switch on the router and interrupt the boot process by
   pressing 'Ctrl-C'
3. Load and run OpenWrt initramfs image:
      tftpboot initramfs-kernel.bin
      bootm
4. Once inside OpenWrt, set / update env variables:
      fw_setenv baudrate 115200
      fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit"
      fw_setenv fdtcontroladdr 5ffc0e70
      fw_setenv ipaddr 192.168.1.1
      fw_setenv loadaddr 0x46000000
      fw_setenv mtdids "spi-nand0=spi-nand0"
      fw_setenv mtdparts "spi-nand0:2M(boot),1M(u-boot-env),50M(ubi0),50M(ubi1),8M(userconfig),4M(tp_data)"
      fw_setenv netmask 255.255.255.0
      fw_setenv serverip 192.168.1.2
      fw_setenv stderr serial@11002000
      fw_setenv stdin serial@11002000
      fw_setenv stdout serial@11002000
      fw_setenv tp_boot_idx 0
5. Run 'sysupgrade -n' with the sysupgrade OpenWrt image

Installation (without UART)
---------------------------
1.  Login as root via SSH (router IP, port 20001, password - your web
    interface password)
2.  Open for editing /etc/hotplug.d/iface/65-iptv (e.g., using WinSCP and
    SSH settings from the p.1)
3.  Add a newline after "#!/bin/sh":
       telnetd -l /bin/login.sh
4.  Save "65-iptv" file
5.  Toggle "IPTV/VLAN Enable" checkbox in the router web interface and
    save
6.  Make sure that telnetd is running:
       netstat -ltunp | grep 23
7.  Login via telnet to router IP, port 23 (no username and password are
    required)
8  Upload OpenWrt "initramfs-kernel.bin" to the "/tmp" folder of the
    router (e.g., using WinSCP and SSH settings from the p.1)
9.  Stock busybox doesn't contain ubiupdatevol command. Hence, we need to
    download and upload the full version of busybox to the router. For
    example, from here:
    https://github.com/xerta555/Busybox-Binaries/raw/master/busybox-arm64
    Upload busybox-arm64 to the /tmp dir of the router and run:
    in the telnet shell:
       cd /tmp
       chmod a+x busybox-arm64
10. Check "initramfs-kernel.bin" size:
       du -h initramfs-kernel.bin
11. Delete old and create new "kernel" volume with appropriate size
    (greater than "initramfs-kernel.bin" size):
       ubirmvol /dev/ubi0 -N kernel
       ubimkvol /dev/ubi0 -n 1 -N kernel -s 9MiB
12. Write OpenWrt "initramfs-kernel.bin" to the flash:
       ./busybox-arm64 ubiupdatevol /dev/ubi0_1 /tmp/initramfs-kernel.bin
13. u-boot-env can be empty so lets create it (or overwrite it if it
    already exists) with the necessary values:
       fw_setenv baudrate 115200
       fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit"
       fw_setenv fdtcontroladdr 5ffc0e70
       fw_setenv ipaddr 192.168.1.1
       fw_setenv loadaddr 0x46000000
       fw_setenv mtdids "spi-nand0=spi-nand0"
       fw_setenv mtdparts "spi-nand0:2M(boot),1M(u-boot-env),50M(ubi0),50M(ubi1),8M(userconfig),4M(tp_data)"
       fw_setenv netmask 255.255.255.0
       fw_setenv serverip 192.168.1.2
       fw_setenv stderr serial@11002000
       fw_setenv stdin serial@11002000
       fw_setenv stdout serial@11002000
       fw_setenv tp_boot_idx 0
14. Reboot to OpenWrt initramfs:
       reboot
15. Login as root via SSH (IP 192.168.1.1, port 22)
16. Upload OpenWrt sysupgrade.bin image to the /tmp dir of the router
17. Run sysupgrade:
       sysupgrade -n /tmp/sysupgrade.bin

Recovery
--------
1. Press Reset button and power on the router
2. Navigate to U-Boot recovery web server (http://192.168.1.1/) and
   upload the OEM firmware

Recovery (UART)
---------------
1. Place OpenWrt initramfs image on tftp server with IP 192.168.1.2
2. Attach UART, switch on the router and interrupt the boot process by
   pressing 'Ctrl-C'
3. Load and run OpenWrt initramfs image:
      tftpboot initramfs-kernel.bin
      bootm
4. Do what you need (restore partitions from a backup, install OpenWrt
   etc.)

Stock layout
------------
0x000000000000-0x000000200000 : "boot"
0x000000200000-0x000000300000 : "u-boot-env"
0x000000300000-0x000003500000 : "ubi0"
0x000003500000-0x000006700000 : "ubi1"
0x000006700000-0x000006f00000 : "userconfig"
0x000006f00000-0x000007300000 : "tp_data"

ubi0/ubi1 format
----------------
U-Boot at boot checks that all volumes are in place:
+-------------------------------+
| Volume Name: uboot   Vol ID: 0|
| Volume Name: kernel  Vol ID: 1|
| Volume Name: rootfs  Vol ID: 2|
+-------------------------------+

MAC addresses
-------------
+---------+-------------------+-----------+
|         | MAC               | Algorithm |
+---------+-------------------+-----------+
| label   | 00:eb:xx:xx:xx:be | label     |
| LAN     | 00:eb:xx:xx:xx:be | label     |
| WAN     | 00:eb:xx:xx:xx:bf | label+1   |
| WLAN 2g | 00:eb:xx:xx:xx:be | label     |
| WLAN 5g | 00:eb:xx:xx:xx:bd | label-1   |
+---------+-------------------+-----------+
label MAC address was found in UBI partition "tp_data", file
"default-mac". OEM wireless eeprom is also there (file
"MT7986_EEPROM.bin").

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
(cherry picked from commit e4fe3097ef)
[Fix merging conflict]
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2023-07-01 15:16:17 +00:00
..
airoha airoha: spi-en7523: Fix compile warning 2023-05-31 23:10:11 +02:00
apm821xx apm821xx: switch over from DTB_SIZE to DEVICE_DTC_FLAGS 2023-06-10 19:06:15 +02:00
archs38 treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
armsr uboot-armsr: add support for QEMU armv7/armv8 2023-06-13 14:15:22 +02:00
at91 treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
ath25 kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
ath79 kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
bcm27xx kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
bcm47xx treewide: Disable building 8M RAM devices 2023-05-21 01:08:31 +02:00
bcm53xx nu801: add kmod-leds-uleds to MR26 + MR18 2023-05-18 16:17:52 +02:00
bcm63xx kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
bcm4908 kernel: bump 5.15 to 5.15.111 2023-05-13 22:38:35 +02:00
bmips kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
gemini treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
generic kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
imx imx: image: ventana: add blkdev compressed disk image 2023-05-18 17:11:43 +02:00
ipq40xx ipq4019: add support for ZTE MF287+ aka DreiNeo 2023-07-01 15:31:56 +02:00
ipq806x ipq806x: set PERFORMANCE as the default cpufreq governor 2023-06-16 11:42:40 +02:00
ipq807x ipq807x: image: fix eMMC flashing/recovery from within initramfs 2023-06-12 22:10:30 +02:00
kirkwood kirkwood: add support for Iomega Storcenter ix4-200d 2023-05-20 15:35:37 +02:00
lantiq kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
layerscape kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
malta treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
mediatek mediatek: add support for Mercusys MR90X v1 2023-07-01 15:16:17 +00:00
mpc85xx mpc85xx: add support for Aerohive BR200-WP 2023-05-14 00:08:35 +02:00
mvebu kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
mxs generic: enable CONFIG_ARM_CRYPTO for 32bit arm targets 2023-05-10 19:01:45 +02:00
octeon kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
octeontx kernel: enable (ARM|ARM64)_MODULE_PLTS in generic config 2023-05-24 19:26:41 +01:00
omap treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
oxnas oxnas: Enable CONFIG_CRYPTO_LZ4 2023-06-08 17:28:11 +02:00
pistachio treewide: cleanup kernel symbol references 2023-05-12 13:02:44 +02:00
qoriq kernel: fix handling of CONFIG_DYNAMIC_DEBUG 2023-05-03 10:26:17 -07:00
ramips kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
realtek kernel: bump 5.15 to 5.15.118 2023-06-25 16:05:18 +02:00
rockchip rockchip: fix setup network config for nanopi r2c 2023-06-17 12:21:13 +02:00
sifiveu kernel: bump 5.15 to 5.15.117 2023-06-17 12:09:03 +02:00
sunxi kernel: Set CONFIG_FRAME_WARN depending on target 2023-06-02 21:18:41 +02:00
tegra treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
uml uml: fix build error due to frame size > 1024 2023-05-24 19:25:39 +01:00
x86 kernel: kmod-amazon-ena: move to top level netdevices 2023-06-13 14:14:28 +02:00
zynq generic: enable CONFIG_ARM_CRYPTO for 32bit arm targets 2023-05-10 19:01:45 +02:00
Makefile build: fix issues with targets installed via feeds 2022-09-27 13:41:12 +02:00