BPI-R4 and R4 Pro extras for frankw's kernel

I started collecting a lot of local patches so I decided to keep a fork of frank’s BPI-Router-Linux with these and make them available to the community. TLDR: everything works for me (better than spec I could say) and there are a few extras that might be useful. Kernel is at:

https://github.com/meehien/BPI-Router-Linux

The main branch in the repo above is frankw’s 7.3-main with the Wi-Fi stack from Felix Fietkau’s tree on top (the mt76 fixes arrive sooner that way) and then one commit per patch of mine. Plan is to always rebase on frankw’s latest -main. Commits link to issues, explanations and tests so it should be easy to cherry-pick only the parts you want, especially with AI helpers. The labels should also say if a fix is ours or upstream and if a patch was carried over from OpenWrt or MediaTek (all original authors are kept).

Roughly what is in there:

Boards (R4 Pro 8X, R4)

  • BE14 reset on the R4 Pro: reset through GPIO7, PERST# held across the chip reset, the second link trained after it, PCIe PHY reference clocks kept running (#1)
  • R4 Pro FIT configurations for the key-M slots and a state for the M.2 lane select hogs (#2)
  • supplies and rails described on both boards, key-B slot supply at 3.95 V, mPCIe 3.3 V rails, the unfitted INA226 disabled (#3)
  • WED nodes for MT7988 (#4) and the uart2_3_lite pin group (#5)

PCIe, modem, storage

  • PCIe link kept up across a rebind, the slot not powered down when the link fails (#7)
  • Sierra EM919x over MHI: subsystem IDs read again at probe, no runtime suspend, SoC reset on removal, QRTR download buffers, SAHARA as a WWAN port (#7)
  • nvme quirks parameter parsed after the slab allocator is up (#9), xsphy quiet on probe deferral (#6)

PHYs, SFP, SerDes

  • RollBall SFP modules: started before the PHY probe, command completion reworked, no rtnl held during the scan, probe retried on bad c45 IDs (#10)
  • BCM84891 10GBASE-T modules with the bcm84881 driver (#11)
  • AS21xxx: 10GBASE-T master/slave and a force_master knob, the pause advertisement it really sends, CFG_PARAM sub-commands, latched link drops, IPC recovery at probe (#12, #13)
  • AS21010 link watchdog: autoneg restart and firmware reload when the PHY stops negotiating, reload on request (#14)
  • XFI CTLE read no longer clobbers registers, USXGMII reconfigures on the configured interface (#15)

mtk_eth_soc

  • hardware LRO rules, flag and DIP slots (#16)
  • DMA ordering on the TX and RX rings, QDMA free queue, delay fields and bounds (#17)
  • RSS kept across DMA restarts (#18), RX DIM sampling per ring (#19), XDP frame return and per CPU counters (#20)
  • MTU change without bouncing the links (#21), GDM MIB drain timer and probe fixes (#22)
  • PDMA NAPIs switchable between softirq and threads at runtime (#56)
  • QDMA: page register address, leaky bucket bits, scheduler debugfs (#57, #58), QoS queues and schedulers with CPU and PPE steering (#59), TBF and ETS offloaded to the QDMA (#64)

DSA, switch, bridge

  • tag_8021q switches: TX checksum, TSO limits, PPE choice by conduit, PPE offload to user ports and of bridged flows (#23)
  • MxL862xx: drop counting, bridge port map writes, tagger skb leak, per port TX queues, LAG P-mapper (#24)
  • bridge: an NTF_USE refresh no longer hides an FDB move from the switch (#25)

PPE, WED, BE14 (mt7996)

  • offloaded Wi-Fi flows get the TID of their DSCP, DSCP and ECN kept on NETSYS v3 (#26)
  • WED reset and teardown: RRO buffer pool freed once, WDMA prefetch reset, TX buffer manager rebuilt (#27), 16384 TX tokens for WED (#38)
  • debug: WO firmware debugfs and exception report, WA statistics and trace, host path counters with drop reasons, WM debug levels, tracepoints, RRO counters, WFDMA ring pointers, where the WM and WA cores are (#28)
  • PCIe error recovery: errors on both functions, slot reset, no MMIO when the endpoint is gone, restart before a reboot (#32)
  • TX blocked latch cleared when the token pool drains (#33), ASPM kept off (6 GHz upload stall) (#37)
  • firmware RED, airtime fairness and a per-AC cap with WED (#39), runtime switches for spatial reuse, SCS, MU modes and A-MSDU (#40), puncturing chosen by the card (#41)
  • LEDs per band, steady on and active low (#29, #34), TX BA stop on an MCU error (#31), EEPROM before registering (#35)
  • mac80211: a sleeping station’s held frames no longer block AQL for the whole radio (#42), station index and packet id not reused at once (#43)

Thermal, cpufreq

  • a thermal zone for each of the eight LVTS sensors (#60), CPU throttling at 95 C (#61)
  • LVTS: wait for each sensor bus command, CALSCALE written, filtered mode and the 125 C hardware reset (#79, #80, #81)
  • cpufreq boost for turbo OPPs up to 2.5 GHz, OPP voltages tunable at runtime and settable from tmpfiles, CCI OPPs linked to the CPU ones, test voltages up to 1.2 V (#62, #63, #66, #67)

TOPS (the NPU) https://github.com/meehien/tops-aqm

  • power domains, DT node and the mtk-npu driver, with MediaTek’s loader imported (#68)
  • own images on the cores, host messages and a watch of the steering registers (#69)
  • PPE flows steered to TOPS by MAC or final port, only while a program serves the TDMA, switched in place, drained on unload (#70, #71, #72)
  • TDMA hang check that switches steering off and never resets the frame engine (#73)
  • the AQM as a service with heartbeat and restart, a device stamp for IPv4 uploads after NAT (#74), two DRAM chunks for its frames (#78)

EIP-197 (still open, not particularly usefull)

  • the engine is in the DT,
  • forced clocks and 8 beat bursts (#77),
  • safexcel priority parameter and firmware handling (#75)

All of this is tested on my two boards only. Please read the issue before you take the overclocking or the TOPS patches.

1 Like