Commit Graph

35162 Commits

Author SHA1 Message Date
Kenneth Kasilag ea57b794fc qualcommbe: use kernel 6.18 by default and drop 6.12
Switch the qualcommbe target to use kernel 6.18 and drop 6.12.

Kernel 6.18 for qualcommbe resolves some issues regarding
PCS support and reduces maintenance load maintaining two
kernel branches.

Signed-off-by: Kenneth Kasilag <kenneth@kasilag.me>
Link: https://github.com/openwrt/openwrt/pull/23908
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-23 10:51:19 +02:00
John Audia c430788f5d kernel: bump 6.18 to 6.18.36
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.18.36

Removed upstreamed:
  airoha/patches-6.18/162-v7.2-net-airoha-Fix-use-after-free-in-metadata-dst-teardo.patch[1]
  airoha/patches-6.18/164-v7.2-net-airoha-Add-NULL-check-for-of_reserved_mem_lookup.patch[2]

All other patches automatically rebased via update_kernel.sh

A new option was introduced with this release[3]. Updated configs on
affected targets: armsr/armv8 and rockchip/armv8.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.36&id=6f829e2c17a53a35321268339cd252aff6d6d723
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.36&id=01f7d4b504580664d36faea5671cde5e3f0d8a5b
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/diff/arch/arm64/Kconfig?id=v6.18.36&id2=v6.18.35

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/23887
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-23 09:05:22 +02:00
Shiji Yang 8eb0fd0ed5 kernel: bump 6.12 to 6.12.94
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.94

New kconfig symbols:
- ARM64_ERRATUM_4118414: enabled on ARM Cortex-A76 and newer targets.
- ARM64_ERRATUM_4193714: enabled on ARM C1-Pro and newer targets.

All patches are automatically refreshed.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/23886
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-23 09:03:54 +02:00
Shiji Yang 4cc28f945f kernel: reorder kernel config symbols
Sort kernel configuration files alphabetically.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/23886
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-23 09:03:54 +02:00
Rosen Penev 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
Kenneth Kasilag 8db23dc91a qualcommbe: fix pwm period calculation
During testing on the Askey SBE1V1K, it was noticed that only very low
PWM frequencies would work, and 100% duty cycles also did not work.

Comparing the proposed upstream pwm-ipq driver to the downstream vendor
driver, `ipq_pwm_apply()` fixed pwm_div at its maximum and derived only
pre_div from the requested period. Since the period spans
`(pre_div + 1) * (pwm_div + 1)` input clocks, pinning pwm_div near its
maximum forces pre_div towards zero for short periods: once pre_div
rounds to 0 the shortest representable period is
`(pwm_div + 1) / clk_rate` (~2.7 ms, i.e. ~366 Hz, at a 24 MHz clock),
and any shorter request is silently stretched to that. The high
duration then truncates to 0, so the output collapses to ~0% duty.

Since 4-wire fans commonly expect a ~25kHz PWM, it was effectively
unusable, since every duty cycle programs a ~zero high time.

Search for the (pre_div, pwm_div) pair whose period best approximates
the request instead of fixing pwm_div. Starting pre_div at the smallest
value that keeps pwm_div within its field and stopping once pre_div
exceeds pwm_div bounds the loop and keeps pwm_div as large as possible
for fine duty resolution. For a 25 kHz request at 24 MHz this selects
pre_div = 0, pwm_div = 959, giving full 0..960 duty resolution.

While reworking the high-duration computation, round it to nearest
rather than truncating, so mid-range duty cycles are not biased low, and
clamp it to pwm_div + 1. Rounding, or a 100% duty request, could
otherwise push hi_dur past the period length and overflow the 16-bit
HI_DURATION field.

Also compute hi_div in `get_state()` in 64-bit; `hi_dur * (pre_div + 1)`
can exceed 32 bits before the existing promotion.

Fixes: 01fb4a6daa ("qualcommbe: update pwm patches and add missing symbol")
Signed-off-by: Kenneth Kasilag <kenneth@kasilag.me>
Link: https://github.com/openwrt/openwrt/pull/23916
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-06-23 07:40:16 +02:00
Jonas Jelonek 8ebf189e60 realtek: pcs: drop unused cmu_band code
For RTL930x and RTL931x, there were some functions to get and set the
CMU band. However, they were used nearly nowhere and even the SDK
doesn't use them for active SerDes configuration. Drop them to reduce
dead code.

Dropping the cmu_band_set call from RTL931x configuration has no
negative effect. We do not know where this call originally came from.
It was introduced 51c8f76612 ("realtek: improve MAC config handling for
all SoCs") but without any explanation why and where it came from. The
SDK doesn't have it and it may be overwritten again in the later CMU
setup when parts of the SerDes are reset.

Link: https://github.com/openwrt/openwrt/pull/23904
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 13:02:07 +02:00
Jonas Jelonek 0a7becdce1 realtek: pcs: rtl931x: use xsg_write instead of open-coded pattern
The xsg_write operation for RTL931x already offers the correct procedure
writing to both page + 0x40 and page + 0x80. Though, this wasn't used
so far because this pattern was still open-coded where needed. Replace
that with the xsg_write helper call.

In clear_symerr, this deliberately changes the exact sequence of
operations a bit. However, this shouldn't have any practical effect and
testing shows no issues.

Link: https://github.com/openwrt/openwrt/pull/23904
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 13:02:07 +02:00
Jonas Jelonek f3b7cfcb58 realtek: pcs: rename 'determine_hw_mode' to 'select_hw_mode'
Rename the 'determine_hw_mode' to 'select_hw_mode' to better express
what the function does. Based on the requested interface, the number of
links on a SerDes and the capabilities, it selects a suitable hardware
mode. 'determine' is clunkier and less expressive in this case.

Link: https://github.com/openwrt/openwrt/pull/23904
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 13:02:06 +02:00
Jonas Jelonek 4ac14efb86 realtek: pcs: drop wrong __maybe_unused
Some functions specify __maybe_unused from former times although they
are clearly used. Remove those attributes.

Link: https://github.com/openwrt/openwrt/pull/23904
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 13:02:06 +02:00
Jonas Jelonek 06cb5f1b21 realtek: pcs: drop unused modify helper
Drop the unused rtpcs_sds_modify helper. Other helpers already provide
what we need.

Link: https://github.com/openwrt/openwrt/pull/23904
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 13:02:06 +02:00
Jonas Jelonek 9be7947ac3 realtek: pcs: add macro for USXGMII AN opcode
Instead of hardcoding the USXGMII AN opcode values and potentially
losing track of what they actually mean, add a define for them. Actually
only one is used, however the other one gets a macro too for
documentation purpose.

Link: https://github.com/openwrt/openwrt/pull/23904
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 13:02:06 +02:00
Jonas Jelonek 947e0d8c63 realtek: pcs: fix comment
A comment sentence misses a word which likely confuses readers. Add the
missing word before everyone forgets what it might be.

Link: https://github.com/openwrt/openwrt/pull/23904
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-22 13:02:05 +02:00
Sayantan Nandy d3e13c05f7 airoha: account for L2 overhead in PPE MTU configuration
The PPE egress MTU register and WAN MTU register compare against L2
frame length without FCS, as confirmed by the hardware reset value of
0x05EA (1514 = ETH_HLEN + 1500).

Account for VLAN_ETH_HLEN when programming these registers to prevent
valid VLAN-tagged frames from being incorrectly dropped by hardware.

Signed-off-by: Sayantan Nandy <sayantann11@gmail.com>
[ add commit description ]
Link: https://github.com/openwrt/openwrt/pull/23875
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-06-22 12:13:01 +02:00
Rosen Penev 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 Penev 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 Penev 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 Penev 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 Penev 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
Chukun Pan 58ba08c493 rockchip: enable dwc3 usb dual-role mode for otg
Most Rockchip boards have an OTG port. Enable DWC3 USB Dual-role
mode for the OTG port to fix the following error:

Configuration mismatch. dr_mode forced to host

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Link: https://github.com/openwrt/openwrt/pull/23770
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-21 20:55:29 +02:00
Chukun Pan c97b4da1a8 rockchip: replace rk3528 usb patch with upstream
Replace the RK3528 USB driver and DT patch with the upstream version.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Link: https://github.com/openwrt/openwrt/pull/23770
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-21 20:55:29 +02:00
Chukun Pan a4095b1f32 rockchip: replace nvmem otp patch with upstream
Replace the rockchip-otp patch with the upstream version.
Also backports OTP support for RK3562 and RK3568 SoCs.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Link: https://github.com/openwrt/openwrt/pull/23770
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-21 20:55:29 +02:00
Rosen Penev 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
Ahmed Naseef 34ac128d6d econet: replace pending patches with upstream backports
The EN751221 clock/reset bindings and driver, along with the PCI bridge
window fix, have all been accepted upstream. Replace the downstream
patches with the exact versions merged upstream and add the kernel
version tag:

  910: dt-bindings: clock, reset: Add econet EN751221           (v7.1, 35af99f7482673)
  911: clk: airoha: Add econet EN751221 clock/reset support     (v7.1, d8b034525fd954)
  913: PCI: Prevent assignment to unsupported bridge windows    (v7.1, 92427ab4378faa)

Refresh the patches as a result.

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23879
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-21 10:55:32 +02:00
Ahmed Naseef 30db95936f econet: use kernel 6.18 by default and drop 6.12
Switch the econet target to use kernel 6.18 and drop 6.12.

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23879
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-21 10:55:32 +02:00
Rosen Penev 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
Shine 304525e754 realtek: rtl930x: add support for Zyxel XGS1010-12 B1
This commit adds support for the Zyxel XGS1010-12 B1 revision, which is
basically the unmanaged version of the XGS1210-12 B1. It features a newer
uBoot build and slightly different 2.5G PHYs than the A1 revision of this
model.

SoC:         RTL9302B
RAM:         128MB DDR3
Flash:       16MB SPI-NOR
Ethernet:    8x 1GBE RJ45 (RTL8218D)
             2x 2.5GBE (2x RTL8226B)
             2x SFP+ cage (10G/2.5G/1G)
UART:        3.3V 115200 8N1, accessible from the right side of the case
             Pinout (top to bottom): Vcc - Tx - Rx - Gnd

MAC address:
The base MAC is stored in uBoot env variable 'ethaddr', which contains only
a placeholder ('00:E0:4C:00:00:00') in the factory default configuration.
Will be generated randomly at boot unless manually preset (see installation
instructions). Additional port MACs are assigned incrementally per port.

This contribution is based on the already existing support for the Zyxel
XGS1010-12-A1 and XGS1210-12-B1.

Installation instructions:

1. Set your PC's IP address to 192.168.1.111 and serve the OpenWrt Initramfs
   image via TFTP (e.g. as "initramfs.bin")
2. Connect to the device via UART, power on and press Esc within 1 second
   after prompted.
3. (Optional) Set a unique MAC address:
   setenv ethaddr AA:BB:CC:DD:EE:FF
4. Populate the uBoot env partition with the command:
   saveenv
5. Enter the following command line to boot the Initramfs OpenWrt image:
   rtk network on; tftpboot 0x84f00000 initramfs.bin; bootm
6. Wait until OpenWrt has booted and connect via SSH.
7. (Optional) Back up the original partitions (at least mtd5-mtd9) in order
   to be able to revert to stock later.
8. Update the boot command needed to boot OpenWrt:
   fw_setenv bootcmd "rtk network on; bootm 0xb4900000"
9. Install the OpenWrt sysupgrade image and wait for the device to boot
   OpenWrt from flash. Enjoy.

Back to stock:

1. Boot the Initramfs image as described above.
2. Write the previously backed up mtd5-mtd9 partitions to flash.
3. Restore the boot command to stock:
   fw_setenv bootcmd boota
4. Reboot into stock firmware.

Signed-off-by: Shine <4c.fce2@proton.me>
Link: https://github.com/openwrt/openwrt/pull/23882
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-06-20 15:26:36 +02:00
Shine d32dd03f3d realtek: rtl930x: use common DTSI for Zyxel XGS1010-12
In preparation for adding support for the B1 revision of this model,
introduce a common DTSI and image recipe.

Signed-off-by: Shine <4c.fce2@proton.me>
Link: https://github.com/openwrt/openwrt/pull/23882
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-06-20 15:26:36 +02:00
Rosen Penev 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 Penev 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 Penev 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 Penev 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
Lars Gierth 4694bb11a4 realtek: rtl931x: add support for Hasivo F5800W-12S+
This commit adds support for the Hasivo F5800W-12S+ 12-port SFP+ switch.
Based on board revision `RTL_12S+ v1.01`.

Hardware
--------

|          |                                                                |
|----------|----------------------------------------------------------------|
| SoC      | RTL9313 rev B                                                  |
| RAM      | 512 MB Samsung K4B4G1646E                                      |
| Flash    | 32 MB Macronix MX25L25645G SPI NOR, 29 MB usable by OpenWrt    |
| Ethernet | 12x SFP+ via SoC (10G/2.5G/1G)                                 |
| LEDs     | 12x green 10G link, 12x green 1G link,                         |
|          | 3x green power and PSUs -- no system status LED                |
| Button   | Reset                                                          |
| Console  | RJ45 38400 bps 8n1                                             |
| Watchdog | via Hasivo MCU                                                 |
| Power    | 2x internal 100-240V AC PSUs with 2x C14 inputs                |
| Clock    | NXP PCF8563 with coin cell battery                             |
| Fans     | 2x 40mm case fan via Hasivo MCU                                |

Installing OpenWrt
------------------

1. Attach to RJ45 serial console port using a cisco cable.
2. Attach SFP to port 12.
3. Serve initramfs-kernel.bin on TFTP 192.168.1.111.
4. Power on the device.
5. Interrupt U-Boot by pressing `Ctrl+c`, then `z`, then `h`, during 3 second countdown.
6. Bring up networking: `rtk network on ; rtk 10g 55 fiber10g`.
7. Boot from TFTP: `tftpboot 0x84f00000 initramfs-kernel.bin ; bootm 0x84f00000`.
8. Use `mtd dump` to make backups of all flash partitions.
9. Use SCP to copy `squashfs-sysupgrade.bin` to the device, then run `sysupgrade`.

Restoring factory firmware
--------------------------

OpenWrt uses the `RUNTIME` and `RUNTIME2` partitions as one combined partition.
To restore them from backups, boot from `initramfs-kernel.bin` just like during
the installation, then use `mtd write` to write your backups of the factory
`mtd5` and `mtd6` partitions to the live `mtd5` partition.

Notes/Quirks
------------

- U-Boot interruption is obfuscated. Press `Ctrl+c`, then `z`, then `h`,
  during the 3 second countdown.
- MAC address is stored on the `RUNTIME` or `RUNTIME2` partitions,
  which are used by OpenWrt. Instead, we generate one random MAC address
  and store it in the U-Boot environment.
- There is no system status LED. The three non-network LEDs are for
  primary PSU (MS label), secondary PSU (SL), and powered on/off (PW).

Signed-off-by: Lars Gierth <larsg@systemli.org>
Link: https://github.com/openwrt/openwrt/pull/23443
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-06-19 17:43:51 +02:00
Lars Gierth bef32df164 realtek: uci-defaults: refactor and expand fwenv ethaddr hack
With the upcoming addition of the Hasivo F5800W-12S+ switch model,
another invariant of the u-boot env ethaddr fixup will be neccessary.
While previously all devices used the exact "zero" dummy ethaddr,
this new Hasivo ends in :10 instead of :00.

Make the hack work based on the 5-byte prefix of the ethaddr.
The currently known possible values for the 6th byte are 0x00 and 0x10.
This can be further expanded in the future if neccessary.

The separate XGS1010-12-A1 case doesn't need to deal with ethaddr prefixes
as it only covers one single device with one single dummy ethaddr.

Also use this opportunity to add more documentation,
and extract the common json and fw_setenv logic to a separate function.

Signed-off-by: Lars Gierth <larsg@systemli.org>
Link: https://github.com/openwrt/openwrt/pull/23443
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-06-19 17:43:51 +02:00
Wayen Yan 0d7add7433 net: pcs: airoha: fix swapped JCPLL SDM DI_LS/DI_EN REG_FIELD entries
The JCPLL SDM DI_LS and DI_EN REG_FIELD entries have their bit
positions swapped compared to the #define macros:

  #define JCPLL_SDM_DI_LS   GENMASK(25,24)  → bits 24-25
  #define JCPLL_SDM_DI_EN   BIT(16)          → bit 16

But the REG_FIELD mapping is:
  DI_LS → REG_FIELD(..., 16, 16)  ← wrong, should be (24, 25)
  DI_EN → REG_FIELD(..., 24, 25)  ← wrong, should be (16, 16)

Fix by swapping the enum and REG_FIELD order so DI_EN comes before
DI_LS, keeping the bit values in ascending order and matching the
register layout. This way:

  [DI_EN] = REG_FIELD(..., 16, 16)  ← BIT(16) ✓
  [DI_LS] = REG_FIELD(..., 24, 25)  ← GENMASK(25,24) ✓

The TXPLL section in the same file already follows this bit-order
convention (DI_EN at bit 0, DI_LS at bits 8-9).

Signed-off-by: Wayen Yan <win847@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23876
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-06-19 10:11:06 +02:00
Christian Marangi 3ed5f08733 airoha: replace multi serdes patch with upstream kernel version
Now that multi serdes patch are accepted upstream, reorder the current
patch in the 1xx numbering and add the kernel version tag.

Also replace the downstream patch with the exact version merged upstream.

Downstream PCS implementation is updated with a new revision for the
ethernet code.

Update any patch affected by these changes.

Link: https://github.com/openwrt/openwrt/pull/23849
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-06-19 09:06:15 +02:00
Christian Marangi cdb3dee613 generic: 6.18: backport netdev_from_priv() helper
Backport netdev_from_priv() helper from upstream kernel to reduce patch
delta on backporting new driver and fixes from upstream kernel.

Link: https://github.com/openwrt/openwrt/pull/23849
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-06-19 09:06:15 +02:00
Jonas Jelonek 4ec2d6dd97 realtek: pcs: drop setup_serdes
Introducing the setup_serdes hook in the PCS driver was always intended
to be only a temporary solution. It was needed to be able to collect all
scattered code in the PCS driver first. Later, refactoring can be done
to bring everything into a proper shape.

Now we've reached the point where the setup of all variants has been
refactored in such a way that all share the same high-level sequence.
This is fully orchestrated in pcs_config now. Thus, the setup_serdes hook
is no longer needed. Move the last piece out of it into another SerDes
op hook, then drop setup_serdes.

Link: https://github.com/openwrt/openwrt/pull/23861
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:23:31 +02:00
Jonas Jelonek f6d95ca8c2 realtek: pcs: rtl931x: call CMU config from hw mode config
One deviating piece left is the extra call in 931x's setup_serdes to
config_cmu. It is called right after the hw mode configuration, in
contrast to 930x. Until we find a better home, move it to the end of
config_hw_mode to retain behavior but to pave the way for the final
unification steps.

Link: https://github.com/openwrt/openwrt/pull/23861
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:23:31 +02:00
Jonas Jelonek 84b63cfa75 realtek: pcs: move media configuration to pcs_config
As next step, move the media configuration to pcs_config by adding
another optional SerDes ops hook which is called from pcs_config. Drop
the redundant call sites in setup_serdes then.

Link: https://github.com/openwrt/openwrt/pull/23861
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:23:30 +02:00
Jonas Jelonek 9156053a1a realtek: pcs: rtl931x: adjust function naming
Rename the RTL931x function _sds_set_media to _sds_config_media to (1)
match the RTL930x name and (2) better express what it's doing. It's not
just setting the media type, it's configuring media-specific parameters.

Link: https://github.com/openwrt/openwrt/pull/23861
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:23:30 +02:00
Jonas Jelonek 97b48adb0f realtek: pcs: encapsule rtl930x media config in function
Move the two pieces for media configuration from RTL930x's setup_serdes
into a separate function, having the same encapsulation as RTL931x. This
will further allow to unify the setup sequence, and play a central role
in refactoring of the whole calibration code later.

Link: https://github.com/openwrt/openwrt/pull/23861
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:23:30 +02:00
Jonas Jelonek 458e498c1f realtek: pcs: carve out media selection as generic
So far, RTL931x implemented its media selection logic within
setup_serdes, unavailable to potential other users. One of those is
RTL930x which needs this too. To easy further refactoring, carve out the
logic to a generic helper providing the equal selection for all variants
anyway.

Link: https://github.com/openwrt/openwrt/pull/23861
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:23:29 +02:00
Jonas Jelonek 3aca9acdb3 realtek: pcs: move mode setting to pcs_config
Right now, setting the hardware mode of a SerDes is always the last step
in setup_serdes for each variant and more or less does exactly the same.
Drop that redundancy, replacing it with a ops hook and unified call from
pcs_config.

This changes behavior for RTL839x. Before, setup for 5G SerDes was
skipped entirely. Now, the mode is set properly. Tested on a device,
this has no negative effect.

Link: https://github.com/openwrt/openwrt/pull/23861
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:23:29 +02:00
Jonas Jelonek 6590a3d656 realtek: pcs: rtl83xx: move reset into activation
RTL838x and RTL839x call a reset at the end of their setup procedure
while RTL93xx do not do that. Since this is another hurdle for unifying
the setup procedure, move them to the activation hooks for now.

This retains behavior for both variants. Though something is called now
for RTL839x, the reset still skips 5G SerDes.

Link: https://github.com/openwrt/openwrt/pull/23861
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:23:29 +02:00
Wayen Yan 3aeb95bf22 uart: airoha: fix out-of-bounds access in baud rate calculation
The baud rate table lookup does not check if the requested index
is within bounds before accessing the array. This can cause
out-of-bounds read when an unsupported baud rate is requested.

Signed-off-by: Wayen Yan <win847@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23783
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:15:36 +02:00
Wayen Yan 71d0568aa3 thermal: airoha: fix wrong variable in TEMPOFFSETL regmap_write
The regmap_write for TEMPOFFSETL should use low_temp but incorrectly
uses high_temp, causing the low temperature threshold to be misconfigured.

This prevents the low temperature trip point from working properly.

Fixes: 7d55e75edc87 ("thermal: airoha: convert to regmap API")
Signed-off-by: Wayen Yan <win847@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23780
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:14:17 +02:00
Lars Gierth 71767c37a7 realtek: rtl931x: remove unused thermal-sensor-cells from DTS
Quote @jonasjelonek: It's all not really wired up correctly,
the thermal driver has no support for RTL931x and nothing else
really links e.g. SFP slots with a fan or whatever.

Signed-off-by: Lars Gierth <larsg@systemli.org>
Link: https://github.com/openwrt/openwrt/pull/23865
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:10:26 +02:00
Lars Gierth a3646ae7ac realtek: rtl930x: remove SFP power settings for Hasivo F1100W
I think these were copied from a different device's DTS at the very
beginning of the porting work. We don't know the actual maximums
of these SFP ports, so let's stick with the 1W default, unless someone
researches what the Hasivo vendor firmware does for this setting.

Signed-off-by: Lars Gierth <larsg@systemli.org>
Link: https://github.com/openwrt/openwrt/pull/23865
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:10:26 +02:00
Wayen Yan 78f8876830 thermal: airoha: fix wrong variable in AN7583 error check
In an7583_thermal_probe(), the code assigns priv->chip_scu from
device_node_to_regmap() but then checks IS_ERR(priv->map)
and returns PTR_ERR(priv->map). The variable priv->map is
not assigned in this function, so the error check uses a
different variable than what was actually assigned.

This should check chip_scu instead of map.

Fixes: 5891a9e5fbdf ("thermal/drivers: airoha: Add support for AN7583")
Signed-off-by: Wayen Yan <win847@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23781
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-18 22:09:17 +02:00