Skip to content

mediatek: MERCUSYS MR85X: add OpenWrt UBI layout and convert to DSA - #24435

Merged
openwrt-bot merged 5 commits into
openwrt:mainfrom
csharper2005:mercusys_mr85x-ubi
Aug 20, 2026
Merged

openwrt-bot merged 5 commits into
openwrt:mainfrom
csharper2005:mercusys_mr85x-ubi

Conversation

@csharper2005

@csharper2005 csharper2005 commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

This commit adds OpenWrt U-Boot (UBI) layout support for MERCUSYS MR85X.

Stock bootloader UBI size: 50 MiB
OpenWrt U-Boot UBI size:  127 MiB

A note about U-Boot network support #24435 (comment)

image

@openwrt openwrt Bot added core packages pull request/issue for core (in-tree) packages not following guidelines Pull request does not follow formatting guidelines target/mediatek pull request/issue for mediatek target labels Jul 26, 2026
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Jul 26, 2026
@csharper2005 csharper2005 changed the title mediatek: MERCUSYS MR85X: add OpenWrt UBI layout mediatek: add OpenWrt UBI layout for MERCUSYS MR85X Jul 26, 2026

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • e8a5260 "mediatek: add OpenWrt UBI layout for MERCUSYS MR85X" — the diff does more than the subject/body describe: besides adding the UBI variant, it refactors the existing mt7981b-mercusys-mr85x.dts into a new shared mt7981b-mercusys-mr85x-common.dtsi and, in doing so, changes the already-supported non-UBI board (three properties dropped from the EN8811H PHY node, &watchdog { status = "okay"; } added, button nodes renamed). Splitting the "move shared nodes into a common dtsi" refactor into its own commit — or at least mentioning it in the body — would make the functional delta on the existing device reviewable. See the inline comment on the PHY node.

Reviewed 2 commits at e8a5260. Main things to look at: the mac-base cell width vs. the default-mac format used in the flash instructions, the green:lan-2 GPIO differing between the U-Boot DTS and the kernel DTS, and the check_buttons → boot_tftp dangling reference in the default environment.


Generated by Claude Code

@csharper2005
csharper2005 force-pushed the mercusys_mr85x-ubi branch 2 times, most recently from 40f0018 to 4c10215 Compare July 26, 2026 18:48
@csharper2005

Copy link
Copy Markdown
Contributor Author

Commit checks

  • e8a5260 "mediatek: add OpenWrt UBI layout for MERCUSYS MR85X" — the diff does more than the subject/body describe: besides adding the UBI variant, it refactors the existing mt7981b-mercusys-mr85x.dts into a new shared mt7981b-mercusys-mr85x-common.dtsi and, in doing so, changes the already-supported non-UBI board (three properties dropped from the EN8811H PHY node,

Fixed.

&watchdog { status = "okay"; } added, button nodes renamed). Splitting the "move shared nodes into a common dtsi" refactor into its own commit — or at least mentioning it in the body — would make the functional delta on the existing device reviewable. See the inline comment on the PHY node.

I've added the section to the commit message.

Other changes
-------------
- Watchdog is enabled for the both layouts
- Button labels renamed according to the kernel documentation

Reviewed 2 commits at e8a5260. Main things to look at: the mac-base cell width vs. the default-mac format used in the flash instructions,

I added the section to the commit message. I have no idea why it’s different in the non-UBI version.

MAC addresses

+---------+-------------------+-----------+
|         | MAC               | Algorithm |
+---------+-------------------+-----------+
| label   | 08:xx:xx:xx:xx:f5 | label     |
| LAN     | 08:xx:xx:xx:xx:f5 | label     |
| WAN     | 08:xx:xx:xx:xx:f6 | label+1   |
| WLAN 2g | 08:xx:xx:xx:xx:f5 | label     |
| WLAN 5g | 08:xx:xx:xx:xx:f4 | label-1   |
+---------+-------------------+-----------+

label MAC address was found in UBI partition "tp_data", file "default-mac" (raw binary MAC). Proof:

   hexdump -C default-mac
   00000000  08 xx xx xx xx f5   |....Y.|
   00000006

OEM wireless eeprom is also there (file "MT7981_EEPROM.bin").

the green:lan-2 GPIO differing between the U-Boot DTS and the kernel DTS, and the check_buttons → boot_tftp dangling reference in the default environment.

Fixed.

@csharper2005
csharper2005 requested a review from openwrt-ai July 26, 2026 18:49

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the 3 files that changed since e8a5260.

Resolved from the previous round: the EN8811H phy-mode/full-duplex/pause properties are back in the common dtsi, the green:lan-2 GPIO now matches the kernel DTS (&pio 10), check_buttons and reset_factory no longer reference undefined variables, the stray replacevol=1 is gone, and fip as static now matches both the tree convention and the flash instructions. The mac-base question is answered by the new MAC-address section, and the new (0)/(-1) band offsets line up with the documented table.

One new issue introduced by this push — see the inline comment on ubi_create_env.


Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the delta since 4c10215. The only change is the one-line fix in 474-add-mercusys_mr85x.patch — ubi_create_env now creates ubootenv/ubootenv2 as dynamic again, which resolves the fw_setenv/-EROFS issue from the previous round. Both commit messages are unchanged and still match their diffs, and all checks on ac917f3 are green.

No new issues found.


Generated by Claude Code

@csharper2005

Copy link
Copy Markdown
Contributor Author

U-Boot network support

