100 Commits
Author SHA1 Message Date
Rosen PenevandJonas Jelonek 3978d4e5ee swconfig: fix portmap memory leak and hardening
Free the per-port segment strings on unregister to avoid leaking them
across device rebind. Drop the dead (phys < 0) check and guard the
kstrdup allocation against failure.

Move swconfig_create_led_trigger() before list_add_tail() in
register_switch so a failing registration never publishes the device on
the global swdevs list with dangling portmap/portbuf pointers (a
use-after-free for any swdevs iterator). Route both the LED trigger
failure and the -ENFILE (swdev id exhaustion) failure paths through a
shared cleanup that frees portbuf, portmap, and the per-port segment
strings instead of leaking them.

Reorder the frees in unregister_switch to run after list_del so the
buffers are not freed while the device is still reachable from swdevs.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24246
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-21 09:11:05 +02:00
Rosen PenevandJonas Jelonek ce120be361 kernel: disable qualcomm crypto
Upstream has marked it as BROKEN. Quote:

This driver is harmful:

- It is much slower than the CPU.
- It Has a history of bugs.
- It does not have exclusive access to the hardware, causing races
  with the secure world.
- It register its implementations with too low a cra_priority for them
  to be actually used.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24326
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-21 09:01:40 +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
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
Rosen PenevandJonas Jelonek 9e43544bc6 mpc85xx: use regulator for USB power
Use upstream solution for managing GPIO power for USB devices.

A small patch is needed to make the whole thing work as this is an older
USB driver that does not use the PHY framework.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16842
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-15 20:25:52 +02:00
Rosen PenevandJonas Jelonek c8839a94d7 lantiq: move pcie driver from patch to files
This driver is quite huge and local only. Never seems to have been
submitted upstream.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24190
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-14 23:23:32 +02:00
Rosen PenevandJonas Jelonek 594b4aef09 gpio-button-hotplug: don't include of_irq.h
Not used. Add the proper headers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24177
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-11 23:43:29 +02:00
Rosen PenevandJonas Jelonek 5de5bb79fd gpio-button-hotplug: remove pointless void cast
void pointer casting like this is unnecessary.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24177
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-11 23:43:28 +02:00
Rosen PenevandJonas Jelonek a88866c5c4 treewide: remove weird double void casting
This must be some older compiler and kernel warning.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24177
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-11 23:43:28 +02:00
Rosen PenevandJonas Jelonek b0a03893cb gpio-button-hotplug: fix signed issue
struct gpio_keys_button has an unsigned int for its irq field. A signed
one is needed for fwnode_irq_get. Handle it before passing it to the
button member.

Fixes: 79b9a36959 ("gpio-button-hotplug: use device and fwnode")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24174
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-11 00:32:05 +02:00
Rosen PenevandRobert Marko e79589bea4 mvebu: use libdeflate for gzip
Shrinks size slightly.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24149
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-07-09 10:28:04 +02:00
Rosen PenevandJonas Jelonek 30a3525cdb treewide: remove fwnode_for_each_available_child_node
It's used in probe to be a generic way to iterate over the children.
Confusingly, device_for_each_child_node_scoped internally calls the
available loop despite not mentioning it.

