Adding support for RT-N65U

Hello everyone,

I would like add a support for ASUS RT-N65U. There was an similar thread, but just an request without any technical details. So I decided to do it by own.

Here are the results:

Starting kernel at 80000000...

[    0.000000] Linux version 5.10.163 (openwrt@cfd916202ec2) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 12.2.0 r21637+171-b6c7f90b17) 12.2.0, GNU ld (GNU Binutils) 2.39) #0 Mon Jan 16 17:11:40 2023
[    0.000000] SoC Type: Ralink RT3883 ver:1 eco:5
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[    0.000000] MIPS: machine is Asus RT-N65U
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 123412K/131072K available (3900K kernel code, 577K rwdata, 596K rodata, 1188K init, 190K bss, 7660K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 500MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041786 ns
[    0.000014] sched_clock: 32 bits at 250MHz, resolution 4ns, wraps every 8589934590ns
[    0.007664] Calibrating delay loop... 249.44 BogoMIPS (lpj=1247232)
[    0.083663] pid_max: default: 32768 minimum: 301
[    0.088323] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.095393] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.105124] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.116282] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.125846] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.132461] pinctrl core: initialized pinctrl subsystem
[    0.138807] NET: Registered protocol family 16
[    0.155041] OF: /ethernet@10100000: could not get #nvmem-cell-cells for /palmbus@10000000/spi@b00/flash@0/partitions/partition@40000/macaddr@4
[    0.168684] rt3883-pci 10140000.pci: mode: PCIe
[    1.798394] PCI host bridge /pci@10140000/pci@0 ranges:
[    1.803464]  MEM 0x0000000020000000..0x000000002fffffff
[    1.808522]   IO 0x0000000010160000..0x000000001016ffff
[    1.851634] rt2880_gpio 10000600.gpio: registering 24 gpios
[    1.857058] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    1.863498] rt2880_gpio 10000638.gpio: registering 16 gpios
[    1.870869] PCI host bridge to bus 0000:00
[    1.874883] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    1.881506] pci_bus 0000:00: root bus resource [io  0x10160000-0x1016ffff]
[    1.888201] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    1.894773] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    1.902667] pci 0000:00:01.0: [1814:0802] type 01 class 0x060400
[    1.908462] pci 0000:00:01.0: reg 0x14: [mem 0x00000000-0x0000ffff]
[    1.914622] pci 0000:00:01.0: supports D1
[    1.918450] pci 0000:00:01.0: PME# supported from D0 D1 D3hot
[    1.926270] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    1.934296] pci 0000:01:00.0: [1b21:1042] type 00 class 0x0c0330
[    1.940155] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit]
[    1.946905] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x1 link at 0000:00:01.0 (capable of 4.000 Gb/s with 5.0 GT/s PCIe x1 link)
[    1.963509] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    1.969891] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01
[    1.976371] pci 0000:00:01.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    1.982909] pci 0000:00:01.0: BAR 1: assigned [mem 0x20100000-0x2010ffff]
[    1.989532] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x20007fff 64bit]
[    1.996618] pci 0000:00:01.0: PCI bridge to [bus 01]
[    2.001438] pci 0000:00:01.0:   bridge window [mem 0x20000000-0x200fffff]
[    2.016798] clocksource: Switched to clocksource MIPS
[    2.023127] NET: Registered protocol family 2
[    2.027688] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    2.035516] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    2.043692] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    2.051114] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    2.057952] TCP: Hash tables configured (established 1024 bind 1024)
[    2.064282] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    2.070651] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    2.077719] NET: Registered protocol family 1
[    2.082010] pci 0000:01:00.0: enabling device (0000 -> 0002)
[    2.092491] pci 0000:01:00.0: 0x802757dc took 10238 usecs
[    2.097745] PCI: CLS 0 bytes, default 32
[    2.102002] rt-timer 10000100.timer: maximum frequency is 5065Hz
[    2.111310] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    2.122069] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.127752] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    2.140286] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    2.147791] printk: console [ttyS0] disabled
[    2.151999] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    2.161685] printk: console [ttyS0] enabled
[    2.161685] printk: console [ttyS0] enabled
[    2.170150] printk: bootconsole [early0] disabled
[    2.170150] printk: bootconsole [early0] disabled
[    2.190817] spi spi0.0: force spi mode3
[    2.196104] spi-nor spi0.0: mx25l12805d (16384 Kbytes)
[    2.201511] 4 fixed-partitions partitions found on MTD device spi0.0
[    2.208086] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    2.215587] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    2.223490] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    2.231043] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    2.238807] Creating 4 MTD partitions on "spi0.0":
[    2.243716] 0x000000000000-0x000000030000 : "u-boot"
[    2.251902] 0x000000030000-0x000000040000 : "config"
[    2.258264] 0x000000040000-0x000000050000 : "factory"
[    2.266548] 0x000000050000-0x000001000000 : "firmware"
[    2.274630] 2 uimage-fw partitions found on MTD device firmware
[    2.280751] Creating 2 MTD partitions on "firmware":
[    2.285829] 0x000000000000-0x000000188560 : "kernel"
[    2.290934] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[    2.301886] 0x000000188560-0x000000fb0000 : "rootfs"
[    2.307033] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    2.317675] mtd: setting mtd5 (rootfs) as root device
[    2.324287] 1 squashfs-split partitions found on MTD device rootfs
[    2.330680] 0x000000476000-0x000000fb0000 : "rootfs_data"
[    2.344937] rtl8367b rtl8367rb: cannot find mdio bus from bus handle (yet)
[    2.365798] mtk_soc_eth 10100000.ethernet: using fixed link parameters
[    2.372570] mtk_soc_eth 10100000.ethernet eth0 (uninitialized): link up (1000Mbps/Full duplex)
[    2.382167] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    2.391281] rt2880_wdt 10000120.watchdog: Initialized
[    2.397972] NET: Registered protocol family 10
[    2.408728] Segment Routing with IPv6
[    2.412645] NET: Registered protocol family 17
[    2.417335] 8021q: 802.1Q VLAN Support v1.8
[    2.424958] rtl8367b rtl8367rb: using MDIO bus 'mdio'
[    2.435248] rtl8367b rtl8367rb: unknown chip num:0000 ver:0000, mode:0000
[    2.442194] rtl8367b rtl8367rb: chip detection failed, err=-19
[    2.540415] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    2.553978] Freeing unused kernel memory: 1188K
[    2.558647] This architecture does not have kernel memory protection.
[    2.565232] Run /sbin/init as init process
[   14.866775] init: Console is alive
[   14.870931] init: - watchdog -
[   26.791044] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[   30.325122] usbcore: registered new interface driver usbfs
[   30.330920] usbcore: registered new interface driver hub
[   30.336458] usbcore: registered new device driver usb
[   30.350661] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   30.360957] ehci-fsl: Freescale EHCI Host controller driver
[   30.369021] ehci-platform: EHCI generic platform driver
[   30.384950] phy phy-usbphy.0: remote usb device wakeup disabled
[   30.391030] phy phy-usbphy.0: UTMI 16bit 30MHz
[   30.395570] ehci-platform 101c0000.ehci: EHCI Host Controller
[   30.401489] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[   30.409729] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[   30.436836] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[   30.444477] hub 1-0:1.0: USB hub found
[   30.449466] hub 1-0:1.0: 2 ports detected
[   30.462554] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   30.471616] ohci-platform: OHCI generic platform driver
[   30.477546] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[   30.484545] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[   30.492830] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[   30.572053] hub 2-0:1.0: USB hub found
[   30.576942] hub 2-0:1.0: 2 ports detected
[   30.595624] xhci_hcd 0000:01:00.0: xHCI Host Controller
[   30.601101] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 3
[   30.663014] xhci_hcd 0000:01:00.0: hcc params 0x0200f180 hci version 0x96 quirks 0x0000000000080010
[   30.674370] hub 3-0:1.0: USB hub found
[   30.679246] hub 3-0:1.0: 2 ports detected
[   30.684180] xhci_hcd 0000:01:00.0: xHCI Host Controller
[   30.689643] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 4
[   30.697250] xhci_hcd 0000:01:00.0: Host supports USB 3.0 SuperSpeed
[   30.704933] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[   30.714601] hub 4-0:1.0: USB hub found
[   30.719546] hub 4-0:1.0: 2 ports detected
[   30.736339] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[   30.746063] init: - preinit -
Board is ASUS asus,rt-n65u, replacing uImage header...
[   39.615201] random: jshn: uninitialized urandom read (4 bytes read)
[   39.765846] random: jshn: uninitialized urandom read (4 bytes read)
[   40.147076] random: jshn: uninitialized urandom read (4 bytes read)
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.
Failed to connect to the switch. Use the "list" command to see which switches are available.
[   46.694992] mtk_soc_eth 10100000.ethernet eth0: link up (1000Mbps/Full duplex)
[   46.703295] 8021q: adding VLAN 0 to HW filter on device eth0
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   49.494457] random: procd: uninitialized urandom read (4 bytes read)
[   55.364065] mount_root: no usable overlay filesystem found, using tmpfs overlay
[   55.376983] urandom-seed: Seed file not found (/etc/urandom.seed)
[   55.419931] mtk_soc_eth 10100000.ethernet eth0: link down
[   55.452370] procd: - early -
[   55.455765] procd: - watchdog -
[   61.882397] procd: - watchdog -
[   61.886378] procd: - ubus -
[   66.843385] random: ubusd: uninitialized urandom read (4 bytes read)
[   66.852898] random: ubusd: uninitialized urandom read (4 bytes read)
[   66.860168] random: ubusd: uninitialized urandom read (4 bytes read)
[   66.871636] procd: - init -
Please press Enter to activate this console.
[   73.125156] random: jshn: uninitialized urandom read (4 bytes read)
[   73.198339] random: ubusd: uninitialized urandom read (4 bytes read)
[   73.205334] random: ubus: uninitialized urandom read (4 bytes read)