I have successfully integrated the Realtek switch driver (taken from D-Link DIR-X3260 GPL sources https://github.com/hsj79/dir-x3260-gplcode/). Everything is working perfectly and users can operate the device without any issues. TFTP flashing (FIP, preloader, recovery images) works flawlessly across both cold and warm boot cycles with stable speeds around 6.5 MiB/s.

Why it's not ready for upstream OpenWrt yet:

  • Patch Size: The included Realtek SDK files are massive (approximately 3 MB), which is way too large for a standard OpenWrt package patch
  • Code Optimization: The implementation is currently a functional workaround and requires significant refactoring, cleanup and optimization to match official OpenWrt submission standards

Patches and binaries

https://github.com/csharper2005/uboot-mediatek-rtl8367s/

Log

The network is fully working:

F0: 102B 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 2400 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [1000]
T0: 0000 01D3 [010F]
Jump to BL

NOTICE:  BL2: v2.14.0(release):OpenWrt v2026.01.23~e06f2586-1 (mt7981-spim-nand-ubi-ddr3-1866)
NOTICE:  BL2: Built : 15:21:34, Jul 29 2026
NOTICE:  WDT: [40000000] Software reset (reboot)
NOTICE:  EMI: Using DDR3 settings
NOTICE:  EMI: complex R/W mem test passed
NOTICE:  DRAM: 512MB
NOTICE:  CPU: MT7981 (1300MHz)
NOTICE:  SPI-NAND probed by parameter page
NOTICE:  SPI-NAND: POWERCHIP PSU1GS20DX (128MB)
NOTICE:  SPI-NAND: Page size: 2KB+64, Block size: 128KB
NOTICE:  UBI: scanning [0x100000 - 0x8000000] ...
NOTICE:  UBI: scanning is finished
NOTICE:  UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
NOTICE:  UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
NOTICE:  UBI: Volume fip (Id #0) size is 906412 bytes
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v2.14.0(release):OpenWrt v2026.01.23~e06f2586-1 (mt7981-spim-nand-ubi-ddr3-1866)
NOTICE:  BL31: Built : 15:21:34, Jul 29 2026


U-Boot 2026.07-OpenWrt-r35534+59-69668f8f82 (Jul 29 2026 - 15:21:34 +0000)

CPU:   MediaTek MT7981
Model: MERCUSYS MR85X (UBI)
DRAM:  512 MiB
Core:  38 devices, 17 uclasses, devicetree: embed
Loading Environment from UBI... spi-nand: spi_nand spi_nand@0: CASN page check failed
spi-nand: spi_nand spi_nand@0: Fallback to read ID
spi-nand: spi_nand spi_nand@0: ESMT SPI NAND was found.
spi-nand: spi_nand spi_nand@0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
Read 126976 bytes from volume ubootenv to 000000005f7c1d40
Read 126976 bytes from volume ubootenv2 to 000000005f7e0d80
*** Warning - bad CRC, using default environment

In:    serial@11002000
Out:   serial@11002000
Err:   serial@11002000
reset button found
Loading Environment from UBI... UBI partition 'ubi' already selected
Read 126976 bytes from volume ubootenv to 000000005f7c1d00
Read 126976 bytes from volume ubootenv2 to 000000005f7e0d40
*** Warning - bad CRC, using default environment

Net:   
============================================
mtk_eth: Initializing Architecture with Native RTL8367S Support...
============================================
rtk_switch_init ret = 0!!!!!!!!!!!!
rtk_switch reg = 0x1234 !!!!!!!!!!!!
rtk_vlan_init ret = 0!!!!!!!!!!!!
Realtek SDK: Unlocking port matrices via rtk_port_isolation_set...
Realtek SDK: Global forward routing lanes unblocked!
Set RTL8367S SGMII 2.5Gbps
rtk_port_macForceLinkExt_set return value is 0
rtk_port_sgmiiNway_set return value is 0

Warning: ethernet@15100000 (eth0) using random MAC address - da:fa:f8:a0:f8:89
eth0: ethernet@15100000
Saving Environment to UBI... UBI partition 'ubi' already selected
Writing to UBI... done
OK
Saving Environment to UBI... UBI partition 'ubi' already selected
Writing to redundant UBI... done
OK


        ( ( ( OpenWrt ) ) )       U-Boot 2026.07-OpenWrt-r35534+59-69668f8f82 (J
      1. Run default boot command
      2. Boot system via TFTP
      3. Boot production system from NAND
      4. Boot recovery system from NAND
      5. Load production system via TFTP then write to NAND
      6. Load recovery system via TFTP then write to NAND
      7. Load BL31+U-Boot FIP via TFTP then write to NAND
      8. Load BL2 preloader via TFTP then write to NAND
      9. Reboot
      a. Reset all settings to factory defaults
      0. Exit


  Press UP/DOWN to move, ENTER to select, ESC to quit







Using ethernet@15100000 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'openwrt-mediatek-filogic-mercusys_mr85x-ubi-bl31-uboot.fip'.
Load address: 0x46000000
Loading: ##############################################################
	 6.8 MiB/s
done
Bytes transferred = 906412 (dd4ac hex)
Remove UBI volume fip (id 0)
Creating static volume fip of size 906412
906412 bytes written to volume fip
126976 bytes written to volume ubootenv
126976 bytes written to volume ubootenv2
Press ENTER to return to menu 











        ( ( ( OpenWrt ) ) )       U-Boot 2026.07-OpenWrt-r35534+59-69668f8f82 (J
      1. Run default boot command
      2. Boot system via TFTP
      3. Boot production system from NAND
      4. Boot recovery system from NAND
      5. Load production system via TFTP then write to NAND
      6. Load recovery system via TFTP then write to NAND
      7. Load BL31+U-Boot FIP via TFTP then write to NAND
      8. Load BL2 preloader via TFTP then write to NAND
      9. Reboot
      a. Reset all settings to factory defaults
      0. Exit


  Press UP/DOWN to move, ENTER to select, ESC to quit







Using ethernet@15100000 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'openwrt-mediatek-filogic-mercusys_mr85x-ubi-preloader.bin'.
Load address: 0x46000000
Loading: ############
	 6.2 MiB/s
done
Bytes transferred = 168444 (291fc hex)
Erasing 0x00000000 ... 0x000fffff (8 eraseblock(s))
Writing 524288 byte(s) (256 page(s)) at offset 0x00000000
Press ENTER to return to menu 














        ( ( ( OpenWrt ) ) )       U-Boot 2026.07-OpenWrt-r35534+59-69668f8f82 (J
      1. Run default boot command
      2. Boot system via TFTP
      3. Boot production system from NAND
      4. Boot recovery system from NAND
      5. Load production system via TFTP then write to NAND
      6. Load recovery system via TFTP then write to NAND
      7. Load BL31+U-Boot FIP via TFTP then write to NAND
      8. Load BL2 preloader via TFTP then write to NAND
      9. Reboot
      a. Reset all settings to factory defaults
      0. Exit


  Press UP/DOWN to move, ENTER to select, ESC to quit







Using ethernet@15100000 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'openwrt-mediatek-filogic-mercusys_mr85x-ubi-initramfs-recovery.itb'.
Load address: 0x46000000
Loading: #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ##
	 6.7 MiB/s
done
Bytes transferred = 9568256 (920000 hex)
## Loading kernel (any) from FIT Image at 46000000 ...
   Using 'config-1' configuration
   Trying 'kernel-1' kernel subimage
     Description:  ARM64 OpenWrt Linux-6.18.39
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x460000e8
     Data Size:    4669988 Bytes = 4.5 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x48000000
     Entry Point:  0x48000000
     Hash algo:    crc32
     Hash value:   822830cb
     Hash algo:    sha1
     Hash value:   e7199f8675a5463ff4087d26a2d35a3476c07b50
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading ramdisk (any) from FIT Image at 46000000 ...
   Using 'config-1' configuration
   Trying 'initrd-1' ramdisk subimage
     Description:  ARM64 OpenWrt mercusys_mr85x-ubi initrd
     Type:         RAMDisk Image
     Compression:  uncompressed
     Data Start:   0x46474448
     Data Size:    4852256 Bytes = 4.6 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: unavailable
     Entry Point:  unavailable
     Hash algo:    crc32
     Hash value:   90dd3249
     Hash algo:    sha1
     Hash value:   53b4b66feac2c57c988d2ad04287cf9fa8ee39f7
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt (any) from FIT Image at 46000000 ...
   Using 'config-1' configuration
   Trying 'fdt-1' fdt subimage
     Description:  ARM64 OpenWrt mercusys_mr85x-ubi device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x46914f78
     Data Size:    22606 Bytes = 22.1 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   ac86843d
     Hash algo:    sha1
     Hash value:   b291a8174ad2474fa646286361135aa03e7286c2
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x46914f78
Working FDT set to 46914f78
   Uncompressing Kernel Image to 48000000
   Loading Ramdisk to 5e35f000, end 5e7ffa20 ... OK
   Loading Device Tree to 000000005e356000, end 000000005e35e84d ... OK
Working FDT set to 5e356000
Add 'ramoops@42ff0000' node failed: FDT_ERR_EXISTS

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.18.39 (bulder@buildhost) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 14.4.0) 14.4.0, GNU ld (GNU Binutils) 2.46.1) #0 SMP Sun Jul 26 18:27:24 2026
[    0.000000] KASLR enabled
[    0.000000] Machine model: MERCUSYS MR85X (UBI)
[    0.000000] OF: reserved mem: 0x0000000042ff0000..0x0000000042ffffff (64 KiB) map non-reusable ramoops@42ff0000
[    0.000000] OF: reserved mem: 0x0000000043000000..0x000000004302ffff (192 KiB) nomap non-reusable secmon@43000000
[    0.000000] OF: reserved mem: 0x0000000047c80000..0x0000000047d7ffff (1024 KiB) nomap non-reusable wmcpu-reserved@47c80000
[    0.000000] OF: reserved mem: 0x0000000047d80000..0x0000000047dbffff (256 KiB) nomap non-reusable wo-emi@47d80000
[    0.000000] OF: reserved mem: 0x0000000047dc0000..0x0000000047ffffff (2304 KiB) nomap non-reusable wo-data@47dc0000
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x0000000042ffffff]
[    0.000000]   node   0: [mem 0x0000000043000000-0x000000004302ffff]
[    0.000000]   node   0: [mem 0x0000000043030000-0x0000000047c7ffff]
[    0.000000]   node   0: [mem 0x0000000047c80000-0x0000000047ffffff]
[    0.000000]   node   0: [mem 0x0000000048000000-0x000000005fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.5
[    0.000000] percpu: Embedded 20 pages/cpu s43416 r8192 d30312 u81920
[    0.000000] pcpu-alloc: s43416 r8192 d30312 u81920 alloc=20*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GICv3 CPU interface
[    0.000000] CPU features: kernel page table isolation disabled by kernel configuration
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Kernel command line: root=/dev/fit0 rootwait
[    0.000000] printk: log buffer data + meta data: 131072 + 458752 = 589824 bytes
[    0.000000] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.000000] software IO TLB: SWIOTLB bounce buffer size adjusted to 0MB
[    0.000000] software IO TLB: area num 2.
[    0.000000] software IO TLB: mapped [mem 0x000000005f540000-0x000000005f5c0000] (0MB)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 131072
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] RCU Tasks Trace: Setting shift to 1 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=2.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 640 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: GICv3 features: 16 PPIs
[    0.000000] GICv3: GICD_CTLR.DS=0, SCR_EL3.FIQ=0
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x000000000c080000
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.000000] arch_timer: cp15 timer running at 13.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2ff89eacb, max_idle_ns: 440795202429 ns
[    0.000000] sched_clock: 56 bits at 13MHz, resolution 76ns, wraps every 4398046511101ns
[    0.000093] Calibrating delay loop (skipped), value calculated using timer frequency.. 26.00 BogoMIPS (lpj=130000)
[    0.000102] pid_max: default: 32768 minimum: 301
[    0.002526] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.002536] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.007627] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.008446] rcu: Hierarchical SRCU implementation.
[    0.008454] rcu: 	Max phase no-delay instances is 1000.
[    0.008650] Timer migration: 1 hierarchy levels; 8 children per group; 1 crossnode level
[    0.008868] smp: Bringing up secondary CPUs ...
[    0.009268] Detected VIPT I-cache on CPU1
[    0.009319] GICv3: CPU1: found redistributor 1 region 0:0x000000000c0a0000
[    0.009351] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.009436] smp: Brought up 1 node, 2 CPUs
[    0.009441] SMP: Total of 2 processors activated.
[    0.009443] CPU: All CPU(s) started at EL2
[    0.009446] CPU features: detected: 32-bit EL0 Support
[    0.009449] CPU features: detected: CRC32 instructions
[    0.009474] alternatives: applying system-wide alternatives
[    0.009612] CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
[    0.009749] Memory: 487888K/524288K available (9664K kernel code, 948K rwdata, 2972K rodata, 960K init, 297K bss, 34476K reserved, 0K cma-reserved)
[    0.013177] posixtimers hash table entries: 1024 (order: 2, 16384 bytes, linear)
[    0.013214] futex hash table entries: 512 (32768 bytes on 1 NUMA nodes, total 32 KiB, linear).
[    0.013251] 2G module region forced by RANDOMIZE_MODULE_REGION_FULL
[    0.013259] 0 pages in range for non-PLT usage
[    0.013261] 520528 pages in range for PLT usage
[    0.014844] pinctrl core: initialized pinctrl subsystem
[    0.016098] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.016438] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[    0.016464] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.016486] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.016936] thermal_sys: Registered thermal governor 'fair_share'
[    0.016939] thermal_sys: Registered thermal governor 'bang_bang'
[    0.016943] thermal_sys: Registered thermal governor 'step_wise'
[    0.016945] thermal_sys: Registered thermal governor 'user_space'
[    0.017026] ASID allocator initialised with 65536 entries
[    0.017696] pstore: Using crash dump compression: deflate
[    0.017701] pstore: Registered ramoops as persistent store backend
[    0.017704] ramoops: using 0x10000@0x42ff0000, ecc: 0
[    0.019139] /soc/interrupt-controller@c000000: Fixed dependency cycle(s) with /soc/interrupt-controller@c000000
[    0.038137] SCSI subsystem initialized
[    0.038334] libata version 3.00 loaded.
[    0.040128] clocksource: Switched to clocksource arch_sys_counter
[    0.042562] NET: Registered PF_INET protocol family
[    0.042677] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.043927] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.043941] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.043955] TCP established hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.043986] TCP bind hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.044092] TCP: Hash tables configured (established 4096 bind 4096)
[    0.044347] MPTCP token hash table entries: 512 (order: 2, 12288 bytes, linear)
[    0.044470] UDP hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.044491] UDP-Lite hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.044705] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.044732] PCI: CLS 0 bytes, default 64
[    0.044910] Unpacking initramfs...
[    0.051363] workingset: timestamp_bits=46 max_order=17 bucket_order=0
[    0.056508] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.056519] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.060002] cryptd: max_cpu_qlen set to 1000
[    0.127024] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.129870] printk: legacy console [ttyS0] disabled
[    0.150340] 11002000.serial: ttyS0 at MMIO 0x11002000 (irq = 72, base_baud = 2500000) is a ST16650V2
[    0.150388] printk: legacy console [ttyS0] enabled
[    0.937043] mtk_rng trng: registered RNG driver
[    0.941847] random: crng init done
[    0.949103] loop: module loaded
[    0.960990] spi-nand spi0.0: ESMT SPI NAND was found.
[    0.966054] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
[    1.402089] Freeing initrd memory: 4736K
[    1.412488] 2 fixed-partitions partitions found on MTD device spi0.0
[    1.419148] Creating 2 MTD partitions on "spi0.0":
[    1.423962] 0x000000000000-0x000000100000 : "bl2"
[    1.429747] 0x000000100000-0x000008000000 : "ubi"
[    1.503726] ubi0: default fastmap pool size: 50
[    1.508265] ubi0: default fastmap WL pool size: 25
[    1.513101] ubi0: attaching mtd1
[    2.456797] ubi0: scanning is finished
[    2.471811] ubi0: attached mtd1 (name "ubi", size 127 MiB)
[    2.477301] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    2.484182] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    2.490970] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    2.497918] ubi0: good PEBs: 1016, bad PEBs: 0, corrupted PEBs: 0
[    2.504011] ubi0: user volume: 5, internal volumes: 1, max. volumes count: 128
[    2.511225] ubi0: max/mean erase counter: 8/3, WL threshold: 4096, image sequence number: 0