Avoid pointless variables.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24120
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-09 09:33:41 +02:00
Rosen PenevandJonas Jelonek 79b9a36959 gpio-button-hotplug: use device and fwnode
Upstream prefers these instead of OF functions.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24120
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-09 09:33:41 +02:00
Rosen PenevandJonas Jelonek c6006b0447 kernel: replace strcpy/strcat with strscpy/strlcat
Replace deprecated strcpy/strcat calls with strscpy/strlcat for
bounds-checked string operations in swconfig_leds, clk-rtl83xx,
and UML pseudo-random MAC patch.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24132
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-09 09:31:24 +02:00
Rosen PenevandJonas Jelonek 0cce5275b6 treewide: convert ranges to new syntax
Same as e1c2f02325 but for ranges.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24133
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-08 22:15:47 +02:00
Rosen PenevandRobert Marko bc42f9759f qoriq: use libdeflate for gzip
Shrinks size slightly. Tested on WatchGuard Firebox M300

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24119
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-07-08 19:13:25 +02:00
Rosen PenevandRobert Marko b13e9be1a1 apm821xx: nand: reenable PCI_DISABLE_COMMON_QUIRKS
This is a size reduction symbol that appears to have been disabled as a
result of wndr4700 enablement. There's a patch for that.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24129
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-07-08 19:11:58 +02:00
Rosen PenevandJonas Jelonek c2a758b16a apm821xx: enable PM
There's support for sleep in several drivers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24075
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-07 23:02:03 +02:00
Rosen PenevandJonas Jelonek 72f6415ef7 mvebu: wt61p803: use fwnode for LED driver
Upstream prefers fwnode nowadays.

Also clean up the code a little bit with dev_err_probe and _scoped
helpers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24094
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-07 22:58:56 +02:00
Rosen PenevandJonas Jelonek f2851263c7 mvebu: move wt61p803 drivers to files
It seems that this was last attempted to be upstreamed in 2021. No
progress since then. Move to files as with many other local drivers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24094
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-07 22:58:56 +02:00
Rosen PenevandJonas Jelonek b8a70a1539 ramips: i2c: move local driver to files
Seems like this was last attempted to be upstreamed in 2014. Move to
files as with other local drivers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24097
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-07 22:58:03 +02:00
Rosen PenevandJonas Jelonek 6e5b0f352c ramips: spi: move rt2800 driver to files
This is a local only driver. Move it to files as with others.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24096
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-07 08:43:00 +02:00
Rosen PenevandJonas Jelonek 9055f4ebe8 apm821xx: disable RTC
No device in apm821xx has an RTC. Remove support to slim down the
kernel.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24114
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-07 08:41:08 +02:00
Rosen PenevandJonas Jelonek ba56736dd1 apm821xx: remove bootwrapper patch
CONFIG_KERNEL_GZIP does the same thing. It's used elsewhere for a
similar purpose.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24074
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-06 23:42:37 +02:00
Rosen PenevandJonas Jelonek 56c5ab49fe ramips: gpio: use fwnode instead of of
Upstream nowadays prefers fwnode instead of of.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24095
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-06 23:42:00 +02:00
Rosen PenevandJonas Jelonek 07eec850d8 ramips: gpio: use module_platform_driver
Use the normal macro to remove some duplication.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24095
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-06 23:42:00 +02:00
Rosen PenevandJonas Jelonek 1006c536b5 ramips: move GPIO driver to files
This was last attempted to be upstreamed in 2014. Move it to files as
with other local drivers.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24095
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-06 23:41:59 +02:00
Rosen PenevandJonas Jelonek 4d75424ae2 realtek: pcs: use device loop
Most of the file uses fwnode except for this section. Convert it.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24091
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-06 22:36:25 +02:00
Rosen PenevandJonas Jelonek 75c2186487 apm821xx: wndr4700: merge ubi and ecos partitions
This concatenates the ubi partition (19.9 MiB) with the ecos partition
(96.1 MiB) into a single virtual MTD device for UBI, giving ~116 MiB
of usable flash space.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24098
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-06 08:59:52 +02:00
Rosen PenevandJonas Jelonek 8c4917178e apm821xx: move sensors to kmods
Only the WNDR4700 uses these. No need to bloat the kernel.

Nothing uses the GPIO_FAN sensor. Remove it.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24040
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-05 23:37:57 +02:00
Rosen PenevandJonas Jelonek d78d2c784b treewide: various fwnode conversions
Avoid having to use of_fwnode_handle and use fwnode_handle directly.

