Adding support for Asus RT-AC1200-V2 (& maybe V1)

Here we go, better late than never, just started to add support for this small router.
Main thing is that it is possible, that this build can run on vanilla (V1) version of the router too.
So far I know, the V1 and V2 is only differing in chip modernization, where V2 has the RAM built in into the MT7628DAN, the V1 should have external RAM for the MT7628AN. Will need to test this by someone out there.

The work is pretty much in the beginning, there are so far these issues after putting an initial build together:

SPI max frequency still not clear
Partition boundary issues
Only Power Led is working
AC Radio MAC incorrect
AC Radio TX levels missing

A Syslog from this stage:

Thu Jan 27 15:53:32 2022 kern.notice kernel: [    0.000000] Linux version 5.10.92 (user@debian-x64) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r18640-d8c5406a93) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 Thu Jan 27 15:38:06 2022
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Board has DDR2
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Analog PMU set to hw control
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Digital PMU set to hw control
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] printk: bootconsole [early0] enabled
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] MIPS: machine is ASUS RT-AC1200 V2
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Initrd not found or empty - disabling initrd
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Zone ranges:
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Movable zone start for each node
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Early memory node ranges
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    0.000000] On node 0 totalpages: 16384
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    0.000000]   Normal zone: 144 pages used for memmap
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    0.000000]   Normal zone: 0 pages reserved
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    0.000000]   Normal zone: 16384 pages, LIFO batch:3
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    0.000000] pcpu-alloc: [0] 0
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Writing ErrCtl register=00036020
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Readback ErrCtl register=00036020
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] Memory: 56424K/65536K available (5257K kernel code, 608K rwdata, 1116K rodata, 1200K init, 202K bss, 9112K reserved, 0K cma-reserved)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] NR_IRQS: 256
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] intc: using register map from devicetree
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    0.000000] random: get_random_bytes called from start_kernel+0x3b8/0x5a8 with crng_init=0
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] CPU Clock: 580MHz
Thu Jan 27 15:53:32 2022 kern.crit kernel: [    0.000000] timer_probe: no matching timers found
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.000011] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.015384] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.087592] pid_max: default: 32768 minimum: 301
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.096916] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.111256] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.128849] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.148278] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.167656] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.181169] pinctrl core: initialized pinctrl subsystem
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.192572] NET: Registered protocol family 16
Thu Jan 27 15:53:32 2022 kern.err kernel: [    0.317139] mt7620-pci 10140000.pcie: Port 0 N_FTS = 1b105000
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.478153] PCI host bridge /pcie@10140000 ranges:
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.487506]  MEM 0x0000000020000000..0x000000002fffffff
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.497807]   IO 0x0000000010160000..0x000000001016ffff
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.556861] PCI host bridge to bus 0000:00
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.564927] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.578426] pci_bus 0000:00: root bus resource [io  0x10160000-0x1016ffff]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.592014] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.605425] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.621137] pci 0000:00:00.0: [14c3:0801] type 01 class 0x060400
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.632964] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x7fffffff]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.645336] pci 0000:00:00.0: reg 0x14: [mem 0x20200000-0x2020ffff]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.657799] pci 0000:00:00.0: supports D1
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.665618] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.679011] pci 0000:01:00.0: [14c3:7663] type 00 class 0x000280
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.690845] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit pref]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.705059] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00003fff 64bit pref]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.719334] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x00000fff 64bit pref]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.733733] pci 0000:01:00.0: supports D1 D2
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.742027] pci 0000:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.755159] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x1 link at 0000:00:00.0 (capable of 4.000 Gb/s with 5.0 GT/s PCIe x1 link)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.786137] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.799117] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.812201] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.825236] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.839001] pci 0000:00:00.0: BAR 9: assigned [mem 0x20000000-0x201fffff pref]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.853272] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.866704] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit pref]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.882019] pci 0000:01:00.0: BAR 2: assigned [mem 0x20100000-0x20103fff 64bit pref]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.897323] pci 0000:01:00.0: BAR 4: assigned [mem 0x20104000-0x20104fff 64bit pref]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.912629] pci 0000:00:00.0: PCI bridge to [bus 01]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.922410] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x201fffff pref]
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.943041] clocksource: Switched to clocksource MIPS
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.954396] NET: Registered protocol family 2
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.963187] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.978139] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    0.994665] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.009710] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.023632] TCP: Hash tables configured (established 1024 bind 1024)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.036350] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.049211] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.063228] NET: Registered protocol family 1
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.071779] PCI: CLS 0 bytes, default 32
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.087035] workingset: timestamp_bits=14 max_order=14 bucket_order=0
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.105294] squashfs: version 4.0 (2009/01/31) Phillip Lougher
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.116751] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.139884] mt7621_gpio 10000600.gpio: registering 32 gpios
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.151129] mt7621_gpio 10000600.gpio: registering 32 gpios
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.162374] mt7621_gpio 10000600.gpio: registering 32 gpios
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.173670] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.187386] printk: console [ttyS0] disabled
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.195879] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.213704] printk: console [ttyS0] enabled
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.230165] printk: bootconsole [early0] disabled
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.250211] spi-mt7621 10000b00.spi: sys_freq: 193333333
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.273950] spi-nor spi0.0: w25q128 (16384 Kbytes)
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.283584] 4 fixed-partitions partitions found on MTD device spi0.0
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.296177] Creating 4 MTD partitions on "spi0.0":
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.305684] 0x000000000000-0x000000030000 : "u-boot"
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.318053] 0x000000030000-0x000000040000 : "u-boot-env"
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.329796] 0x000000040000-0x000000050000 : "factory"
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.342933] 0x000000050000-0x000001000000 : "firmware"
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.354511] 2 uimage-fw partitions found on MTD device firmware
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.366313] Creating 2 MTD partitions on "firmware":
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.376164] 0x000000000000-0x000000213b62 : "kernel"
Thu Jan 27 15:53:32 2022 kern.warn kernel: [    1.386000] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.405319] 0x000000213b62-0x000000fb0000 : "rootfs"
Thu Jan 27 15:53:32 2022 kern.warn kernel: [    1.415241] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.434607] mtd: device 5 (rootfs) set to be root filesystem
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.446958] 1 squashfs-split partitions found on MTD device rootfs
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    1.459286] 0x000000670000-0x000000fb0000 : "rootfs_data"
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.476135] libphy: Fixed MDIO Bus: probed
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.531202] rt3050-esw 10110000.esw: mediatek esw at 0xb0110000, irq 25 initialized
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.547346] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.565433] NET: Registered protocol family 10
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.579112] Segment Routing with IPv6
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.586601] NET: Registered protocol family 17
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.595521] 8021q: 802.1Q VLAN Support v1.8
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.610975] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.631764] Freeing unused kernel memory: 1200K
Thu Jan 27 15:53:32 2022 kern.warn kernel: [    1.640783] This architecture does not have kernel memory protection.
Thu Jan 27 15:53:32 2022 kern.info kernel: [    1.653552] Run /sbin/init as init process
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    1.661647]   with arguments:
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    1.661654]     /sbin/init
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    1.661659]   with environment:
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    1.661665]     HOME=/
Thu Jan 27 15:53:32 2022 kern.debug kernel: [    1.661672]     TERM=linux
Thu Jan 27 15:53:32 2022 user.info kernel: [    2.342497] init: Console is alive
Thu Jan 27 15:53:32 2022 user.info kernel: [    2.349949] init: - watchdog -
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    2.733053] random: fast init done
Thu Jan 27 15:53:32 2022 user.info kernel: [    3.374817] kmodloader: loading kernel modules from /etc/modules-boot.d/*
Thu Jan 27 15:53:32 2022 user.info kernel: [    3.497271] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
Thu Jan 27 15:53:32 2022 user.info kernel: [    3.522303] init: - preinit -
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    4.810445] random: jshn: uninitialized urandom read (4 bytes read)
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    4.934556] random: jshn: uninitialized urandom read (4 bytes read)
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    5.146710] random: jshn: uninitialized urandom read (4 bytes read)
Thu Jan 27 15:53:32 2022 kern.warn kernel: [    6.012733] urandom_read: 2 callbacks suppressed
Thu Jan 27 15:53:32 2022 kern.notice kernel: [    6.012744] random: procd: uninitialized urandom read (4 bytes read)
Thu Jan 27 15:53:32 2022 kern.info kernel: [   10.084526] rt3050-esw 10110000.esw: port 1 link up
Thu Jan 27 15:53:32 2022 kern.info kernel: [   10.094261] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Thu Jan 27 15:53:32 2022 kern.info kernel: [   10.121426] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.1: link becomes ready
Thu Jan 27 15:53:32 2022 kern.notice kernel: [   10.346354] jffs2: notice: (364) jffs2_build_xattr_subsystem: complete building xattr subsystem, 6 of xdatum (0 unchecked, 1 orphan) and 7 of xref (1 dead, 0 orphan) found.
Thu Jan 27 15:53:32 2022 user.info kernel: [   10.378855] mount_root: switching to jffs2 overlay
Thu Jan 27 15:53:32 2022 kern.warn kernel: [   10.393429] overlayfs: upper fs does not support tmpfile.
Thu Jan 27 15:53:32 2022 user.warn kernel: [   10.412164] urandom-seed: Seeding with /etc/urandom.seed
Thu Jan 27 15:53:32 2022 user.info kernel: [   10.578650] procd: - early -
Thu Jan 27 15:53:32 2022 user.info kernel: [   10.584879] procd: - watchdog -
Thu Jan 27 15:53:32 2022 user.info kernel: [   11.313289] procd: - watchdog -
Thu Jan 27 15:53:32 2022 user.info kernel: [   11.321725] procd: - ubus -
Thu Jan 27 15:53:32 2022 kern.notice kernel: [   11.419827] random: ubusd: uninitialized urandom read (4 bytes read)
Thu Jan 27 15:53:32 2022 kern.notice kernel: [   11.436079] random: ubusd: uninitialized urandom read (4 bytes read)
Thu Jan 27 15:53:32 2022 kern.notice kernel: [   11.454629] random: ubusd: uninitialized urandom read (4 bytes read)
Thu Jan 27 15:53:32 2022 user.info kernel: [   11.475890] procd: - init -
Thu Jan 27 15:53:32 2022 user.info kernel: [   12.855040] kmodloader: loading kernel modules from /etc/modules.d/*
Thu Jan 27 15:53:32 2022 kern.info kernel: [   13.461996] Loading modules backported from Linux version v5.15.8-0-g43e577d7a2cb
Thu Jan 27 15:53:32 2022 kern.info kernel: [   13.476928] Backport generated by backports.git v5.15.8-1-0-g83f664bb
Thu Jan 27 15:53:32 2022 user.info kernel: [   13.586098] urngd: v1.0.2 started.
Thu Jan 27 15:53:32 2022 kern.info kernel: [   13.770813] mt76_wmac 10300000.wmac: ASIC revision: 76280001
Thu Jan 27 15:53:32 2022 kern.notice kernel: [   13.997634] random: crng init done
Thu Jan 27 15:53:32 2022 kern.notice kernel: [   14.004424] random: 1 urandom warning(s) missed due to ratelimiting
Thu Jan 27 15:53:32 2022 kern.info kernel: [   14.845253] mt76_wmac 10300000.wmac: Firmware Version: 20151201
Thu Jan 27 15:53:32 2022 kern.info kernel: [   14.857079] mt76_wmac 10300000.wmac: Build Time: 20151201183641
Thu Jan 27 15:53:32 2022 kern.info kernel: [   14.913047] mt76_wmac 10300000.wmac: firmware init done
Thu Jan 27 15:53:32 2022 kern.debug kernel: [   15.102116] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
Thu Jan 27 15:53:32 2022 kern.err kernel: [   15.193486] mt7615e 0000:01:00.0: card - bus=0x1, slot = 0x0 irq=4
Thu Jan 27 15:53:32 2022 kern.info kernel: [   15.207621] mt7615e 0000:01:00.0: Invalid MAC address, using random address 6a:22:4e:9c:3e:01
Thu Jan 27 15:53:32 2022 kern.debug kernel: [   15.276628] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
Thu Jan 27 15:53:32 2022 kern.info kernel: [   15.538841] PPP generic driver version 2.4.2
Thu Jan 27 15:53:32 2022 kern.info kernel: [   15.564435] NET: Registered protocol family 24
Thu Jan 27 15:53:32 2022 user.info kernel: [   15.613554] kmodloader: done loading kernel modules from /etc/modules.d/*
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.016465] mt7615e 0000:01:00.0: mediatek/mt7663pr2h.bin not found, switching to mediatek/mt7663pr2h_rebb.bin
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.371929] mt7615e 0000:01:00.0: HW/SW Version: 0x65322d31, Build Time: 2009041715da1a1
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.371929]
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.587000] mt7615e 0000:01:00.0: N9 Firmware Version: 7663mp1827, Build Time: 20200904171623
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.603985] mt7615e 0000:01:00.0: Region number: 0x3
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.613821] mt7615e 0000:01:00.0: Parsing tailer Region: 0
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.673214] mt7615e 0000:01:00.0: Region 0, override_addr = 0x00112c00
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.686174] mt7615e 0000:01:00.0: Parsing tailer Region: 1
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.733796] mt7615e 0000:01:00.0: Parsing tailer Region: 2
Thu Jan 27 15:53:32 2022 kern.info kernel: [   18.753422] mt7615e 0000:01:00.0: override_addr = 0x00112c00, option = 3
Thu Jan 27 15:53:34 2022 user.notice dnsmasq: DNS rebinding protection is active, will discard upstream RFC1918 responses!
Thu Jan 27 15:53:34 2022 user.notice dnsmasq: Allowing 127.0.0.0/8 responses
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: started, version 2.86 cachesize 150
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: DNS service limited to local subnets
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-cryptohash no-DNSSEC no-ID loop-detect inotify dumpfile
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: UBus support enabled: connected to system bus
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: using only locally-known addresses for test
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: using only locally-known addresses for local
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: using only locally-known addresses for lan
Thu Jan 27 15:53:35 2022 daemon.warn dnsmasq[1]: no servers found in /tmp/resolv.conf.d/resolv.conf.auto, will retry
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: read /etc/hosts - 4 addresses
Thu Jan 27 15:53:35 2022 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 0 addresses
Thu Jan 27 15:53:36 2022 authpriv.info dropbear[1015]: Not backgrounding
Thu Jan 27 15:53:39 2022 daemon.notice wpa_supplicant[1088]: Successfully initialized wpa_supplicant
Thu Jan 27 15:53:39 2022 kern.info kernel: [   26.711150] rt3050-esw 10110000.esw: port 1 link down
Thu Jan 27 15:53:40 2022 user.notice : Added device handler type: bonding
Thu Jan 27 15:53:40 2022 user.notice : Added device handler type: 8021ad
Thu Jan 27 15:53:40 2022 user.notice : Added device handler type: 8021q
Thu Jan 27 15:53:40 2022 user.notice : Added device handler type: macvlan
Thu Jan 27 15:53:40 2022 user.notice : Added device handler type: veth
Thu Jan 27 15:53:40 2022 user.notice : Added device handler type: bridge
Thu Jan 27 15:53:40 2022 user.notice : Added device handler type: Network device
Thu Jan 27 15:53:40 2022 user.notice : Added device handler type: tunnel
Thu Jan 27 15:53:42 2022 daemon.notice procd: /etc/rc.d/S50uhttpd: 4+0 records in
Thu Jan 27 15:53:42 2022 daemon.notice procd: /etc/rc.d/S50uhttpd: 4+0 records out
Thu Jan 27 15:53:43 2022 user.notice ucitrack: Setting up /etc/config/network reload dependency on /etc/config/dhcp
Thu Jan 27 15:53:44 2022 user.notice ucitrack: Setting up /etc/config/wireless reload dependency on /etc/config/network
Thu Jan 27 15:53:44 2022 kern.info kernel: [   31.018165] rt3050-esw 10110000.esw: port 1 link up
Thu Jan 27 15:53:44 2022 user.notice ucitrack: Setting up /etc/config/firewall reload dependency on /etc/config/luci-splash
Thu Jan 27 15:53:44 2022 user.notice ucitrack: Setting up /etc/config/firewall reload dependency on /etc/config/qos
Thu Jan 27 15:53:44 2022 user.notice ucitrack: Setting up /etc/config/firewall reload dependency on /etc/config/miniupnpd
Thu Jan 27 15:53:44 2022 user.notice ucitrack: Setting up /etc/config/dhcp reload dependency on /etc/config/odhcpd
Thu Jan 27 15:53:45 2022 user.notice ucitrack: Setting up non-init /etc/config/fstab reload handler: /sbin/block mount
Thu Jan 27 15:53:45 2022 user.notice ucitrack: Setting up /etc/config/system reload trigger for non-procd /etc/init.d/led
Thu Jan 27 15:53:46 2022 user.notice ucitrack: Setting up /etc/config/system reload dependency on /etc/config/luci_statistics
Thu Jan 27 15:53:46 2022 user.notice ucitrack: Setting up /etc/config/system reload dependency on /etc/config/dhcp
Thu Jan 27 15:53:47 2022 daemon.notice procd: /etc/rc.d/S96led: setting up led lan
Thu Jan 27 15:53:47 2022 daemon.notice procd: /etc/rc.d/S96led: setting up led wan
Thu Jan 27 15:53:49 2022 kern.info kernel: [   36.001097] br-lan: port 1(eth0.1) entered blocking state
Thu Jan 27 15:53:49 2022 kern.info kernel: [   36.011893] br-lan: port 1(eth0.1) entered disabled state
Thu Jan 27 15:53:49 2022 kern.info kernel: [   36.023203] device eth0.1 entered promiscuous mode
Thu Jan 27 15:53:49 2022 kern.info kernel: [   36.032701] device eth0 entered promiscuous mode
Thu Jan 27 15:53:49 2022 kern.info kernel: [   36.115690] br-lan: port 1(eth0.1) entered blocking state
Thu Jan 27 15:53:49 2022 kern.info kernel: [   36.126462] br-lan: port 1(eth0.1) entered forwarding state
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'lan' is enabled
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'lan' is setting up now
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'lan' is now up
Thu Jan 27 15:53:49 2022 daemon.notice netifd: bridge 'br-lan' link is up
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'lan' has link connectivity
Thu Jan 27 15:53:49 2022 daemon.notice netifd: VLAN 'eth0.1' link is up
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'loopback' is enabled
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'loopback' is setting up now
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'loopback' is now up
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'wan' is enabled
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'wan6' is enabled
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Network device 'eth0' link is up
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Network device 'lo' link is up
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'loopback' has link connectivity
Thu Jan 27 15:53:49 2022 daemon.notice netifd: VLAN 'eth0.2' link is up
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'wan' has link connectivity
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'wan' is setting up now
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'wan6' has link connectivity
Thu Jan 27 15:53:49 2022 daemon.notice netifd: Interface 'wan6' is setting up now
Thu Jan 27 15:53:50 2022 kern.info kernel: [   37.023706] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
Thu Jan 27 15:53:50 2022 daemon.err odhcpd[1203]: Failed to send to ff02::1%lan@br-lan (Address not available)
Thu Jan 27 15:53:50 2022 daemon.notice netifd: wan (1741): udhcpc: started, v1.35.0
Thu Jan 27 15:53:52 2022 daemon.notice netifd: wan (1741): udhcpc: broadcasting discover
Thu Jan 27 15:53:53 2022 user.notice firewall: Reloading firewall due to ifup of lan (br-lan)
Thu Jan 27 15:53:53 2022 daemon.info procd: - init complete -
Thu Jan 27 15:53:54 2022 daemon.notice netifd: radio0 (1667): sh: out of range
Thu Jan 27 15:53:55 2022 daemon.notice netifd: wan (1741): udhcpc: broadcasting discover
Thu Jan 27 15:53:55 2022 daemon.notice netifd: radio1 (1668): sh: out of range

Will report back here with progress, or you can see it here:

So I just got to the point, where everything works, however from the LEDs I have only Power LED, i.e. no Wireless 2G/5G, no WAN/4xLAN LEDs at all.
The GPIOs are extracted from the source, so they should be accurate. At least for Power LED it is for sure.

I was trying to extract the LED setup from the source and from the OEM logs, but somehow there is missing something.
The OEM syslog has this entries regarding pinmuxing:

GPIO#44 updated GPIOMODE register: 54050404 -> 54450404
GPIO#4 updated GPIOMODE register: 54450404 -> 54550404
ASUS RT-AC1200v2 gpio init : wps / reset pin
GPIO#11 updated GPIOMODE register: 54550404 -> 54550405
.
.
.
RALINK_GPIOMODE = 54550405
RALINK_GPIOMODE = 54540405
***** Xtal 40MHz *****
start PCIe register access
RALINK_RSTCTRL = 2400000
RALINK_CLKCFG1 = fdbfffc0

The 0x54540405 mask is giving what I entered in the dts for state_default, but simply nothing changed.
I already trying to change it randomly at this stage, but its a no go.

My dts:

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "mt7628an.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "asus,rt-ac1200-v2", "mediatek,mt7628an-soc";
	model = "ASUS RT-AC1200 V2";

	aliases {
		led-boot = &led_power;
		led-failsafe = &led_power;
		led-running = &led_power;
		led-upgrade = &led_power;
		label-mac-device = &ethernet;
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};

		wps {
			label = "wps";
			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};

	leds {
		compatible = "gpio-leds";

		led_power: power {
			label = "blue:power";
			gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
		};

		lan1 {
			label = "blue:lan1";
			gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
		};

		lan2 {
			label = "blue:lan2";
			gpios = <&gpio 41 GPIO_ACTIVE_LOW>;
		};

		lan3 {
			label = "blue:lan3";
			gpios = <&gpio 40 GPIO_ACTIVE_LOW>;
		};

		lan4 {
			label = "blue:lan4";
			gpios = <&gpio 39 GPIO_ACTIVE_LOW>;
		};

		wan {
			label = "blue:wan";
			gpios = <&gpio 43 GPIO_ACTIVE_LOW>;
		};

		wlan2g {
			label = "blue:wlan2g";
			gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
		};

		wlan5g {
			label = "blue:wlan5g";
			gpios = <&gpio 73 GPIO_ACTIVE_LOW>;
		};
	};
};

&state_default {
	gpio {
/*		groups = "gpio", "i2c", "i2s", "perst", "refclk", "wdt",
			"p0led_an", "p1led_an", "p2led_an", "p3led_an", "p4led_an", "wled_an",
			"p0led_kn", "p1led_kn", "p2led_kn", "p3led_kn", "p4led_kn", "wled_kn";
*/		groups = "gpio", "spis", "sdhci", "perst", "refclk", "wled_an", "i2c",
			"p0led_an", "uart3", "pwm0", "pwm1";
		function = "gpio";
	};
};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <104000000>;
		m25p,fast-read;

		partitions: partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "u-boot-env";
				reg = <0x30000 0x10000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
				read-only;

				compatible = "nvmem-cells";
				#address-cells = <1>;
				#size-cells = <1>;

				macaddr_factory_4: macaddr@4 {
					reg = <0x4 0x6>;
				};
			};

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0xfb0000>;
			};
		};
	};
};