@csharper2005 csharper2005 changed the title mediatek: add OpenWrt UBI layout for MERCUSYS MR85X mediatek: add OpenWrt UBI layout for MERCUSYS MR85X, convert to DSA Aug 4, 2026
@csharper2005

csharper2005 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Changes:

  • New commit "mediatek: convert MERCUSYS MR85X to DSA"

Cc @Schneider-Azima @namiltd @hauke (participants of the #19445 "mediatek: add support for Mercusys MR85X with DSA switch driver")

@csharper2005 csharper2005 changed the title mediatek: add OpenWrt UBI layout for MERCUSYS MR85X, convert to DSA mediatek: MERCUSYS MR85X: add OpenWrt UBI layout and convert to DSA Aug 4, 2026
@csharper2005

Copy link
Copy Markdown
Contributor Author

rtl8365mb-mdio is much better:

  • No more network hangs when disable / enable wireless
  • New DSA VLANs also work as expected

LAN1 - uplink (trunk with 4 VLANs)

Screenshot from 2026-08-04 15-39-55
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [    5.751838] rtl8365mb-mdio mdio-bus:1d: found an RTL8367S switch
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [    6.098704] rtl8365mb-mdio mdio-bus:1d: configuring for fixed/2500base-x link mode
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [    6.113047] rtl8365mb-mdio mdio-bus:1d lan1 (uninitialized): PHY [mdio-bus:1d:user_mii:00] driver [RTL8365MB-VC Gigabit Ethernet] (irq=POLL)
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [    6.113382] rtl8365mb-mdio mdio-bus:1d: Link is Up - 2.5Gbps/Full - flow control rx/tx
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [    6.130004] rtl8365mb-mdio mdio-bus:1d lan2 (uninitialized): PHY [mdio-bus:1d:user_mii:01] driver [RTL8365MB-VC Gigabit Ethernet] (irq=POLL)
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [    6.150314] rtl8365mb-mdio mdio-bus:1d lan3 (uninitialized): PHY [mdio-bus:1d:user_mii:02] driver [RTL8365MB-VC Gigabit Ethernet] (irq=POLL)
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [    7.089271] rtl8365mb-mdio mdio-bus:1d lan1: configuring for phy/gmii link mode
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [   10.236198] rtl8365mb-mdio mdio-bus:1d lan1: Link is Up - 1Gbps/Full - flow control rx/tx
[Aug 4, 2026, 11:50:13 AM UTC] kern.info: [   11.695696] rtl8365mb-mdio mdio-bus:1d lan1: Link is Down
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   19.998556] rtl8365mb-mdio mdio-bus:1d lan1: configuring for phy/gmii link mode
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   20.042283] rtl8365mb-mdio mdio-bus:1d lan1: entered allmulticast mode
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   20.105371] rtl8365mb-mdio mdio-bus:1d lan2: configuring for phy/gmii link mode
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   20.140994] rtl8365mb-mdio mdio-bus:1d lan2: entered allmulticast mode
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   20.151182] rtl8365mb-mdio mdio-bus:1d lan2: entered promiscuous mode
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   20.157810] rtl8365mb-mdio mdio-bus:1d lan1: entered promiscuous mode
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   20.199159] rtl8365mb-mdio mdio-bus:1d lan3: configuring for phy/gmii link mode
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   20.260938] rtl8365mb-mdio mdio-bus:1d lan3: entered allmulticast mode
[Aug 4, 2026, 11:50:18 AM UTC] kern.info: [   20.274798] rtl8365mb-mdio mdio-bus:1d lan3: entered promiscuous mode
[Aug 4, 2026, 11:50:19 AM UTC] kern.info: [   21.116282] rtl8365mb-mdio mdio-bus:1d lan1: Link is Up - 1Gbps/Full - flow control rx/tx

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • 75869e0 "mediatek: fix LED enumerators for MERCUSYS MR85X" — Fixes: b2648d8 ("mediatek: add support for Mercusys MR85X") points at a commit that doesn't contain the file this patch touches: mt7981b-mercusys-mr85x-common.dtsi is created two commits earlier in this very series, so the tag can't be used to pick the fix back onto b2648d8. (OpenWrt/kernel convention is also a 12-char SHA, not 7.) See the inline comment — squashing this into the DSA commit sidesteps both problems.