Upstream prefers fwnode to of anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24039
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-05 23:35:05 +02:00
Rosen PenevandJonas Jelonek abf6df457f mac80211: ath9k: call reset on init
Even though external_reset() is handled elsewhere, it seems some devices
need it here.

Fixes: 0ccc336c56 ("mac80211: ath9k: avoid a double reset")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24042
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-05 23:23:25 +02:00
Rosen PenevandJonas Jelonek 9716066e80 kernel: add qualcommax patches to generic
Move upstreamed patches to backports.

Move the others to pending.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24013
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-05 13:02:07 +02:00
Rosen PenevandJonas Jelonek 4e1fd5b025 kernel: modules: mux-mmio: add missing regmap-mmio dependency
mux-mmio.ko depends on regmap-mmio.ko at runtime, but the kmod package
was missing the dependency, causing build failures when the module is
included.

Fixes: ac39016898 ("kernel: modules: package MMIO mux driver")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24028
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-02 10:06:12 +02:00
Rosen PenevandJonas Jelonek 9fedddbc1e treewide: remove factory:
For the most part, factory: remains as a hold over from nvmem-layout
conversion and no longer serves any purpose.

In the case of &factory sections, reduce identation slightly by
referencing the nvmem-layout node instead.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24008
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-02 10:03:37 +02:00
Rosen PenevandJonas Jelonek aef2523de1 apm821xx: only install swconfig for needed devices
Only the wndap6x0 devices need swconfig because of the realtek switch.
Place swconfig there instead of for every device.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23985
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-01 09:40:06 +02:00
Rosen PenevandJonas Jelonek 8fd0289452 apm821xx: move PHY/DSA drivers to DEVICE_PACKAGES on nand boards
Only the devices that actually have these PHYs and DSA switches
should carry the kernel modules, instead of baking them into the
kernel for all nand boards.

These devices have no space constraints, so any size increase is
meaningless.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23985
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-01 09:40:05 +02:00
Rosen PenevandRobert Marko 106fd083bc mediatek: qihoo: fix WMAC eeprom
Wrong factory partition was used.

Fixes: 53fa04d261 ("mediatek: filogic: replace mtd-eeprom with nvmem")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23999
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-06-30 10:38:56 +02:00
Rosen PenevandJonas Jelonek c1ba308aa6 lantiq: vrx518_ep: use module_pci_driver macro
Use = {} to get rid of the memset so that init is just
pci_register_driver with extra prints.

Assisted-by: Opencode:Big-Pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23976
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-28 23:36:05 +02:00
Rosen PenevandJonas Jelonek 0d892f17c9 fs: rpsec: add missing modules for CRYPTO_KRB5
Upstream selects these for CRYPTO_KRB5.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23794
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-28 22:09:37 +02:00
Rosen PenevandJonas Jelonek 8ff69df2e0 irq-ath79-intc: move irq_chip to private struct
For whatever reason, the static array change is causing massive dmesg
spam. Revert it for now.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23884
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-27 12:07:34 +02:00
Rosen PenevandJonas Jelonek dcbb2f58dc irq-ath79-intc: use of_irq_get
Modern version of irq_of_map_and_parse() that does not require
irq_dispose_mapping() to be called.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23884
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-27 12:07:34 +02:00
Rosen PenevandJonas Jelonek d6d6c309d8 kernel: use module_mtd_part_parser for mtdsplit
Remove boilerplate.

Also added deregister for bcm_wifi for consistency. Not needed as it's
builtin but still good to have.

There's a slight change from subsys_initcall to module_init. Not really
an issue for mtd drivers. No driver in linux upstream's drivers/mtd uses
subsys_initcall.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23893
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-23 09:00:59 +02:00
Rosen PenevandJonas Jelonek ec26a78f1e kernel: fix wrong strlcat call
strlcat takes the total buffer size, not the remaining space.
Passing strlen(cmdline) + l caused it to truncate by one byte
when the appended string fit within the buffer.

