gmac0 used a fixed-link with no phy-handle, so the AR8035 was never
attached and never configured. The PHY comes out of reset with the
RGMII RX delay enabled and the TX delay disabled, and the IPQ8064 MAC
has no internal RGMII delay of its own, so nothing ever enables it and
LAN1 receives but never transmits when booting from flash. Booting via
tftpboot + bootm masked this, as U-Boot leaves the PHY configured.
Point gmac0 at phy1 on mdio0 and use rgmii-id, which is the mode that
makes the at803x driver enable both delays. The fixed-link has to go,
as phylink does not attach a PHY for fixed-link MACs, which also means
the port now autonegotiates instead of being pinned to 1000/full.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25452
Signed-off-by: Robert Marko <robimarko@gmail.com>
Passing target flags through EXTRA_CFLAGS leaks them into kernel
module builds on Linux 6.6 and 6.12, causing ARM hard-float ABI
mismatches in generated module objects. Linux 6.18 also forwards
these flags to host tools, where the host compiler rejects them.
Reuse SAN_CFLAGS, normally used for sanitizer options, to pass
target flags to both userspace selftests and their target libbpf
builds on Linux 6.6, 6.12 and 6.18. Host tools and kernel modules
do not consume this variable. USERCFLAGS would only cover the
selftests, leaving their libbpf builds without the target flags.
This covers the targets built by this package; CROSS_BPFTOOL
does not consume SAN_CFLAGS.
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Link: https://github.com/openwrt/openwrt/pull/25345
Signed-off-by: Robert Marko <robimarko@gmail.com>
phylink_bringup_phy() stores the PHY in pl->phydev before its last
step that can fail. If that step fails, the pointer outlives the
failed connect: a later phylink_connect_phy() gets a permanent -EBUSY,
the SFP path is left with a pointer to a freed phy_device, and a
disconnect detaches the same PHY twice. The fix publishes the pointer
only after the last call that can fail.
It is also the base the pending phylink late-PHY series relies on:
retrying a connect after a failed bringup is what makes this window
reachable.
The fix is in net:
https://git.kernel.org/netdev/net/c/a940003f44e7
The phylink patches that apply on top of it are refreshed for hunk
offsets.
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Link: https://github.com/openwrt/openwrt/pull/25459
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
swconfig,port is used in only two places, here and ramips. This stuff is
already handled in userspace. No need for it here.
This aliases node is not only in the wrong location, it serves no
purpose. Remove.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25406
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Add support for RTL9313-based Ubiquiti UniFi USW Pro XG 10 PoE switch
with 10x 10G RJ45 and 2x SFP+ ports.
Hardware
========
- RTL9313 switch SoC
- 512 MiB RAM
- 32 MiB SPI-NOR flash
- 10x 100M/1G/2.5G/5G/10G RJ45 ports via RTL8264B and RTL8261BE
- PoE: 10x 802.3bt, 90W per port, 400W total budget
- 2x 1G/2.5G/10G SFP+ ports
- Buttons: 1x Reset
- LEDs:
- System LED white/blue
- RGBW LED per port
- Console: TTL 3.3V, 115200 8N1, populated 4-pin header J19,
front to back: VCC, RX, TX and GND
(device must be opened to access header)
- Etherlighting feature (lighting patterns and color control)
- Vendor firmware: U-Boot + LEDE-based Ubiquiti OS
MAC address
===========
Single MAC address in EEPROM partition, applied to all ports.
Known issues
============
- Etherlighting not controllable, driver WIP. Port LEDs for link work
though. By default, the controller keeps the LEDs in a breathing
state, gated by the link state delivered by the Realtek SoC.
Disclaimer
==========
Stock firmware uses a dual-bank layout (kernel0/kernel1, ~15 MiB each).
OpenWrt replaces both banks with a single contiguous firmware partition.
Flashing OpenWrt overwrites both stock kernel slots; U-Boot remains
intact and can be used for recovery.
Installation
============
1. Enable SSH on the stock UniFi OS and log in with user account.
(at this stage you may make backups of the flash, just to be sure)
2. Copy the OpenWrt sysupgrade image to /tmp on the switch (e.g. via
scp).
3. Adjust IMG below to point at the copied file, then run the block as a
whole. It writes kernel0, splits into kernel1 if the image is larger
than that slot (otherwise invalidates kernel1 so U-Boot cannot pick
a stale bank), and reboots:
IMG=/tmp/openwrt-realtek-rtl931x-ubnt_usw-pro-xg-10-poe-squashfs-sysupgrade.bin
K0_BLOCKS=$((0xec0000 / 0x10000))
dd if="$IMG" of=/dev/mtdblock2 bs=64k count=$K0_BLOCKS conv=fsync
if [ "$(wc -c < "$IMG")" -gt $((0xec0000)) ]; then
dd if="$IMG" of=/dev/mtdblock3 bs=64k skip=$K0_BLOCKS conv=fsync
else
dd if=/dev/zero of=/dev/mtdblock3 bs=64k count=1 conv=fsync
fi
sync
reboot
Then it comes up in OpenWrt.
You may also install the image in any other way, just make sure to
write it to the kernel0 partition and if the image is larger than
15,104 kiB, write the rest to the kernel1 partition, otherwise invalidate
it so U-Boot cannot boot from the second bank.
4. It is recommended to modify the bootcmd to speedup the boot and prevent
any issues due to the dual-boot selection. Since U-Boot by default
uses bootubnt which does a lot of (unneeded) RTK initialization,
quite some time passes until Linux is started. Additionally, the
U-boot logic fiddles with some bits on flash which causes JFFS2
errors in OpenWrt. While this doesn't seem to cause issues yet, be
defensive and set the bootcmd to:
bootm 0xb4150000
This directly boots the uImage from flash, without doing all the
initialization. OpenWrt is able to bootstrap the networking completely
on its own.
It does not matter which bank stock booted from when the dd block
runs: both banks are touched in the same pass (kernel0 written, kernel1
either written or invalidated). With kernel1 invalidated, U-Boot's
internal fallback kicks in and permanently switches to kernel0 on the
next boot, so the device stays on OpenWrt as long as kernel0 is
bootable.
Recovery
========
Since the installation procedure invalidates or partially overwrites
the second bank, recovery requires serial console access (see Hardware
above for pinout).
1. Interrupt U-Boot autoboot by spamming the Escape key during early
boot to drop into the U-Boot prompt.
2. Bring up networking:
rtk network on
3. Transfer an OpenWrt initramfs image via TFTP and boot it:
setenv ipaddr <switch-ipaddr>
setenv serverip <tftpserver-ipaddr>
setenv bootfile openwrt-realtek-rtl931x-ubnt_usw-pro-xg-10-poe-initramfs-kernel.bin
tftpboot
bootm
4. From the running initramfs OpenWrt, do a sysupgrade to reflash
OpenWrt or whatever you want to recover. There is no need for the
complicated procedure from installation since OpenWrt sees the
firmware partition already as a whole.
Return to stock firmware
========================
There is no fully-supported revert path. The stock firmware blob is a
Ubiquiti UBNT archive (header + parts, see firmware-utils' fw.h) that
embeds a u-boot and a kernel0 uImage payload; only the latter is
relevant when writing back to the kernel partitions.
The snippet below extracts the kernel0 uImage from such a blob by
locating the uImage offset and size using binwalk. It is provided as a
best-effort starting point; verify the result before flashing,
otherwise you're on your own:
BLOB=US3.rtl93xx_7.4.1+X.Y.Z.bin
binwalk $BLOB | grep uImage > uimage-info.txt
OFF=$(cut -d\ -f1 uimage-info.txt)
SIZE=$(sed -nE 's/^.*image size: ([0-9]+) bytes,.*/\1/p' uimage-info.txt)
dd if="$BLOB" of=kernel0.uImage bs=1 skip="$OFF" count="$SIZE"
Once you have a clean uImage, it can be written to the kernel partition
from within OpenWrt. If you adjusted the bootcmd during installation,
make sure to restore it to the default "bootcmd=bootubnt". After a reboot,
Ubiquiti's firmware should boot.
Or, if you did backups of the flash before, just write the backup to the
flash.
(lightly modified from Jonas commit adding support for usw-pro-8-poe)
Signed-off-by: Russell Senior <russell@personaltelco.net>
Link: https://github.com/openwrt/openwrt/pull/25425
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
The BPi-R4 Pro 4E is a Wi-Fi 7 router board based on the MT7988A SoC.
Difference to 8X is that board has only 4GB RAM and does not contain
the Aeonsemi 10G phys.
Wan port uses MT7988 internal 2.5GBit/s phy with no ethmux chip between
so it need overlays to switch between this wan-phy and SFP-Slot.
Specification
-------------
- SoC: Mediatek MT7988A (4x Cortex-A73 @1.8GHz)
- RAM: 4GB DDR4
- Flash: 256MB SPI-NAND, 8GB eMMC, microSD Slot
- Switch: MT7988A built-in switch, MxL86252C
- Ports: 9 ports, 8 usable simultaneously
* 2x 1G RJ45 LAN
* 4x 2.5G RJ45 LAN
* 1x SFP (LAN)
* 1x 2.5G RJ45/SFP Combo (WAN)
- Buttons: Reset, WPS
- LEDs: Power
- USB: On-board VIA VL822 USB3.2/USB2.0 hub
* 1x USB-A 2.0 connector
* 1x USB-A 3.2 connector
* 3x NGFF-KEYB
- PCIe:
* 2x mini-PCIe slots with PCIe 3.0 2-lane interface
* 2x M.2 M-Key slots with PCIe 3.0 1-lane interface (switchable
PCIe signal with M.2 B-Key)
- Debug: USB Type-C console port
- Power: USB Type-C PD 20V or DC barrel connector
Note: This device comes without a MAC address programmed from the
factory. The randomly generated MAC is stored in the U-Boot env on first
boot and used persistently afterwards.
Installation
------------
Uncompress *sdcard.img.gz and write to microSD card, eg. using 'dd'. Use
bootloader menu on the serial console to install SPI-NAND once installed
to SPI-NAND you can used the bootloader menu to install to eMMC. See
instructions for BananaPi R4 for details.
Description is taken from 8X patch and changed to 4E variant.
R4Pro needed a patch for adding aliases to ensure right probe order so add
this here too.
Co-authored-by: Wilfried Teiken <wteiken@teiken.org>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
The BPi R4 Pro 4E can boot from microSD, SPI-NAND and eMMC. Add support
for each storage option.
NVME (via pcie3) works in uboot, but bootloader only supports spi and mmc.
Patches are taken from R4Pro 8X and modified for 4E variant.
Co-authored-by: Andrew LaMarche <andrewjlamarche@gmail.com>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
The switch applies the egress spanning-tree port state to frames the
CPU sends to a port, so a port that is not forwarding drops them:
kernel STP cannot announce a designated port during the forward
delay, user-space RSTP cannot send proposals from a discarding port,
and LLDP stays silent on blocked ports.
Set BP_FLTR2 in the TX CPU tag. It bypasses the egress spanning-tree
port state and egress VLAN filtering, as IGNORE_STP does when
transmitting on RTL93xx. Skipping the VLAN filter does not widen
where frames go: the CPU names each frame's single destination port
(AS_DPM).
Signed-off-by: Paul Tobias <openwrt-commits@tobias.pt>
Link: https://github.com/openwrt/openwrt/pull/25442
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
rtldsa_port_fdb_dump() walks fib_entries rows of the hash table and 64
rows of the CAM, and rtldsa_find_l2_cam_entry() searches 64 CAM rows.
On RTL931x otto_table.c maps the hash table with 32768 rows and the
CAM with 128, but fib_entries stays at 16384 there. So bridge fdb show
misses the entries of the second hash block, which starts at row
16384, and the CAM search never uses rows 64 to 127.
Take the row counts from otto_table_rows() on l2_uc_tbl and
l2_cam_tbl, as the debugfs dump does. The bounds do not change on
RTL838x, RTL839x and RTL930x. On RTL931x the FDB add path can now place
entries in CAM rows 64 to 127. fib_entries itself is left alone, since
it also sizes l2_uc_map.
Compile-tested. On an RTL9303, where the bounds do not change, bridge
fdb show still listed every unicast row of the hardware table. Not
tested on RTL931x hardware.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25448
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The L2 table dump prints the members and the primary port of a trunk
entry by indexing lags_port_members[] and lag_primary[] with the trunk
id read from the table. Both arrays have MAX_LAGS (16) entries, while
the RTL930x and RTL931x fill functions take the id from a 6-bit and an
8-bit field. The driver should never program an id that large, but a
row carrying one would make the dump read past both arrays.
Print only the id when it is out of range.
Compile-tested. On an RTL9303 the dump still works, but no trunk rows
were present, so neither branch of the check ran on hardware.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25448
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The GS310TP's PoE MCU (Nuvoton M05xx in front of a BCM59121) is not on
UART1 as the device tree assumed: nothing is received on UART and
realtek-poe logs "No response from PoE controller" every 2 s. The
vendor firmware talks to the MCU over bit-banged I2C on SoC GPIO 4
(SCL) and 5 (SDA), slave address 0x20 (board_conf.ko: poeSmiConf and
its boardI2c entry; ski.ko: poe_bcm59121_* over drv_i2c_*), and a
get-system-info frame sent that way is answered: mode "Auto I2C", 8
ports, device id 0xe121, gen1 dialect.
Describe that bus and the MCU with the realtek-pse-mcu SMBus transport,
map the eight copper PHYs to its PIs like the GS110TPP, and replace
realtek-poe and its board.d PoE budget with the kernel modules. UART1,
where nothing answers, goes back to disabled. The enable line on RTL8231
pin 10 moves from a gpio hog to the driver's disable-ports-gpios, so the
ports are released once the MCU has answered, as the vendor firmware
does.
Signed-off-by: Paul Tobias <openwrt-commits@tobias.pt>
Link: https://github.com/openwrt/openwrt/pull/25451
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
This commit implements the OpenWrt UBI layout for the ASUS RT-AX59U. The
primary goal is get working Kernel Address Space Layout Randomization
(KASLR). Additionally, this layout frees up ~6MB of extra storage space
for package installation.
Preparation
------------
Make a backup (from OpenWrt for stock bootloader):
* Backup partitions:
apk update && apk add nand-utils
nanddump /dev/mtd0 | gzip -1 -c > /tmp/mtd0_u-boot.bin.gz
nanddump /dev/mtd1 | gzip -1 -c > /tmp/mtd1_UBI_DEV.bin.gz
* Backup nvram, Factory and Factory2 volumes:
cat /dev/ubi0_0 > /tmp/nvram.bin
cat /dev/ubi0_1 > /tmp/Factory.bin
cat /dev/ubi0_2 > /tmp/Factory2.bin
* Copy backup from the /tmp dir on your router to a safe place using scp
Installation
------------
* Attach UART (see 'UART' section for details)
* Run mtkuartboot (see 'mtkuartboot recovery' section for details), exit
the boot menu, and run:
mtd erase ubi
* Run mtkuartboot again and write ubi bl2 and fip via the network, then
reboot.
Default tftp server ip: 192.168.1.254
Default router ip: 192.168.1.1
* Load the ubi initramfs image via tftpboot and execute sysupgrade to
write OpenWrt to spi-nand.
* Copy Factory backup to your router:
scp -O Factory.bin root@192.168.1.1:/tmp
* Check factory volume index:
ubinfo -a
* Prepare and write new factory ubi volume (substitute X with your
factory volume index):
dd if=/tmp/Factory.bin of=/tmp/factory.bin bs=1 count=$((0x65000))
ubiupdatevol /dev/ubi0_X /tmp/factory.bin
UART
----
UART pins are silkscreened on PCB. Connection parameters:
115200, 8N1, 3.3V
U-Boot tftp recovery
--------------------
* Place OpenWrt ubi-initramfs-recovery.itb image on the tftp server (IP:
192.168.1.254)
* Press reset button and power on the router. After ~10 sec release the
button.
* Use OpenWrt initramfs system for recovery (for example, run sysupgrade)
mtkuartboot recovery
--------------------
Use mtk_uartboot and UART connetion for the installation or if BL2 or FIP
in UBI is destroyed:
Link: https://github.com/981213/mtk_uartboot
Start script:
'''
sudo ./mtk_uartboot \
-p mt7986-ram-ddr4-bl2.bin \
--aarch64 \
-f openwrt-mediatek-filogic-asus_rt-ax59u-ubi-preloader.bin \
-s /dev/ttyUSB0
picocom -b 115200 /dev/ttyUSB0
'''
Notes
-----
1. A simple installation without serial console is also possible using a
fork of Daniel's UBI Installer (requires adaptation)
Link: https://github.com/dangowrt/owrt-ubi-installer
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25278
Signed-off-by: Robert Marko <robimarko@gmail.com>
Add a new Trusted Firmware-A (TF-A) build profile for the MediaTek
MT7986 SoC named 'mt7986-spim-nand-ubi-1m-ddr4'.
This profile reduces the UBI starting address (UBI_START_ADDR) from
0x200000 (2MB) down to 0x100000 (1MB). This layout adjustment matches
devices like the ASUS RT-AX59U factory partition offsets and frees up
flash space for the main operating system layout.
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25278
Signed-off-by: Robert Marko <robimarko@gmail.com>
Refactor how OVERRIDE_UBI_START_ADDR is passed to the TF-A build system.
Instead of using hardcoded string matches against the $(PLAT) variable
inside global make flags, move the UBI start address directly into
target-specific definition blocks using a new UBI_START_ADDR variable.
This aligns the UBI partition boundary setup with how FIP_OFFSET and
FIP_SIZE are cleanly tracked across different MediaTek SoCs.
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25278
Signed-off-by: Robert Marko <robimarko@gmail.com>
Define the factory pre-calibration data partition at offset 0x1010 and
pass it to the wifi node via nvmem-cells. This ensures the mt7986
wireless hardware can properly utilize factory-calibrated RF settings.
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25278
Signed-off-by: Robert Marko <robimarko@gmail.com>
Increase the spi-max-frequency from 20MHz to 52MHz for the SPI-NAND flash
on the ASUS RT-AX59U. The underlying Winbond W25N01KV chip natively
supports up to 104MHz, and the MediaTek MT7986A SoC safely handles 52MHz.
It's also 52 MHz in the stock U-Boot:
...
spi-max-frequency = <0x3197500>;
...
Testing with 'dd' reading 16MB from /dev/mtd1 shows a significant
performance improvement (~48% reduction in read time):
Before (20MHz):
256+0 records in
256+0 records out
real 0m 2.86s
After (52MHz):
256+0 records in
256+0 records out
real 0m 1.50s
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25278
Signed-off-by: Robert Marko <robimarko@gmail.com>
GL.iNet GL-X2000 (Spitz Plus) is a dual-SIM 4G LTE Wi-Fi 6 router.
Specifications:
SoC: Qualcomm IPQ5018, dual-core Cortex-A53 @ 1.0 GHz
RAM: 512 MiB DDR3
Flash: 128 MiB SPI NAND (Winbond W25N01GWZEIG)
WLAN: IPQ5018 2x2 2.4 GHz, QCN6122 2x2 5 GHz (802.11ax)
Ethernet: 1x GbE WAN (IPQ5018 internal GE PHY)
1x GbE LAN (Atheros AR8031, SGMII)
WWAN: Quectel EG120K-EA, LTE Cat.12, USB 3.0 SuperSpeed
USB: 1x USB 2.0 host behind an internal hub
Buttons: reset
LEDs: power, internet, 2.4G, 5G, 4x signal strength
Serial: 3v3 TTL, 115200 8N1; 4-pin header labelled GND/RX/TX/3V3 on
the mainboard, under the Quectel module in the top right
corner. The case opens after pulling the four rubber feet
Power: DC 9-35 V, shipped with a 12 V 2.5 A supply
Misc: PWM fan, dual SIM slots (muxed inside the modem)
The base MAC address is stored at offset 0x6 of the 0:art partition; the
first six bytes are erased, which is why U-Boot reports the ART address as
invalid. WAN uses the base address (this is the one on the label), LAN
base+1, the 2.4 GHz radio base+2 and the 5 GHz radio base+3. The ethernet
addresses come from nvmem cells. The board deliberately has no ethernetN
aliases: GL.iNet's U-Boot uses them to write its own mac-address
properties into both GMAC nodes (a placeholder for WAN, the base address
for LAN), which of_get_mac_address() would prefer over the nvmem cells.
The modem enumerates at SuperSpeed and therefore requires the IPQ5018 USB3
UNIPHY, so both usbphy0 and usbphy1 are enabled. uqmi cannot communicate
with this modem, so modemmanager has to be installed separately to use it.
The QCN6122 is wired to the second radio instance, so wifi@b00b040 with
userpd3 is enabled rather than wifi@b00a040: the stock device tree enables
wifi2@/userpd3 and leaves wifi1@/userpd2 disabled. That instance places
its BDF and M3 dump above the default q6 region, so the reserved region
is grown accordingly.
Board data for the two radios is submitted separately to
firmware_qca-wireless. It is taken from the stock firmware's wifi_fw
partition, which is a squashfs image: bdwlan.b24 for the IPQ5018 2.4 GHz
radio and qcn6122/bdwlan.b60 for the QCN6122 5 GHz radio, matching the
qcom,board_id values of 0x24 and 0x60 that the stock device tree assigns
to the respective radios. The two radios require distinct board data;
sharing a single BDF leaves the front-end misconfigured and the affected
radio unable to transmit or receive at usable power.
The device tree started from the initial port by Hostle, was largely
rewritten by georgem83 and further reworked by Andreas Boeckler, published
in the OpenWrt forum thread linked below. It is carried here with fixes for
the WLAN board data, the QCN6122 radio instance, the U-Boot environment
partition and the fan cooling map.
Link: https://forum.openwrt.org/t/plain-openwrt-on-gl-x2000/231554
Installation:
Interrupt the bootloader over serial (115200 8N1) by typing "gl", then
TFTP the initramfs image and boot it:
tftpboot 0x44000000 openwrt-qualcommax-ipq50xx-glinet_gl-x2000-initramfs-uImage.itb
bootm 0x44000000
Then flash the factory image with sysupgrade.
Signed-off-by: Gilberto Conde <gilbertorconde@gmail.com>
The U-Boot script embedded in the GL.iNet QSDK factory image hardcodes
the GL-B3000 flash layout. Replace the UBI offset and size with
placeholders filled in by the gl-qsdk-factory recipe, so other GL.iNet
boards with a different layout can use the same script.
The script is copied under a per-device name, which keeps the FIT
description unchanged and avoids devices overwriting each other's
substituted copy in KDIR_TMP.
Signed-off-by: Gilberto Conde <gilbertorconde@gmail.com>
The pinctrl driver leaves GPIO13's fourth function slot empty, so PWM3
cannot be routed there. The GL.iNet GL-X2000 drives its fan from PWM3 on
GPIO13, and the stock firmware muxes the pin with select value 4:
gpio13 : out low func4 8mA no pull
pin 13 (GPIO_13): 1941010.pwm function pwm3 group gpio13
Select value 4 corresponds to the empty slot, so add pwm3 there and list
gpio13 in pwm3_groups.
Accepted upstream via pinctrl-qcom/for-current, so this can be dropped
once the kernel is bumped to 7.3 or later. The backport carries the
upstream diff unchanged; 0305, which adds gpio30 to pwm3_groups
downstream, is refreshed to apply on top of it.
Link: https://patch.msgid.link/20260921093419.2870168-1-gilbertorconde@gmail.com
Signed-off-by: Gilberto Conde <gilbertorconde@gmail.com>
Two real commits since the previous pin:
mediatek: mt7622: move PMIC init before PLL/DRAM stage
Fixes a hang in DRAM calibration on reboot when cpufreq had lowered
Vcore before the reset, by moving PMIC init earlier so it no longer
depends on the Vcore level left over from the previous boot.
mediatek: mt7981, mt7986, mt7987, mt7988: add SMCCC TRNG support
Implements the standard SMCCC TRNG interface (upstream U-Boot
doesn't support the MTK-specific one, our uboot-mediatek does).
Tested on MT7981 by upstream; not yet verified on the other three
SoCs by upstream.
Mirror hash verified via an independent fresh clone of the pinned
commit.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The property dates back to the CAF snps_gmac driver, where it told the
MAC which MDIO bus its PHY was on, and has been carried over from device
to device since the driver was replaced by upstream stmmac in 2015.
Nothing in the tree parses it anymore.
The MDIO bus a PHY lives on is taken from the bus the phy node itself was
registered on, so the phy-handle references do not need the extra hint and
nothing changes functionally by dropping it.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25453
Signed-off-by: Robert Marko <robimarko@gmail.com>
Several rtw88 USB and SDIO chips do not always report the TX status of a
frame within RTW_TX_PROBE_TIMEOUT (500 ms). The driver then drops the
tracking skbs and warns
rtw_8822bu 3-1:1.0: failed to get tx report from firmware
every one to three seconds on an access point serving clients that use
power save. mac80211 never learns the ACK status of those frames, which
hostapd uses to tell whether a polled station is still there.
Add the pending upstream patch that uses the 2500 ms timeout, so far
applied only to RTL8723DU, for every USB and SDIO device and keeps
500 ms for PCIe. It is adapted to backports 7.2, which does not have
the RTL8723BS condition yet.
Pending upstream, submitted to rtw-next:
https://lore.kernel.org/linux-wireless/20260924004637.9958-1-pkshih@realtek.com/
Tested with backports 6.12.96 on a TP-Link Archer T4U v3 (RTL8812BU,
handled by rtw_8822bu) as a 2.4 GHz AP with six associated clients.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25303
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
BlueZ creates Bluetooth Low Energy HID devices through uhid, so a
Bluetooth remote or keyboard needs it in addition to kmod-bluetooth.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The L2 table dump now lives in l2.c as realtek_otto_l2/fdb and reads
the whole table on every family. Remove the old rtl838x/l2_table copy,
which stopped at half the table on RTL931x and could print stack
contents as trunk data on RTL838x and RTL839x.
The other files in the rtl838x debugfs directory are unchanged.
Tested on an RTL9303 (Hasivo S1100W-8XGT-SE): rtl838x/l2_table is gone
and realtek_otto_l2/fdb lists 150 static FDB entries next to the
learned ones.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25394
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The only debugfs dump of the L2 table is rtl838x/l2_table in
debugfs.c. It walks fib_entries rows of the hash table and 64 rows of
the CAM, which leaves half of both unread on RTL931x. On RTL838x and
RTL839x its entry is not initialised and the fill functions of those
families never set is_trunk or trunk, so a stack value can be printed
as trunk data and used as an index into the LAG arrays.
Add the dump to l2.c as realtek_otto_l2/fdb, next to realtek_otto_l3.
It takes the row counts of the hash table and the CAM from
otto_table_rows(), so on RTL931x it reads all 32768 hash rows and 128
CAM rows. The upper hash rows are ones the driver already writes: on
RTL931x the second hash block starts at row 16384. The entry is zeroed
for every row, and the walk yields the CPU every 64 rows whether or not
they are valid, where the old loop only reached cond_resched() on a
valid row. The output format is unchanged.
debugfs.c keeps its copy until the next commit.
Tested on an RTL9303 (Hasivo S1100W-8XGT-SE) at this commit, where both
files exist: with 150 static FDB entries added, rtl838x/l2_table and
realtek_otto_l2/fdb listed the same 182 entries on three back-to-back
reads, identical apart from the age of learned entries. Reading the new
file in 64-byte chunks matched a single read, ages aside, and
CONFIG_DEBUG_ATOMIC_SLEEP reported nothing. Not tested on RTL838x,
RTL839x or RTL931x hardware.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25394
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The L2 debugfs dump walks fib_entries rows of the hash table and a
fixed 64 rows of the CAM. That covers both tables on RTL838x, RTL839x
and RTL930x, but not on RTL931x: otto_table.c maps the RTL9310 L2 table
with 32768 rows and its CAM with 128, while fib_entries stays at 16384
there (its TODO says the code cannot handle 32K). fib_entries also
sizes l2_uc_map and bounds the fdb_dump walk, so raising it is a change
of its own.
Record which otto_table ids hold the L2 hash table and the CAM of each
family, so a dump can take the row counts from otto_table_rows()
instead. Nothing reads the new fields yet, so this is a no-op on all
four families.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25394
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
rtldsa_port_fdb_dump() reuses one uninitialised entry for every row it
reads, but the fill functions do not write every field for every row
type. RTL838x and RTL839x never write is_trunk, so the test that skips
trunk entries reads a stack value for the whole walk and can drop every
hardware entry from bridge fdb show. An L2 multicast row leaves port
and is_static untouched on all families, and vid too on RTL930x and
RTL931x, so it is reported on the port of whatever row came before it.
Zero the entry for every row and report only L2_UNICAST rows, as
mv88e6xxx and b53 do. On RTL838x and RTL839x this skips IP multicast
rows as well. On RTL930x and RTL931x unicast rows are reported as
before, and the driver writes no multicast rows of its own: a static
FDB entry with a multicast MAC, which rtldsa_port_fdb_add() stores as a
unicast row there, reads back as multicast and is no longer reported.
Tested on an RTL9303 (Hasivo S1100W-8XGT-SE), with the L2 table dump of
PR #25394 as the reference and two follow-ups that change only the loop
bounds, which are the same on RTL930x. With 150 static and 16 learned
entries, bridge fdb show listed exactly the 166 unicast rows the
hardware held on user ports. A static FDB entry with a multicast MAC,
present in the table as an L2 multicast row, was not reported on any
user port. Not tested on RTL838x, RTL839x or RTL931x hardware.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25398
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
A prefix route is given its row when its gateway resolves, and until
then it carries the -1 its allocator wrote there. A route with no
gateway to resolve keeps that value for its whole life, and a connected
route is exactly that: nothing routes inside its own subnet, so nothing
ever places it.
Removing one still takes the hardware side of the removal path, because
the test there asks whether the ops can look a route up, not whether
this route was ever written. So the CAM is searched for an entry that
was never in it, and the answer is reported as a fault: on a plain
dual-stack box, "prefix route 192.168.1.0/24 was not in hardware" at
every restart of the network.
The noise is not the whole of it. That search keys on the masked
destination, so a shorter prefix covering the same address answers it,
and the row that comes back is then reported as holding another route -
which it does, and rightly, because it is not this route's row and never
was.
Ask the row the driver recorded instead. Both messages stay for the case
they were written for, a route that was placed and is no longer where
the driver put it, which is the state a half-finished row move leaves
behind.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25447
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Programming the routes that were waiting on a neighbour runs the whole
of otto_l3_nexthop_update() inside rcu_read_lock(), and everything it
does there ends in otto_table_acquire(), which takes a mutex.
Where this kernel is built there is no preemptible RCU, so that section
is a preempt_disable(): taking a mutex in it is fine only while the
mutex is free, and the moment it is not, the wait for it is a schedule()
with preemption off. Nothing says so at build time either, since
DEBUG_ATOMIC_SLEEP is off in the generic config and the might_sleep()
that would have complained is compiled out.
The other side of that mutex is not hypothetical. The router MAC, the
four host route tables, the four prefix route tables and the next hop
table are reached through one access register and so share one lock,
and this function writes three of them. The debugfs route dump holds
that same lock across a sweep of 8192 addresses and calls
cond_resched() every 64 rows, which is to say it sleeps with it held,
by design and legitimately. A neighbour resolving while someone reads
that file is all it takes.
Keep the section the rhashtable asks for around the lookup, which is
what needs it, and end it there. The routes the lookup would have walked
are the ones on the driver's own list with that gateway, and the list is
what the rest of this file already walks: the work queue behind every
route added, removed or programmed is single threaded, which is the
invariant the teardown path states and relies on.
Holding ctrl->lock instead was the smaller diff and would have been
wrong: it serialises this driver's insertions, not the rhashtable's own
shrink worker, which is what the RCU section is there for.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25447
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The netevent handler ends by testing an err it never assigns and prints
a netdev warning with whatever the stack left there. Nothing it does can
fail at that point: the work it has just queued is what could, and that
happens somewhere else entirely.
No build says so, because the kernel turns -Wmaybe-uninitialized off for
GCC outside W=2 (scripts/Makefile.extrawarn).
Assisted-by: Claude:claude-opus-5
Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net>
Link: https://github.com/openwrt/openwrt/pull/25311
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The current pcie phy driver results in inconsistent failures on PCIe linkup,
different from one boot to another. Doing some testing, it has became clear
that mdio operations are at fault. The mdio seem to require an additional
delay after it has completed an operation and reported status of done. The
mdio ready bit however, is unchanged and so doesn't have any connection to
this "after completion" delay.
Fix the issue by adding an additional delay after regmap polling and remove
MDIO_READY from cond variable as it is unrelated. Change the function name
to rtk_phy_poll_done_and_delay() to go along with the changes. Mostly as a
guess but 10 us is enough delay to fix the inconsistent failures. Tested by
booting an image on rtl9607c machine 4 times and no failed link ups happen.
Add the fsleep() after regmap_read() in rtk_phy_read() as it also triggers
something in phy mdio controller that require the same delay.
Fixes: bb00e9f097 ("realtek: phy: add support for rtl9607c pcie phy")
Signed-off-by: Rustam Adilov <adilov@tutamail.com>
Link: https://github.com/openwrt/openwrt/pull/25412
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Enable MACsec (Media Access Control Security) support in the Mellanox
mlx5 driver by setting CONFIG_MLX5_MACSEC=y.
Enabling this configuration allows users to utilize hardware MACsec
offload capabilities on supported Mellanox ConnectX network adapters.
This provides point-to-point Layer 2 encryption at line rate while
significantly reducing CPU overhead.
The kmod-macsec dependency is intentionally omitted to make this an
opt-in feature. The offload support only builds if kmod-macsec is
also selected, preventing driver bloat for standard users.
Signed-off-by: Til Kaiser <mail@tk154.de>
Link: https://github.com/openwrt/openwrt/pull/25400
Signed-off-by: Robert Marko <robimarko@gmail.com>
Rework 711-04-net-dsa-qca8k-no-program-unicast-host-FDB-entries.patch:
host FDB adds on CPU ports are skipped, relying on unknown-unicast
flooding to deliver host-bound frames to the CPU. That assumption
breaks when a station roams from a wired user port onto an interface
behind the CPU (wireless AP and WDS setups): a stale dynamically
learned ATU entry still points at the old user port, so downstream
frames hit it and are dropped by same-port filtering instead of being
flooded to the CPU. With CPU-port hardware learning disabled (assisted
learning), nothing ever corrects the entry - clients roaming onto the
device stay blackholed while the device itself stays reachable.
Purge any dynamically learned ATU entry for {addr, vid} when the host
add is skipped, so the address becomes unknown unicast again - exactly
the delivery mechanism the skip relies on. Static entries are left
untouched, and the companion skip in qca8k_port_fdb_del is kept so
host address removal does not purge legitimately learned entries.
Also refresh ipq40xx's 706 patch for the shifted hunk offsets.
Tested on IPQ4019 (Google WiFi APs): stale entries are purged at
association time and roaming recovers instantly.
Fixes: 9716066e80 ("kernel: add qualcommax patches to generic")
Signed-off-by: Brandon Mahdavi <brandon.mahdavi@mahcom.com>
Link: https://github.com/openwrt/openwrt/pull/24162
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>