Reviewed the 2 new commits since ac917f3 (75869e0, 2ad49f2); the two earlier commits are unchanged apart from the rebase onto b941179. The DSA switch node itself matches the realtek,rtl8365mb binding apart from the interrupt-controller child, and lan1/lan2/lan3 + openwrt,netdev-name = "wan" line up consistently across the DTS, 01_leds, 02_network and the 1.1 compat bump (correctly applied only to the pre-existing mercusys_mr85x, not to the brand-new -ubi variant). All checks on 2ad49f2 are green.


Generated by Claude Code

Comment thread target/linux/mediatek/image/filogic.mk Resolved
@openwrt openwrt Bot added drop package Removes an existing package Makefile from the tracking tree kernel pull request/issue with Linux kernel related changes labels Aug 4, 2026

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the delta since 2ad49f2, which is just two hunks: the completed interrupt-controller node in mt7981b-mercusys-mr85x-common.dtsi and the KernelPackage/switch-rtl8367s removal in modules.mk. The three commits carrying them (f350bb9, bf38a31, 3081a1d) all have messages that match their diffs.

Resolved from the previous round: 75869e0's LED renumbering no longer leaves the tree broken — f350bb9 now moves 01_leds to lan1/lan2/lan3 + masks 0x01/0x02/0x04 in the same commit, so every commit is self-consistent (the block is then replaced by netdev triggers in bf38a31, which is expected).

