Commit Graph
69919 Commits
Author SHA1 Message Date
Jonas Jelonek e1a6d77124 realtek: pcs: rtl930x: apply only needed patching
For 10GBase-R and 2500Base-X, the patching sequences for the slower
modes are also applied. This mirrors the SDK which uses some automatic
detection and only does a one-time initialization. However, Linux works
different. The PCS is configured to a specific mode on demand. Thus,
there is no need to apply the other patching when it isn't really
needed.

Those patching sequences seem to initialize AFE blocks within the
SerDes, thus a 1G AFE shouldn't be needed for 10GBase-R. Testing
confirms this so far, no difference in any link characteristics when
e.g. 1G and 2.5G sequences aren't applied for a 10GBase-R link.

Link: https://github.com/openwrt/openwrt/pull/24310
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-20 15:45:54 +02:00
Jonas Jelonek e05153e47e realtek: pcs: rtl931x: do not configure 1000Base-X for 10GBase-R
So far, the 10GBase-R configuration mirrored the SDK which in addition
also sets up 1000Base-X and lets it run in a special mode having
autodetection of 10G/1G. This doesn't make that much sense given that
Linux will trigger PCS reconfiguration once the interface mode has
changed. Thus, we should only provide that for each mode standalone, not
for some proprietary and special mixed auto mode.

Link: https://github.com/openwrt/openwrt/pull/24310
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-20 15:45:54 +02:00
Jonas Jelonek b253af3698 realtek: pcs: rtl931x: add info to config bits
Give two SerDes register writes some meaningful information, since they
line up with usual PHY registers.

Link: https://github.com/openwrt/openwrt/pull/24310
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-20 15:45:53 +02:00
Jonas Jelonek b489ab0d86 realtek: pcs: rtl931x: drop RX channel resets during USXGMII config
The mode configuration calls LEQ/DFE reset and RX reset before doing
USXGMII configuration. Though the SDK does that similar, these calls are
actually unneeded because essentially the same is executed later again
in the attachment configuration. This is also the place where it
rather belongs. Thus, drop those calls in mode configuration.

Link: https://github.com/openwrt/openwrt/pull/24310
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-20 15:45:53 +02:00
Jonas Jelonek d9fdf451f1 realtek: pcs: rtl931x: drop unused helper
Drop the unused helper rtpcs_931x_sds_reset because it is unused and -
if it was used - would actively mess with the defined SerDes
deactivation/activation in pcs_config.