&pcie {
	status = "okay";
};

&i2c {
	status = "okay";
};

&i2s {
	status = "okay";
};

&sdhci {
	status = "okay";
};

&pwm {
	status = "okay";
};

&ethernet {
	nvmem-cells = <&macaddr_factory_4>;
	nvmem-cell-names = "mac-address";
};

&esw {
	mediatek,portmap = <0x3e>;
};

&wmac {
	status = "okay";

	mediatek,mtd-eeprom = <&factory 0x0>;
};

&pcie0 {
	wifi5: wifi@0,0 {
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		/*ieee80211-freq-limit = <5000000 6000000>;*/
	};
};

&usbphy {
	status = "disabled";
};

&ehci {
	status = "disabled";
};

&ohci {
	status = "disabled";
};

Anyone has any idea what am I missing?
TiA!

1 Like

For the record, the wifi2g LED and the switch LEDs are working; for the latter I'll have to introduce a driver patch, which includes a new dts-binding called "mediatek,led_source".
This is changing the switch LEDs to a configuration which is not documented. Without this, the LEDs would never work correctly, i.e. blinking crazy all the time, no matter if there is traffic, or not.

At this point, the only remaining thing is the wifi5g LED missing. Never saw it coming up before, other than with the OEM FW, which is so old, it is even doing completely different things. Or OpenWRT is just too new :wink:

If anyone has an idea where to start looking for the wifi5g LED, share the ideas :wink:
TiA

I've no idea where can be the 5GHz LED, I have the feeling, this needs also some deep tinkering, but since I don't have any datasheet for the 7613e, I'm stuck. :frowning:

Is there anyone with a working LED out there at all? Maybe even on different devices with the same chip?

The newest dts for the device, but the wifi 5G Led is not yet working - however I debugged the driver and it does everything correctly it seems, if we can believe the registers' configuration.

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "mt7628an.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "asus,rt-ac1200-v2", "mediatek,mt7628an-soc";
	model = "ASUS RT-AC1200 V2";

	aliases {
		led-boot = &led_wps;
		led-failsafe = &led_wps;
		led-running = &led_wps;
		led-upgrade = &led_wps;
		label-mac-device = &ethernet;
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};

		wps {
			label = "wps";
			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};

	leds {
		compatible = "gpio-leds";

		led_wps: wps {
			label = "blue:wps";
			gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
		};

		wlan2g {
			label = "blue:wlan2g";
			gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
		};
};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <58000000>;
		m25p,fast-read;

		partitions: partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "u-boot";
				reg = <0x0 0x30000>;
				read-only;
			};

			partition@30000 {
				label = "u-boot-env";
				reg = <0x30000 0x10000>;
				read-only;
			};

			factory: partition@40000 {
				label = "factory";
				reg = <0x40000 0x10000>;
				read-only;

				compatible = "nvmem-cells";
				#address-cells = <1>;
				#size-cells = <1>;

				macaddr_factory_4: macaddr@4 {
					reg = <0x4 0x6>;
				};
			};

			partition@50000 {
				compatible = "denx,uimage";
				label = "firmware";
				reg = <0x50000 0xfb0000>;
			};
		};
	};
};

&gpio {
	enable-leds {
		gpio-hog;
		line-name = "enable-leds";
		output-low;
		gpios = <4 GPIO_ACTIVE_HIGH>;
	};
};

&ethernet {
	nvmem-cells = <&macaddr_factory_4>;
	nvmem-cell-names = "mac-address";
};

&esw {
	mediatek,portmap = <0x3e>;
	mediatek,led_source = <4>;
};

&wmac {
	status = "okay";

	mediatek,mtd-eeprom = <&factory 0x0>;
};

&pcie {
	status = "okay";
};

&pcie0 {
	mt76@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		ieee80211-freq-limit = <5000000 6000000>;

		led {
			led-sources = <2>;
			led-active-low;
		};
	};
};

&state_default {
	spis {
		groups = "spis";
		function = "spis";
	};

	gpio {
		groups = "refclk", "i2c", "wled_an";
		function = "gpio";
	};
};

&usbphy {
	status = "disabled";
};

&ehci {
	status = "disabled";
};

&ohci {
	status = "disabled";
};

Regarding wifi 5G LED, I was tracing back the pins on the pcb.
The LED's anode is ending up to a "fixed" 3.3V, while the cathode in contrast to standard solutions, gets to the MT7613 pin#73, which is UART_RXD.

Interestingly, one can also see this pin (not gpio) mentioned in the source from Asus, so we can be pretty sure, we are on the correct way:

#define WIFI_5G_LED  73  /* UART_RXD */

So we can do whatever we want with gpios and driver-driven LED, it will never work.
Since I don't have datasheet and driver either (proprietary), I can only assume, that the UART_RXD pin has to be muxed to gpio and control the LED like that, or something similar.
The openwrt mt76 driver doesn't have such functionality in it (so far I saw), so I think I'm out of options here.
I figured the 7613's memory is mapped to 0x20000000 and from various code fragments I found some gpio registers, so GPIO_BASE 0x80023000 is mapped to 0x20023000, but this is simply not enough:

#ifndef __GPIO_H__

#define __GPIO_H__



#define GPIO_BASE 0x80023000

#define GPIO_PU1 (GPIO_BASE + 0x00)

#define GPIO_PU1_SET (GPIO_BASE +0x04)

#define GPIO_PU1_RESET (GPIO_BASE + 0x8)

#define GPIO_PD1 (GPIO_BASE + 0x10)

#define GPIO_PD1_SET (GPIO_BASE + 0x14)

#define GPIO_PD1_RESET (GPIO_BASE + 0x18)

#define GPIO_DOUT1 (GPIO_BASE + 0x20)

#define GPIO_DOUT1_SET (GPIO_BASE + 0x24)

#define GPIO_DOUT1_RESET (GPIO_BASE + 0x28)

#define GPIO_OE1 (GPIO_BASE + 0x30)

#define GPIO_OE1_SET (GPIO_BASE + 0x34)

#define GPIO_OE1_RESET (GPIO_BASE + 0x38)

#define GPIO_DIN1 (GPIO_BASE + 0x40)

#define PINMUX_SEL1 (GPIO_BASE + 0x80)

#define PINMUX_SEL2 (GPIO_BASE + 0x84)

#define PINMUX_SEL3 (GPIO_BASE + 0X88)



#define GPIO0_SEL_MASK (0x7)

#define GPIO0_SEL(p) (((p) & 0x7))

#define GPIO0_SEL_VALUE 0x0

#define GPIO1_SEL_MASK (0x7 << 4)

#define GPIO1_SEL(p) (((p) & 0x7) << 4)

#define GPIO1_SEL_VALUE 0x2

#define GPIO2_SEL_MASK (0x7 << 8)

#define GPIO2_SEL(p) (((p) & 0x7) << 8)

#define GPIO2_SEL_VALUE 0x2

#define GPIO3_SEL_MASK (0x7 << 12)

#define GPIO3_SEL(p) (((p) & 0x7) << 12)

#define GPIO3_SEL_VALUE 0x2

#define GPIO4_SEL_MASK (0x7 << 16)

#define GPIO4_SEL(p) (((p) & 0x7) << 16)

#define GPIO4_SEL_VALUE 0x2

#define GPIO5_SEL_MASK (0x7 << 20)

#define GPIO5_SEL(p) (((p) & 0x7) << 20)

#define GPIO5_SEL_VALUE 0x2

#define GPIO6_SEL_MASK (0x7 << 24)

#define GPIO6_SEL(p) (((p) & 0x7) << 24)

#define GPIO6_SEL_VALUE 0x0

#define GPIO7_SEL_MASK (0x7 << 28)

#define GPIO7_SEL(p) (((p) & 0x7) << 28)

#define GPIO7_SEL_VALUE 0x0

#define GPIO8_SEL_MASK (0x7)

#define GPIO8_SEL(p) (((p) & 0x7))

#define GPIO8_SEL_VALUE 0x0

#define GPIO9_SEL_MASK (0x7 << 4)

#define GPIO9_SEL(p) (((p) & 0x7) << 4)

#define GPIO9_SEL_VALUE 0x0

#define GPIO10_SEL_MASK (0x7 << 8)

#define GPIO10_SEL(p) (((p) & 0x7) << 8)

#define GPIO10_SEL_VALUE 0x0

#define GPIO11_SEL_MASK (0x7 << 12)

#define GPIO11_SEL(p) (((p) & 0x7) << 12)

#define GPIO11_SEL_VALUE 0x2

#define GPIO12_SEL_MASK (0x7 << 16)

#define GPIO12_SEL(p) (((p) & 0x7) << 16)

#define GPIO12_SEL_VALUE 0x2

#define GPIO13_SEL_MASK (0x7 << 20)

#define GPIO13_SEL(p) (((p) & 0x7) << 20)

#define GPIO13_SEL_VALUE 0x2

#define GPIO14_SEL_MASK (0x7 << 24)

#define GPIO14_SEL(p) (((p) & 0x7) << 24)

#define GPIO14_SEL_VALUE 0x2

#define GPIO15_SEL_MASK (0x7 << 28)

#define GPIO15_SEL(p) (((p) & 0x7) << 28)

#define GPIO15_SEL_VALUE 0x2

#define GPIO16_SEL_MASK (0x7)

#define GPIO16_SEL(p) (((p) & 0x7))

#define GPIO16_SEL_VALUE 0x2



#define OUTPUT_HIGH 1

#define OUTPUT_LOW 0

#define INPUT_HIGH 1

#define INPUT_LOW 0

#define GPIO_OUTPUT 1

#define GPIO_INPUT 0

#define PULL_UP 1

#define NO_PULL_UP 0

#define PULL_DOWN 1

#define NO_PULL_DOWN 0



#define GPIO0 0

#define GPIO1 1

#define GPIO2 2

#define GPIO3 3

#define GPIO4 4

#define GPIO5 5

#define GPIO6 6

#define GPIO7 7

#define GPIO8 8

#define GPIO9 9

#define GPIO10 10

#define GPIO11 11

#define GPIO12 12

#define GPIO13 13

#define GPIO14 14

#define GPIO15 15

#define GPIO16 16



INT32 GPIODirectionInput(struct _RTMP_ADAPTER *pAd, UINT32 GPIO);

INT32 GPIODirectionOuput(struct _RTMP_ADAPTER *pAd, UINT32 GPIO, UINT8 Value);

UINT32 GPIOGetValue(struct _RTMP_ADAPTER *pAd, UINT32 GPIO);

VOID GPIOSetValue(struct _RTMP_ADAPTER *pAd, UINT32 GPIO, UINT8 Value);

UINT32 GPIOGetMode(struct _RTMP_ADAPTER *pAd, UINT32 GPIO);

INT32 GPIOPullUp(struct _RTMP_ADAPTER *pAd, UINT32 GPIO, UINT8 Value);

INT32 GPIOPullDown(struct _RTMP_ADAPTER *pAd, UINT32 GPIO, UINT8 Value);



#endif

Only thing I achieved via bothering the PINMUX_SEL1 via devmem, that the wifi restarted and reauthenticated.
Found nothing really about the ominous UART...

For the record; the 5G LED is functioning:

1 Like

@tsb
Wow! Thanks for this!
I was pleasantly surprised when I found this. The router with native firmware is more like a useless box without any meaningful option(e.g. without WiFi wan, Repeater, minimal possible configuration and that was something what disappointed me a lot even more as it´s from Asus and I had very good experience with their routers.)

Running it with OpenWRT for week without crashes nor problems.

1 Like

PR is already up https://github.com/openwrt/openwrt/pull/9415
The LED functions still remain a question if accepted, but let's hope :wink:

Btw it is very interesting, that with OpenWRT the 5G Wifi is capable of 160MHz, which is turning the router to something higher, than the ac1200 class, but ofc we only have a 100Mb switch here, so....
Still cool I think :wink:

@tsb Can I ask you something ?
How´s your config.buildinfo looks like ? If I have built image without changes or with only added Luci Web I´m getting random WiFi driver crashes. I don't have log for now as I don't have the AP at home.

Do you maybe have something different than I have (see photo)?

I'll send the config right away too.

I have nothing at all in config.buildinfo, I'm not using defconfig etc, just make -jxx download world
:

CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt76x8=y
CONFIG_TARGET_ramips_mt76x8_DEVICE_asus_rt-ac1200-v2=y
CONFIG_PACKAGE_cgi-io=y
CONFIG_PACKAGE_libiwinfo-lua=y
CONFIG_PACKAGE_liblua=y
CONFIG_PACKAGE_liblucihttp=y
CONFIG_PACKAGE_liblucihttp-lua=y
CONFIG_PACKAGE_libubus-lua=y
CONFIG_PACKAGE_lua=y
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_luci-app-firewall=y
CONFIG_PACKAGE_luci-app-opkg=y
CONFIG_PACKAGE_luci-base=y
CONFIG_PACKAGE_luci-lib-base=y
CONFIG_PACKAGE_luci-lib-ip=y
CONFIG_PACKAGE_luci-lib-jsonc=y
CONFIG_PACKAGE_luci-lib-nixio=y
CONFIG_PACKAGE_luci-mod-admin-full=y
CONFIG_PACKAGE_luci-mod-network=y
CONFIG_PACKAGE_luci-mod-status=y
CONFIG_PACKAGE_luci-mod-system=y
CONFIG_PACKAGE_luci-proto-ipv6=y
CONFIG_PACKAGE_luci-proto-ppp=y
CONFIG_PACKAGE_luci-theme-bootstrap=y
CONFIG_PACKAGE_rpcd=y
CONFIG_PACKAGE_rpcd-mod-file=y
CONFIG_PACKAGE_rpcd-mod-iwinfo=y
CONFIG_PACKAGE_rpcd-mod-luci=y
CONFIG_PACKAGE_rpcd-mod-rrdns=y
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_uhttpd-mod-ubus=y

Update: I just swapped my main router from an old ac device to a new ax one and if I set it to 160MHz wide, the RT-AC1200-V2 doesn't connect to it at all. Setting 5GHz to 80MHz is ok.
Trying to auth 3 times, then timeout.

@tsb Salute ! Thanks sir for your work, been enjoyed SQM with this router now. Since OEM only include basic QOS feature (classic rules).

Just want to report a problem too (ASUS RT-AC1200 v2). Theres a wireless connection problem after random time interval (frequently after 12hours+ routers powered on).

  1. All wireless client got disconnected and need waiting several time (1-5minutes), before all client can reconnecet to AP.

  2. After this problem occur. Router must be rebooted, if not the problem will come more frequently (under 1hours activity and all wireless client got disconnected again).

  3. Im not sure this is a problem or not. When first times enabled 5ghz wireless interface, WAN interface get disconnected and can't get reconnected again without rebooting whole system.

Overall, this is very great job ! Thanks again tsb

Hi @LOS did you still use this device with openwrt till now (ASUS RT-AC1200 v2) ?

Are you having problems with the wireless interface ? At random intervals, all clients will be disconnected and will need to wait a few minutes for them to reconnect.

And the problem will occur more often if you don't restart the device.

Hi there,

I have just installed openwrt on my RT-AC1200 v2 and faced a couple of issues:

  • Not all channels seem to be working regardless of a country on 5Ghz. I'm in the country where I can use channel 100 and when I select this country, the channel appears in the list, but once I switch to it, my 5Ghz network disappears. Only 36-44 channels work.
  • The 5Ghz LED is still not working :slight_smile:

So, overall the firmware looks like under development and not all features are enabled as of now, but I'd like to know the state of the development. I mean, no any messages in this topic for almost a year, so any chance that I can hope on a fix for the mentioned channel issues in any foreseeable future?