On 3081a1d: I checked the concern from the filogic.mk thread. git grep switch-rtl8367s at head returns nothing outside the removed block, and the three remaining users (mt7622-{buffalo-wsr-2533dhp2,elecom-wrc-2533gent,totolink-a8000ru}.dts, all mediatek,rtk-gsw) get the driver from CONFIG_RTL8367S_GSW=y in target/linux/mediatek/mt7622/config-6.18:448, not from the kmod — so dropping the package definition while keeping files/drivers/net/phy/rtk/ is consistent with what the commit message says, and @namiltd's point is covered. filogic/config-6.18 already carries # CONFIG_RTL8367S_GSW is not set, so nothing there needs a refresh.

One question on the interrupt hunk — see the inline comment. All checks on 3081a1d are green.


Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the delta since 3081a1d. Two commits have new OIDs (3a24bf2, 6eda51c), but 6eda51c is a pure rebase of the modules.mk removal — the only content change in the whole push is one hunk in mt7981b-mercusys-mr85x-common.dtsi: the rtl8367s_intc node and the three interrupt-parent/interrupts pairs on [email protected] are dropped again, putting the switch PHYs back in polled mode.

That closes the question from the previous round, and with hardware evidence: your log shows the IRQs are wired up correctly (irq=78/79/80 instead of POLL) but no lan1/lan2/lan3 link ever comes up, so falling back to polling is the right call for now. Worth noting realtek.yaml makes the interrupt-controller child optional and rtl8365mb_irq_setup() is skipped entirely when it is absent, so this is a supported configuration, not a workaround. No dangling references are left behind — git grep rtl8367s_intc at head returns nothing, and IRQ_TYPE_* is no longer used in either mr85x DTS.

Both commit messages are unchanged and still match their diffs. All checks on 6eda51c are green.

Reviewed 2 new commits; no new issues found.


Generated by Claude Code

@csharper2005

Copy link
Copy Markdown
Contributor Author

Changes:

  • rename 474-add-mercusys_mr85x.patch -> 475-add-mercusys_mr85x.patch

Avoid numbering conflict since after the latest commits to main 474 is now taken by 474-add-tplink-be450.patch.

@csharper2005

Copy link
Copy Markdown
Contributor Author

Changes:

  • Another renaming 475-add-mercusys_mr85x.patch -> 476-add-mercusys_mr85x.patch

Avoid numbering conflict since after the latest commits to main 475 is now taken by 475-add-teralink_tl3020-256mb.patch.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the delta since bb60afe. git range-diff shows commits 2–5 (ac03858, 60fc920, 35e294a, 8d1f6df) are byte-identical to their previous OIDs; the only content change in the whole push is in commit 1893080 — the 475-add-mercusys_mr85x.patch → 476-add-mercusys_mr85x.patch rename plus the 45-line git-format header you added in response to the FormalityCheck bot.

The renumbering is correct: origin/main now carries 475-add-teralink_tl3020-256mb.patch, 476 is free (nothing between 474 and 500 besides 475), and git grep '47[45]-add-mercusys' at head returns nothing, so no dangling references.

The header itself is internally consistent — the diffstat (arch/arm/dts/mt7981_mercusys-mr85x.dts 160, configs/mt7981_mercusys_mr85x_defconfig 97, defenvs/mercusys-mr85x_env 34, 291 total) matches the three hunks in the file exactly, and everything above --- /dev/null is ignored by quilt/patch. One cosmetic point on the Subject: line — see the inline comment.

CI on 8d1f6df: all 22 check runs green, including FormalityCheck / Code Patches, which was the warning that prompted this push.

Reviewed 5 commits (1 with new content); 1 nit.


Generated by Claude Code

From 7fdff1f4c493be5b240b44227dada51007698122 Mon Sep 17 00:00:00 2001
From: Mikhail Zhilkin <[email protected]>
Date: Sun, 26 Jul 2026 16:41:38 +0300
Subject: uboot-mediatek: add support for MERCUSYS MR85X

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the new header's Subject: is the OpenWrt commit subject (uboot-mediatek: prefix) and drops the [PATCH] tag. Inside a U-Boot patch this should read like a U-Boot commit — both neighbours added recently do: 474-add-tplink-be450.patch:4 is Subject: [PATCH] add TP-Link BE450, 475-add-teralink_tl3020-256mb.patch:4 is Subject: [PATCH] board: mediatek: add Teralink TL3020 256mb.

Suggested change
Subject: uboot-mediatek: add support for MERCUSYS MR85X
Subject: [PATCH] board: mediatek: add MERCUSYS MR85X

Two related points on the same header block, prose only since neither has a single obvious replacement:

  • Line 1's From 7fdff1f4c493be5b240b44227dada51007698122 is the OID this commit had before the last rebase (it is now 1893080), i.e. an OpenWrt-tree SHA that no longer resolves anywhere. It is inert as far as quilt/patch are concerned, so not worth another push on its own, but if you touch the header again a fresh git format-patch-generated line (or just dropping the SHA) avoids the stale pointer.
  • The header body carries the OpenWrt-packaging discussion verbatim ("Why it's not ready for upstream OpenWrt yet", the 3 MB SDK size, the link to your out-of-tree binaries). That reads oddly as a U-Boot commit message and duplicates commit 1893080's body; the "Networking Configuration Note" part is the piece that actually belongs here.

Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you noticed before: Not something I'd block on, but adding the header is trivial if you want the bot quiet. I dropped the header, since it's not trivial and this story is becoming never ending.

@openwrt

openwrt Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Formality Check: Suggestions Available

We checked this pull request against the contribution guidelines. Here is what needs your attention:

⚠️ STYLISTIC WARNINGS & SUGGESTIONS