Link: https://github.com/openwrt/openwrt/pull/24310
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-20 15:45:53 +02:00
Jonas Jelonek 39cd3f8954 realtek: pcs: rtl931x: fix 1000Base-X config
Commit 7899dfa6ef ("realtek: pcs: rtl931x: separate and reuse
1000base-x config") introduced an issue by accident, using the register
value 0x12 instead of 0x13. A regression hasn't been noticed before, for
yet unknown reasons the 1000Base-X still worked here and there. Probably
due to some external setup.

However, this currently breaks 1000Base-X functionality on at least one
switch. Correcting the register value instantly restores 1000Base-X,
allowing the link to come up. It is unclear yet what this field means,
according to the SerDes register defines from related RTL8295 this might
be TX mode configuration field.

Also add another write which is present in several SDK versions.
Referring from related RTL8295, this might be a field called
EN_LINK_FIB1G, enabling 1000Base-X operation.

Fixes: 7899dfa6ef ("realtek: pcs: rtl931x: separate and reuse 1000base-x config")
Link: https://github.com/openwrt/openwrt/pull/24310
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-20 15:45:52 +02:00
Eric FahlgrenandJonas Jelonek 10dc55290e package: rtl826x-firmware: make package versions consistent
The two packages rtl826x-firmware and rtl826x-lp-firmware are built
from the same source, yet have 'VERSION=xxx' overrides that modify
the package name and metadata.  This causes issues with apk, as
it always selects the package with the higher version number (the
'-lp-' one), irrespective of which package is desired.

Remove the VERSION overrides and use the actual package version so
that apk can install the correct package.  The binary contents of
the packages remain unaffect, this only changes the package file
name and metadata related to versioning.

Before
  rtl826x-firmware-20221115.apk
  rtl826x-lp-firmware-20240729.apk

After
  rtl826x-firmware-2026.01.24~0cd4abe2-r4.apk
  rtl826x-lp-firmware-2026.01.24~0cd4abe2-r4.apk

Fixes: https://github.com/openwrt/openwrt/issues/24145
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24201
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-20 15:45:01 +02:00
Felix Fietkau 5b3b961f41 ucode-mod-bpf: bump PKG_RELEASE
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau 9565a9bd91 ucode-mod-bpf: add map info method and map type constants
Scripts need the map type to know how to interact with a map, e.g.
per-CPU value handling or keyless queue/stack semantics. Add an
info() map method returning type, key/value size and max_entries,
along with BPF_MAP_TYPE constants for comparison.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau a148933214 ucode-mod-bpf: add ring buffer and perf event buffer support
Add consumer support for BPF_MAP_TYPE_RINGBUF and
BPF_MAP_TYPE_PERF_EVENT_ARRAY maps. ringbuf(callback) and
perf_buffer(callback, pages, lost_callback) map methods return a
buffer resource with fileno, poll and consume methods. The fileno
method exposes the epoll fd and matches the interface uloop.handle()
expects, so a buffer can be passed directly to uloop for event loop
integration.

The ring buffer callback receives the sample data and may return a
negative integer to stop consumption; the perf callbacks additionally
receive the CPU number.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau 9b7ddbaef9 ucode-mod-bpf: add map-in-map and prog array support
Updates on array/hash-of-maps and prog array maps take the fd of the
inner object as a 4-byte value. Accept bpf.map and bpf.program
resources as map values and convert them to their fd.

Lookups on map-in-map types return the inner map id; add open_map_id
and open_program_id to obtain a usable object from such an id.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau ec06937a5a ucode-mod-bpf: add support for keyless maps
Queue and stack maps have zero-sized keys and require a NULL key
pointer; the kernel rejects any non-NULL key with EINVAL, making
these maps unusable. Accept a null key argument on maps without a
key, mapping get() to peek, set() to push and delete() with return
to pop.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau 9070d0e630 ucode-mod-bpf: add per-CPU map support
Lookup, update and lookup-and-delete on per-CPU maps use buffers of
roundup(value_size, 8) * num_possible_cpus bytes. The previous code
sized buffers for a single value, so get() on a per-CPU map made the
kernel overflow the stack buffer and set() passed undersized data.

Track the map type and size the buffers accordingly. get() and
delete() with return now yield an array with one value per CPU, set()
accepts either such an array or a single value replicated to all
CPUs.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau acc687da84 ucode-mod-bpf: fix error reporting in tc hook setup
Failures in the detach path returned NULL without recording any error
state, so error() reported a stale or empty error. Attach failures
reported a hardcoded ENOENT regardless of the actual cause. Record
errno for all failures; if_nametoindex, bpf_tc_attach and
bpf_tc_detach all set it.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau 05208d9a7e ucode-mod-bpf: fix stale errno when rodata map is missing
bpf_object__next_map does not set errno when it runs out of maps, so
the reported error code was whatever errno happened to hold. With
errno 0 the failure was invisible to error(). Report ENOENT instead.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau e04461835a ucode-mod-bpf: fix unaligned access in integer iterator
The iterator key buffer is a flexible array member placed directly
after a bool, leaving it without natural alignment for the u32/u64
loads in next_int. Copy the key via memcpy instead of dereferencing
a misaligned pointer, which traps on strict-alignment targets.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau 5c35e410fc ucode-mod-bpf: fix key/value aliasing in map argument conversion
uc_bpf_map_arg converted integer arguments through a single static
buffer. When map set was called with both an integer key and an integer
value, the second conversion overwrote the first, so the element was
written at the wrong key. Convert into a caller-provided buffer
instead.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Felix Fietkau 3c5e204abe ucode-mod-bpf: fix missing resource pointer checks
uc_fn_thisval can return NULL when a method is called with a foreign or
missing this context. pin, foreach and the iterator next functions
dereferenced the result without checking it, crashing the VM.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-07-20 10:43:36 +02:00
Paul Spooren ff41ddea1c build: gate firmware image signing behind SIGN_FIRMWARE
Firmware image signing in append-metadata/append-gl-metadata was conditional
only by the presence of the build key. Add an explicit SIGN_FIRMWARE option
(default enabled except with BUILDBOT) so appending the fwtool signature can be
toggled on its own.

It's disable on buildbot since we use a decentralized building with no
individual keys on builders. Instead, a fake key is currently used, which adds
an insecure signature.

The future of signing firmware  and key distribution across the build
infrastructure should be discussed separately.

Link: https://github.com/openwrt/openwrt/pull/24291
Signed-off-by: Paul Spooren <mail@aparcar.org>
2026-07-20 10:33:41 +02:00
Jonas Jelonek 3ec398f0c3 tools: firmware-utils: update to Git HEAD (2026-07-19)
1ab209233682 mkzynfw: rename macros from RTL93XX to RTL_OTTO
606f25ef3ca2 mkzynfw: add board definitions for Zyxel GS1920 v2 series
162fa533b309 mkzynfw: add board definitions for GS2210 series
b2d46a825a53 mkzynfw: add board definitions for Zyxel GS1920 v1 series
5c5df244b8a1 Revert "mkzynfw: add board definitions for Zyxel GS1920 v1 series"
7f28bfbc4b5a Revert "mkzynfw: add board definitions for GS2210 series"
5e1b83d1fc2b mkzynfw: add board definitions for GS2210 series
3e6b426938e8 mkzynfw: add board definitions for Zyxel GS1920 v1 series

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-19 21:45:08 +00:00
Vincenzo SuraciandHauke Mehrtens bacda03b76 ramips: add support for Comfast CF-EW84
Add support for the Comfast CF-EW84 based on the MediaTek MT7621
SoC.

Hardware:
  CPU/SoC:      MediaTek MT7621DA
  RAM:          128 MB DDR3
  Flash:        Macronix MX25L12805D 16 MB
  Switch:       MediaTek MT7530
  WiFi 2.4 GHz: MediaTek MT7603E
  WiFi 5 GHz:   MediaTek MT7613B
  Ports:        1x WAN, 2x LAN (10/100/1000 Mbps)
  LEDs:         Power, WAN, LAN1, LAN2, WLAN
  Buttons:      Reset
  UART:         through-hole on PCB
                pinout: RX, TX, GND, 3.3V
                settings: 115200n8

Flash instructions:
1. Connect the bundled PoE injector to power.
2. Connect the PC to the LAN1 or LAN2 port of the device.
3. Configure a static IP on the computer's Ethernet adapter:
     IP:      192.168.1.x (x = 2 to 254)
     Mask:    255.255.255.0
     Gateway: empty
     DNS:     empty
4. Connect a second Ethernet cable to the PoE port of the
   bundled injector.
5. Press and hold the reset button on the device.
6. While holding the reset button, plug the other end of the
   second Ethernet cable into the WAN port.
7. Wait at least 3 seconds, then release the reset button.
8. Browse to http://192.168.1.1: the MediaTek U-Boot System
   Recovery page should appear.
9. Click Upload and select the *-sysupgrade.bin firmware file.
10. After flashing completes, browse to http://192.168.1.1
    again: the LuCI login page should appear.

Factory data:
  2.4 GHz EEPROM:        factory offset 0x0000
  5 GHz EEPROM:          factory offset 0x8000
  LAN MAC address:       factory offset 0xe000
  WAN MAC address:       factory offset 0xe000 (+1)

LED layout:
The Comfast CF-EW84 has five physical LEDs, but only the WLAN
LED is software-controllable through the Linux GPIO-LEDs
subsystem.

Signed-off-by: Vincenzo Suraci <vincenzo.suraci@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24112
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-07-19 13:09:05 +02:00
Mikhail ZhilkinandJonas Jelonek b10eb807c8 airoha: an7583: build airoha_an7583-evb by default
These devices aren't broken and their build shouldn't have been disabled.

Fixes: 2566781 ("airoha: an7583: remove source-only flag")
Link: https://github.com/openwrt/openwrt/pull/23809#issuecomment-5011321092
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24285
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-19 11:24:19 +02:00
Mikhail ZhilkinandJonas Jelonek 3eb815e3d5 airoha: an7583: add missing config symbol
Add missing CONFIG_SND_SOC_AN7581 symbol.

Fix error:
------------------------------------------------------------------
ASoC support for Airoha AN7581 chip (SND_SOC_AN7581) [N/m/?] (NEW)
make[7]: *** [scripts/kconfig/Makefile:85: syncconfig] Error 1
------------------------------------------------------------------

Fixes: 2566781 ("airoha: an7583: remove source-only flag")
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24285
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-19 11:24:18 +02:00
Carlo SzelinskyandJonas Jelonek 13cb708691 realtek: add support for Zyxel GS1900-10HP B1
The GS1900-10HP B1 keeps the RTL8380M SoC and port layout but replaces the
A1's Broadcom PoE (Gen1) with a Realtek RTL8238 PSE fronted by a Nuvoton
MCU speaking the Gen2 protocol at 115200 baud. It reuses the shared
rtl8380_zyxel_gs1900-10hp.dtsi and only overrides the PSE compatible and
UART speed.

Specifications:
- SoC: Realtek RTL8380M
- Ports: 8x 10/100/1000 (PoE+), 2x SFP
- PoE: Realtek RTL8238 via Nuvoton MCU (Gen2, UART 115200)

Tested on hardware: driver probes RTL8238B (8 ports), per-port control via
ethtool, verified across a cold power-cycle.

Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
Link: https://github.com/openwrt/openwrt/pull/24283
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-19 11:21:11 +02:00
Carlo SzelinskyandJonas Jelonek 101fcccac5 realtek: gs1900-10hp: move A1 PoE to in-kernel PSE driver
The GS1900-10HP A1 (Broadcom BCM59121 behind a Gen1 MCU on UART) was
driven by the userspace realtek-poe daemon. Move it to the in-kernel
realtek-pse-mcu (Gen1) driver so PoE is managed through the standard
PSE-PD / ethtool interface, and factor the board description shared with
the upcoming B1 variant into rtl8380_zyxel_gs1900-10hp.dtsi.

Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
Link: https://github.com/openwrt/openwrt/pull/24283
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-19 11:21:11 +02:00
Markus Stockhausen e26eccaa3c realtek: dts: adapt RTL8214FC bus location on RTL839x
The RTL839x has the following hard-coded bus topology:
- Bus 0: Port 0-23
- Bus 1: Port 24-51

So the bus number and the PHY address in the dts are mostly
ignored. Nevertheless fix the assignment for the Zyxel GS1920.
This does not change the functionality it just describes the
hardware correctly. While we are here add the PHY package
description too.

Link: https://github.com/openwrt/openwrt/pull/24281
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-07-19 11:18:16 +02:00
Markus Stockhausen 49f0512036 realtek: dts: more ethernet-phy-package conversion
Encapsulate some more multiport PHYs into their packages.

Link: https://github.com/openwrt/openwrt/pull/24281
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-07-19 11:18:16 +02:00
Josef SchlehoferandChristian Marangi 4f2dc5cc64 CI: remove labeler workflow and enable webhook-based labeling
Remove the .github/workflows/labeler.yml workflow and enable the "enable_labeler_yml" option in .github/formalities.json to let the webhook bot handle pull request labeling. This avoids running on GitHub Actions, so it is faster and uses fewer resources.

It uses the existing .github/labeler.yml for labels.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24256
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-07-18 12:34:34 +02:00
Josef SchlehoferandChristian Marangi 9146f931b6 CI: migrate to webhook bot and simplify labeler
This commit migrates the repository validation to a webhook-based bot instead of the GitHub Actions workflow (.github/workflows/formal.yml).

Since the bot handles stable branch labeling automatically (via the "branch_labeling: true" configuration option), the redundant branch check and labeling steps are removed from .github/workflows/labeler.yml.

The following configuration choices are applied in formalities.json:
- check_space_after_assignment: false (Disabled temporarily to catch any issues since it is a newly implemented check)
- check_makefile_indentation: false (Disabled temporarily to catch any issues since it is a new feature)
- check_patch_headers: 'warning' (Changed to warning instead of hard error since many legacy patches lack headers)
- enable_stale_bot: false (Disabled for now)

Other configurations can be adjusted in formalities.json based on the openwrt-bot-worker repository [1].

[1] https://github.com/openwrt/openwrt-bot-worker

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24256
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-07-18 12:34:33 +02:00
Rosen PenevandJonas Jelonek e92d07b113 ramips: move sound driver to files
This is local only. Also has never been upstreamed.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24236
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:23:21 +02:00
Mikhail ZhilkinandJonas Jelonek 42b8e0d9b7 airoha: add initial support for Nokia XG-040G-MF
This commit adds initial support for Nokia XG-040G-MF XG-PON ONU.

Specification
-------------
- SoC       : Airoha AN7583DT (dual-core ARM Cortex-A53 1.2 GHz)
- RAM       : 512 MiB DDR4 (Winbond W664GG6RB-06)
- Flash     : SPI-NAND 256 MiB (GigaDevice GD5F2GM7UEYIG)
- WLAN      : -
- Ethernet  : 1x 2500 Mbps (LAN1, Airoha EN8811HN)
              3x 10/100/1000 Mbps (LAN2-LAN4, Airoha AN7583 SoC switch)
- XG-PON    : ECONET EN7572, SLIC: MaxLinear PEF32001VSV12
- USB       : 1x USB2 (with power control via gpio)
              1x USB3 (with power control via gpio)
- Buttons   : Reset
- LEDs      : 1x Power (green)
              1x WAN (green)
              1x WAN (red)
              4x LAN (green)
              2x USB (green)
- Power     : 12 VDC, 1 A

Unsupported functions, limitations and known issues
---------------------------------------------------
1. XG-PON won't be available after installing OpenWrt.
2. USB ports: AN7583 SoC in OpenWrt doesn't support USB at this time.

Installation (UART)
-------------------
1. Attach UART and run picocom:
   picocom -b 115200 --send-cmd "sb -vv" /dev/ttyUSB0
2. Interrupt boot process by pressing Enter key to enter u-boot
   Username: telecomadmin
   Password: nE7jA%5m
3. Start download firmware via ymodem protocol (via UART):
   loady 0x85000000
4. Press Ctrl + A then Ctrl + S in the picocom terminal (if you are using
   a different terminal, please refer to the documentation) to start
   upload OpenWrt initramfs image using ymodem protocol. Enter local path
   to the OpenWrt initramfs image and press Enter.
5. Load OpenWrt initramfs image from the memory:
   bootm 0x85000000
5. Sysupgrade with OpenWrt sysupgrade image

Alternative for the p.3-4. Load and boot OpenWrt initramfs from tftp IP
192.168.1.254:
   tftpboot 0x85000000 192.168.1.254:openwrt-initramfs-uImage.itb
   bootm 0x85000000

Backup and installation (without UART)
--------------------------------------
1. Unplug Fiber
2. Make ONU Reset
3. Navigate: http://192.168.1.1
   Username: CMCCAdmin
   Password: aDm8H%MdA
4. Go to Apps -> Home Storage -> FTP and check Enable FTP
5. Go to Apps -> Home Storage -> SAMBA Sharing and check Enable Samba
6. Visit the following URL to open Telnet:
   http://192.168.1.1/system.cgi?telnet
7. Telnet account login:
   Username: user
   Password: <see ONU label>
8. Get root privileges:
   su user_ftp
   Password: <see ONU label>
9. Copy 'squashfs-factory-kernel.bin', 'squashfs-factory-rootfs.bin' and
   'OpenWrt.mtd2.u-boot-env.bin' (backup of 'u-boot-env' partition from
   the another Nokia XG-040G-MF with OpenWrt installed)
9. Attach USB flash drive and check the new dir in /mnt:
   ls /mnt
10. Change current dir to the flash drive (change D to your flash drive
   label):
   cd /mnt/D
11. Make backup:
   for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; \
   do cat /dev/mtd$i | gzip -9 > mtd$i.bin.gz; done
12. Check image sizes:
   ls -l | awk '{if(NR>1) {$5=sprintf("0x%x", $5); print}}'
13. Write images:
   mtd_debug erase /dev/mtd0 0x60000 0x20000
   mtd_debug write /dev/mtd0 0x60000 0x20000 OpenWrt.mtd2.u-boot-env.bin
   mtd_debug erase /dev/mtd14 0x0 0x2880000
   mtd_debug write /dev/mtd14 0x0 0x3e6cfc squashfs-factory-kernel.bin
   mtd_debug erase /dev/mtd11 0x0 0x80e0000
   mtd_debug write /dev/mtd11 0x0 0x440000 squashfs-factory-rootfs.bin
   0x3e6cfc - size of your 'squashfs-factory-kernel.bin'
   0x440000 - size of your 'squashfs-factory-rootfs.bin'
14. Reboot:
   reboot

Recovery
--------
The same as described in Installation (UART).

Return to stock
---------------
1. Follow the steps 1-5 of the Installation (UART)
2. Once in OpenWrt upload you backup to the /tmp dir of the router:
   scp -O mtd16.bin.gz root@192.168.1.1:/tmp
5. Connect to the router using ssh and install kmod-mtd-rw:
   apk update && apk add kmod-mtd-rw
   insmod mtd-rw i_want_a_brick=1
6. Unlock bootloader:
   mtd unlock bootloader
7. Restore stock:
   zcat /tmp/mtd16.bin.gz | mtd write - all_flash
8. Reboot:
   reboot

Stock layout
------------
+-------+------------+---------+---------+
| mtd   | label      | start   | size    |
+-------+------------+---------+---------+
| mtd0  | bootloader | 0       | 80000   |
| mtd1  | romfile    | 80000   | 40000   |
| mtd14 | nsb_master | c0000   | 2880000 |
| mtd15 | nsb_slave  | 2940000 | 2880000 |
| mtd6  | bosa       | 51c0000 | 40000   |
| mtd7  | ri         | 5200000 | 40000   |
| mtd8  | flag       | 5240000 | 40000   |
| mtd9  | flagback   | 5280000 | 40000   |
| mtd10 | config     | 52c0000 | a00000  |
| mtd11 | data       | 5cc0000 | 80e0000 |
| mtd12 | oopsfs     | dda0000 | 400000  |
| mtd13 | log        | e1a0000 | a00000  |
+-------+------------+---------+---------+

UART
----
A view from the back side of the PCB:
   ------------------------
   |       GND RX TX
   |        X  X  X
Connection parameters:
115200, 8N1, 3.3V

MAC addresses
-------------
+---------+-------------------+-----------+
|         | MAC               | Algorithm |
+---------+-------------------+-----------+
| LAN     | e0:xx:xx:xx:xx:a0 | label     |
| WAN     | e0:xx:xx:xx:xx:a1 | label + 1 |
+---------+-------------------+-----------+
The LAN MAC (hex) was found in 'ri', 0x3e

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23809
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:21:09 +02:00
Mikhail ZhilkinandJonas Jelonek 05c4cb954e airoha: move common Nokia XG-040G properties to dtsi files
Move shared DTS properties for Nokia XG-040G-MD and XG-040G-MF into
common DTSI files to reduce duplication:
- an758x-nokia_xg-040g-common.dtsi
- an758x-nokia_xg-040g-stock-parts.dtsi
- an758x-nokia_xg-040g-ubi-parts.dtsi

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23809
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:21:08 +02:00
Mikhail ZhilkinandJonas Jelonek 25667811da airoha: an7583: remove source-only flag
Remove source-only flag from Airoha an7583 subtarget for upcoming Nokia
XG-040G-MF support. Also disable builds for airoha_an7583-evb and
airoha_an7583-evb-emmc evaluation boards.

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23809
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:21:08 +02:00
Mikhail ZhilkinandJonas Jelonek a62a603a1d airoha: use standard LED function and enumerators for PHY LEDs
Configure shared LAN PHY LED templates with standard LED_FUNCTION_LAN
macros and initial function-enumerators. These nodes remain disabled
by default.

Board-specific DTS files enabling them must provide the required 'color'
property, and must override the 'function-enumerator' values if identical
colors are used to guarantee unique sysfs names.

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23809
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:21:08 +02:00
Mikhail ZhilkinandJonas Jelonek ada7ded2f4 airoha: an7583: refresh kernel config
1. Enable MEDIATEK_GE_SOC_PHY driver and disable NET_DSA_MT7530_MDIO
2. Refresh kernel configs with:
   make kernel_oldconfig CONFIG_TARGET=subtarget

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23809
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:21:07 +02:00
Mikhail ZhilkinandJonas Jelonek ed38b88bc3 airoha: an7583: enable mtd virtual concat support
This is required for upcoming Nokia XG-040G-MF support.

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23809
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:21:07 +02:00
Mikhail ZhilkinandJonas Jelonek 0782f282a6 airoha: an7583: add default packages
Add airoha-an7583-npu-firmware, kmod-gpio-button-hotplug, kmod-leds-gpio
and uboot-envtools to the default packages.

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23809
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:21:07 +02:00
Mikhail ZhilkinandJonas Jelonek 8225fab99e airoha: wrap long lines and fix indents
Wrap long lines and fix indents in the an7583.mk.

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23809
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-18 10:21:06 +02:00
Paul Spooren 06c826e335 kernel: use iremap for assembly
Currently assembly code of the Kernel may contain the build path, resulting in
unreproducible firmware images (and Kernels). Fix this by adding a iremap
KAFLAG.

Before:

    strings "/path/to/vmlinux" | grep linux-6.18.38
    /path/to/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.18.38
    /path/to/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.18.38

After

    strings "/path/to/vmlinux" | grep linux-6.18.38
    target-x86_64_musl/linux-x86_64/linux-6.18.38
    target-x86_64_musl/linux-x86_64/linux-6.18.38

Link: https://github.com/openwrt/openwrt/pull/24271
Signed-off-by: Paul Spooren <mail@aparcar.org>
2026-07-17 21:43:03 +02:00
Jonas Jelonek 52c0274e55 realtek: add PoE support for GS1920-24HP
Add PoE support for GS1920-24HP by providing the device tree
definition and selecting the Realtek PSE MCU driver package for build.
Support includes both versions of the device since they basically share
the same PSE frontend. The common DTSI includes the shared definitions,
the device DTS files then set the correct compatibles.

Link: https://github.com/openwrt/openwrt/pull/24239
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 19:34:46 +02:00
Jonas Jelonek b76acc1b1a realtek: add PoE support for USW XG Pro 8 PoE
Add device tree definition for PoE support using the Realtek PSE MCU
driver. Select the kernel package for the driver in DEVICE_PACKAGES
accordingly.

Link: https://github.com/openwrt/openwrt/pull/24239
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 19:34:46 +02:00
Jonas Jelonek d3e2f2df83 realtek: add PoE support for XGS1930-28HP
Add support for PoE on Zyxel XGS1930-28HP by leveraging the new Realtek
PSE driver. Define the PSE controller with all its properties in DTS of
the device and link it to the PHYs.

Link: https://github.com/openwrt/openwrt/pull/24239
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 19:34:45 +02:00
Jonas Jelonek 5b527dc7a4 realtek: switch to PSE driver for Plasma Cloud PSX28
Use the kernel PSE driver for PoE functionality on this device instead
relying on userspace apps. Drop the automatic selection for poemgr in
favor of the driver module.

Link: https://github.com/openwrt/openwrt/pull/24239
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 19:34:45 +02:00
Jonas JelonekandJan-Henrik Bruhn f306a19481 realtek: add PoE support for Linksys LGS328MPCv2
Add PoE support to Linksys LGS328MPCv2 by adding the required device
tree definition and select the needed kernel module package, making use
of the Realtek PSE MCU driver.

Co-authored-by: Jan-Henrik Bruhn <git@jhbruhn.de>
Link: https://github.com/openwrt/openwrt/pull/24239
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 19:34:45 +02:00
Jonas Jelonek 2f9484a2d8 realtek: add macro for pse-pi
Add a macro PSE_PI for the common pse-pi definition, helping with
devices which make use of the Realtek PSE MCU driver. While those
definitions stay manageable for low port counts, this adds too much
visual boilerplate with 24 or even 48 ports. The macro keeps it short
with one line per pse-pi.

Also make use of this macro directly for the two devices XS1930-12HP and
XMG1915-10EP.

Link: https://github.com/openwrt/openwrt/pull/24239
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 19:34:44 +02:00
Robert MarkoandRobert Marko 696b38be9c uboot-airoha: fix AN7583 pinctrl compatible
Use the compatible expected by the AN7583 pinctrl driver so the pinctrl and integrated GPIO driver can bind.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2026-07-17 12:07:33 +02:00
Anna KiriandJonas Jelonek dd62e3af15 mtd: fis: fix buffer overflow from negative memset size
In fis_remap(), when desc < last, the memset size is computed as
'tmp - end'. Since tmp is calculated as 'end - positive_value', tmp is
always less than end, making 'tmp - end' negative. When cast to size_t,
this wraps to a very large value, causing a massive buffer overflow.

Fix by swapping the operands to 'end - tmp' which correctly computes the
number of bytes to clear.

Signed-off-by: Anna Kiri <bredcorn@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23550
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 10:02:59 +02:00
Rosen PenevandJonas Jelonek 938a43b522 kernel: remove kmod-crypto-misc
Nothing selects this. In addition, a lot of those algorithms are
legacy/obsolete.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23927
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 09:51:18 +02:00
Maxim AnisimovandJonas Jelonek 7085d16552 mediatek: fix nmbm max-reserved-blocks for Keenetic/Netcraze devices
The devicetree set mediatek,bmt-max-reserved-blocks to 64, but the
factory firmware uses 256. With the lower value NMBM fails to locate
its signature on some boards, and the device does not boot.

Restore the factory value of 256 to match stock firmware and fix
boot on affected units.

Vendor nmbm max blocks value:
https://github.com/keenetic/kernel-49/blob/master/drivers/mtd/nmbm/nmbm-mtd.c#L31

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24001
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 09:47:36 +02:00
Gleb PesinandJonas Jelonek 4c85dfa73e ramips: mt7620: fix jumbo frame mode
MAX_RX_PKT_LEN value 2 selects 1552-byte frames, not jumbo mode.
Select value 3 so the configured 2 KiB frames are actually accepted by
the switch.

Tested on a ZBT-WE826 (MT7620). With value 2, 1534-byte IPv4
packets pass while 1535-byte packets are dropped. With value 3,
1792-byte and 1800-byte DF IPv4 packets pass.

Fixes: d083212e11 ("ramips: ethernet: ralink: mt7620 enable jumbo frames")
Signed-off-by: Gleb Pesin <dormancygrace@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24242
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-17 09:26:12 +02:00