BusyBox v1.36.0 (2023-01-15 13:47:06 UTC) built-in shell (ash)

[   85.633646] urngd: v1.0.2 started.
[   85.964605] kmodloader: loading kernel modules from /etc/modules.d/*
[   86.361539] random: crng init done
[   86.365035] random: 20 urandom warning(s) missed due to ratelimiting
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r21808-a33f37ca36
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@(none):/# [   86.525858] Loading modules backported from Linux version v6.1-rc8-0-g76dcd734eca2
[   86.533685] Backport generated by backports.git v5.15.81-1-41-g02e352527db5
[   86.811639] PPP generic driver version 2.4.2
[   86.829213] NET: Registered protocol family 24
[   86.894966] rt2800_wmac 10180000.wmac: loaded eeprom from mtd device "factory"
[   86.902425] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 3883, rev 0400 detected
[   86.910409] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 3853 detected
[   86.947539] kmodloader: done loading kernel modules from /etc/modules.d/*

Basically there are multiple issues/questions, but now focus on 2 major one.

  1. Are the partitions ok? Looks like, there is something wrong, or is it normal?
[    2.190817] spi spi0.0: force spi mode3
[    2.196104] spi-nor spi0.0: mx25l12805d (16384 Kbytes)
[    2.201511] 4 fixed-partitions partitions found on MTD device spi0.0
[    2.208086] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    2.215587] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    2.223490] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    2.231043] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
[    2.238807] Creating 4 MTD partitions on "spi0.0":
[    2.243716] 0x000000000000-0x000000030000 : "u-boot"
[    2.251902] 0x000000030000-0x000000040000 : "config"
[    2.258264] 0x000000040000-0x000000050000 : "factory"
[    2.266548] 0x000000050000-0x000001000000 : "firmware"
[    2.274630] 2 uimage-fw partitions found on MTD device firmware
[    2.280751] Creating 2 MTD partitions on "firmware":
[    2.285829] 0x000000000000-0x000000188560 : "kernel"
[    2.290934] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
[    2.301886] 0x000000188560-0x000000fb0000 : "rootfs"
[    2.307033] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    2.317675] mtd: setting mtd5 (rootfs) as root device
[    2.324287] 1 squashfs-split partitions found on MTD device rootfs
[    2.330680] 0x000000476000-0x000000fb0000 : "rootfs_data"
  1. RTL8367B switch is not detected. Looks like, that something is wrong with MDIO bus, while it can't detect the switch. Not sure if 3883-soc is able to handle with MDIO and not via GPIO. So how to get it working?
[    2.424958] rtl8367b rtl8367rb: using MDIO bus 'mdio'
[    2.435248] rtl8367b rtl8367rb: unknown chip num:0000 ver:0000, mode:0000
[    2.442194] rtl8367b rtl8367rb: chip detection failed, err=-19

The main problem which I have is, that I don't have any kind of schematic. Basically everything is based on other devices and technical data which I found.

Current status could be found here.
Any kind of help is welcome.

Regards,
Andy

Maybe someone just overlooked this topic, but support is still required :slight_smile: .

I have the old FW for comparison, but I still don't understand, what is the real issue with the partitions. What is then the right combination for partitioning?

Same question as above... what's wrong with the switch detection?

Thank you,
Andy