Commit 4d442a7 - uboot-mediatek: add support for MERCUSYS MR85X:

  • ⚠️ - Embedded patch file 'package/boot/uboot-mediatek/patches/476-add-mercusys_mr85x.patch' violates standard guidelines. Missing required Git header parameters ('From Mon Sep 17 00:00:00 2001' / 'From:' / 'Date:' / 'Subject:') to ensure 'git am' application compatibility

Something broken? Consider reporting an issue.
Running version 3eeda58 deployed on 2026-08-18 11:06:29 CEST

@csharper2005

Copy link
Copy Markdown
Contributor Author

Ran a 2+ day stability test as a dumb AP with VLANs. Upstream is hooked up via an RTL8367S switch. Everything is up and running smoothly with zero issues found.

Screenshot from 2026-08-08 10-47-04

@namiltd

namiltd commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Please remove "Link: namiltd#131" from "mediatek: convert MERCUSYS MR85X to DSA". It might disappear if I delete the local openwrt tree, and it would point to a non-existent page.

@csharper2005

csharper2005 commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Please remove "Link: namiltd#131" from "mediatek: convert MERCUSYS MR85X to DSA". It might disappear if I delete the local openwrt tree, and it would point to a non-existent page.

Done.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the delta since 8d1f6df. git range-diff shows commits 2, 3 and 5 (7a43cc3, 9912ea6, bc0bb46) are byte-identical to their previous OIDs; only two things changed in the whole push:

  • cd274d3 — the 45-line git-format header is removed from 476-add-mercusys_mr85x.patch again (git diff 8d1f6df..bc0bb46 is exactly -45 lines in that one file, no code touched). I'm not re-raising this: you explained the reasoning in the previous thread, and a bare --- /dev/null start matches the prevailing convention in that directory (470-add-bpi-r4-lite.patch, 473-add-creatlentem_clt-r30b1-ubi.patch). It also makes the Subject: nit from last round moot. The patch itself is still well-formed — three hunks, and the @@ -0,0 +1,97/160/34 @@ counts match the 300-line file exactly.
  • 086dcc2 — Link: https://github.com/namiltd/openwrt/pull/131/ dropped from the DSA commit message, which is what @namiltd asked for. The rest of the message is unchanged and still matches its diff.

Patch numbering is still valid: origin/main at 94a21b3 tops out at 475-add-teralink_tl3020-256mb.patch, so 476 is free, and git grep -E '47[0-9]-add-mercusys' at head returns nothing outside the file itself.