This is also more consistent with the rest of the file.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23892
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 11:06:48 +02:00
Rosen PenevandJonas Jelonek a8282f563d kernel: handle bootargs-override the same everywhere
l is an int. No need for a cast. Also might as well use l since it's
available.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23892
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 11:06:47 +02:00
Rosen PenevandJonas Jelonek 35ee4f8d31 kernel: replace strncpy with safer alternatives
strncpy is deprecated. Replace with:
- strscpy() for NUL-terminated destinations
- strscpy_pad() for NUL-terminated destinations with zero-padding
- memcpy() for fixed-length in-place overwrites (bootargs mangle/cmdline replacement)

Assisted-by: Opencode:Big-Pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23892
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 11:06:47 +02:00
Rosen PenevandJonas Jelonek 3372463999 kernel: replace open-coded arithmetic in allocators
Dynamic size calculations in allocator arguments can overflow,
leading to undersized allocations. Replace with:
- kcalloc() for count * sizeof() patterns
- devm_kcalloc() for managed allocations
- array_size()/size_add()/size_mul() for complex cases

Assisted-by: Opencode:Big-Pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23892
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 11:06:47 +02:00
Rosen PenevandJonas Jelonek 7aec4efba8 kernel: replace BUG_ON/BUG with WARN_ON/WARN_ON
BUG() and BUG_ON() are deprecated - they destabilize the system
and make debugging impossible. Replace with:
- WARN_ON() + return error for assertion failures
- WARN_ON_ONCE() for bounds checks
- WARN_ON() + return -EPERM for in_interrupt() guards

Assisted-by: Opencode:Big-Pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23892
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 11:06:46 +02:00
Rosen PenevandJonas Jelonek 9863b15fce bcm53xx: nvmem conversions
Add upstream patches for devices with nvram definitions in dts.

For others, replace * with all devices that have no nvram definitions.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22181
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-21 20:38:55 +02:00
Rosen PenevandJonas Jelonek 560fb07c03 ipq40xx: add beginning space to bootargs-append
Technically not needed but more consistent with other users.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23899
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-21 10:50:05 +02:00
Rosen PenevandJonas Jelonek f83bddb9c0 treewide: use _scoped for loops
Done for local patches. Potential upstreaming will be using these
anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23872
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-20 10:03:00 +02:00
Rosen PenevandJonas Jelonek e2d12cfae6 bcm53xx: backport meraki mx6x warning fix
The kernel ended up fixing this dts problem at runtime, but fix it
directly instead. Upstream backport.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23870
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-19 22:30:58 +02:00
Rosen PenevandJonas Jelonek bf8ca30dbe ath79: improve reset-controller driver
Use _scoped loop to about fwnode_handle_put everywhere.

Remove usage of of_node.

Use devm_led_classdev_register_ext to avoid fwnode handle leaks.

Remove custom struct_size function.

Fix other various issues found with AI.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21027
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-19 22:30:14 +02:00
Rosen PenevandJonas Jelonek 30214f3b03 ath79: move leds-reset driver to files
This driver looks like it will never be upstreamed. Keep it local for
easier modification.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21027
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-19 22:30:14 +02:00
Rosen PenevandJonas Jelonek 80eefabec3 bcm53xx: ac87u: set WAN MAC in dts
Userspace handling is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22059
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-17 09:03:47 +02:00
Rosen PenevandJonas Jelonek faf8f3760d irq-ath79-intc: add missing \n
Needed to make the dmesg output normal.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:34 +02:00
Rosen PenevandJonas Jelonek 00841615f1 irq-ath79-intc: avoid negative values
of_count_phandle_with_args can return negative. We don't want that.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:33 +02:00
Rosen PenevandJonas Jelonek dbb4ac9342 irq-ath79-intc: add irq_dispose_mapping
Avoids a resource leak on failure.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:33 +02:00
Rosen PenevandJonas Jelonek 4ae9c7bdc1 irq-ath79-intc: statically allocate irq_chip
No need for dynamic allocation. static is fine.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:33 +02:00
Rosen PenevandJonas Jelonek 3c2e7b3eee irq-ath79-intc: add chained_irq_enter/exit
Original review said:

Missing chained_irq_enter/exit calls.

Also rework slightly to reduce indentation.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:32 +02:00
Rosen PenevandJonas Jelonek 5ed10923f9 irq-ath79-intc: rename pending_mask to enable_mask
Original review said:

Isn't this "pending_mask" more of an "enabled"?

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:32 +02:00
Rosen PenevandJonas Jelonek 10d7a164ad irq-ath79-intc: don't use hwirq_max
Original review said:

Don't. This is an implementation detail of the irq domain, and you're
not supposed to access that field.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:32 +02:00
Rosen PenevandJonas Jelonek 20275da9cd irq-ath79-intc: use generic_handle_domain_irq
Combines irq_find_mapping and generic_handle_irq.

Matches upstream commit
046a6ee2343bb26d85a9973a39ccdb9764236fa4

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:32 +02:00
Rosen PenevandJonas Jelonek e46cc54e9d irq-ath79-intc: add SPDX license
License boilerplate was deprecated by upstream in
d2912cb15bdda8ba4a5dd73396ad62641af2f520

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:31 +02:00
Rosen PenevandJonas Jelonek 122ea336de irq-ath79-intc: switch from add to create
Upstream Linux wants to remove the add APIs.

Get ahead of this and make the switch as was done upstream in
affdc0d1bdfa544fed26ae07c4e136af86465507

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:31 +02:00
Rosen PenevandJonas Jelonek 0354345493 irq-ath79-intc: remove panic and add kfree
Panic like this was recommended against in the original review of the
upstream submission. Remove it and add missing kfree calls.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:31 +02:00
Rosen PenevandJonas Jelonek 86cc4d84bb ath79: move intc driver out of patch
This driver has been attempted to be upstreamed once and never again.
Keep it local to make modification easier.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22981
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 11:50:30 +02:00
Rosen PenevandJonas Jelonek a62ffbf3ac prereq-build: add clang support
The Apple g++ check is really clang in disguise. Furthermore, testing on
Linux hosts reveals that clang can sufficiently replace gcc.

Minimum version of clang is 12 because of ccache.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17259
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 10:56:46 +02:00
Rosen PenevandJonas Jelonek fa846e7e64 mediatek: predator-w6x: set MAC in NVMEM
Userspace handling is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23764
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-16 09:47:22 +02:00
Rosen PenevandJonas Jelonek e4c35c2eec mac80211: backport ath9k memset fixes from upstream
Backport two upstream commits that replace memset() on coherent DMA
descriptor rings with explicit WRITE_ONCE() status word stores.

On 32-bit PowerPC platforms like apm821xx, coherent DMA memory may be
mapped uncached. The optimized memset() path can use dcbz there, which
triggers alignment warnings and spams the kernel log.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23776
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-15 10:00:38 +02:00
Rosen PenevandJonas Jelonek 0c9548a058 treewide: add linux,rootfs to rootfs labeled partitions
A step towards removing hack/420-mtd-support-OpenWrt-s-MTD_ROOTFS_ROOT_DEV.patch

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/20951
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-14 23:58:17 +02:00
Rosen PenevandJonas Jelonek 53fa04d261 mediatek: filogic: replace mtd-eeprom with nvmem
These use fairly standard sizes.

0x1000 for mt7916 and 0x1e00 for mt7992.

Added a mediatek,mt76 compatible line where missing as required by mt76
upstream Documentation.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23113
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-14 23:42:52 +02:00
Rosen PenevandJonas Jelonek 17a0904384 mediatek: mt7622: replace mtd-eeprom with nvmem
These use fairly standard sizes.

0x4da8 for mt7615 + mt7622 and 0xe00 for mt7915.

Added a mediatek,mt76 compatible line where missing as required by mt76
upstream Documentation.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23113
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-14 23:42:52 +02:00
Rosen PenevandJonas Jelonek 3d7d675888 mpc85xx: ws-ap3xxxi: use u-boot,env for MAC
Userspace handling is deprecated.

Fix bad copy/paste error with ws-ap3710i. enet2 is unused.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23761
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-14 23:35:48 +02:00
Rosen PenevandJonas Jelonek 87592fa409 apm821xx: drop support for 6.12
Remove the 6.12 kernel configuration and patch stack after switching to 6.18.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23777
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-14 23:10:51 +02:00
Rosen PenevandJonas Jelonek f7efd51a8c apm821xx: switch to 6.18
Move apm821xx to the 6.18 kernel after testing it as the testing kernel.

There are ethernet performance improvements in the 6.18 kernel for
whatever reason. There's also work on getting rid of dmesg slop at
runtime.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23777
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-14 23:10:50 +02:00
Rosen PenevandJonas Jelonek db533a6235 ipq40xx: use nvmem for cal data
Userspace handling is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22178
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-13 01:31:36 +02:00
Rosen PenevandJonas Jelonek 6c3d37c6c8 ath79: ws-ap3610: assign MAC address with nvmem
Userspace handling is deprecated.

As with all ws-ap devices, a redundant u-boot environment is used.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23146
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-12 09:28:37 +02:00
Rosen PenevandJonas Jelonek cbd8fe4461 ipq40xx: remove ethernet0 alias
Not needed when using nvmem. All others left alone.

Move some swport nvmem definitions to the root gmac to avoid a
randomized MAC address for the GMAC. The former inherits from the latter anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22550
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-11 10:38:22 +02:00
Rosen PenevandJonas Jelonek 641f3190c2 ath79: iodata etg3-r: set eth MAC in dts
Userspace handling is deprecated. WAN stuff needs to remain as no DSA
yet.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21119
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-11 10:36:07 +02:00
Rosen PenevandJonas Jelonek f079f0252b nvram: use strdup
No need for malloc + strcpy.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22370
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-11 10:33:00 +02:00
Rosen PenevandJonas Jelonek 113d3edce0 nvram: move variable assignment out of if
More readable.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22370
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-11 10:33:00 +02:00
Rosen PenevandJonas Jelonek 55d146432f nvram: use flex array
Clarifies that the struct needs to be over allocated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22370
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-11 10:32:59 +02:00
Rosen PenevandJonas Jelonek 51a018ee49 ramips: mt7621: use dts for label mac
Userspace handling was needed before band mac overrides.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22306
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-11 10:29:39 +02:00
Rosen PenevandJonas Jelonek eaa1d41b55 ramips: mr600-v2-eu: fix WAN MAC address
78110c3 states that the MAC for the WAN interface is LAN + 1.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22306
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-11 10:29:39 +02:00
Rosen PenevandJonas Jelonek f3bc5ea5d9 ipq40xx: use nvmem for mikrotik mac address
Userspace handling is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16257
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-11 09:04:28 +02:00
Rosen PenevandJonas Jelonek 193f1e3266 gpio-rb91x-key: add gc owner
For platform drivers themselves this is not needed. but for gpiochips,
it is to avoid module unload.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23731
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-10 21:41:22 +02:00
Rosen PenevandJonas Jelonek e6f2cd1ca8 gpio-rb4xx: use GPIO_LINE_DIRECTION_OUT
Remove the comment since the macro is descriptive enough.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23731
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-10 21:41:21 +02:00
Rosen PenevandJonas Jelonek 5814684332 gpio-rb4xx: fix rb4xx_gpio_set on newer kernels
Propagate error code from rb4xx_gpio_cpld_set instead of just returning
0.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23731
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-10 21:41:21 +02:00
Rosen PenevandJonas Jelonek 11b93e9df5 gpio-rb4xx: use dev and remove of_node
Claude seems to get confused by a supposedly NULL of_node. Just use dev.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23731
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-10 21:41:21 +02:00
Rosen PenevandJonas Jelonek 92f97baba7 gpio-rb4xx: fix unset ret
Add an else branch to do so.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23731
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-10 21:41:21 +02:00
Rosen PenevandRobert Marko 631d74d1b7 prereq-build: increase GCC requirement to 10
With ccache 4.13, it mandates a minimum of 10.

Fixes: 84cb042e3a ("tools/ccache: update to 4.13.3")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23718
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-06-10 11:43:38 +02:00
Rosen PenevandJonas Jelonek 1ac7a562ef ath79: wndap360: switch MACs to newer firmware
Original ar71xx has this setup:

define WNDAP360_WMAC0_MAC_OFFSET               0x120c
define WNDAP360_WMAC1_MAC_OFFSET               0x520c

/* Reusing wifi MAC with offset of 1 as eth0 MAC */
ath79_init_mac(ath79_eth0_data.mac_addr,
               art + WNDAP360_WMAC0_MAC_OFFSET, 1);

ap94_pci_init(art + WNDAP360_CALDATA0_OFFSET,
              art + WNDAP360_WMAC0_MAC_OFFSET,
              art + WNDAP360_CALDATA1_OFFSET,
              art + WNDAP360_WMAC1_MAC_OFFSET);

The ath79 port made a questionable change for eth0 being just art with
no offset. That MAC ends up being the OUI for Atheros.

WNDAP360_WMAC1_MAC_OFFSET is the same as WNDAP360_WMAC0_MAC_OFFSET
except with the first hex value being subtracted by 2, which is not a
valid OUI.

And newer Netgear firmware seems to assign differently as well,
art_120C as a base and the others incremented by 0x8.

Switch the assignment to the latest firmware and add label-mac-device to
document that the first Wi-FI MAC address is printed on the device.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22895
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-10 09:06:06 +02:00
Rosen PenevandJonas Jelonek 076eefdc2c treewide: remove usage of of_device.h
of_device.h was used only for of_match_device. That is no longer
used in most places so we can drop the extra header.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23071
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-10 09:03:11 +02:00
Rosen PenevandJonas Jelonek 31d7dd77c6 prereq-build: bump python requirement to 3.8
Even though 3.8 is quite old, it's still used by Ubuntu 20.04 LTS. Bump
the version to get some extra features.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23521
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-10 09:00:33 +02:00
Rosen PenevandJonas Jelonek c699a1ab37 ath79: mynet-wifi-rangeextender: use nvmem
Convert the last remaining userspace eeprom for ath9k to nvmem. Well,
easily converted at least.

wifi MAC has to be handled in userspace as the kernel nvram driver works
on memory mapped addresses, not mtd ones.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/14666
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-09 12:43:26 +02:00
Rosen PenevandJonas Jelonek f93b02e545 ath79: fix label-mac-device
It appears 683-of_net-add-mac-address-to-of-tree.patch relies on the
mac-address nvmem property being present. These nodes don't need it as
they take it from the eeprom but label-mac-device needs it.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/14666
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-09 12:43:26 +02:00
Rosen PenevandRobert Marko 6863c6c5f3 generic: ppc: replace revert with proper solution
Upstream removed simple-bus from the NAND node to match documentation,
but failed to keep fsl,ifc working. Add a patch that properly fixes
this.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23657
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-06-05 12:05:29 +02:00
Rosen PenevandRobert Marko c9ebdc6762 mpc85xx: remove bootwrapper patch
CONFIG_KERNEL_GZIP does the same thing. It's used elsewhere for a
similar purpose.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23658
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-06-05 12:03:50 +02:00
Rosen PenevandJonas Jelonek 805098d8b6 gpio-button-hotplug: avoid a const cast
Introduce a variable inside probe to avoid having to cast const away.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22619
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-01 09:34:39 +02:00