CI on bc0bb46: all 22 check runs green, including FormalityCheck / Code Patches (the bot's missing-git-header note is a warning, not a failure).

Reviewed 5 commits (2 with new content); no new issues found.


Generated by Claude Code

@csharper2005

Copy link
Copy Markdown
Contributor Author

@jonasjelonek hi! Could you take a look when you have time?

@LuckySpecialist

Copy link
Copy Markdown

Hi!
I've been using the device on the build from this PR as an access point for almost a week. Everything is stable and the performance is pleasing.
I also took speed measurements via iperf3, which showed an average of 930 Mbps and CPU usage of 70%.
I plan to use this week as my main router.
P.S. @csharper2005, thank you for your excellent work!
MR85X_AP

@jonasjelonek

Copy link
Copy Markdown
Member

In commit message of the "uboot-mediatek: add support for MERCUSYS MR85X" commit, what's the purpose of the "ToDo" section? Is this a development relic? Sounds weird to have something like "not ready for OpenWrt", etc. described there.

@csharper2005

Copy link
Copy Markdown
Contributor Author

In commit message of the "uboot-mediatek: add support for MERCUSYS MR85X" commit, what's the purpose of the "ToDo" section? Is this a development relic? Sounds weird to have something like "not ready for OpenWrt", etc. described there.

Thank you for the review. This is the final version of the initial support patch. Due to the lack of an upstream driver for the Realtek switch, Ethernet functionality is disabled by default in this U-Boot commit.

The "ToDo" section is intentionally kept as a guide for future developers and users. Since enabling upstream Ethernet requires a massive 3MB SDK driver that is not ready for OpenWrt, this section provides a clear roadmap and links to the source code for anyone who wants to continue this work. Additionally, the ready-to-use binaries allow users to utilize full Ethernet functionality right now.

Regarding device recovery: since Ethernet is disabled in this initial U-Boot build, a UART serial connection is required for emergency recovery when using this bootloader. It is worth noting that a UART connection is also required for installing / recovering OpenWrt on the stock bootloader anyway. Ultimately, this means the user experience and recovery situation do not become any worse compared to using the stock bootloader.

@csharper2005

Copy link
Copy Markdown
Contributor Author

The router has been rock-solid with 14 days of uptime, so I decided to stop further testing. No issues was found.

Screenshot_20260819_204111

csharper2005 and others added 5 commits August 20, 2026 23:49
Introduce initial board support for the Mercusys MR85X, an AX3000
wireless router powered by the MediaTek MT7981 (Filogic 820) SoC.

Networking Configuration Note
-----------------------------
Ethernet functionality is currently disabled in this stage of U-Boot
due to the specific board configuration:
1. The Realtek RTL8367S switch does not have an available U-Boot driver
2. The Airoha EN8811 PHY is physically routed to GMAC1 rather than the
standard GMAC0 pipeline. This requires further adjustment to bind and
trace MDIO/PHY operations over GMAC1.

ToDo
----
I have successfully integrated the Realtek switch driver (taken from
D-Link DIR-X3260 GPL sources.
Link:  https://github.com/hsj79/dir-x3260-gplcode/

Everything is working perfectly and users can operate the device without
any issues. TFTP flashing (FIP, preloader, recovery images) works
flawlessly across both cold and warm boot cycles with stable speeds
around 6.5 MiB/s.

Why it's not ready for upstream OpenWrt yet:
- Patch Size: The included Realtek SDK files are massive (approximately
3 MB), which is way too large for a standard OpenWrt package patch
- Code Optimization: The implementation is currently a functional
workaround and requires significant refactoring, cleanup and optimization
to match official OpenWrt submission standards

Patches and ready-to-use binaries
Link: https://github.com/csharper2005/uboot-mediatek-rtl8367s/

Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
This commit adds OpenWrt U-Boot (UBI) layout support for MERCUSYS MR85X.

Stock bootloader UBI size: 50 MiB
OpenWrt U-Boot UBI size:  127 MiB

Other changes
-------------
- Watchdog is enabled for the both layouts
- Button labels renamed according to the kernel documentation

Preparation
-----------
OpenWrt for stock U-Boot should be installed first. Before formatting or
rewriting any partition structures, you must copy EEPROM data and unique
MAC address. Navigate to the /tmp/tp_data directory on the router. Locate
and copy these files to your PC:
- default-mac (contains your device's unique MAC address mapping)
- MT7981_EEPROM.bin (contains factory wireless calibration data)

Installation
------------
1. Initialize the Hardware Environment
Power off the router. Run the mtk_uartboot utility on your computer. Power
on the router. Wait for the utility to push the initial payload, boot the
device temporarily and format the UBI partition structure.

2. Access the U-Boot Promp
Run mtk_uartboot on your computer a second time. When the utility menu
appears on your terminal screen, choose Exit. This will drop you safely
into the interactive U-Boot command line interface prompt (MT7981>).

3. Flash the BL2 (preloader)
You must write the second-stage bootloader (BL2) directly to the MTD
partition. Prepare the router to receive the BL2 image over serial Ymodem
protocol:
   MT7981> loady
In your terminal application, select File -> Transfer -> Ymodem -> Send
and select the path to:
openwrt-mediatek-filogic-mercusys_mr85x-ubi-preloader.bin
Erase the existing BL2 partition:
   MT7981> mtd erase bl2
Commit the new BL2 binary from RAM to the flash memory:
   MT7981> mtd write bl2 $loadaddr 0x0 ${filesize}

4. Provision the FIP Partition (BL31 & U-Boot)
Ready the router to receive the FIP package:
   MT7981> loady
In your terminal application, send the following file via Ymodem:
openwrt-mediatek-filogic-mercusys_mr85x-ubi-bl31-uboot.fip
Clear the legacy tracking data and configure the UBI block allocation:
   MT7981> ubi write $loadaddr fip ${filesize}

5. Boot into OpenWrt Recovery
With the core partition structures and boot code firmly written, you can
now push and execute the temporary OpenWrt recovery environment to finish
the installation. Prepare for the final serial download:
   MT7981> loady
Send the following recovery image file via Ymodem:
openwrt-mediatek-filogic-mercusys_mr85x-ubi-initramfs-recovery.itb
Boot the OpenWrt kernel image directly out of the memory cache:
   MT7981> bootm

6. Flash OpenWrt permanently
Once the router finishes booting the initramfs image, navigate to
192.168.1.1 in your web browser to access the OpenWrt LuCI recovery
interface. From there, permanently flash the production sysupgrade image.

7. Recovery factory data
Once the router finishes booting into OpenWrt, you must rebuild and flash
the factory volume payload. This process combines your unique wireless
calibration data and MAC address back into a single compliant block.
Use SCP or an SFTP client (like WinSCP) to copy your two backup files from
your PC into the router's /tmp directory:
- default-mac
- MT7981_EEPROM.bin
Connect to the router via SSH and run the following commands:
   dd if=/dev/zero bs=$((0x8000)) count=1 | tr '\000' '\377' > /tmp/factory.bin
   dd if=/tmp/MT7981_EEPROM.bin of=/tmp/factory.bin conv=notrunc
   dd if=/tmp/default-mac >> /tmp/factory.bin
Query the system to confirm the exact logical UBI character device target
for the factory volume:
ubinfo /dev/ubi0 -N factory | grep "Volume ID" | awk '{print $3}'
Commit the newly created factory.bin file directly into the designated
factory UBI block (replace _1 below if your volume ID query returned a
different number):
   ubiupdatevol /dev/ubi0_1 /tmp/factory.bin
Reboot your router to apply the changes.

Recovery
--------
The same as installation.

UART
----
Connection parameters: 115200, 8N1, 3.3V
UART pins are silkscreened on the PCB.

MAC addresses
-------------
+---------+-------------------+-----------+
|         | MAC               | Algorithm |
+---------+-------------------+-----------+
| label   | 08:xx:xx:xx:xx:f5 | label     |
| LAN     | 08:xx:xx:xx:xx:f5 | label     |
| WAN     | 08:xx:xx:xx:xx:f6 | label+1   |
| WLAN 2g | 08:xx:xx:xx:xx:f5 | label     |
| WLAN 5g | 08:xx:xx:xx:xx:f4 | label-1   |
+---------+-------------------+-----------+
label MAC address was found in UBI partition "tp_data", file
"default-mac" (raw binary MAC). Proof:
   hexdump -C default-mac
   00000000  08 xx xx xx xx f5   |....Y.|
   00000006
OEM wireless eeprom is also there (file
"MT7981_EEPROM.bin").

Link: https://github.com/981213/mtk_uartboot
Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
Update the LED enumeration layout from 0, 1, 2 to 1, 2, 3. This aligns
the internal LED identifiers directly with physical LAN ports 1, 2, and 3
to improve code readability and eliminate off-by-one mapping confusion.

Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
Migrate the Mercusys MR85X network switch configuration from the legacy
swconfig architecture to the Distributed Switch Architecture (DSA) driver
framework.

This updates the device tree bindings to utilize the realtek-rtl8365mb
DSA driver for the integrated Realtek RTL8367S switch, enabling proper
native Linux bridging interface management.

Co-authored-by: Schneider Azima <[email protected]>
Link: openwrt#19445
Co-authored-by: Mieczyslaw Nalewaj <[email protected]>
Co-authored-by: Mikhail Zhilkin <[email protected]>
Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
Dropping kmod-switch-rtl8367s leaves it with zero in-tree users. Clean up
the tree by removing its definition in modules.mk.

Keep Realtek SDK located under
target/linux/mediatek/files/drivers/net/phy/rtk/ untouched since it's
necessary for mt7622 devices:
- totolink,a8000ru
- elecom,wrc-2533gent
- buffalo,wsr-2533dhp2

Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
@openwrt-bot
openwrt-bot merged commit 725cbf1 into openwrt:main Aug 20, 2026
6 checks passed
@jonasjelonek

Copy link
Copy Markdown
Member

Thanks! Rebased on top of main and merged!

@csharper2005
csharper2005 deleted the mercusys_mr85x-ubi branch August 21, 2026 03:30
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 22, 2026
Introduce initial board support for the Mercusys MR85X, an AX3000
wireless router powered by the MediaTek MT7981 (Filogic 820) SoC.

Networking Configuration Note
-----------------------------
Ethernet functionality is currently disabled in this stage of U-Boot
due to the specific board configuration:
1. The Realtek RTL8367S switch does not have an available U-Boot driver
2. The Airoha EN8811 PHY is physically routed to GMAC1 rather than the
standard GMAC0 pipeline. This requires further adjustment to bind and
trace MDIO/PHY operations over GMAC1.

ToDo
----
I have successfully integrated the Realtek switch driver (taken from
D-Link DIR-X3260 GPL sources.
Link:  https://github.com/hsj79/dir-x3260-gplcode/

Everything is working perfectly and users can operate the device without
any issues. TFTP flashing (FIP, preloader, recovery images) works
flawlessly across both cold and warm boot cycles with stable speeds
around 6.5 MiB/s.

Why it's not ready for upstream OpenWrt yet:
- Patch Size: The included Realtek SDK files are massive (approximately
3 MB), which is way too large for a standard OpenWrt package patch
- Code Optimization: The implementation is currently a functional
workaround and requires significant refactoring, cleanup and optimization
to match official OpenWrt submission standards

Patches and ready-to-use binaries
Link: https://github.com/csharper2005/uboot-mediatek-rtl8367s/

Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 22, 2026
This commit adds OpenWrt U-Boot (UBI) layout support for MERCUSYS MR85X.

Stock bootloader UBI size: 50 MiB
OpenWrt U-Boot UBI size:  127 MiB

Other changes
-------------
- Watchdog is enabled for the both layouts
- Button labels renamed according to the kernel documentation

Preparation
-----------
OpenWrt for stock U-Boot should be installed first. Before formatting or
rewriting any partition structures, you must copy EEPROM data and unique
MAC address. Navigate to the /tmp/tp_data directory on the router. Locate
and copy these files to your PC:
- default-mac (contains your device's unique MAC address mapping)
- MT7981_EEPROM.bin (contains factory wireless calibration data)

Installation
------------
1. Initialize the Hardware Environment
Power off the router. Run the mtk_uartboot utility on your computer. Power
on the router. Wait for the utility to push the initial payload, boot the
device temporarily and format the UBI partition structure.

2. Access the U-Boot Promp
Run mtk_uartboot on your computer a second time. When the utility menu
appears on your terminal screen, choose Exit. This will drop you safely
into the interactive U-Boot command line interface prompt (MT7981>).

3. Flash the BL2 (preloader)
You must write the second-stage bootloader (BL2) directly to the MTD
partition. Prepare the router to receive the BL2 image over serial Ymodem
protocol:
   MT7981> loady
In your terminal application, select File -> Transfer -> Ymodem -> Send
and select the path to:
openwrt-mediatek-filogic-mercusys_mr85x-ubi-preloader.bin
Erase the existing BL2 partition:
   MT7981> mtd erase bl2
Commit the new BL2 binary from RAM to the flash memory:
   MT7981> mtd write bl2 $loadaddr 0x0 ${filesize}

4. Provision the FIP Partition (BL31 & U-Boot)
Ready the router to receive the FIP package:
   MT7981> loady
In your terminal application, send the following file via Ymodem:
openwrt-mediatek-filogic-mercusys_mr85x-ubi-bl31-uboot.fip
Clear the legacy tracking data and configure the UBI block allocation:
   MT7981> ubi write $loadaddr fip ${filesize}

5. Boot into OpenWrt Recovery
With the core partition structures and boot code firmly written, you can
now push and execute the temporary OpenWrt recovery environment to finish
the installation. Prepare for the final serial download:
   MT7981> loady
Send the following recovery image file via Ymodem:
openwrt-mediatek-filogic-mercusys_mr85x-ubi-initramfs-recovery.itb
Boot the OpenWrt kernel image directly out of the memory cache:
   MT7981> bootm

6. Flash OpenWrt permanently
Once the router finishes booting the initramfs image, navigate to
192.168.1.1 in your web browser to access the OpenWrt LuCI recovery
interface. From there, permanently flash the production sysupgrade image.

7. Recovery factory data
Once the router finishes booting into OpenWrt, you must rebuild and flash
the factory volume payload. This process combines your unique wireless
calibration data and MAC address back into a single compliant block.
Use SCP or an SFTP client (like WinSCP) to copy your two backup files from
your PC into the router's /tmp directory:
- default-mac
- MT7981_EEPROM.bin
Connect to the router via SSH and run the following commands:
   dd if=/dev/zero bs=$((0x8000)) count=1 | tr '\000' '\377' > /tmp/factory.bin
   dd if=/tmp/MT7981_EEPROM.bin of=/tmp/factory.bin conv=notrunc
   dd if=/tmp/default-mac >> /tmp/factory.bin
Query the system to confirm the exact logical UBI character device target
for the factory volume:
ubinfo /dev/ubi0 -N factory | grep "Volume ID" | awk '{print $3}'
Commit the newly created factory.bin file directly into the designated
factory UBI block (replace _1 below if your volume ID query returned a
different number):
   ubiupdatevol /dev/ubi0_1 /tmp/factory.bin
Reboot your router to apply the changes.

Recovery
--------
The same as installation.

UART
----
Connection parameters: 115200, 8N1, 3.3V
UART pins are silkscreened on the PCB.

MAC addresses
-------------
+---------+-------------------+-----------+
|         | MAC               | Algorithm |
+---------+-------------------+-----------+
| label   | 08:xx:xx:xx:xx:f5 | label     |
| LAN     | 08:xx:xx:xx:xx:f5 | label     |
| WAN     | 08:xx:xx:xx:xx:f6 | label+1   |
| WLAN 2g | 08:xx:xx:xx:xx:f5 | label     |
| WLAN 5g | 08:xx:xx:xx:xx:f4 | label-1   |
+---------+-------------------+-----------+
label MAC address was found in UBI partition "tp_data", file
"default-mac" (raw binary MAC). Proof:
   hexdump -C default-mac
   00000000  08 xx xx xx xx f5   |....Y.|
   00000006
OEM wireless eeprom is also there (file
"MT7981_EEPROM.bin").

Link: https://github.com/981213/mtk_uartboot
Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 22, 2026
Update the LED enumeration layout from 0, 1, 2 to 1, 2, 3. This aligns
the internal LED identifiers directly with physical LAN ports 1, 2, and 3
to improve code readability and eliminate off-by-one mapping confusion.

Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 22, 2026
Migrate the Mercusys MR85X network switch configuration from the legacy
swconfig architecture to the Distributed Switch Architecture (DSA) driver
framework.

This updates the device tree bindings to utilize the realtek-rtl8365mb
DSA driver for the integrated Realtek RTL8367S switch, enabling proper
native Linux bridging interface management.

Co-authored-by: Schneider Azima <[email protected]>
Link: openwrt#19445
Co-authored-by: Mieczyslaw Nalewaj <[email protected]>
Co-authored-by: Mikhail Zhilkin <[email protected]>
Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 22, 2026
Dropping kmod-switch-rtl8367s leaves it with zero in-tree users. Clean up
the tree by removing its definition in modules.mk.

Keep Realtek SDK located under
target/linux/mediatek/files/drivers/net/phy/rtk/ untouched since it's
necessary for mt7622 devices:
- totolink,a8000ru
- elecom,wrc-2533gent
- buffalo,wsr-2533dhp2

Signed-off-by: Mikhail Zhilkin <[email protected]>
Link: openwrt#24435
Signed-off-by: Jonas Jelonek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core packages pull request/issue for core (in-tree) packages drop package Removes an existing package Makefile from the tracking tree kernel pull request/issue with Linux kernel related changes target/mediatek pull request/issue for mediatek target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants